IsolatedStorageFile.GetStore Metoda
Definicja
Ważne
Niektóre informacje odnoszą się do produktu w wersji wstępnej, który może zostać znacząco zmodyfikowany przed wydaniem. Firma Microsoft nie udziela żadnych gwarancji, jawnych lub domniemanych, w odniesieniu do informacji podanych w tym miejscu.
Uzyskuje izolowany magazyn odpowiadający danej domenie aplikacji i obiektom dowodów zestawów oraz izolowanym zakresowi magazynu.
Przeciążenia
| Nazwa | Opis |
|---|---|
| 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
- Ź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
Bitowa kombinacja 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 parametr dla bieżącej domeny aplikacji zwrócił null.
— 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ń dla zestawu wywołującego.
Uwagi
Note
scope Jeśli parametr to 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 .IsolatedStorageException
Zobacz też
Dotyczy
GetStore(IsolatedStorageScope, Type)
- Źródło:
- IsolatedStorageFile.cs
- Źródło:
- IsolatedStorageFile.cs
- Ź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
Bitowa kombinacja 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ść applicationEvidenceType 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 dla bieżącej domeny aplikacji zwrócił wartość null.
— 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ń dla zestawu wywołującego.
Uwagi
Note
scope Jeśli parametr to 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 .IsolatedStorageException
Zobacz też
Dotyczy
GetStore(IsolatedStorageScope, Object, Object)
- Źródło:
- IsolatedStorageFile.cs
- Źródło:
- IsolatedStorageFile.cs
- Ź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
Bitowa kombinacja wartości wyliczenia.
- domainIdentity
- Object
Obiekt zawierający dowody tożsamości domeny aplikacji.
- assemblyIdentity
- Object
Obiekt zawierający dowody tożsamości zestawu kodu.
Zwraca
Obiekt reprezentujący parametry.
Wyjątki
Nie udzielono wystarczających izolowanych uprawnień magazynu.
Ani nie domainIdentityassemblyIdentity został przekazany. Sprawdza to, czy używany jest prawidłowy 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 dla bieżącej domeny aplikacji zwrócił wartość null.
— 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ń dla zestawu wywołującego.
Uwagi
Ta forma jest najbardziej przydatna GetStore w przypadku kodu administracyjnego, który musi otworzyć magazyn tak, jakby był innym zestawem. Sklep jest otwarty dla dostarczonych dowodów, a nie dla aktualnie wykonywanego zestawu.
Note
scope Jeśli parametr to 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 .IsolatedStorageException
Zobacz też
Dotyczy
GetStore(IsolatedStorageScope, Type, Type)
- Źródło:
- IsolatedStorageFile.cs
- Źródło:
- IsolatedStorageFile.cs
- Ź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
Bitowa kombinacja wartości wyliczenia.
- domainEvidenceType
- Type
Typ Evidence , który można wybrać z listy obecnych Evidence w domenie aplikacji wywołującej.
null
IsolatedStorage umożliwia obiektowi wybranie dowodów.
- assemblyEvidenceType
- Type
Typ Evidence , który można wybrać z listy obecnych Evidence w domenie aplikacji wywołującej.
null
IsolatedStorage umożliwia obiektowi 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 nie znajduje się 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 dla bieżącej domeny aplikacji zwrócił wartość null.
— 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 zestawu wywołującego.
Przykłady
Poniższy przykład kodu przedstawia metodę GetStore . Pełny kontekst tego przykładu zawiera IsolatedStorageFile omówienie.
// 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 najprawdopodobniej wywoływane GetStore z kodu aplikacji.
To przeciążenie GetStore otwiera izolowany magazyn dla typów dowodów, które są przekazywane.
Note
scope Jeśli parametr to 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 .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
Bitowa kombinacja wartości wyliczenia.
- domainEvidence
- Evidence
Obiekt zawierający tożsamość domeny aplikacji.
- domainEvidenceType
- Type
Typ tożsamości do wyboru z dowodów domeny aplikacji.
- assemblyEvidence
- Evidence
Obiekt zawierający 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.
Nie domainEvidence przekazano tożsamości lub assemblyEvidence .
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 dla bieżącej domeny aplikacji zwrócił wartość null.
— 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ń dla 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
Note
scope Jeśli parametr to 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 .IsolatedStorageException