2012-09-07 52 views
0

我有一個項目,我添加一個名爲「測試」的數據文件到項目及用途:找不到數據文件IsolatedStorageFile

IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication(); 

if (!isf.FileExists("Test")) 
    return; 

imgStream = isf.OpenFile("Test", FileMode.Open, FileAccess.Read); 

BinaryReader r = new BinaryReader(imgStream); 
int count = r.ReadInt32(); 
for (int i = 0; i < count; ++i) 
{ 
    .......................... 
} 

調試時,應用程序無法找到數據文件在該項目中,!isf.FileExists("Test")返回true。爲什麼?

回答

2

FileExists確定指定的路徑是否引用隔離存儲中的現有文件。

如果您以前沒有在IsolatedStorage中創建該文件,它會告訴您該文件不存在。

添加到Visual Studio項目中的文件未放置在IsolatedStorage中。