2011-07-22 38 views

回答

2

你可以決定你的獨立存儲中的可用空間是這樣的:

using System; 
using System.IO; 
using System.IO.IsolatedStorage; 

public class CheckingSpace 
{ 
    public static void Main() 
    { 
     // Get an isolated store for this assembly and put it into an 
     // IsolatedStoreFile object. 
     IsolatedStorageFile isoStore = IsolatedStorageFile.GetStore(IsolatedStorageScope.User | 
      IsolatedStorageScope.Assembly, null, null); 

     // Create a few placeholder files in the isolated store. 
     new IsolatedStorageFileStream("InTheRoot.txt", FileMode.Create, isoStore); 
     new IsolatedStorageFileStream("Another.txt", FileMode.Create, isoStore); 
     new IsolatedStorageFileStream("AThird.txt", FileMode.Create, isoStore); 
     new IsolatedStorageFileStream("AFourth.txt", FileMode.Create, isoStore); 
     new IsolatedStorageFileStream("AFifth.txt", FileMode.Create, isoStore); 

     Console.WriteLine(isoStore.AvailableFreeSpace + " bytes of space remain in this isolated store."); 
    } // End of Main. 
} 
+0

看起來像AvailableFreeSpace屬性是.nEt FrameWork 4.0功能cuz它沒有顯示在我的控制檯基於.net 3.5 .. – Anirudha

+0

在以前的版本中使用: long spaceLeft =(long)(isoStore.MaximumSize - isoStore.CurrentSize) ; –

+0

嗨,Thaxx Brian Knight 它提供了一個非常大的數字..孤立的存儲真的有一個應用程序的這麼大的空間.... – Anirudha

0

IsoltaedStorage有一個屬性AvailableFreeSpace

msdn link

+0

@downvoter:爲什麼這downvote?接受的代碼確切地說明了我在說什麼。 – Tigran

0

有兩個答案談論多少空間。或者,你可能會問the location而變動的基於OS:

下表顯示了上一些常見的操作系統創建的獨立存儲根位置。尋找微軟\ IsolatedStorage目錄這根位置

如果它沒有這些(可用空間,位置)之下,那麼你需要編輯你的問題,讓你在尋找更清楚什麼樣的信息。

+0

嘿,其實我想知道爲在Windows XP上運行的特定應用程序提供的總空間... – Anirudha