当前位置: 首页>>代码示例>>C#>>正文


C# IsolatedStorageFile.DeleteDirectory方法代码示例

本文整理汇总了C#中System.IO.IsolatedStorage.IsolatedStorageFile.DeleteDirectory方法的典型用法代码示例。如果您正苦于以下问题:C# IsolatedStorageFile.DeleteDirectory方法的具体用法?C# IsolatedStorageFile.DeleteDirectory怎么用?C# IsolatedStorageFile.DeleteDirectory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.IO.IsolatedStorage.IsolatedStorageFile的用法示例。


在下文中一共展示了IsolatedStorageFile.DeleteDirectory方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DeleteDirectoryTree

        /// <summary>
        /// Deletes all of the folders and their contents in a given file-path.
        /// </summary>
        /// <param name="filepath">A valid filepath in IsolatedStorage.</param>
        /// <param name="storage">A reference to a valid IsolateStorageFile object.</param>
        public static void DeleteDirectoryTree(string filepath, IsolatedStorageFile storage)
        {
            //Bail if we don't detect any folders
            if (!HasDirectories(filepath)) return;

            //Get the root folder from the path
            var folderPath = GetRootDirectory(filepath);

            //Delete the root directory and have it cascade down
            storage.DeleteDirectory(folderPath);
        }
开发者ID:Aaronontheweb,项目名称:isolatedstorage-extensions,代码行数:16,代码来源:IsolatedStorageHelper.Directory.cs

示例2: InnerClear

 private void InnerClear(IsolatedStorageFile iso, string path) {
     var fs = iso.GetFileNames(string.Format("{0}/*", path));
     foreach (var f in fs) {
         iso.DeleteFile(Path.Combine(path, f));
     }
     var ds = iso.GetDirectoryNames(string.Format("{0}/*", path));
     foreach (var d in ds) {
         var sp = Path.Combine(path, d);
         this.InnerClear(iso, sp);
         iso.DeleteDirectory(sp);
     }
 }
开发者ID:gruan01,项目名称:Discuz.Mobi,代码行数:12,代码来源:Storage.cs

示例3: RecursiveDeleteDirectory

        public static void RecursiveDeleteDirectory(string directory, IsolatedStorageFile store)
        {
            foreach (var fileName in store.GetFileNames(directory + "\\*"))
            {
                store.DeleteFile(directory + "\\" + fileName);
            }

            foreach (var directoryName in store.GetDirectoryNames(directory + "\\*"))
            {
                RecursiveDeleteDirectory(directory + "\\" + directoryName, store);
            }

            store.DeleteDirectory(directory);
        }
开发者ID:bgourlie,项目名称:petroledger,代码行数:14,代码来源:Util.cs

示例4: DeleteDirectory

 /// <summary>
 /// �ڴ洢����ɾ��Ŀ¼
 /// </summary>
 /// <param name="storage"></param>
 /// <param name="dirName"></param>
 public static void DeleteDirectory(IsolatedStorageFile storage, string dirName)
 {
     try
     {
         if (!string.IsNullOrEmpty(dirName) && storage.GetDirectoryNames(dirName).Length > 0)
         {
             storage.DeleteDirectory(dirName);
         }
     }
     catch (Exception ex)
     {
         throw new Exception("�޷��ڴ洢����ɾ��Ŀ¼.", ex);
     }
 }
开发者ID:Andy-Yin,项目名称:MY_OA_RM,代码行数:19,代码来源:IsolatedStorageHelper.cs

示例5: DeleteDirectoryRecursively

 public static void DeleteDirectoryRecursively(IsolatedStorageFile storageFile, string directoryName)
 {
     var pattern = directoryName + @"\*";
     var files = storageFile.GetFileNames(pattern);
     foreach (var fileName in files)
     {
         storageFile.DeleteFile(Path.Combine(directoryName, fileName));
     }
     var dirs = storageFile.GetDirectoryNames(pattern);
     foreach (var dirName in dirs)
     {
         DeleteDirectoryRecursively(storageFile, Path.Combine(directoryName, dirName));
     }
     storageFile.DeleteDirectory(directoryName);
 }
开发者ID:Korshunoved,项目名称:Win10reader,代码行数:15,代码来源:CredentialsProvider.cs

示例6: Write

		// use the caller stack to execute some write operations
		private void Write (IsolatedStorageFile isf)
		{
			isf.CreateDirectory ("testdir");

			string filename = Path.Combine ("testdir", "file");
			using (IsolatedStorageFileStream isfs = new IsolatedStorageFileStream (filename, FileMode.Create, isf)) {
			}
			isf.DeleteFile (filename);

			isf.DeleteDirectory ("testdir");
			try {
				isf.Remove ();
			}
			catch (IsolatedStorageException) {
				// fx 1.x doesn't like removing when things "could" still be in use
			}
		}
开发者ID:Profit0004,项目名称:mono,代码行数:18,代码来源:IsolatedStorageFileCas.cs

示例7: DeleteDirectory

        public static void DeleteDirectory(IsolatedStorageFile store, String root)
        {
            String dir = root;

            //  delete file in current dir
            foreach (String file in store.GetFileNames(dir + "/*"))
            {
                store.DeleteFile(dir + "/" + file);
            }

            //  delete sub-dir
            foreach (String subdir in store.GetDirectoryNames(dir + "/*"))
            {
                DeleteDirectory(store, dir + "/" + subdir + "/");
            }

            //  delete current dir
            store.DeleteDirectory(dir);
        }
开发者ID:GhostSoar,项目名称:JigsawPuzzle,代码行数:19,代码来源:ChoosePictures.xaml.cs

示例8: DeleteDirectory

        private void DeleteDirectory(string path, IsolatedStorageFile iso)
        {
            if (!iso.DirectoryExists(path))
            return;

              var folders = iso.GetDirectoryNames(path + "/" + "*.*");

              foreach (var folder in folders)
              {
            string folderPath = path + "/" + folder;
            DeleteDirectory(folderPath, iso);
              }

              foreach (var file in iso.GetFileNames(path + "/" + "*.*"))
              {
            iso.DeleteFile(path + "/" + file);
              }

              if (path != "")
            iso.DeleteDirectory(path);
        }
开发者ID:msachs,项目名称:TestRepo2,代码行数:21,代码来源:StoragePhone7.cs

示例9: DeleteDirectory

 // Can't delete unless empty. Must recursively delete files and folders
 private static void DeleteDirectory(IsolatedStorageFile storage, string dir)
 {
     foreach (var file in storage.GetFileNames(Path.Combine(dir, "*")))
     {
         storage.DeleteFile(Path.Combine(dir, file));
     }
     foreach (var subDir in storage.GetDirectoryNames(Path.Combine(dir, "*")))
     {
         DeleteDirectory(storage, Path.Combine(dir, subDir));
     }
     storage.DeleteDirectory(dir);
 }
开发者ID:achingono,项目名称:WinPhoneGmail,代码行数:13,代码来源:MailStorage.cs

示例10: DeleteDirectoryRecursively

 // helper function from: http://stackoverflow.com/questions/18422331/easy-way-to-recursively-delete-directories-in-isolatedstorage-on-wp7-8
 private void DeleteDirectoryRecursively(IsolatedStorageFile storageFile, String dirName)
 {
     try
     {
         String pattern = dirName + @"\*";
         String[] files = storageFile.GetFileNames(pattern);
         foreach (var fName in files)
         {
             storageFile.DeleteFile(Path.Combine(dirName, fName));
         }
         String[] dirs = storageFile.GetDirectoryNames(pattern);
         foreach (var dName in dirs)
         {
             DeleteDirectoryRecursively(storageFile, Path.Combine(dirName, dName));
         }
         if (storageFile.DirectoryExists(dirName))
         {
             storageFile.DeleteDirectory(dirName);
         }
     }
     catch(Exception e)
     {
         Debug.WriteLine("Unable to delete directory : " + dirName);
     }
 }
开发者ID:stevengill,项目名称:phonegap-app-developer,代码行数:26,代码来源:Unzip.cs

示例11: DeleteFileHelper

        private static void DeleteFileHelper(IsolatedStorageFile isoStore, string path)
        {
            int retries = 3;

            while (retries-- > 0)
            {
                try
                {
                    if (isoStore.FileExists(path))
                    {
                        isoStore.DeleteFile(path);

                        try
                        {
                            isoStore.DeleteDirectory(Path.GetDirectoryName(path));
                        }
                        catch (IsolatedStorageException)
                        {
                        }
                    }
                    else
                    {
                        return;
                    }
                }
                catch (IsolatedStorageException)
                {
                    // random iso-store failures..
                    //
                    Thread.Sleep(50);
                }
                return;
            }
        }
开发者ID:Kinnara,项目名称:AgFx,代码行数:34,代码来源:IsoStoreProvider.cs

示例12: DeleteAllFiles

        private static void DeleteAllFiles(IsolatedStorageFile isf)
        {
            if (false == isf.DirectoryExists(Constants.MyScriptsDirectoryName))
                return;

            var filesDel = isf.GetFileNames(string.Format("{0}\\*", Constants.MyScriptsDirectoryName));
            foreach (var f in filesDel)
            {
                isf.DeleteFile(Constants.MyScriptsDirectoryName + "\\" + f);
            }
            isf.DeleteDirectory(Constants.MyScriptsDirectoryName);
        }
开发者ID:slodge,项目名称:main,代码行数:12,代码来源:MainViewModel.cs

示例13: MoveOldCrashlogsIfNeeded

 public void MoveOldCrashlogsIfNeeded(IsolatedStorageFile store)
 {
     try
     {
         if (store.DirectoryExists(Constants.OldCrashDirectoryName))
         {
             var files = store.GetFileNames(Path.Combine(Constants.OldCrashDirectoryName, Constants.CrashFilePrefix + "*.log"));
             if (files.Length > 0)
             {
                 if (!store.DirectoryExists(Constants.CrashDirectoryName))
                 {
                     store.CreateDirectory(Constants.CrashDirectoryName);
                 }
                 foreach (var fileName in files)
                 {
                     store.MoveFile(Path.Combine(Constants.OldCrashDirectoryName, Path.GetFileName(fileName)), Path.Combine(Constants.CrashDirectoryName, Path.GetFileName(fileName)));
                 }
                 if (store.GetFileNames(Path.Combine(Constants.OldCrashDirectoryName, Constants.CrashFilePrefix + "*.*")).Length == 0)
                 {
                     store.DeleteDirectory(Constants.OldCrashDirectoryName);
                 }
             }
         }
     }
     catch (Exception e)
     {
         HockeyClient.Current.AsInternal().HandleInternalUnhandledException(e);
     }
 }
开发者ID:bitstadium,项目名称:HockeySDK-Windows,代码行数:29,代码来源:CrashHandler.cs

示例14: DeleteRecursive

        private static void DeleteRecursive(Path dir, IsolatedStorageFile isf)
        {
            // Delete every subdirectory's contents recursively
            foreach (string subDir in isf.GetDirectoryNames(dir.PathString + "/*"))
                DeleteRecursive(dir.NavigateIn(subDir), isf);
            // Delete every file inside
            foreach (string file in isf.GetFileNames(dir.PathString + "/*"))
                isf.DeleteFile(System.IO.Path.Combine(dir.PathString, file));

            isf.DeleteDirectory(dir.PathString);
        }
开发者ID:hmehart,项目名称:Notepad,代码行数:11,代码来源:Directory.cs

示例15: DeleteDirectoryRecursive

 public void DeleteDirectoryRecursive(IsolatedStorageFile isolatedStorageFile, String dirName)
 {
     String pattern = dirName + @"\*";
     String[] files = isolatedStorageFile.GetFileNames(pattern);
     foreach (String fName in files)
     {
         isolatedStorageFile.DeleteFile(Path.Combine(dirName, fName));
     }
     String[] dirs = isolatedStorageFile.GetDirectoryNames(pattern);
     foreach (String dName in dirs)
     {
         DeleteDirectoryRecursive(isolatedStorageFile, Path.Combine(dirName, dName));
     }
     isolatedStorageFile.DeleteDirectory(dirName);
 }
开发者ID:joshgo,项目名称:NLog,代码行数:15,代码来源:IsolatedStorageFileTargetTests.cs


注:本文中的System.IO.IsolatedStorage.IsolatedStorageFile.DeleteDirectory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。