本文整理匯總了C#中System.IO.IsolatedStorage.IsolatedStorageFile.GetType方法的典型用法代碼示例。如果您正苦於以下問題:C# IsolatedStorageFile.GetType方法的具體用法?C# IsolatedStorageFile.GetType怎麽用?C# IsolatedStorageFile.GetType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.IO.IsolatedStorage.IsolatedStorageFile
的用法示例。
在下文中一共展示了IsolatedStorageFile.GetType方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: FileIsExpired
public static bool FileIsExpired(IsolatedStorageFile isolatedStorage, string imageFileName, int cacheDays)
{
// Very very very ugly function to determine lastwritetime of file in isolated storage
if (cacheDays == 0)
return false;
try
{
var propertyInfo = isolatedStorage.GetType().GetField("m_RootDir",
BindingFlags.NonPublic | BindingFlags.Instance);
if (propertyInfo != null)
{
var rootDir = propertyInfo.GetValue(isolatedStorage) as string;
if (rootDir != null)
{
var file = new FileInfo(rootDir + imageFileName);
if (file.Exists)
{
if (file.LastWriteTime < DateTime.Now.AddDays(-cacheDays))
return true;
}
}
}
}
catch (Exception ex)
{
Trace.WriteLine(ex.Message);
}
return false;
}
示例2: GetFullyQualifiedFileName
private static string GetFullyQualifiedFileName(string path, IsolatedStorageFile store)
{
var fieldInfo = store.GetType()
.GetField(ISOLATED_STORE_ROOT_DIR,
System.Reflection.BindingFlags.NonPublic |
System.Reflection.BindingFlags.Instance);
if (fieldInfo != null)
{
return Path.Combine(fieldInfo.GetValue(store).ToString(), path);
}
return "";
}
示例3: GetFullyQualifiedFileName
private static string GetFullyQualifiedFileName(string path, IsolatedStorageFile store)
{
return Path.Combine(store.GetType().GetField(IsolatedStorageFileSystem.IsolatedStoreRootDir, System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).GetValue(store).ToString(), path);
}
示例4: RootDirectoryGet
private static string RootDirectoryGet(IsolatedStorageFile isolatedStorage)
{
FieldInfo fi= isolatedStorage.GetType().GetField("m_RootDir",
System.Reflection.BindingFlags.Instance |
System.Reflection.BindingFlags.NonPublic |
System.Reflection.BindingFlags.Static);
string m_RootDir = fi.GetValue(isolatedStorage).ToString();
return m_RootDir;
}