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


C# IsolatedStorageFile.GetFileNames方法代码示例

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


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

示例1: GetFiles

        private static void GetFiles(string dir, string pattern, IsolatedStorageFile storeFile)
        {
            string fileString = System.IO.Path.GetFileName(pattern);

            string[] files = storeFile.GetFileNames(pattern);

            try
            {
                for (int i = 0; i < storeFile.GetFileNames(dir + "/" + fileString).Length; i++)
                {

                    //Files are prefixed with "--"

                    //Add to the list
                    //listDir.Add("--" + dir + "/" + storeFile.GetFileNames(dir + "/" + fileString)[i]);

                    Debug.WriteLine("--" + dir + "/" + storeFile.GetFileNames(dir + "/" + fileString)[i]);
                }
            }
            catch (IsolatedStorageException ise)
            {
                Debug.WriteLine("An IsolatedStorageException exception has occurred: " + ise.InnerException);
            }
            catch (Exception e)
            {
                Debug.WriteLine("An exception has occurred: " + e.InnerException);
            }
        }
开发者ID:bramleffers,项目名称:MonkeySpace,代码行数:28,代码来源:IsoViewer.cs

示例2: CollectSubdirectoriesAndFilesBreadthFirst

        /// <summary>
        /// Collects the Paths of Directories and Files inside a given Directory relative to it.
        /// </summary>
        /// <param name="Iso">The Isolated Storage to Use</param>
        /// <param name="directory">The Directory to crawl</param>
        /// <param name="relativeSubDirectories">relative Paths to the subdirectories in the given directory, ordered top - down</param>
        /// <param name="relativeSubFiles">relative Paths to the files in the given directory and its children, ordered top - down</param>
        private static void CollectSubdirectoriesAndFilesBreadthFirst(IsolatedStorageFile Iso, string directory, out IList<string> relativeSubDirectories, out IList<string> relativeSubFiles)
        {
            var relativeDirs = new List<string>();
            var relativeFiles = new List<string>();
            var toDo = new Queue<string>();

            toDo.Enqueue(string.Empty);

            while (toDo.Count > 0)
            {
                var relativeSubDir = toDo.Dequeue();
                var absoluteSubDir = Path.Combine(directory, relativeSubDir);
                var queryString = string.Format("{0}\\*", absoluteSubDir);

                foreach (var file in Iso.GetFileNames(queryString))
                {
                    relativeFiles.Add(Path.Combine(relativeSubDir, file));
                }

                foreach (var dir in Iso.GetDirectoryNames(queryString))
                {
                    var relativeSubSubdir = Path.Combine(relativeSubDir, dir);
                    toDo.Enqueue(relativeSubSubdir);
                    relativeDirs.Add(relativeSubSubdir);
                }
            }

            relativeSubDirectories = relativeDirs;
            relativeSubFiles = relativeFiles;
        }
开发者ID:SNSB,项目名称:DiversityMobile,代码行数:37,代码来源:IsolatedStorageExtensions.cs

示例3: GetAllFiles

        public static List<String> GetAllFiles(string pattern, IsolatedStorageFile storeFile)
        {
            // Get the root and file portions of the search string.
            string fileString = Path.GetFileName(pattern);

            List<String> fileList = new List<String>(storeFile.GetFileNames(pattern));

            // Loop through the subdirectories, collect matches,
            // and make separators consistent.
            foreach (string directory in GetAllDirectories("*", storeFile))
            {
                foreach (string file in storeFile.GetFileNames(directory + "/" + fileString))
                {
                    fileList.Add((directory + "/" + file));
                }
            }

            return fileList;
        }
开发者ID:NBitionDevelopment,项目名称:WindowsPhoneFeedBoard,代码行数:19,代码来源:FileHelper.cs

示例4: Read

		// use the caller stack to execute some read operations
		private void Read (IsolatedStorageFile isf)
		{
			Assert.IsNotNull (isf.GetDirectoryNames ("*"), "GetDirectoryNames");
			Assert.IsNotNull (isf.GetFileNames ("*"), "GetFileNames");
			try {
				Assert.IsTrue (isf.CurrentSize >= 0, "CurrentSize");
				Assert.IsTrue (isf.MaximumSize >= isf.CurrentSize, "MaximumSize");
			}
			catch (InvalidOperationException) {
				// roaming
			}
		}
开发者ID:Profit0004,项目名称:mono,代码行数:13,代码来源:IsolatedStorageFileCas.cs

示例5: DeleteAllFilesInDirectory

 private void DeleteAllFilesInDirectory(IsolatedStorageFile store, string path)
 {
     if (!store.DirectoryExists(path))
     {
         return;
     }
     var files = store.GetFileNames(path + "/*");
     foreach (var file in files)
     {
         store.DeleteFile(path + "/" + file);
     }
 }
开发者ID:fiftin,项目名称:oblqo,代码行数:12,代码来源:AccountManager.cs

示例6: 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

示例7: Clear

 public override void Clear()
 {
     base.Clear();
     using ( _storage = IsolatedStorageFile.GetUserStoreForApplication() ) {
         try {
             foreach ( string file in _storage.GetFileNames( CACHE_FOLDER + @"\*" ) ) {
                 _storage.DeleteFile( GetFilePath( file ) );
             }
         }
         catch ( Exception e ) {
             e.ToString();
         }
     }
 }
开发者ID:arakuma,项目名称:wp_imagetool,代码行数:14,代码来源:FsBitmapCache.cs

示例8: 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

示例9: 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

示例10: 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

示例11: IsolatedStorageCrawlerQueueService

		public IsolatedStorageCrawlerQueueService(Uri crawlStart, bool resume)
		{
			m_CrawlStart = crawlStart;
			m_Store = IsolatedStorageFile.GetMachineStoreForDomain();

			if (!resume)
			{
				Clean();
			}
			else
			{
				Initialize();
				m_Count = m_Store.GetFileNames(Path.Combine(WorkFolderPath, "*")).Count();
			}
		}
开发者ID:senzacionale,项目名称:ncrawler,代码行数:15,代码来源:IsolatedStorageCrawlerQueueService.cs

示例12: CleanupLogs

        private static void CleanupLogs(IsolatedStorageFile store, string logFolder)
        {
            var files = store.GetFileNames(logFolder);
            var fileCount = files.Count();
            if (fileCount > MAX_FILE_COUNT - 1)
            {
                var filesAgeAsc = from file in files
                                  let age = store.GetCreationTime(file)
                                  orderby age ascending
                                  select file;
                var deleteFiles = filesAgeAsc.Take(fileCount - MAX_FILE_COUNT + 1);

                foreach (var file in deleteFiles)
                {
                    var filePath = Path.Combine(logFolder, file);
                    store.DeleteFile(filePath);
                }
            }
        }
开发者ID:SNSB,项目名称:DiversityMobile,代码行数:19,代码来源:LogFile.cs

示例13: TryToDeleteAllFiles

        public static void TryToDeleteAllFiles(IsolatedStorageFile storageFolder, string directory)
        {
            if (storageFolder.DirectoryExists(directory))
            {
                try
                {
                    string[] files = storageFolder.GetFileNames(directory);
                    foreach (string File in files)
                    {
                        storageFolder.DeleteFile(directory + files);

                    }
                }
                catch (Exception)
                {
                    //ignoring the exception
                }
             }
        }
开发者ID:njlxyaoxinwei,项目名称:AroundMe,代码行数:19,代码来源:LockscreenHelpers.cs

示例14: TryToDeleteAllFiles

        /// <summary>
        /// delete files in directory
        /// </summary>
        /// <param name="storageFolder"></param>
        /// <param name="directory"></param>
        private static void TryToDeleteAllFiles(IsolatedStorageFile storageFolder, string directory)
        {
            if (storageFolder.DirectoryExists(directory))
            {
                try
                {
                    string[] files = storageFolder.GetFileNames(directory);

                    foreach (string file in files)
                    {
                        storageFolder.DeleteFile(directory + file);
                    }
                }
                catch (Exception)
                {
                    // could be in use
                }
            }
        }
开发者ID:jozhang1,项目名称:PhotoProcess_0.1,代码行数:24,代码来源:PhotoHelper.cs

示例15: 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


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