當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。