public Write ( byte buffer, int offset, int count ) : void | ||
buffer | byte | |
offset | int | |
count | int | |
return | void |
void wc_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e) { if (e.Error == null && !e.Cancelled) { string iconPath = "1.txt"; using (var isf = IsolatedStorageFile.GetUserStoreForApplication()) { var isfs = new IsolatedStorageFileStream(iconPath, FileMode.Create, isf); int bytesRead; byte[] bytes = new byte[e.Result.Length]; while ((bytesRead = e.Result.Read(bytes, 0, bytes.Length)) != 0) { isfs.Write(bytes, 0, bytesRead); } isfs.Flush(); isfs.Close(); } this.Dispatcher.BeginInvoke(() => { NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative)); }); } }
private void button1_Click(object sender, RoutedEventArgs e) { OpenFileDialog nekaj = new OpenFileDialog(); bool? nekaj2 = nekaj.ShowDialog(); if (nekaj2 == true) { using (FileStream fs = nekaj.File.OpenRead()) { byte[] buffer = new byte[(int)fs.Length]; fs.Read(buffer, 0, (int)fs.Length); char[] niz = new char[buffer.Length]; for (int i = 0; i < buffer.Length; i++) niz[i] = (char)buffer[i]; IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication(); IsolatedStorageFileStream tok = new IsolatedStorageFileStream("test.txt", FileMode.Create, isf); tok.Write(buffer, 0, buffer.Length); tok.Close(); } } else MessageBox.Show("Preklicano"); }
private void RestoreFromFile(Stream file) { // // using (var store = IsolatedStorageFile.GetUserStoreForApplication()) { using (var zip = new ZipInputStream(file)) { try { while (true) { var ze = zip.GetNextEntry(); if (ze == null) break; using (var f = new IsolatedStorageFileStream(ze.Name, FileMode.Create, store)) { var fs = new byte[ze.Size]; zip.Read(fs, 0, fs.Length); f.Write(fs, 0, fs.Length); } } } catch { lblLastBackup.Text = StringResources.BackupAndRestorePage_Messages_RestoreFailed; App.ToastMe(StringResources.BackupAndRestorePage_Messages_RestoreFailed); return; } finally { file.Close(); ClearOldBackupFiles(); App.ViewModel.IsRvDataChanged = true; } } } lblLastBackup.Text = StringResources.BackupAndRestorePage_Messages_RestoreSuccess; App.ToastMe(StringResources.BackupAndRestorePage_Messages_RestoreSuccess); }
public static void SaveFile (string fileName) { fileName += ".wav"; // first, we grab the current apps isolated storage handle var storage = IsolatedStorageFile.GetUserStoreForApplication (); // if that file exists... if (storage.FileExists (fileName)) { // then delete it storage.DeleteFile (fileName); } // now we set up an isolated storage stream to point to store our data var stream = new IsolatedStorageFileStream (fileName, FileMode.Create, IsolatedStorageFile.GetUserStoreForApplication ()); var streamArray = Utilities.MemoryStream.ToArray (); stream.Write (streamArray, 0, streamArray.Length); // ok, done with isolated storage... so close it stream.Close (); Utilities.MemoryStream = null; }
public static void WriteAllText(string fileName, string content) { var data = Encoding.UTF8.GetBytes(content); using (var folder = IsolatedStorageFile.GetUserStoreForApplication()) { using (var stream = new IsolatedStorageFileStream(fileName, FileMode.Create, FileAccess.Write, folder)) stream.Write(data, 0, data.Length); } }
/// <summary> /// Create a file in IsolatedStorage. /// </summary> /// <param name="data">The data you want to write, expressed as a byte array.</param> /// <param name="filepath">The path of the file you want to write.</param> /// <param name="storage">A reference to a valid IsolatedStorageFile instance.</param> public static void MakeFile(byte[] data, string filepath, IsolatedStorageFile storage) { CreateDirectoryTree(filepath, storage); using (var filestream = new IsolatedStorageFileStream(filepath, FileMode.Create, FileAccess.Write, storage)) { filestream.Write(data, 0, data.Count()); } }
public static void WriteStream(Stream stream, System.IO.IsolatedStorage.IsolatedStorageFileStream fileStream) { byte[] buffer = new byte[4096]; int bytesRead; while ((bytesRead = stream.Read(buffer, 0, buffer.Length)) != 0) { fileStream.Write(buffer, 0, bytesRead); } }
/// <summary> /// Writes byte data to an isolated storage file. /// </summary> /// <param name="data">The bytes to write to the file.</param> /// <param name="path">Path to the file.</param> public static void WriteToIsolatedStorage(byte[] data, string path) { // Create a file in the application's isolated storage. using (IsolatedStorageFile file = IsolatedStorageFile.GetUserStoreForApplication()) { using (IsolatedStorageFileStream writestream = new IsolatedStorageFileStream(path, FileMode.Create, FileAccess.Write, file)) { writestream.Write(data, 0, data.Length); } } }
public static void SaveToIsolatedStorage(string key, string value) { using (IsolatedStorageFile isf = IsolatedStorageFile.GetStore(IsolatedStorageScope.User | IsolatedStorageScope.Assembly | IsolatedStorageScope.Domain, typeof(System.Security.Policy.Url), typeof(System.Security.Policy.Url))) { using (IsolatedStorageFileStream isfs = new IsolatedStorageFileStream(key + ".txt", FileMode.Create, isf)) { byte[] data = System.Text.Encoding.UTF8.GetBytes(value); isfs.Write(data, 0, data.Length); } } }
public static void SerializeObject(string filename, object obj) { //Stream stream = File.Open(filename, FileMode.Create); IsolatedStorageFile isof = IsolatedStorageFile.GetUserStoreForApplication(); IsolatedStorageFileStream isfs = new IsolatedStorageFileStream(filename, FileMode.Create, isof); byte[] b = BusinessLib.SilverlightSerializer.Serialize(obj); isfs.Write(b, 0, b.Length); isfs.Flush(); isfs.Close(); isof.Dispose(); }
public void Save() { using (IsolatedStorageFileStream fs = container.CreateFile(LocalSettings)) { // note: SL seems to prepend a line with a fully qualified name for System.Object + CRLF byte[] header = System.Text.Encoding.UTF8.GetBytes(typeof(object).AssemblyQualifiedName); fs.Write(header, 0, header.Length); fs.WriteByte(13); fs.WriteByte(10); // and does not seems to need it when reading back... DataContractSerializer ser = new DataContractSerializer(settings.GetType()); ser.WriteObject(fs, settings); } }
public static bool WriteFile(string filename,string data) { bool success = false; using (IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication()) { IsolatedStorageFileStream filestream = new IsolatedStorageFileStream(filename, System.IO.FileMode.Create, isf); byte[] buffer = Encoding.UTF8.GetBytes(data); filestream.Write(buffer, 0, buffer.Length); filestream.Close(); success = true; } return success; }
/// <summary> /// Copy file from the XAP to the isolated storage /// </summary> /// <param name="sourceFileName"></param> /// <param name="destinationFileName"></param> public static void CopyFileFromXAP(string sourceFileName, string destinationFileName) { //TODO: 10/8 Handle Errors IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication(); if (!isf.FileExists(destinationFileName)) { BinaryReader fileReader = new BinaryReader(Application.GetResourceStream(new Uri(sourceFileName, UriKind.Relative)).Stream); //Increase Isolated Storage Quota If needed bool checkQuotaIncrease = FilesManager.CanIsolatedStorageSpaceSizeIncrease(fileReader.BaseStream.Length); IsolatedStorageFileStream outFile = new IsolatedStorageFileStream(destinationFileName, FileMode.Create, isf); bool eof = false; long fileLength = fileReader.BaseStream.Length; int writeLength = 512; while (!eof) { if (fileLength < 512) { writeLength = Convert.ToInt32(fileLength); outFile.Write(fileReader.ReadBytes(writeLength), 0, writeLength); } else { outFile.Write(fileReader.ReadBytes(writeLength), 0, writeLength); } fileLength = fileLength - 512; if (fileLength <= 0) eof = true; } fileReader.Close(); outFile.Close(); } }
public void CacheImage(string imageFileName, Stream imageStream) { using (var output = new IsolatedStorageFileStream(imageFileName, FileMode.Create, GetIsolatedStorageFile())) { var buffer = new byte[1024]; int read; if (imageStream != null) while ((read = imageStream.Read(buffer, 0, buffer.Length)) > 0) { output.Write(buffer, 0, read); } } }
public static void WriteFeedToIsolatedStorage(string feedxml, Uri feedUri) { using(var storage = IsolatedStorageFile.GetUserStoreForApplication()) { CreateDirectoryTree(feedUri, storage); using(var filestream = new IsolatedStorageFileStream(feedUri.OriginalString, FileMode.Create, FileAccess.Write, storage)) { var data = Encoding.UTF8.GetBytes(feedxml); filestream.Write(data, 0, data.Count()); } } }
public async Task DisposeAsync_FlushesAndCloses(PresetScopes scope) { TestHelper.WipeStores(); using (IsolatedStorageFile isf = GetPresetScope(scope)) { IsolatedStorageFileStream isfs = isf.CreateFile("DisposeAsyncFile"); isfs.Write(new byte[100], 0, 100); await isfs.DisposeAsync(); using (isfs = isf.OpenFile("DisposeAsyncFile", FileMode.Open)) { Assert.Equal(100, isfs.Length); } } }
/// <summary> /// Initializes a new instance of the <see cref="MainViewModel" /> class. /// </summary> public MainViewModel() { IsRvDataChanged = true; lbRvItems = new ObservableCollection<ReturnVisitSummaryModel>(); lbMainMenuItems = new ObservableCollection<MainMenuModel>(); RvSearchBoxSuggestionsSource = new ObservableCollection<ReturnVisitSummaryModel>(); RvSearchBoxLoaded = false; if (!IsolatedStorageFile.GetUserStoreForApplication().FileExists("mainpage.xml")) { using (IsolatedStorageFile iso = IsolatedStorageFile.GetUserStoreForApplication()) { using (var file = new IsolatedStorageFileStream("mainpage.xml", FileMode.CreateNew, iso)) { byte[] b = Encoding.UTF8.GetBytes("<?xml version=\"1.0\" encoding=\"utf-8\" ?><items><magazines>0</magazines><brochures>0</brochures><books>0</books><rvs>0</rvs><bs>0</bs><tracts>0</tracts><notes> </notes></items>"); file.Write(b, 0, b.Length); } } } }
public static Uri StrToHTML(string input) { using (IsolatedStorageFile file = IsolatedStorageFile.GetUserStoreForApplication()) { if (!file.DirectoryExists("temp")) file.CreateDirectory("temp"); using (IsolatedStorageFileStream fs = new IsolatedStorageFileStream("temp\\review.html", System.IO.FileMode.Create, file)) { string html = "<!DOCTYPE html><html lang='zh-CN'><head><meta http-equiv='Content-Type' content='text/html; charset=utf-8'><meta name='viewport' content='width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0' /></head><body>"; html += input; html += "</body></html>"; byte[] bytes = Encoding.UTF8.GetBytes(html); fs.Write(bytes, 0, bytes.Length); } } return new Uri("temp\\review.html", UriKind.Relative); }
public static void CopyFromContentToStorage(String sourceFile, String destinationFile) { IsolatedStorageFile isolatedStorageFile = IsolatedStorageFile.GetUserStoreForApplication(); using (Stream inputStream = Application.GetResourceStream(new Uri(sourceFile, UriKind.Relative)).Stream) { using (IsolatedStorageFileStream outStream = new IsolatedStorageFileStream(destinationFile, FileMode.Create, FileAccess.Write, isolatedStorageFile)) { Byte[] Buffer = new Byte[5120]; Int32 ReadCount = inputStream.Read(Buffer, 0, Buffer.Length); while (ReadCount > 0) { outStream.Write(Buffer, 0, ReadCount); ReadCount = inputStream.Read(Buffer, 0, Buffer.Length); } } } }
private void SaveSomething() { Task.Factory.StartNew(() => { IsolatedStorageFile isoStore = IsolatedStorageFile.GetUserStoreForApplication(); //for (int i = 0; i < 20; i++) //{ IsolatedStorageFileStream isoStream = new IsolatedStorageFileStream(Guid.NewGuid().ToString() + ".dat", System.IO.FileMode.Create, isoStore); isoStream.Write(new byte[1024 * 1024 * 20], 0, 1024 * 1024 * 20); isoStream.Close(); Debug.WriteLine("正在写入文件"); // } // long availableSpace = isoStore.AvailableFreeSpace; // long quota = isoStore.Quota; isoStore.Dispose(); }); }
public void Store(string key, byte[] dataBytes) { var mutex = new Mutex(false, key); try { mutex.WaitOne(); using (var stream = new IsolatedStorageFileStream(key, FileMode.Create, FileAccess.Write, File)) { var data = ProtectedData.Protect(dataBytes, this.optionalEntropy); stream.Write(data, 0, data.Length); } } finally { mutex.ReleaseMutex(); } }
private void saveimage() { WriteableBitmap wBitmap = new WriteableBitmap(statistics, null); using (MemoryStream stream = new MemoryStream()) { wBitmap.SaveJpeg(stream, (int)statistics.ActualWidth, (int)statistics.ActualHeight, 0, 100); wBitmap = null; //Use can either save the file to isolated storage or media library. //Creates file in Isolated Storage. using (var local = new IsolatedStorageFileStream("/Statistics", FileMode.Create, IsolatedStorageFile.GetUserStoreForApplication())) { local.Write(stream.GetBuffer(), 0, stream.GetBuffer().Length); } //Creates file in Media Library. var lib = new MediaLibrary(); var picture = lib.SavePicture("Statistics", stream.GetBuffer()); } }
private void button3_Click(object sender, RoutedEventArgs e) { test = 3; StreamResourceInfo input = Application.GetResourceStream(new Uri("/Test;component/test.lzma", UriKind.Relative)); using (IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication()) { IsolatedStorageFileStream output = new IsolatedStorageFileStream("test.lzma", FileMode.Create, store); int size = 65536; byte[] data = new byte[size]; while ((size = input.Stream.Read(data, 0, data.Length)) > 0) { output.Write(data, 0, size); } output.Close(); } IsolatedStorageDecoder d = new IsolatedStorageDecoder(); d.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(d_ProgressChanged); d.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(d_RunWorkerCompleted); d.DecodeAsync("test.lzma", "test3.out"); }
public static void MoveIntialDB() { IsolatedStorageFile isostore = IsolatedStorageFile.GetUserStoreForApplication(); if (!isostore.FileExists("catappdb.sdf")) { StreamResourceInfo sri = App.GetResourceStream(new Uri("catappdb.sdf", UriKind.Relative)); IsolatedStorageFileStream isfs = new IsolatedStorageFileStream("catappdb.sdf", FileMode.Create, IsolatedStorageFile.GetUserStoreForApplication()); long FileLength = (long)sri.Stream.Length; byte[] byteInput = new byte[FileLength]; sri.Stream.Read(byteInput, 0, byteInput.Length); isfs.Write(byteInput, 0, byteInput.Length); sri.Stream.Close(); isfs.Close(); } }
private void decode(object sender, RoutedEventArgs e) { IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication(); LibmadWrapper Libmad = new LibmadWrapper(); IBuffer buffer = WindowsRuntimeBufferExtensions.AsBuffer(Mp3bytes, 0, Mp3bytes.Length); PCMStream = isf.CreateFile("decoded_pcm.pcm"); bool init = Libmad.DecodeMp32Pcm_Init(buffer); if (init) { List<short> samples = new List<short>(); RawPCMContent rpcc = null; try { while ((rpcc = Libmad.ReadSample()).count != 0) { short[] shortBytes = rpcc.PCMData.ToArray<short>(); byte[] rawbytes = new byte[shortBytes.Length * 2]; for (int i = 0; i < shortBytes.Length; i++) { rawbytes[2 * i] = (byte)shortBytes[i]; rawbytes[2 * i + 1] = (byte)(shortBytes[i] >> 8); } PCMStream.Write(rawbytes, 0, rawbytes.Length); } PCMStream.Flush(); PCMStream.Close(); PCMStream.Dispose(); MessageBox.Show("over"); Libmad.CloseFile(); } catch (Exception exception) { MessageBox.Show(exception.Message); } } isf.Dispose(); }
private void btnCopyToIso_Click(object sender, RoutedEventArgs e) { OpenFileDialog dlg = new OpenFileDialog { Filter = "All files (*.*)|*.*", Multiselect = true }; var dlgResult = dlg.ShowDialog(); if (dlgResult != null && dlgResult.Value) { IsolatedStorageFile iso = IsolatedStorageFile.GetUserStoreForApplication(); foreach (FileInfo file in dlg.Files) { using (Stream fileStream = file.OpenRead()) { using (IsolatedStorageFileStream isoStream = new IsolatedStorageFileStream(file.Name, FileMode.Create, iso)) { // Read and write the data block by block until finish while (true) { byte[] buffer = new byte[100001]; int count = fileStream.Read(buffer, 0, buffer.Length); if (count > 0) { isoStream.Write(buffer, 0, count); } else { break; } } } } } ShowManipulationResult("Successfully copied the selected file(s) to Isolated file storage.."); } else { MessageBox.Show("You canceled file selection."); } }
public ImageSource GetThumbnail(string host, string path) { string thumbName = Path.GetFileName(path); if (store.GetFileNames(thumbName).Length == 0) { using (var stream = new IsolatedStorageFileStream(thumbName, FileMode.CreateNew, store)) { byte[] data = GetThumbnail(path); stream.Write(data, 0, data.Length); } } using (var stream = new IsolatedStorageFileStream(thumbName, FileMode.Open, store)) { var image = new BitmapImage(); image.BeginInit(); image.CacheOption = BitmapCacheOption.OnLoad; image.StreamSource = stream; image.EndInit(); image.Freeze(); return image; } }
/// <summary>Saves data written to the current <see cref="T:System.IO.IsolatedStorage.IsolatedStorageSettings" /> object.</summary> /// <exception cref="T:System.IO.IsolatedStorage.IsolatedStorageException">The <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFile" /> does not have enough available free space.</exception> public void Save() { using (IsolatedStorageFileStream stream = this._appStore.OpenFile("__LocalSettings", FileMode.OpenOrCreate)) { using (MemoryStream stream2 = new MemoryStream()) { Dictionary <Type, bool> dictionary = new Dictionary <Type, bool>(); StringBuilder builder = new StringBuilder(); foreach (object obj2 in this._settings.Values) { if (obj2 != null) { Type type = obj2.GetType(); if (!type.IsPrimitive && (type != typeof(string))) { dictionary[type] = true; if (builder.Length > 0) { builder.Append('\0'); } builder.Append(type.AssemblyQualifiedName); } } } builder.Append(Environment.NewLine); byte[] bytes = Encoding.UTF8.GetBytes(builder.ToString()); stream2.Write(bytes, 0, bytes.Length); new DataContractSerializer(typeof(Dictionary <string, object>), dictionary.Keys).WriteObject(stream2, this._settings); if (stream2.Length > (this._appStore.AvailableFreeSpace + stream.Length)) { throw new IsolatedStorageException("Not enough space in isolated storage."); } stream.SetLength(0L); byte[] buffer = stream2.ToArray(); stream.Write(buffer, 0, buffer.Length); } } }
void PhotoChooseCall(object sender, PhotoResult e) { switch (e.TaskResult) { case TaskResult.OK: BinaryReader objReader = new BinaryReader(e.ChosenPhoto); image1.Source = new BitmapImage(new Uri(e.OriginalFileName)); // New code var contents = new byte[1024]; using (var store = IsolatedStorageFile.GetUserStoreForApplication()) { using (var local = new IsolatedStorageFileStream("image.jpg", FileMode.OpenOrCreate, store)) { int bytes; while ((bytes = e.ChosenPhoto.Read(contents, 0, contents.Length)) > 0) { local.Write(contents, 0, bytes); } } } break; // BitmapImage bi = new BitmapImage(); // bi.SetSource(e.ChosenPhoto); // Uri uri = new Uri(e.OriginalFileName); // image2 = e.OriginalFileName; // Debug.WriteLine(image2); // break; case TaskResult.Cancel: MessageBox.Show("Cancelled"); break; case TaskResult.None: MessageBox.Show("Nothing Entered"); break; } }
public async Task SaveImageAsync(Stream stream, string path) { CreateDirectoryIfNotExist(path); int count; var buffer = new byte[1024]; var isDone = false; count = await stream.ReadAsync(buffer, 0, buffer.Length); if (count == 0) return; using (var isfs = new IsolatedStorageFileStream(path, FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite, isolatedStorage)) { while (!isDone) { isfs.Write(buffer, 0, count); count = await stream.ReadAsync(buffer, 0, buffer.Length); if (count <= 0) isDone = true; } } }
public static void GetImageFromGravatar(string imageFileName, string email, int authorImageSize, IsolatedStorageFile isolatedStorage) { try { var baseUrl = String.Concat("http://www.gravatar.com/avatar/{0}?d=identicon&s=", authorImageSize, "&r=g"); //hash the email address var emailHash = MD5.CalcMD5(email.ToLower()); //format our url to the Gravatar var imageUrl = String.Format(baseUrl, emailHash); var webClient = new WebClient {Proxy = WebRequest.DefaultWebProxy}; webClient.Proxy.Credentials = CredentialCache.DefaultCredentials; var imageStream = webClient.OpenRead(imageUrl); using (var output = new IsolatedStorageFileStream(imageFileName, FileMode.Create, isolatedStorage)) { var buffer = new byte[1024]; int read; if (imageStream != null) while ((read = imageStream.Read(buffer, 0, buffer.Length)) > 0) { output.Write(buffer, 0, read); } } } catch (Exception ex) { //catch IO errors Trace.WriteLine(ex.Message); } }
/// <summary> /// 保存信息至本地文件,SilverLight缓存中 /// </summary> /// <param name="rFileName"></param> /// <param name="buffer"></param> public static void WriteSlByteFile(string rFileName, byte[] buffer) { System.IO.IsolatedStorage.IsolatedStorageFile isf = null; System.IO.Stream stream = null; try { isf = System.IO.IsolatedStorage.IsolatedStorageFile.GetUserStoreForApplication(); if (rFileName.IndexOf(':') >= 0) { rFileName = rFileName.Substring(rFileName.LastIndexOf(':') + 1); } ClearSlFile(rFileName); string rPath = System.IO.Path.GetDirectoryName(rFileName); if (rPath != "") { isf.CreateDirectory(rPath); } stream = new System.IO.IsolatedStorage.IsolatedStorageFileStream(rFileName, System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.Write, System.IO.FileShare.Write, isf); stream.Write(buffer, 0, buffer.Length); stream.Flush(); } finally { try { stream.Close(); // Close the stream too stream.Dispose(); isf.Dispose(); } catch { } } }
private static void MoveToIsolatedStorage(string path) { var store = IsolatedStorageFile.GetUserStoreForApplication(); if (store.GetFileNames(path).Length != 0) { return; } using (var target = new IsolatedStorageFileStream(path, FileMode.Create, store)) { path = string.Format("Demo.WindowsPhone.{0}", path); using(var source = Assembly.GetExecutingAssembly().GetManifestResourceStream(path)) { if (source != null) { var content = new byte[source.Length]; source.Read(content, 0, content.Length); target.Write(content, 0, content.Length); } } } }
public void Push(CrawlerQueueEntry crawlerQueueEntry) { AspectF.Define. NotNull(crawlerQueueEntry, "crawlerQueueEntry"). WriteLock(m_QueueLock). Do(() => { byte[] data = crawlerQueueEntry.ToBinary(); string path = Path.Combine(WorkFolderPath, Guid.NewGuid().ToString()); using (IsolatedStorageFileStream isoFile = new IsolatedStorageFileStream(path, FileMode.Create, m_Store)) { isoFile.Write(data, 0, data.Length); } }); Interlocked.Increment(ref m_Count); }
private void CopyStream(Stream Input, IsolatedStorageFileStream Output) { Byte[] Buffer = new Byte[5120]; Int32 ReadCount = Input.Read(Buffer, 0, Buffer.Length); while (ReadCount > 0) { Output.Write(Buffer, 0, ReadCount); ReadCount = Input.Read(Buffer, 0, Buffer.Length); } }
public static void WriteAllText(this IsolatedStorageFileStream stream, string content) { byte[] buffer = Encoding.UTF8.GetBytes(content); stream.Write(buffer, offset: 0, count: buffer.Length); }