MCTS Programming

www.SarafMoghadam.Com

MCTS Programming

www.SarafMoghadam.Com

استفاده از فضای امن IsolatedStorage برای ذخیره اطلاعات

IsolatedStorage یک فایل خصوصی سیستمی است که توسط دات نت مدیریت می شود.
Imports System.IO
Imports System.IO.IsolatedStorage


برای ساختن یک فایل IsolatedStorage

Dim IsoStore As IsolatedStorageFile = IsolatedStorageFile.GetUserStoreForAssembly
Dim IsoFile As IsolatedStorageFileStream = New IsolatedStorageFileStream("mytextfile.txt", FileMode.Create, IsoStore)
Dim sw As New StreamWriter(IsoFile)
sw.WriteLine("my computer name is: " & My.Computer.Name)
sw.Close()


برای خواندن از یک فایل IsolatedStorage
Dim IsoStorage As IsolatedStorageFile = IsolatedStorageFile.GetUserStoreForAssembly
Dim IsoFile As IsolatedStorageFileStream = New IsolatedStorageFileStream("mytextfile.txt", FileMode.Open, IsoStorage)
Dim sr As New StreamReader(IsoFile)
MsgBox(sr.ReadToEnd.ToString)
sr.Close()

نظرات 0 + ارسال نظر
برای نمایش آواتار خود در این وبلاگ در سایت Gravatar.com ثبت نام کنید. (راهنما)
ایمیل شما بعد از ثبت نمایش داده نخواهد شد