IsolatedStorageFile.GetStore Methode

Definition

Ruft den isolierten Speicher ab, der der angegebenen Anwendungsdomäne, den Assemblybeweisobjekten und dem Gültigkeitsbereich des isolierten Speichers zugeordnet ist.

Überlädt

GetStore(IsolatedStorageScope, Object)

Ruft den isolierten Speicher ab, der der angegebenen Anwendungsidentität entspricht.

GetStore(IsolatedStorageScope, Type)

Ruft isolierten Speicher ab, der dem Isolationsbereich und dem Anwendungsidentitätsobjekt entspricht.

GetStore(IsolatedStorageScope, Object, Object)

Ruft den isolierten Speicher ab, der der angegebenen Anwendungsdomäne und den Assemblybeweisobjekten zugeordnet ist.

GetStore(IsolatedStorageScope, Type, Type)

Ruft den isolierten Speicher entsprechend dem Gültigkeitsbereich des isolierten Speichers ab, wenn der Typ des Beweises der Anwendungsdomäne und der Assembly angegeben wird.

GetStore(IsolatedStorageScope, Evidence, Type, Evidence, Type)

Ruft den isolierten Speicher ab, der der angegebenen Anwendungsdomäne und den Assemblybeweisobjekten und -typen zugeordnet ist.

GetStore(IsolatedStorageScope, Object)

Quelle:
IsolatedStorageFile.cs
Quelle:
IsolatedStorageFile.cs
Quelle:
IsolatedStorageFile.cs

Ruft den isolierten Speicher ab, der der angegebenen Anwendungsidentität entspricht.

public:
 static System::IO::IsolatedStorage::IsolatedStorageFile ^ GetStore(System::IO::IsolatedStorage::IsolatedStorageScope scope, System::Object ^ applicationIdentity);
public static System.IO.IsolatedStorage.IsolatedStorageFile GetStore (System.IO.IsolatedStorage.IsolatedStorageScope scope, object? applicationIdentity);
public static System.IO.IsolatedStorage.IsolatedStorageFile GetStore (System.IO.IsolatedStorage.IsolatedStorageScope scope, object applicationIdentity);
static member GetStore : System.IO.IsolatedStorage.IsolatedStorageScope * obj -> System.IO.IsolatedStorage.IsolatedStorageFile
Public Shared Function GetStore (scope As IsolatedStorageScope, applicationIdentity As Object) As IsolatedStorageFile

Parameter

scope
IsolatedStorageScope

Eine bitweise Kombination der Enumerationswerte.

applicationIdentity
Object

Ein Objekt, das den Beweis für die Identität der Anwendung enthält.

Gibt zurück

Ein Objekt, das die Parameter darstellt.

Ausnahmen

Es wurde keine ausreichende Berechtigung für den isolierten Speicher gewährt.

Die applicationIdentity Identität wurde nicht übergeben.

scope ist ungültig.

Ein isolierter Speicherort kann nicht initialisiert werden.

- oder -

scope enthält den Enumerationswert Application, aber die Anwendungsidentität des Aufrufers kann nicht bestimmt werden, da für ActivationContext die aktuelle Anwendungsdomäne zurückgegeben wurde null.

- oder -

scope enthält den Wert Domain, aber die Berechtigungen für die Anwendungsdomäne können nicht bestimmt werden.

- oder -

scope enthält den Wert Assembly, aber die Berechtigungen für die aufrufende Assembly können nicht bestimmt werden.

Hinweise

Hinweis

Wenn der scope Parameter ist IsolatedStorageScope.Application und die Anwendungsdomäne, in der die Assembly installiert ist, nicht vorhanden IsolatedStorageFilePermissionist, gibt die GetStore Methode ein IsolatedStorageFile Objekt ohne Kontingent zurück. Bei späteren Versuchen, ein IsolatedStorageFile -Objekt mit dem IsolatedStorageFile -Objekt zu erstellen, das kein Kontingent aufweist, schlagen mit einem fehl IsolatedStorageException.

Weitere Informationen

Gilt für:

GetStore(IsolatedStorageScope, Type)

Quelle:
IsolatedStorageFile.cs
Quelle:
IsolatedStorageFile.cs
Quelle:
IsolatedStorageFile.cs

Ruft isolierten Speicher ab, der dem Isolationsbereich und dem Anwendungsidentitätsobjekt entspricht.

public:
 static System::IO::IsolatedStorage::IsolatedStorageFile ^ GetStore(System::IO::IsolatedStorage::IsolatedStorageScope scope, Type ^ applicationEvidenceType);
public static System.IO.IsolatedStorage.IsolatedStorageFile GetStore (System.IO.IsolatedStorage.IsolatedStorageScope scope, Type? applicationEvidenceType);
public static System.IO.IsolatedStorage.IsolatedStorageFile GetStore (System.IO.IsolatedStorage.IsolatedStorageScope scope, Type applicationEvidenceType);
static member GetStore : System.IO.IsolatedStorage.IsolatedStorageScope * Type -> System.IO.IsolatedStorage.IsolatedStorageFile
Public Shared Function GetStore (scope As IsolatedStorageScope, applicationEvidenceType As Type) As IsolatedStorageFile

Parameter

scope
IsolatedStorageScope

Eine bitweise Kombination der Enumerationswerte.

applicationEvidenceType
Type

Ein Objekt, das die Anwendungsidentität enthält.

Gibt zurück

Ein Objekt, das die Parameter darstellt.

Ausnahmen

Es wurde keine ausreichende Berechtigung für den isolierten Speicher gewährt.

Die applicationEvidence Identität wurde nicht übergeben.

scope ist ungültig.

Ein isolierter Speicherort kann nicht initialisiert werden.

- oder -

scope enthält den Enumerationswert Application, aber die Anwendungsidentität des Aufrufers kann nicht bestimmt werden, da für ActivationContext die aktuelle Anwendungsdomäne zurückgegeben wurde null.

- oder -

scope enthält den Wert Domain, aber die Berechtigungen für die Anwendungsdomäne können nicht bestimmt werden.

- oder -

scope enthält den Wert Assembly, aber die Berechtigungen für die aufrufende Assembly können nicht bestimmt werden.

Hinweise

Hinweis

Wenn der scope Parameter ist Application und die Anwendungsdomäne, in der die Assembly installiert ist, nicht vorhanden IsolatedStorageFilePermissionist, gibt die GetStore Methode ein IsolatedStorageFile Objekt ohne Kontingent zurück. Bei späteren Versuchen, ein IsolatedStorageFile -Objekt mit dem IsolatedStorageFile -Objekt zu erstellen, das kein Kontingent aufweist, schlagen mit einem fehl IsolatedStorageException.

Weitere Informationen

Gilt für:

GetStore(IsolatedStorageScope, Object, Object)

Quelle:
IsolatedStorageFile.cs
Quelle:
IsolatedStorageFile.cs
Quelle:
IsolatedStorageFile.cs

Ruft den isolierten Speicher ab, der der angegebenen Anwendungsdomäne und den Assemblybeweisobjekten zugeordnet ist.

public:
 static System::IO::IsolatedStorage::IsolatedStorageFile ^ GetStore(System::IO::IsolatedStorage::IsolatedStorageScope scope, System::Object ^ domainIdentity, System::Object ^ assemblyIdentity);
public static System.IO.IsolatedStorage.IsolatedStorageFile GetStore (System.IO.IsolatedStorage.IsolatedStorageScope scope, object? domainIdentity, object? assemblyIdentity);
public static System.IO.IsolatedStorage.IsolatedStorageFile GetStore (System.IO.IsolatedStorage.IsolatedStorageScope scope, object domainIdentity, object assemblyIdentity);
static member GetStore : System.IO.IsolatedStorage.IsolatedStorageScope * obj * obj -> System.IO.IsolatedStorage.IsolatedStorageFile
Public Shared Function GetStore (scope As IsolatedStorageScope, domainIdentity As Object, assemblyIdentity As Object) As IsolatedStorageFile

Parameter

scope
IsolatedStorageScope

Eine bitweise Kombination der Enumerationswerte.

domainIdentity
Object

Ein Objekt, das den Beweis für die Identität der Anwendungsdomäne enthält.

assemblyIdentity
Object

Ein Objekt, das den Beweis für die Identität der Codeassembly enthält.

Gibt zurück

Ein Objekt, das die Parameter darstellt.

Ausnahmen

Es wurde keine ausreichende Berechtigung für den isolierten Speicher gewährt.

Weder domainIdentity noch assemblyIdentity wurde übergeben. Dies überprüft, ob der richtige Konstruktor verwendet wird.

- oder -

Entweder domainIdentity oder assemblyIdentity ist null.

scope ist ungültig.

Ein isolierter Speicherort kann nicht initialisiert werden.

- oder -

scope enthält den Enumerationswert Application, aber die Anwendungsidentität des Aufrufers kann nicht bestimmt werden, da für ActivationContext die aktuelle Anwendungsdomäne zurückgegeben wurde null.

- oder -

scope enthält den Wert Domain, aber die Berechtigungen für die Anwendungsdomäne können nicht bestimmt werden.

- oder -

scope enthält den Wert Assembly, aber die Berechtigungen für die aufrufende Assembly können nicht bestimmt werden.

Hinweise

Diese Form von GetStore ist am nützlichsten für Verwaltungscode, der einen Speicher öffnen muss, als wäre er eine andere Assembly. Der Speicher wird für die bereitgestellten Beweise und nicht für die derzeit ausgeführte Assembly geöffnet.

Hinweis

Wenn der scope Parameter ist Domain und die Anwendungsdomäne, in der die Assembly installiert ist, nicht vorhanden IsolatedStorageFilePermissionist, gibt die GetStore Methode ein IsolatedStorageFile Objekt ohne Kontingent zurück. Bei späteren Versuchen, ein IsolatedStorageFile -Objekt mit dem IsolatedStorageFile -Objekt zu erstellen, das kein Kontingent aufweist, schlagen mit einem fehl IsolatedStorageException.

Weitere Informationen

Gilt für:

GetStore(IsolatedStorageScope, Type, Type)

Quelle:
IsolatedStorageFile.cs
Quelle:
IsolatedStorageFile.cs
Quelle:
IsolatedStorageFile.cs

Ruft den isolierten Speicher entsprechend dem Gültigkeitsbereich des isolierten Speichers ab, wenn der Typ des Beweises der Anwendungsdomäne und der Assembly angegeben wird.

public:
 static System::IO::IsolatedStorage::IsolatedStorageFile ^ GetStore(System::IO::IsolatedStorage::IsolatedStorageScope scope, Type ^ domainEvidenceType, Type ^ assemblyEvidenceType);
public static System.IO.IsolatedStorage.IsolatedStorageFile GetStore (System.IO.IsolatedStorage.IsolatedStorageScope scope, Type? domainEvidenceType, Type? assemblyEvidenceType);
public static System.IO.IsolatedStorage.IsolatedStorageFile GetStore (System.IO.IsolatedStorage.IsolatedStorageScope scope, Type domainEvidenceType, Type assemblyEvidenceType);
static member GetStore : System.IO.IsolatedStorage.IsolatedStorageScope * Type * Type -> System.IO.IsolatedStorage.IsolatedStorageFile
Public Shared Function GetStore (scope As IsolatedStorageScope, domainEvidenceType As Type, assemblyEvidenceType As Type) As IsolatedStorageFile

Parameter

scope
IsolatedStorageScope

Eine bitweise Kombination der Enumerationswerte.

domainEvidenceType
Type

Der Typ von Evidence, der aus der Liste von Evidence in der Domäne der aufrufenden Anwendung ausgewählt werden kann. null ermöglicht dem IsolatedStorage-Objekt das Auswählen des Beweises.

assemblyEvidenceType
Type

Der Typ von Evidence, der aus der Liste von Evidence in der Domäne der aufrufenden Anwendung ausgewählt werden kann. null ermöglicht dem IsolatedStorage-Objekt das Auswählen des Beweises.

Gibt zurück

Ein Objekt, das die Parameter darstellt.

Ausnahmen

Es wurde keine ausreichende Berechtigung für den isolierten Speicher gewährt.

scope ist ungültig.

Der bereitgestellte Beweistyp fehlt in der Liste der Assemblybeweise.

- oder -

Ein isolierter Speicherort kann nicht initialisiert werden.

- oder -

scope enthält den Enumerationswert Application, aber die Anwendungsidentität des Aufrufers kann nicht bestimmt werden, da für ActivationContext die aktuelle Anwendungsdomäne zurückgegeben wurde null.

- oder -

scope enthält den Wert Domain, aber die Berechtigungen für die Anwendungsdomäne können nicht bestimmt werden.

- oder -

scope enthält Assembly, aber die Berechtigungen für die aufrufende Assembly können nicht bestimmt werden.

Beispiele

Im folgenden Codebeispiel wird die GetStore -Methode veranschaulicht. Den vollständigen Kontext dieses Beispiels finden Sie in der IsolatedStorageFile Übersicht.

// Retrieve an IsolatedStorageFile for the current Domain and Assembly.
IsolatedStorageFile^ isoFile = IsolatedStorageFile::GetStore( static_cast<IsolatedStorageScope>(IsolatedStorageScope::User | IsolatedStorageScope::Assembly | IsolatedStorageScope::Domain), (Type^)nullptr, nullptr );
IsolatedStorageFileStream^ isoStream = gcnew IsolatedStorageFileStream( this->userName,FileMode::Open,FileAccess::ReadWrite,isoFile );

// Retrieve an IsolatedStorageFile for the current Domain and Assembly.
IsolatedStorageFile isoFile =
    IsolatedStorageFile.GetStore(IsolatedStorageScope.User |
    IsolatedStorageScope.Assembly |
    IsolatedStorageScope.Domain,
    null,
    null);

IsolatedStorageFileStream isoStream =
    new IsolatedStorageFileStream("substituteUsername",
    System.IO.FileMode.Open,
    System.IO.FileAccess.Read,
     System.IO.FileShare.Read);
' Retrieve an IsolatedStorageFile for the current Domain and Assembly.
Dim isoFile As IsolatedStorageFile = _
    IsolatedStorageFile.GetStore(IsolatedStorageScope.User _
    Or IsolatedStorageScope.Assembly _
    Or IsolatedStorageScope.Domain, Nothing, Nothing)

Dim isoStream As New IsolatedStorageFileStream("substituteUsername", System.IO.FileMode.Open, _
    System.IO.FileAccess.Read, System.IO.FileShare.Read)

Hinweise

Dies ist die Überladung von, die GetStore höchstwahrscheinlich aus Anwendungscode aufgerufen wird.

Diese Überladung von GetStore öffnet einen isolierten Speicher für die übergebenen Beweistypen.

Hinweis

Wenn der scope Parameter ist Domain und die Anwendungsdomäne, in der die Assembly installiert ist, nicht vorhanden IsolatedStorageFilePermissionist, gibt die GetStore Methode ein IsolatedStorageFile Objekt ohne Kontingent zurück. Bei späteren Versuchen, ein IsolatedStorageFile -Objekt mit dem IsolatedStorageFile -Objekt zu erstellen, das kein Kontingent aufweist, schlagen mit einem fehl IsolatedStorageException.

Weitere Informationen

Gilt für:

GetStore(IsolatedStorageScope, Evidence, Type, Evidence, Type)

Ruft den isolierten Speicher ab, der der angegebenen Anwendungsdomäne und den Assemblybeweisobjekten und -typen zugeordnet ist.

public:
 static System::IO::IsolatedStorage::IsolatedStorageFile ^ GetStore(System::IO::IsolatedStorage::IsolatedStorageScope scope, System::Security::Policy::Evidence ^ domainEvidence, Type ^ domainEvidenceType, System::Security::Policy::Evidence ^ assemblyEvidence, Type ^ assemblyEvidenceType);
public static System.IO.IsolatedStorage.IsolatedStorageFile GetStore (System.IO.IsolatedStorage.IsolatedStorageScope scope, System.Security.Policy.Evidence domainEvidence, Type domainEvidenceType, System.Security.Policy.Evidence assemblyEvidence, Type assemblyEvidenceType);
static member GetStore : System.IO.IsolatedStorage.IsolatedStorageScope * System.Security.Policy.Evidence * Type * System.Security.Policy.Evidence * Type -> System.IO.IsolatedStorage.IsolatedStorageFile
Public Shared Function GetStore (scope As IsolatedStorageScope, domainEvidence As Evidence, domainEvidenceType As Type, assemblyEvidence As Evidence, assemblyEvidenceType As Type) As IsolatedStorageFile

Parameter

scope
IsolatedStorageScope

Eine bitweise Kombination der Enumerationswerte.

domainEvidence
Evidence

Ein Objekt, das die Identität der Anwendungsdomäne enthält.

domainEvidenceType
Type

Der Typ der Identität, der aus dem Beweis der Anwendungsdomäne ausgewählt werden soll.

assemblyEvidence
Evidence

Ein Objekt, das die Identität der Codeassembly enthält.

assemblyEvidenceType
Type

Der Typ der Identität, der aus dem Assemblybeweis für Anwendungscode ausgewählt werden soll.

Gibt zurück

Ein Objekt, das die Parameter darstellt.

Ausnahmen

Es wurde keine ausreichende Berechtigung für den isolierten Speicher gewährt.

Die domainEvidence-Identität oder die assemblyEvidence-Identität wurde nicht übergeben.

scope ist ungültig.

Ein isolierter Speicherort kann nicht initialisiert werden.

- oder -

scope enthält den Enumerationswert Application, aber die Anwendungsidentität des Aufrufers kann nicht bestimmt werden, da für ActivationContext die aktuelle Anwendungsdomäne zurückgegeben wurde null.

- oder -

scope enthält den Wert Domain, aber die Berechtigungen für die Anwendungsdomäne können nicht bestimmt werden.

- oder -

scope enthält den Wert Assembly, aber die Berechtigungen für die aufrufende Assembly können nicht bestimmt werden.

Beispiele

Im folgenden Codebeispiel wird Speicher basierend auf Herausgebernachweisen abgerufen.

using System;
using System.IO;
using System.IO.IsolatedStorage;
using System.Security;
using System.Security.Policy;
using System.Security.Permissions;
using System.Security.Cryptography.X509Certificates;

class Program
{
    static void Main(string[] args)
    {
        try
        {

            if (Test())
            {
                Console.WriteLine("PASSED.");
                Environment.ExitCode = 100;
            }
            else
            {
                Console.WriteLine("FAILED.");
                Environment.ExitCode = 101;
            }
        }
        catch (Exception e)
        {
            Console.Write("Exception occurred: {0}", e.ToString());
            Environment.ExitCode = 101;
        }
        return;
    }

    public static Boolean Test()
    {
        Boolean bRes = true;

        Evidence evidence1 = GetTestEvidence();
        Evidence evidence2 = GetTestEvidence();

        IsolatedStorageFile isf = IsolatedStorageFile.GetStore(
                                    IsolatedStorageScope.User | IsolatedStorageScope.Assembly,
                                    evidence1,
                                    typeof(System.Security.Policy.Publisher),
                                    evidence2,
                                    typeof(System.Security.Policy.Publisher));

        IsolatedStorageFileStream isfs = new IsolatedStorageFileStream("AdminEvd1.testfile", FileMode.OpenOrCreate, isf);
        isfs.WriteByte(5);
        isfs.Flush();
        isfs.Close();

        return bRes;
    }

    public static Evidence GetTestEvidence()
    {
        // For demonsration purposes, use a blank certificate.
        Publisher pub = new Publisher(new X509Certificate(new Byte[64]));
        Object[] arrObj = new Object[1];
        arrObj[0] = (Object)pub;
        return new Evidence(arrObj, arrObj);
    }
}
Imports System.IO
Imports System.IO.IsolatedStorage
Imports System.Security
Imports System.Security.Policy
Imports System.Security.Permissions
Imports System.Security.Cryptography.X509Certificates

Class Program

    Public Shared Sub Main(ByVal args() As String)
        Try
            If Test Then
                Console.WriteLine("PASSED.")
                Environment.ExitCode = 100
            Else
                Console.WriteLine("FAILED.")
                Environment.ExitCode = 101
            End If
        Catch e As Exception
            Console.Write("Exception occurred: {0}", e.ToString)
            Environment.ExitCode = 101
        End Try
        Return
    End Sub

    Public Shared Function Test() As Boolean
        Dim bRes As Boolean = True
        Dim evidence1 As Evidence = GetTestEvidence
        Dim evidence2 As Evidence = GetTestEvidence
        Dim isf As IsolatedStorageFile = IsolatedStorageFile.GetStore((IsolatedStorageScope.User _
         Or IsolatedStorageScope.Assembly), _
         evidence1, _
         GetType(System.Security.Policy.Publisher), _
         evidence2, _
         GetType(System.Security.Policy.Publisher))
        Dim isfs As IsolatedStorageFileStream = New IsolatedStorageFileStream("AdminEvd1.testfile", _
         FileMode.OpenOrCreate, isf)
        isfs.WriteByte(5)
        isfs.Flush()
        isfs.Close()
        Return bRes
    End Function

    Public Shared Function GetTestEvidence() As Evidence

        ' For demonsration purposes, use a blank certificate.
        Dim CertTemp(63) As Byte
        Dim pub As Publisher = New Publisher(New X509Certificate(CertTemp))
        Dim arrObj(0) As Object
        arrObj(0) = CType(pub, Object)
        Return New Evidence(arrObj, arrObj)
    End Function
End Class

Hinweise

Hinweis

Wenn der scope Parameter ist Domain und die Anwendungsdomäne, in der die Assembly installiert ist, nicht vorhanden IsolatedStorageFilePermissionist, gibt die GetStore Methode ein IsolatedStorageFile Objekt ohne Kontingent zurück. Bei späteren Versuchen, ein IsolatedStorageFile -Objekt mit dem IsolatedStorageFile -Objekt zu erstellen, das kein Kontingent aufweist, schlagen mit einem fehl IsolatedStorageException.

Weitere Informationen

Gilt für: