本文整理汇总了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);
}
}