locked
FileStream in Winrt (Windows component runtime)????

    Question


  • protected void btnDecode_Click(object sender, EventArgs e) { string base64Encode = @""; //Some Base 64 encoded encrypted text byte[] data = Convert.FromBase64String(base64Encode); using (var fileStream = new FileStream(@"C:\NDMRS\NCF-MFS\Global.zip", FileMode.Create)) { fileStream.Write(data, 0, data.Length); } }

    hi i want to use filestrem in Winrt (Windows component runtime), but getting error Filestream not found in

    System.IO. So tell me How can i do this in winrt i don't want to use Async methods(this will be my last option).

    regards,


    Tuesday, March 04, 2014 9:10 AM

All replies

  • you can't open files directly anymore. you need the FileOpenPicker or gettign files from your IsolatedStorage. FileStream class isnt existing anymore and you need to use StorageFile

    Microsoft Certified Solutions Developer - Windows Store Apps Using C#


    Tuesday, March 04, 2014 11:59 AM
  • As you can see in code, my requirement is create a file then write base64 decoded string in it then wrap in zip file. do you have any reference regarding this...

    regards,

    Tuesday, March 04, 2014 12:58 PM
  • public static async Task SavString(Uri uri)
            {
                string base64Encode = @""; //Some Base 64 encoded encrypted text
                var filepicker = new FileOpenPicker();
    
                var file = await filepicker.PickSingleFileAsync();
                using (var filestream = await file.OpenStreamForWriteAsync())
                {
                    var writer = new StreamWriter(filestream);
                    await writer.WriteLineAsync(base64Encode);
                }
            }


    Microsoft Certified Solutions Developer - Windows Store Apps Using C#

    Tuesday, March 04, 2014 1:29 PM
  • can you please tell me how can i create zip file and open it and add text file(according to your code)
    Tuesday, March 04, 2014 1:51 PM
  • hi please reply actually looking for whole code example
    Thursday, March 06, 2014 5:58 PM