當前位置: 首頁>>代碼示例>>C#>>正文


C# IsolatedStorageFile.CreateFile方法代碼示例

本文整理匯總了C#中System.IO.IsolatedStorage.IsolatedStorageFile.CreateFile方法的典型用法代碼示例。如果您正苦於以下問題:C# IsolatedStorageFile.CreateFile方法的具體用法?C# IsolatedStorageFile.CreateFile怎麽用?C# IsolatedStorageFile.CreateFile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.IO.IsolatedStorage.IsolatedStorageFile的用法示例。


在下文中一共展示了IsolatedStorageFile.CreateFile方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: 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

示例2: IsolatedStorageFileWrapper_Tests

 public IsolatedStorageFileWrapper_Tests()
 {
     storage = IsolatedStorageFile.GetUserStoreForAssembly();
     directory = new IsolatedStorageDirectory(storage);
     using (var stream = storage.CreateFile("exists.js"))
     {
         "content".AsStream().CopyTo(stream);
         stream.Flush();
     }
 }
開發者ID:djcsdy,項目名稱:cassette,代碼行數:10,代碼來源:IsolatedStorageFileWrapper.cs

示例3: WriteTextFile

 protected static void WriteTextFile(IsolatedStorageFile isf, string path, string text)
 {
     using (var fs = isf.CreateFile(path))
     {
         using (var sw = new StreamWriter(fs))
         {
             sw.Write(text);
         }
     }
 }
開發者ID:slodge,項目名稱:main,代碼行數:10,代碼來源:BaseViewModel.cs

示例4: PrepareStartRecordToTempFile

 public string PrepareStartRecordToTempFile()
 {
     RecordLevel = 0;
     useTempFile = true;
     isf = IsolatedStorageFile.GetUserStoreForApplication();
     tempFileKey = Guid.NewGuid().ToString() + ".tmp";
     tempFileStream = isf.CreateFile(tempFileKey);
     _sampleDuration = TimeSpan.FromSeconds(0);
     FrameworkDispatcher.Update();
     //_dispatcherTimer.Start();
     return tempFileKey;
 }
開發者ID:sandcu,項目名稱:wpaudio,代碼行數:12,代碼來源:RecordHelper.cs

示例5: MainPage

        public MainPage()
        {
            InitializeComponent();

            myFile = IsolatedStorageFile.GetUserStoreForApplication();

            if (!myFile.FileExists("Impo.txt"))
            {
                IsolatedStorageFileStream dataFile = myFile.CreateFile("Impo.txt");
                dataFile.Close();
            }
        }
開發者ID:AndreaBruno,項目名稱:Macchinino,代碼行數:12,代碼來源:MainPage.xaml.cs

示例6: SaveDetails

 private void SaveDetails(IsolatedStorageFile store)
 {
     using (var fs = store.CreateFile(InfoPath))
         SaveDetails(fs);
 }
開發者ID:gkardava,項目名稱:WinPass,代碼行數:5,代碼來源:DatabaseInfo.cs

示例7: Save

        /// <summary>
        /// Saves user password.
        /// </summary>
        /// <param name="store">The store.</param>
        /// <param name="xml">The XML.</param>
        private async void Save(IsolatedStorageFile store,
            DbPersistentData xml)
        {
            if (!store.DirectoryExists(Folder))
                store.CreateDirectory(Folder);

            using (var fs = store.CreateFile(ProtectionPath))
            {
                var protect = xml.Protection;
                fs.Write(protect, 0, protect.Length);
            }
            using (var fs = store.CreateFile(ParsedXmlPath))
            using (var buffer = new MemoryStream(xml.Xml))
                BufferEx.CopyStream(buffer, fs);

            using (var fs = store.CreateFile(MasterPasswordPath))
            {
                var data = xml.MasterKey;
                await fs.WriteAsync(data, 0, data.Length);

            }
        }
開發者ID:gkardava,項目名稱:WinPass,代碼行數:27,代碼來源:DatabaseInfo.cs

示例8: Store

        public override void Store( string url, BitmapSource bitmap )
        {
            Deployment.Current.Dispatcher.BeginInvoke( () => {
                string fileName = GetFilePath( GetFileName( url ) );
                using ( _storage = IsolatedStorageFile.GetUserStoreForApplication() ) {
                    if ( _storage.FileExists( fileName ) ) {
                        _storage.DeleteFile( fileName );
                    }

                    using ( IsolatedStorageFileStream fileStream = _storage.CreateFile( fileName ) ) {
                        WriteableBitmap writeableBitmap = new WriteableBitmap( bitmap );
                        writeableBitmap.SaveJpeg( fileStream, writeableBitmap.PixelWidth, writeableBitmap.PixelHeight, 0, IMAGE_QUALITY );
                    }
                }
            } );
        }
開發者ID:arakuma,項目名稱:wp_imagetool,代碼行數:16,代碼來源:FsBitmapCache.cs

示例9: SaveMultimedia

        private async Task SaveMultimedia(IsolatedStorageFile isoStore, string snapshotDir, IProgress<Tuple<BackupStage, int>> Progress) {
            Progress.Report(Tuple.Create(BackupStage.ExternalData, 0));

            var snapshotMultimediaDir = Path.Combine(snapshotDir, MultimediaStorageService.MEDIA_FOLDER);
            var snapshotDBPath = Path.Combine(snapshotDir, DiversityDataContext.DB_FILENAME);

            using (var db = new DiversityDataContext(snapshotDBPath)) {
                var totalCount = db.MultimediaObjects.Count();

                if (totalCount > 0) {
                    var reporter = new PercentageReporter<Tuple<BackupStage, int>>(
                        Progress,
                        p => Tuple.Create(BackupStage.ExternalData, p),
                        totalCount);

                    foreach (var mm in db.MultimediaObjects) {
                        var descriptor = StorageDescriptor.FromURI(mm.Uri);
                        if (descriptor.Type == StorageType.CameraRoll) {
                            using (var content = ImageStore.GetMultimedia(mm.Uri)) {
                                var mmFilePath = Path.Combine(snapshotMultimediaDir, descriptor.FileName);
                                using (var targetFile = isoStore.CreateFile(mmFilePath)) {
                                    await content.CopyToAsync(targetFile);

                                    descriptor.Type = StorageType.IsolatedStorage;
                                    mm.Uri = descriptor.ToString();
                                }
                            }
                        }
                        reporter.Completed++;
                    }

                    db.SubmitChanges();
                }
            }
        }
開發者ID:rollingthunder,項目名稱:DiversityMobile,代碼行數:35,代碼來源:BackupService.cs

示例10: SaveCompletedTimeStamp

        private static void SaveCompletedTimeStamp(string snapshotDir, IsolatedStorageFile isoStore) {
            var completedMarkerPath = Path.Combine(snapshotDir, COMPLETED_MARKER);
            using (var completedFile = isoStore.CreateFile(completedMarkerPath))
            using (var writer = new StreamWriter(completedFile)) {
                var universalNow = DateTime.Now.ToUniversalTime();
                var invariantNowString = universalNow.ToString(CultureInfo.InvariantCulture);
                writer.WriteLine(invariantNowString);

                writer.Flush();
            }
        }
開發者ID:rollingthunder,項目名稱:DiversityMobile,代碼行數:11,代碼來源:BackupService.cs

示例11: WriteFileToFile

 private static void WriteFileToFile(File file, IsolatedStorageFile istorage, string newFilePath)
 {
     using (var newFile = istorage.CreateFile(newFilePath))
     {
         using (var newWriteableFile = new StreamWriter(newFile, Encoding.Unicode))
         {
             newWriteableFile.Write(file.Content);
             newWriteableFile.Flush();
         }
     }
 }
開發者ID:halllo,項目名稱:SilverlightRun,代碼行數:11,代碼來源:IsolatedFiles.cs

示例12: ImportOrMakeSoundsCache

		private void ImportOrMakeSoundsCache(IsolatedStorageFile isf)
		{
			_soundFiles = new Dictionary<int, string>();

			foreach (var sound in Cartridge.Resources.Where(m => m.Type == MediaType.MP3 || m.Type == MediaType.WAV))
			{
				// Copies the sound file to the cache if it doesn't exist already.
				string cacheFilename = GetCachePathCore(sound);
				if (!isf.FileExists(cacheFilename))
				{
					using (IsolatedStorageFileStream fs = isf.CreateFile(cacheFilename))
					{
						fs.Write(sound.Data, 0, sound.Data.Length);
					}
				}

				// Adds the sound filename to the dictionary.
				_soundFiles.Add(sound.MediaId, cacheFilename);
			}

			RaisePropertyChanged("Sounds");
		}
開發者ID:kamaelyoung,項目名稱:WF.Player.WinPhone,代碼行數:22,代碼來源:CartridgeTag.cs

示例13: ExtractFile

 private static void ExtractFile(IsolatedStorageFile store, string baseFileName)
 {
     if (!store.FileExists(baseFileName))
     {
         using (Stream sourceStream = Application.GetResourceStream(new Uri("Data/" + baseFileName, UriKind.Relative)).Stream)
         {
             using (IsolatedStorageFileStream targetStream = store.CreateFile(baseFileName))
             {
                 byte[] buffer = new byte[1024];
                 int length;
                 while ((length = sourceStream.Read(buffer, 0, 1024)) > 0)
                     targetStream.Write(buffer, 0, length);
                 targetStream.Close();
             }
             sourceStream.Close();
         }
     }
 }
開發者ID:michaellperry,項目名稱:MyCon,代碼行數:18,代碼來源:SynchronizationService.cs

示例14: WriteToIsolatedStorage

 private static void WriteToIsolatedStorage(IsolatedStorageFile storage, System.IO.Stream inputStream, string fileName)
 {
     IsolatedStorageFileStream outputStream = null;
     try
     {
         if (!storage.DirectoryExists(imageStorageFolder))
         {
             storage.CreateDirectory(imageStorageFolder);
         }
         if (storage.FileExists(fileName))
         {
             storage.DeleteFile(fileName);
         }
         outputStream = storage.CreateFile(fileName);
         byte[] buffer = new byte[32768];
         int read;
         while ((read = inputStream.Read(buffer, 0, buffer.Length)) > 0)
         {
             outputStream.Write(buffer, 0, read);
         }
         outputStream.Dispose();
     }
     catch
     {
         //We cannot do anything here.
         outputStream?.Dispose();
     }
 }
開發者ID:Korshunoved,項目名稱:Win10reader,代碼行數:28,代碼來源:CacheImageFileConverter.cs

示例15: SaveDetails

        private void SaveDetails(IsolatedStorageFile store)
        {
            using (var fs = store.CreateFile(InfoPath))
            {
                var writer = new StreamWriter(fs);
                var serializer = new JsonSerializer();
                serializer.Serialize(writer, Details);

                writer.Flush();
            }
        }
開發者ID:MarioBinder,項目名稱:7Pass,代碼行數:11,代碼來源:DatabaseInfo.cs


注:本文中的System.IO.IsolatedStorage.IsolatedStorageFile.CreateFile方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。