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

特定のアプリケーション 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が含まれていますが、現在のアプリケーション ドメインの が 返nullされたためActivationContext、呼び出し元のアプリケーション ID を特定できません。

- または -

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

- または -

scopeAssembly という値が含まれますが、呼び出し元アセンブリのアクセス許可を特定できません。

注釈

Note

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

こちらもご覧ください

適用対象

GetStore(IsolatedStorageScope, Type)

ソース:
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 を格納するオブジェクト。

戻り値

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

例外

分離ストレージに対して必要なアクセス許可が与えられていません。

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

scope が無効です。

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

- または -

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

- または -

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

- または -

scopeAssembly という値が含まれますが、呼び出し元アセンブリのアクセス許可を特定できません。

注釈

Note

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

こちらもご覧ください

適用対象

GetStore(IsolatedStorageScope, Object, Object)

ソース:
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 または assemblyIdentity のいずれかが null です。

scope が無効です。

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

- または -

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

- または -

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

- または -

scopeAssembly という値が含まれますが、呼び出し元アセンブリのアクセス許可を特定できません。

注釈

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

Note

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

こちらもご覧ください

適用対象

GetStore(IsolatedStorageScope, Type, Type)

ソース:
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が含まれていますが、現在のアプリケーション ドメインの が を返nullしたためActivationContext、呼び出し元のアプリケーション ID を特定できません。

- または -

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

- または -

scopeAssembly が含まれますが、呼び出し元アセンブリのアクセス許可を特定できません。

次のコード例は、 メソッドを GetStore 示しています。 この例の完全なコンテキストについては、概要を 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)

注釈

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

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

Note

パラメーターが scopeDomain で、アセンブリがインストールされているアプリケーション ドメインに がないIsolatedStorageFilePermissionGetStore場合、 メソッドはクォータのないオブジェクトを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 ID または assemblyEvidence ID が渡されていません。

scope が無効です。

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

- または -

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

- または -

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

- または -

scopeAssembly という値が含まれますが、呼び出し元アセンブリのアクセス許可を特定できません。

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

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

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

こちらもご覧ください

適用対象