private void GetEnumerator (IsolatedStorageScope scope) { IEnumerator e = IsolatedStorageFile.GetEnumerator (scope); int n = 0; while (e.MoveNext ()) { IsolatedStorageFile isf = (IsolatedStorageFile)e.Current; CheckEnumerated (++n, scope, isf); } }
private static void List() { IEnumerator e = IsolatedStorageFile.GetEnumerator(s_Scope); IsolatedStorageFile isf; IsolatedStorageScope scope; int i = 0; while (e.MoveNext()) { ++i; isf = (IsolatedStorageFile)e.Current; try { scope = isf.Scope; Print(s_resmgr.GetString("Record_Number")); Print(i.ToString(CultureInfo.InvariantCulture)); Print(Environment.NewLine); if ((scope & IsolatedStorageScope.Application) != 0) { Print(s_resmgr.GetString("Application") + Environment.NewLine); Print(isf.ApplicationIdentity.ToString()); Print(Environment.NewLine); } if ((scope & IsolatedStorageScope.Domain) != 0) { Print(s_resmgr.GetString("Domain") + Environment.NewLine); Print(isf.DomainIdentity.ToString()); Print(Environment.NewLine); } if ((scope & IsolatedStorageScope.Assembly) != 0) { Print(s_resmgr.GetString("Assembly") + Environment.NewLine); Print(isf.AssemblyIdentity.ToString()); Print(Environment.NewLine); } if (!s_roaming) { Print("\t" + s_resmgr.GetString("Size") + " "); Print(isf.CurrentSize.ToString(CultureInfo.InvariantCulture)); Print(Environment.NewLine); } } finally { isf.Close(); } } }
public static void Main() { IsolatedStorageFile isfs = IsolatedStorageFile.GetStore(IsolatedStorageScope.User | IsolatedStorageScope.Assembly, null, null); IEnumerator e = IsolatedStorageFile.GetEnumerator(IsolatedStorageScope.User); while (e.MoveNext()) { IsolatedStorageFile isf = (IsolatedStorageFile)e.Current; Url assemblyUrl = (Url)isf.AssemblyIdentity; Console.WriteLine("Assembly:" + assemblyUrl.Value); string[] files = isf.GetFileNames("*"); foreach (string file in files) { Console.WriteLine(file); } } }
public static void Main() { using (IsolatedStorageFile isoStore = IsolatedStorageFile.GetStore(IsolatedStorageScope.User | IsolatedStorageScope.Assembly, null, null)) { isoStore.CreateFile("TestFileA.Txt"); isoStore.CreateFile("TestFileB.Txt"); isoStore.CreateFile("TestFileC.Txt"); isoStore.CreateFile("TestFileD.Txt"); } IEnumerator allFiles = IsolatedStorageFile.GetEnumerator(IsolatedStorageScope.User); long totalsize = 0; while (allFiles.MoveNext()) { IsolatedStorageFile storeFile = (IsolatedStorageFile)allFiles.Current; totalsize += (long)storeFile.UsedSize; } Console.WriteLine("The total size = " + totalsize); }