当前位置: 首页>>代码示例>>C#>>正文


C# IsolatedStorage.IsolatedStorageFile类代码示例

本文整理汇总了C#中System.IO.IsolatedStorage.IsolatedStorageFile的典型用法代码示例。如果您正苦于以下问题:C# IsolatedStorageFile类的具体用法?C# IsolatedStorageFile怎么用?C# IsolatedStorageFile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IsolatedStorageFile类属于System.IO.IsolatedStorage命名空间,在下文中一共展示了IsolatedStorageFile类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的System.IO.IsolatedStorage.IsolatedStorageFile类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。