IsolatedStorageFile.GetStore メソッド

定義

特定のアプリケーション ドメインとアセンブリ証拠オブジェクトと分離ストレージ スコープに対応する分離ストレージを取得します。

オーバーロード

名前 説明
GetStore(IsolatedStorageScope, Object)

指定されたアプリケーション ID に対応する分離ストレージを取得します。

GetStore(IsolatedStorageScope, Type)

分離スコープとアプリケーション ID オブジェクトに対応する分離ストレージを取得します。

GetStore(IsolatedStorageScope, Object, Object)

指定されたアプリケーション ドメインとアセンブリ証拠オブジェクトに対応する分離ストレージを取得します。

GetStore(IsolatedStorageScope, Type, Type)

アプリケーション ドメインとアセンブリ証拠の種類に応じて、分離ストレージ スコープに対応する分離ストレージを取得します。

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

指定されたアプリケーション ドメインおよびアセンブリ証拠オブジェクトと型に対応する分離ストレージを取得します。

GetStore(IsolatedStorageScope, Object)

ソース:
IsolatedStorageFile.cs
ソース:
IsolatedStorageFile.cs
ソース:
IsolatedStorageFile.cs
ソース:
IsolatedStorageFile.cs
ソース:
IsolatedStorageFile.cs

指定されたアプリケーション ID に対応する分離ストレージを取得します。

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

パラメーター

scope
IsolatedStorageScope

列挙値のビットごとの組み合わせ。

applicationIdentity
Object

アプリケーション ID の証拠を含むオブジェクト。

返品

パラメーターを表すオブジェクト。

例外

十分な分離ストレージのアクセス許可が付与されていません。

applicationIdentity ID が渡されていません。

scopeが無効です。

分離ストレージの場所を初期化できません。

-又は-

scope には Application列挙値が含まれていますが、現在のアプリケーション ドメインの ActivationContextnull返されるため、呼び出し元のアプリケーション ID を特定できません。

-又は-

scope には Domain値が含まれていますが、アプリケーション ドメインのアクセス許可を特定できません。

-又は-

scope には Assembly値が含まれていますが、呼び出し元アセンブリのアクセス許可を特定できません。

注釈

Note

scope パラメーターがIsolatedStorageScope.Applicationされ、アセンブリがインストールされているアプリケーション ドメインにIsolatedStorageFilePermissionがない場合、GetStore メソッドはクォータのないIsolatedStorageFile オブジェクトを返します。 クォータがないIsolatedStorageFile オブジェクトを使用してIsolatedStorageFile オブジェクトを作成しようとすると、IsolatedStorageExceptionで失敗します。

こちらもご覧ください

適用対象

GetStore(IsolatedStorageScope, Type)

ソース:
IsolatedStorageFile.cs
ソース:
IsolatedStorageFile.cs
ソース:
IsolatedStorageFile.cs
ソース:
IsolatedStorageFile.cs
ソース:
IsolatedStorageFile.cs

分離スコープとアプリケーション ID オブジェクトに対応する分離ストレージを取得します。

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

パラメーター

scope
IsolatedStorageScope

列挙値のビットごとの組み合わせ。

applicationEvidenceType
Type

アプリケーション ID を含むオブジェクト。

返品

パラメーターを表すオブジェクト。

例外

十分な分離ストレージのアクセス許可が付与されていません。

applicationEvidenceType ID が渡されていません。

scopeが無効です。

分離ストレージの場所を初期化できません。

-又は-

scope には Application列挙値が含まれていますが、現在のアプリケーション ドメインの ActivationContextnull返されるため、呼び出し元のアプリケーション ID を特定できません。

-又は-

scope には Domain値が含まれていますが、アプリケーション ドメインのアクセス許可を特定できません。

-又は-

scope には Assembly値が含まれていますが、呼び出し元アセンブリのアクセス許可を特定できません。

注釈

Note

scope パラメーターがApplicationされ、アセンブリがインストールされているアプリケーション ドメインにIsolatedStorageFilePermissionがない場合、GetStore メソッドはクォータのないIsolatedStorageFile オブジェクトを返します。 クォータがないIsolatedStorageFile オブジェクトを使用してIsolatedStorageFile オブジェクトを作成しようとすると、IsolatedStorageExceptionで失敗します。

こちらもご覧ください

適用対象

GetStore(IsolatedStorageScope, Object, Object)

ソース:
IsolatedStorageFile.cs
ソース:
IsolatedStorageFile.cs
ソース:
IsolatedStorageFile.cs
ソース:
IsolatedStorageFile.cs
ソース:
IsolatedStorageFile.cs

指定されたアプリケーション ドメインとアセンブリ証拠オブジェクトに対応する分離ストレージを取得します。

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

パラメーター

scope
IsolatedStorageScope

列挙値のビットごとの組み合わせ。

domainIdentity
Object

アプリケーション ドメイン ID の証拠を含むオブジェクト。

assemblyIdentity
Object

コード アセンブリ ID の証拠を含むオブジェクト。

返品

パラメーターを表すオブジェクト。

例外

十分な分離ストレージのアクセス許可が付与されていません。

domainIdentityassemblyIdentityも渡されていません。 これにより、正しいコンストラクターが使用されていることが確認されます。

-又は-

domainIdentityまたはassemblyIdentitynull

scopeが無効です。

分離ストレージの場所を初期化できません。

-又は-

scope には Application列挙値が含まれていますが、現在のアプリケーション ドメインの ActivationContextnull返されるため、呼び出し元のアプリケーション ID を特定できません。

-又は-

scope には Domain値が含まれていますが、アプリケーション ドメインのアクセス許可を特定できません。

-又は-

scope には Assembly値が含まれていますが、呼び出し元アセンブリのアクセス許可を特定できません。

注釈

この形式の GetStore は、ストアを別のアセンブリのように開く必要がある管理コードに最も役立ちます。 ストアは、現在実行中のアセンブリではなく、提供された証拠のために開かれます。

Note

scope パラメーターがDomainされ、アセンブリがインストールされているアプリケーション ドメインにIsolatedStorageFilePermissionがない場合、GetStore メソッドはクォータのないIsolatedStorageFile オブジェクトを返します。 クォータがないIsolatedStorageFile オブジェクトを使用してIsolatedStorageFile オブジェクトを作成しようとすると、IsolatedStorageExceptionで失敗します。

こちらもご覧ください

適用対象

GetStore(IsolatedStorageScope, Type, Type)

ソース:
IsolatedStorageFile.cs
ソース:
IsolatedStorageFile.cs
ソース:
IsolatedStorageFile.cs
ソース:
IsolatedStorageFile.cs
ソース:
IsolatedStorageFile.cs

アプリケーション ドメインとアセンブリ証拠の種類に応じて、分離ストレージ スコープに対応する分離ストレージを取得します。

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

パラメーター

scope
IsolatedStorageScope

列挙値のビットごとの組み合わせ。

domainEvidenceType
Type

呼び出し元アプリケーションのドメインに存在するEvidenceの一覧から選択できるEvidenceの種類。 null では、 IsolatedStorage オブジェクトが証拠を選択できます。

assemblyEvidenceType
Type

呼び出し元アプリケーションのドメインに存在するEvidenceの一覧から選択できるEvidenceの種類。 null では、 IsolatedStorage オブジェクトが証拠を選択できます。

返品

パラメーターを表すオブジェクト。

例外

十分な分離ストレージのアクセス許可が付与されていません。

scopeが無効です。

指定された証拠の種類がアセンブリ証拠リストに見つかりません。

-又は-

分離ストレージの場所を初期化できません。

-又は-

scope には Application列挙値が含まれていますが、現在のアプリケーション ドメインの ActivationContextnull返されるため、呼び出し元のアプリケーション ID を特定できません。

-又は-

scope には Domain値が含まれていますが、アプリケーション ドメインのアクセス許可を特定できません。

-又は-

scope には Assemblyが含まれていますが、呼び出し元アセンブリのアクセス許可を決定することはできません。

次のコード例は、 GetStore メソッドを示しています。 この例の完全なコンテキストについては、 IsolatedStorageFile の概要を参照してください。


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

注釈

これは、アプリケーション コードから呼び出される可能性 GetStore 最も高いオーバーロードです。

この GetStore のオーバーロードにより、渡された証拠の種類の分離ストアが開きます。

Note

scope パラメーターがDomainされ、アセンブリがインストールされているアプリケーション ドメインにIsolatedStorageFilePermissionがない場合、GetStore メソッドはクォータのないIsolatedStorageFile オブジェクトを返します。 クォータがないIsolatedStorageFile オブジェクトを使用してIsolatedStorageFile オブジェクトを作成しようとすると、IsolatedStorageExceptionで失敗します。

こちらもご覧ください

適用対象

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

指定されたアプリケーション ドメインおよびアセンブリ証拠オブジェクトと型に対応する分離ストレージを取得します。

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

パラメーター

scope
IsolatedStorageScope

列挙値のビットごとの組み合わせ。

domainEvidence
Evidence

アプリケーション ドメイン ID を含むオブジェクト。

domainEvidenceType
Type

アプリケーション ドメインの証拠から選択する ID の種類。

assemblyEvidence
Evidence

コード アセンブリ ID を含むオブジェクト。

assemblyEvidenceType
Type

アプリケーション コード アセンブリの証拠から選択する ID の種類。

返品

パラメーターを表すオブジェクト。

例外

十分な分離ストレージのアクセス許可が付与されていません。

domainEvidenceまたはassemblyEvidence ID が渡されていません。

scopeが無効です。

分離ストレージの場所を初期化できません。

-又は-

scope には Application列挙値が含まれていますが、現在のアプリケーション ドメインの ActivationContextnull返されるため、呼び出し元のアプリケーション ID を特定できません。

-又は-

scope には Domain値が含まれていますが、アプリケーション ドメインのアクセス許可を特定できません。

-又は-

scope には Assembly値が含まれていますが、呼び出し元アセンブリのアクセス許可を特定できません。

次のコード例では、発行元の証拠に基づいてストレージを取得します。

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

注釈

Note

scope パラメーターがDomainされ、アセンブリがインストールされているアプリケーション ドメインにIsolatedStorageFilePermissionがない場合、GetStore メソッドはクォータのないIsolatedStorageFile オブジェクトを返します。 クォータがないIsolatedStorageFile オブジェクトを使用してIsolatedStorageFile オブジェクトを作成しようとすると、IsolatedStorageExceptionで失敗します。

こちらもご覧ください

適用対象