当前位置: 首页>>代码示例>>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;未经允许,请勿转载。