本文整理汇总了C#中System.IO.IsolatedStorage.IsolatedStorageFile类的典型用法代码示例。如果您正苦于以下问题:C# IsolatedStorageFile类的具体用法?C# IsolatedStorageFile怎么用?C# IsolatedStorageFile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IsolatedStorageFile类属于System.IO.IsolatedStorage命名空间,在下文中一共展示了IsolatedStorageFile类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: AssemblyResourceStore
internal AssemblyResourceStore(Type evidence)
{
this.evidence = evidence;
logger = Initializer.Instance.WindsorContainer.Resolve<ILoggingService>();
_isoFile = IsolatedStorageFile.GetMachineStoreForAssembly();
_backingFile = new IsolatedStorageFileStream(evidence.Assembly.GetName().Name, FileMode.OpenOrCreate, _isoFile);
if (_backingFile.Length > 0)
{
try
{
var formatter = new BinaryFormatter();
store = (Dictionary<string, object>)formatter.Deserialize(_backingFile);
}
catch (Exception ex)
{
logger.Log(Common.LogLevel.Error, string.Format("Error deserializing resource store for {0}. Resetting resource store.", evidence.Assembly.GetName().Name));
logger.Log(Common.LogLevel.Debug, string.Format("Deserialize error: {0}", ex.Message));
store = new Dictionary<string, object>();
}
}
else
{
store = new Dictionary<string, object>();
}
}
开发者ID:bartsipes,项目名称:ElementSuite,代码行数:25,代码来源:AssemblyResourceStore.cs
示例2: IsolatedStorageTracer
public IsolatedStorageTracer()
{
_storageFile = IsolatedStorageFile.GetUserStoreForApplication();
_storageFileStream = _storageFile.OpenFile("MagellanTrace.log", FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite);
_streamWriter = new StreamWriter(_storageFileStream);
_streamWriter.AutoFlush = true;
}
开发者ID:p69,项目名称:magellan-framework,代码行数:7,代码来源:Tracer.cs
示例3: DynamicArchiveFileHandlerClass
public DynamicArchiveFileHandlerClass(IsolatedStorageFile isolatedStorageFile)
{
this.MaxArchiveFileToKeep = -1;
this.isolatedStorageFile = isolatedStorageFile;
archiveFileEntryQueue = new Queue<string>();
}
开发者ID:joshgo,项目名称:NLog,代码行数:7,代码来源:IsolatedStorageTarget.cs
示例4: App
/// <summary>
/// Constructor for the Application object.
/// </summary>
public App()
{
// Global handler for uncaught exceptions.
UnhandledException += Application_UnhandledException;
// Standard Silverlight initialization
InitializeComponent();
//get store
store = IsolatedStorageFile.GetUserStoreForApplication();
// Phone-specific initialization
InitializePhoneApplication();
// Show graphics profiling information while debugging.
if (System.Diagnostics.Debugger.IsAttached)
{
// Display the current frame rate counters.
Application.Current.Host.Settings.EnableFrameRateCounter = true;
// Show the areas of the app that are being redrawn in each frame.
//Application.Current.Host.Settings.EnableRedrawRegions = true;
// Enable non-production analysis visualization mode,
// which shows areas of a page that are handed off to GPU with a colored overlay.
//Application.Current.Host.Settings.EnableCacheVisualization = true;
// Disable the application idle detection by setting the UserIdleDetectionMode property of the
// application's PhoneApplicationService object to Disabled.
// Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run
// and consume battery power when the user is not using the phone.
PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;
}
}
开发者ID:jordigaset,项目名称:GeoWorld-Clock,代码行数:37,代码来源:App.xaml.cs
示例5: FromCache
/// <summary>
/// Imports a CartridgeSavegame from metadata associated to a savegame
/// file.
/// </summary>
/// <param name="gwsFilePath">Path to the GWS savegame file.</param>
/// <param name="isf">Isostore file to use to load.</param>
/// <returns>The cartridge savegame.</returns>
///
public static CartridgeSavegame FromCache(string gwsFilePath, IsolatedStorageFile isf)
{
// Checks that the metadata file exists.
string mdFile = gwsFilePath + ".mf";
if (!(isf.FileExists(mdFile)))
{
throw new System.IO.FileNotFoundException(mdFile + " does not exist.");
}
// Creates a serializer.
DataContractSerializer serializer = new DataContractSerializer(typeof(CartridgeSavegame));
// Reads the object.
CartridgeSavegame cs;
using (IsolatedStorageFileStream fs = isf.OpenFile(mdFile, System.IO.FileMode.Open, System.IO.FileAccess.Read))
{
// Reads the object.
object o = serializer.ReadObject(fs);
// Casts it.
cs = (CartridgeSavegame)o;
}
// Adds non-serialized content.
cs.SavegameFile = gwsFilePath;
cs.MetadataFile = mdFile;
// Returns it.
return cs;
}
开发者ID:kamaelyoung,项目名称:WF.Player.WinPhone,代码行数:38,代码来源:CartridgeSavegame.cs
示例6: IsolatedStorageFileStream
public IsolatedStorageFileStream(String path, FileMode mode,
FileAccess access, FileShare share,
IsolatedStorageFile sf)
: this(path, mode, access, share, BUFSIZ, sf)
{
// Nothing to do here.
}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:7,代码来源:IsolatedStorageFileStream.cs
示例7: GetFiles
private static void GetFiles(string dir, string pattern, IsolatedStorageFile storeFile)
{
string fileString = System.IO.Path.GetFileName(pattern);
string[] files = storeFile.GetFileNames(pattern);
try
{
for (int i = 0; i < storeFile.GetFileNames(dir + "/" + fileString).Length; i++)
{
//Files are prefixed with "--"
//Add to the list
//listDir.Add("--" + dir + "/" + storeFile.GetFileNames(dir + "/" + fileString)[i]);
Debug.WriteLine("--" + dir + "/" + storeFile.GetFileNames(dir + "/" + fileString)[i]);
}
}
catch (IsolatedStorageException ise)
{
Debug.WriteLine("An IsolatedStorageException exception has occurred: " + ise.InnerException);
}
catch (Exception e)
{
Debug.WriteLine("An exception has occurred: " + e.InnerException);
}
}
开发者ID:bramleffers,项目名称:MonkeySpace,代码行数:28,代码来源:IsoViewer.cs
示例8: MainPage
// Constructor
public MainPage()
{
this._WatchlistFile = IsolatedStorageFile.GetUserStoreForApplication();
this._WatchlistFileName = "Watchlist.txt";
// If the file doesn't exist we need to create it so the user has it for us to reference.
if (!this._WatchlistFile.FileExists(this._WatchlistFileName))
{
this._WatchlistFile.CreateFile(this._WatchlistFileName).Close();
}
this._WatchList = this._ReadWatchlistFile();
InitializeComponent();
// Init WebClient's and set callbacks
this._LookupWebClient = new WebClient();
this._LookupWebClient.OpenReadCompleted += new OpenReadCompletedEventHandler(this.LookupSymbolComplete);
this._NewsWebClient = new WebClient();
this._NewsWebClient.OpenReadCompleted += new OpenReadCompletedEventHandler(this.NewsSearchComplete);
this._QuoteWebClient = new WebClient();
this._QuoteWebClient.OpenReadCompleted += new OpenReadCompletedEventHandler(this.GetQuoteComplete);
this.SymbolTextBox.Text = _DefaultInputText;
}
开发者ID:Ali-Khatami,项目名称:FinancialWP7,代码行数:28,代码来源:MainPage.xaml.cs
示例9: GetIsolatedStorageView
//*******************************************************************************************
//Enable this if you'd like to be able access the list from outside the class. All list
//methods are commented out below and replaced with Debug.WriteLine.
//Default implementation is to simply output the directories to the console (Debug.WriteLine)
//so if it looks like nothing's happening, check the Output window :) - keyboardP
// public static List<string> listDir = new List<string>();
//********************************************************************************************
//Use "*" as the pattern string in order to retrieve all files and directories
public static void GetIsolatedStorageView(string pattern, IsolatedStorageFile storeFile)
{
string root = System.IO.Path.GetDirectoryName(pattern);
if (root != "")
{
root += "/";
}
string[] directories = storeFile.GetDirectoryNames(pattern);
//if the root directory has not FOLDERS, then the GetFiles() method won't be called.
//the line below calls the GetFiles() method in this event so files are displayed
//even if there are no folders
//if (directories.Length == 0)
GetFiles(root, "*", storeFile);
for (int i = 0; i < directories.Length; i++)
{
string dir = directories[i] + "/";
//Add this directory into the list
// listDir.Add(root + directories[i]);
//Write to output window
Debug.WriteLine(root + directories[i]);
//Get all the files from this directory
GetFiles(root + directories[i], pattern, storeFile);
//Continue to get the next directory
GetIsolatedStorageView(root + dir + "*", storeFile);
}
}
开发者ID:bramleffers,项目名称:MonkeySpace,代码行数:41,代码来源:IsoViewer.cs
示例10: Note
/// <summary>
/// Create a Note instance and create a note file.
/// </summary>
/// <param name="title"></param>
/// <param name="body"></param>
/// <param name="iStorage"></param>
/// <param name="dateTime"></param>
public Note(string title, DateTime dateTime, string body, IsolatedStorageFile iStorage)
{
Title = title;
DateTime = dateTime;
Body = body;
SaveFromTitle(iStorage);
}
开发者ID:tobitech,项目名称:scribbles,代码行数:14,代码来源:Note.cs
示例11: BaseStorageCache
protected BaseStorageCache(IsolatedStorageFile isf, string cacheDirectory, ICacheFileNameGenerator cacheFileNameGenerator, long cacheMaxLifetimeInMillis = DefaultCacheMaxLifetimeInMillis)
{
if (isf == null)
{
throw new ArgumentNullException("isf");
}
if (String.IsNullOrEmpty(cacheDirectory))
{
throw new ArgumentException("cacheDirectory name could not be null or empty");
}
if (!cacheDirectory.StartsWith("\\"))
{
throw new ArgumentException("cacheDirectory name should starts with double slashes: \\");
}
if (cacheFileNameGenerator == null)
{
throw new ArgumentNullException("cacheFileNameGenerator");
}
ISF = isf;
CacheDirectory = cacheDirectory;
CacheFileNameGenerator = cacheFileNameGenerator;
CacheMaxLifetimeInMillis = cacheMaxLifetimeInMillis;
// Creating cache directory if it not exists
ISF.CreateDirectory(CacheDirectory);
}
开发者ID:mdabbagh88,项目名称:jet-image-loader,代码行数:30,代码来源:BaseStorageCache.cs
示例12: SetupApplicationViewModel
public SetupApplicationViewModel(IGlobalSettingsService globalSettingsService)
{
_storage = IsolatedStorageFile.GetUserStoreForApplication();
CacheModules = globalSettingsService.IsCachingEnabled;
Quota = _storage.Quota / 1048576;
_globalSettingsService = globalSettingsService;
}
开发者ID:Marbulinek,项目名称:NIS,代码行数:7,代码来源:SetupApplicationViewModel.cs
示例13: LoadSettings
public void LoadSettings()
{
// Look for settings in isolated storage
this.isoStore = IsolatedStorageFile.GetUserStoreForAssembly();
//this.isoStore.DeleteFile("Prefs.txt");
string[] files = this.isoStore.GetFileNames(prefsFilename);
if (files.Length > 0)
{
using (StreamReader reader = new StreamReader(new IsolatedStorageFileStream(prefsFilename, FileMode.Open, this.isoStore)))
{
// Decrypt the stream
string decrypted = Encryption.Decrypt(reader.ReadToEnd(), key, false);
StringReader sr = new StringReader(decrypted);
// Deserialize the settings
XmlSerializer serializer = new XmlSerializer(this.GetType());
BackupSettings settings = (BackupSettings)serializer.Deserialize(sr);
// Set properties
this.ServerUrl = settings.ServerUrl;
this.AuthenticationKey = settings.AuthenticationKey;
this.CertificateIdentity = settings.CertificateIdentity;
this.StorageAccounts = settings.StorageAccounts;
}
}
}
开发者ID:jamdrop,项目名称:TableStorageBackup,代码行数:29,代码来源:BackupSettings.cs
示例14: IsolatedStorageFileStorage
public IsolatedStorageFileStorage()
{
__IsoStorage =
IsolatedStorageFile.GetStore(IsolatedStorageScope.User | IsolatedStorageScope.Domain | IsolatedStorageScope.Assembly,
null,
null);
}
开发者ID:Se11eR,项目名称:Puckevich,代码行数:7,代码来源:IsolatedStorageFileStorage.cs
示例15: Setup
public override void Setup()
{
base.Setup ();
Device.PlatformServices = new MockPlatformServices (getStreamAsync: GetStreamAsync);
NativeStore = IsolatedStorageFile.GetUserStoreForAssembly ();
networkcalls = 0;
}
开发者ID:Costo,项目名称:Xamarin.Forms,代码行数:7,代码来源:UriImageSourceTests.cs
示例16: TextToSpeech
public TextToSpeech(DictionaryRecord r) : base()
{
FrameworkDispatcher.Update(); // initialize XNA (required)
SpeakCompleted += new EventHandler<BingTranslator.SpeakCompletedEventArgs>(TextToSpeech_SpeakCompleted);
store = IsolatedStorageFile.GetUserStoreForApplication();
record = r;
}
开发者ID:larryk78,项目名称:Kuaishuo.WindowsPhone,代码行数:7,代码来源:TextToSpeech.cs
示例17: GetAllDirectories
// Method to retrieve all directories, recursively, within a store.
public static List<String> GetAllDirectories(string pattern, IsolatedStorageFile storeFile)
{
// Get the root of the search string.
string root = Path.GetDirectoryName(pattern);
if (root != "")
{
root += "/";
}
// Retrieve directories.
List<String> directoryList = new List<String>(storeFile.GetDirectoryNames(pattern));
// Retrieve subdirectories of matches.
for (int i = 0, max = directoryList.Count; i < max; i++)
{
string directory = directoryList[i] + "/";
List<String> more = GetAllDirectories(root + directory + "*", storeFile);
// For each subdirectory found, add in the base path.
for (int j = 0; j < more.Count; j++)
{
more[j] = directory + more[j];
}
// Insert the subdirectories into the list and
// update the counter and upper bound.
directoryList.InsertRange(i + 1, more);
i += more.Count;
max += more.Count;
}
return directoryList;
}
开发者ID:NBitionDevelopment,项目名称:WindowsPhoneFeedBoard,代码行数:35,代码来源:FileHelper.cs
示例18: PodcastSubscriptionModel
/************************************* Public implementations *******************************/
public PodcastSubscriptionModel()
{
m_podcastEpisodesManager = new PodcastEpisodesManager(this);
m_isolatedFileStorage = IsolatedStorageFile.GetUserStoreForApplication();
createLogoCacheDirs();
}
开发者ID:aluetjen,项目名称:Podcatcher,代码行数:8,代码来源:PodcastSubscriptionModel.cs
示例19: Accelerometro
public Accelerometro()
{
InitializeComponent();
accelerometer = new Accelerometer();
accelerometer.TimeBetweenUpdates = TimeSpan.FromMilliseconds(100);
accelerometer.Start();
myFile = IsolatedStorageFile.GetUserStoreForApplication();
if (!myFile.FileExists("Impo.txt"))
{
IsolatedStorageFileStream dataFile = myFile.CreateFile("Impo.txt");
dataFile.Close();
}
Wb = new WebBrowser();
Connesso = false;
Carica();
System.Windows.Threading.DispatcherTimer dt = new System.Windows.Threading.DispatcherTimer();
dt.Interval = new TimeSpan(0, 0, 0, 0, 250); // 500 Milliseconds
dt.Tick += new EventHandler(dt_Tick);
dt.Start();
}
开发者ID:AndreaBruno,项目名称:Macchinino,代码行数:25,代码来源:Accelerometro.xaml.cs
示例20: CollectSubdirectoriesAndFilesBreadthFirst
/// <summary>
/// Collects the Paths of Directories and Files inside a given Directory relative to it.
/// </summary>
/// <param name="Iso">The Isolated Storage to Use</param>
/// <param name="directory">The Directory to crawl</param>
/// <param name="relativeSubDirectories">relative Paths to the subdirectories in the given directory, ordered top - down</param>
/// <param name="relativeSubFiles">relative Paths to the files in the given directory and its children, ordered top - down</param>
private static void CollectSubdirectoriesAndFilesBreadthFirst(IsolatedStorageFile Iso, string directory, out IList<string> relativeSubDirectories, out IList<string> relativeSubFiles)
{
var relativeDirs = new List<string>();
var relativeFiles = new List<string>();
var toDo = new Queue<string>();
toDo.Enqueue(string.Empty);
while (toDo.Count > 0)
{
var relativeSubDir = toDo.Dequeue();
var absoluteSubDir = Path.Combine(directory, relativeSubDir);
var queryString = string.Format("{0}\\*", absoluteSubDir);
foreach (var file in Iso.GetFileNames(queryString))
{
relativeFiles.Add(Path.Combine(relativeSubDir, file));
}
foreach (var dir in Iso.GetDirectoryNames(queryString))
{
var relativeSubSubdir = Path.Combine(relativeSubDir, dir);
toDo.Enqueue(relativeSubSubdir);
relativeDirs.Add(relativeSubSubdir);
}
}
relativeSubDirectories = relativeDirs;
relativeSubFiles = relativeFiles;
}
开发者ID:SNSB,项目名称:DiversityMobile,代码行数:37,代码来源:IsolatedStorageExtensions.cs
注:本文中的System.IO.IsolatedStorage.IsolatedStorageFile类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论