本文整理汇总了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;
}