本文整理匯總了C#中System.IO.IsolatedStorage.IsolatedStorageFile.GetStore方法的典型用法代碼示例。如果您正苦於以下問題:C# IsolatedStorageFile.GetStore方法的具體用法?C# IsolatedStorageFile.GetStore怎麽用?C# IsolatedStorageFile.GetStore使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.IO.IsolatedStorage.IsolatedStorageFile
的用法示例。
在下文中一共展示了IsolatedStorageFile.GetStore方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: IsolatedStorageFileStream
// 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);
示例2: Main
//引入命名空間
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);
}
}