IsolatedStorageFile.GetStore Metoda

Definicja

Uzyskuje izolowany magazyn odpowiadający danej domenie aplikacji i obiektom dowodów zestawów oraz izolowanym zakresom magazynu.

Przeciążenia

GetStore(IsolatedStorageScope, Object)

Uzyskuje izolowany magazyn odpowiadający danej tożsamości aplikacji.

GetStore(IsolatedStorageScope, Type)

Uzyskuje izolowany magazyn odpowiadający zakresowi izolacji i obiektowi tożsamości aplikacji.

GetStore(IsolatedStorageScope, Object, Object)

Uzyskuje izolowany magazyn odpowiadający danej domenie aplikacji i obiektom dowodów zestawu.

GetStore(IsolatedStorageScope, Type, Type)

Uzyskuje izolowany magazyn odpowiadający izolowanym zakresowi magazynu, biorąc pod uwagę typy dowodów domeny aplikacji i zestawu.

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

Uzyskuje izolowany magazyn odpowiadający danej domenie aplikacji oraz obiektom i typom dowodów zestawów.

GetStore(IsolatedStorageScope, Object)

Źródło:
IsolatedStorageFile.cs
Źródło:
IsolatedStorageFile.cs
Źródło:
IsolatedStorageFile.cs

Uzyskuje izolowany magazyn odpowiadający danej tożsamości aplikacji.

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

Parametry

scope
IsolatedStorageScope

Bitowe połączenie wartości wyliczenia.

applicationIdentity
Object

Obiekt zawierający dowody tożsamości aplikacji.

Zwraca

Obiekt reprezentujący parametry.

Wyjątki

Nie udzielono wystarczających izolowanych uprawnień magazynu.

Tożsamość applicationIdentity nie została przekazana.

Element scope jest nieprawidłowy.

Nie można zainicjować izolowanej lokalizacji magazynu.

-lub-

scope zawiera wartość Applicationwyliczenia , ale nie można określić tożsamości aplikacji obiektu wywołującego, ponieważ ActivationContext zwracana nulljest wartość dla bieżącej domeny aplikacji .

-lub-

scope zawiera wartość Domain, ale nie można określić uprawnień dla domeny aplikacji.

-lub-

scope zawiera wartość Assembly, ale nie można określić uprawnień do zestawu wywołującego.

Uwagi

Uwaga

scope Jeśli parametr jest IsolatedStorageScope.Application i domena aplikacji, w której jest zainstalowany zestaw, nie ma IsolatedStorageFilePermission, GetStore metoda zwróci IsolatedStorageFile obiekt bez limitu przydziału. Później próbuje utworzyć IsolatedStorageFile obiekt przy użyciu IsolatedStorageFile obiektu, który nie ma limitu przydziału, zakończy się niepowodzeniem z elementem IsolatedStorageException.

Zobacz też

Dotyczy

GetStore(IsolatedStorageScope, Type)

Źródło:
IsolatedStorageFile.cs
Źródło:
IsolatedStorageFile.cs
Źródło:
IsolatedStorageFile.cs

Uzyskuje izolowany magazyn odpowiadający zakresowi izolacji i obiektowi tożsamości aplikacji.

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

Parametry

scope
IsolatedStorageScope

Bitowe połączenie wartości wyliczenia.

applicationEvidenceType
Type

Obiekt zawierający tożsamość aplikacji.

Zwraca

Obiekt reprezentujący parametry.

Wyjątki

Nie udzielono wystarczających izolowanych uprawnień magazynu.

Tożsamość applicationEvidence nie została przekazana.

Element scope jest nieprawidłowy.

Nie można zainicjować izolowanej lokalizacji magazynu.

-lub-

scope zawiera wartość Applicationwyliczenia , ale nie można określić tożsamości aplikacji obiektu wywołującego, ponieważ ActivationContext zwracana nulljest wartość dla bieżącej domeny aplikacji .

-lub-

scope zawiera wartość Domain, ale nie można określić uprawnień dla domeny aplikacji.

-lub-

scope zawiera wartość Assembly, ale nie można określić uprawnień do zestawu wywołującego.

Uwagi

Uwaga

scope Jeśli parametr jest Application i domena aplikacji, w której jest zainstalowany zestaw, nie ma IsolatedStorageFilePermission, GetStore metoda zwróci IsolatedStorageFile obiekt bez limitu przydziału. Później próbuje utworzyć IsolatedStorageFile obiekt przy użyciu IsolatedStorageFile obiektu, który nie ma limitu przydziału, zakończy się niepowodzeniem z elementem IsolatedStorageException.

Zobacz też

Dotyczy

GetStore(IsolatedStorageScope, Object, Object)

Źródło:
IsolatedStorageFile.cs
Źródło:
IsolatedStorageFile.cs
Źródło:
IsolatedStorageFile.cs

Uzyskuje izolowany magazyn odpowiadający danej domenie aplikacji i obiektom dowodów zestawu.

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

Parametry

scope
IsolatedStorageScope

Bitowe połączenie wartości wyliczenia.

domainIdentity
Object

Obiekt, który zawiera dowody dla tożsamości domeny aplikacji.

assemblyIdentity
Object

Obiekt, który zawiera dowody dla tożsamości zestawu kodu.

Zwraca

Obiekt reprezentujący parametry.

Wyjątki

Nie udzielono wystarczających izolowanych uprawnień magazynu.

Nie przekazano ani domainIdentityassemblyIdentity nie zostało przekazane. Sprawdza to, czy używany jest poprawny konstruktor.

-lub-

Albo domainIdentity lub assemblyIdentity ma wartość null.

Element scope jest nieprawidłowy.

Nie można zainicjować izolowanej lokalizacji magazynu.

-lub-

scope zawiera wartość Applicationwyliczenia , ale nie można określić tożsamości aplikacji obiektu wywołującego, ponieważ ActivationContext zwracana nulljest wartość dla bieżącej domeny aplikacji .

-lub-

scope zawiera wartość Domain, ale nie można określić uprawnień dla domeny aplikacji.

-lub-

scope zawiera wartość Assembly, ale nie można określić uprawnień do zestawu wywołującego.

Uwagi

Ta forma jest najbardziej przydatna GetStore w przypadku kodu administracyjnego, który musi otworzyć magazyn tak, jakby był to inny zestaw. Sklep jest otwarty dla dostarczonych dowodów, a nie dla aktualnie wykonywanego zestawu.

Uwaga

scope Jeśli parametr jest Domain i domena aplikacji, w której jest zainstalowany zestaw, nie ma IsolatedStorageFilePermission, GetStore metoda zwróci IsolatedStorageFile obiekt bez limitu przydziału. Później próbuje utworzyć IsolatedStorageFile obiekt przy użyciu IsolatedStorageFile obiektu, który nie ma limitu przydziału, zakończy się niepowodzeniem z elementem IsolatedStorageException.

Zobacz też

Dotyczy

GetStore(IsolatedStorageScope, Type, Type)

Źródło:
IsolatedStorageFile.cs
Źródło:
IsolatedStorageFile.cs
Źródło:
IsolatedStorageFile.cs

Uzyskuje izolowany magazyn odpowiadający izolowanym zakresowi magazynu, biorąc pod uwagę typy dowodów domeny aplikacji i zestawu.

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

Parametry

scope
IsolatedStorageScope

Bitowe połączenie wartości wyliczenia.

domainEvidenceType
Type

Typ Evidence , który można wybrać z listy obecnych Evidence w domenie aplikacji wywołującej. null umożliwia obiektowi IsolatedStorage wybranie dowodów.

assemblyEvidenceType
Type

Typ Evidence , który można wybrać z listy obecnych Evidence w domenie aplikacji wywołującej. null umożliwia obiektowi IsolatedStorage wybranie dowodów.

Zwraca

Obiekt reprezentujący parametry.

Wyjątki

Nie udzielono wystarczających izolowanych uprawnień magazynu.

Element scope jest nieprawidłowy.

Podany typ dowodu brakuje na liście dowodów zestawów.

-lub-

Nie można zainicjować izolowanej lokalizacji magazynu.

-lub-

scope zawiera wartość Applicationwyliczenia , ale nie można określić tożsamości aplikacji obiektu wywołującego, ponieważ ActivationContext zwracana nulljest wartość dla bieżącej domeny aplikacji .

-lub-

scope zawiera wartość Domain, ale nie można określić uprawnień dla domeny aplikacji.

-lub-

scope zawiera Assemblyelement , ale nie można określić uprawnień do wywoływanego zestawu.

Przykłady

Poniższy przykład kodu przedstawia metodę GetStore . Pełny kontekst tego przykładu zawiera omówienie IsolatedStorageFile .

// 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)

Uwagi

Jest to przeciążenie najczęściej wywoływane GetStore z kodu aplikacji.

To przeciążenie GetStore otwiera izolowany magazyn dla typów dowodów, które są przekazywane.

Uwaga

scope Jeśli parametr to Domain i domena aplikacji, w której zainstalowany zestaw nie ma IsolatedStorageFilePermission, GetStore metoda zwróci IsolatedStorageFile obiekt bez limitu przydziału. Późniejsze próby utworzenia IsolatedStorageFile obiektu przy użyciu IsolatedStorageFile obiektu, który nie ma przydziału, zakończy się niepowodzeniem z powodu .IsolatedStorageException

Zobacz też

Dotyczy

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

Uzyskuje izolowany magazyn odpowiadający danej domenie aplikacji oraz obiektom i typom dowodów zestawów.

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

Parametry

scope
IsolatedStorageScope

Bitowe połączenie wartości wyliczenia.

domainEvidence
Evidence

Obiekt, który zawiera tożsamość domeny aplikacji.

domainEvidenceType
Type

Typ tożsamości do wyboru z dowodów domeny aplikacji.

assemblyEvidence
Evidence

Obiekt, który zawiera tożsamość zestawu kodu.

assemblyEvidenceType
Type

Typ tożsamości do wyboru z dowodów zestawu kodu aplikacji.

Zwraca

Obiekt reprezentujący parametry.

Wyjątki

Nie udzielono wystarczających izolowanych uprawnień magazynu.

Tożsamość domainEvidence lub assemblyEvidence nie została przekazana.

Element scope jest nieprawidłowy.

Nie można zainicjować izolowanej lokalizacji magazynu.

-lub-

scope zawiera wartość Applicationwyliczenia , ale nie można określić tożsamości aplikacji obiektu wywołującego, ponieważ ActivationContext element dla bieżącej domeny aplikacji zwrócił nullwartość .

-lub-

scope zawiera wartość Domain, ale nie można określić uprawnień dla domeny aplikacji.

-lub-

scope zawiera wartość Assembly, ale nie można określić uprawnień do zestawu wywołującego.

Przykłady

Poniższy przykład kodu uzyskuje magazyn na podstawie dowodów wydawcy.

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

Uwagi

Uwaga

scope Jeśli parametr to Domain i domena aplikacji, w której zainstalowany zestaw nie ma IsolatedStorageFilePermission, GetStore metoda zwróci IsolatedStorageFile obiekt bez limitu przydziału. Późniejsze próby utworzenia IsolatedStorageFile obiektu przy użyciu IsolatedStorageFile obiektu, który nie ma przydziału, zakończy się niepowodzeniem z powodu .IsolatedStorageException

Zobacz też

Dotyczy