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


C# IsolatedStorageFile.DirectoryExists方法代码示例

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


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

示例1: VerifyFolderExistsAsync

 private static void VerifyFolderExistsAsync(IsolatedStorageFile isolatedStorageFile)
 {
     if (!isolatedStorageFile.DirectoryExists(MonthFolder))
     {
         isolatedStorageFile.CreateDirectory(MonthFolder);
     }
 }
开发者ID:RRosier,项目名称:GlucoseManager,代码行数:7,代码来源:StorageManager.cs

示例2: AssemblyStorageService

        public AssemblyStorageService()
        {
            Store = IsolatedStorageFile.GetUserStoreForApplication();
            Store.IncreaseQuotaTo(20971520);
            if (!Store.DirectoryExists("Modules"))
                Store.CreateDirectory("Modules");

        }
开发者ID:Marbulinek,项目名称:NIS,代码行数:8,代码来源:AssemblyStorageService.cs

示例3: IsolatedStorageResponseCache

 public IsolatedStorageResponseCache(TimeSpan expiresIn)
 {
     this.expiresIn = expiresIn;
     storage = IsolatedStorageFile.GetUserStoreForApplication();
     if (!storage.DirectoryExists("Cache"))
     {
         storage.CreateDirectory("Cache");
     }
 }
开发者ID:zpinter,项目名称:mobile2-windows7,代码行数:9,代码来源:IsolatedStorageResponseCache.cs

示例4: CreateDirectoryTree

        public static void CreateDirectoryTree(Uri feedUri, IsolatedStorageFile storage)
        {
            if (!feedUri.OriginalString.Contains('\\')) return;

            var directory = GetDirectoryPath(feedUri);

            if (!storage.DirectoryExists(directory)) 
                storage.CreateDirectory(directory);
        }
开发者ID:GuiBGP,项目名称:qdfeed,代码行数:9,代码来源:SilverlightTestFileLoader.cs

示例5: IsolatedStorageResponseCache

        public IsolatedStorageResponseCache(string session)
        {
            if (session == null) throw new ArgumentNullException("session");
            this._sessionKey = HashUtil.ToSHA1(session);

            //create cache dir
            _storage = IsolatedStorageFile.GetUserStoreForApplication();
            if (!_storage.DirectoryExists("ECollegeCache"))
            {
                _storage.CreateDirectory("ECollegeCache");
            }

            //create session dir
            string thisSessionDirectory = string.Format("ECollegeCache\\{0}", _sessionKey);
            if (!_storage.DirectoryExists(thisSessionDirectory))
            {
                _storage.CreateDirectory(thisSessionDirectory);
            }
        }
开发者ID:PearsonLearningStudio,项目名称:mobile2-windows7,代码行数:19,代码来源:IsolatedStorageResponseCache.cs

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

示例7: CreateDirectoryTree

        /// <summary>
        /// Creates all of the directories included in the given filepath.
        /// </summary>
        /// <param name="filepath">A string containing a filepath which may or may not contain any number of directories.</param>
        /// <param name="storage">A reference to a valid IsolatedStorageFile instance</param>
        public static void CreateDirectoryTree(string filepath, IsolatedStorageFile storage)
        {
            //If this filepath is flat and doesn't contain any folders - bail.
             if (!HasDirectories(filepath)) return;

            //Extract the full directory path from the filename
            var directory = GetFullDirectoryPath(filepath);

            //If the directory doesn't already exist, create it.
            if (!storage.DirectoryExists(directory))
                storage.CreateDirectory(directory);
        }
开发者ID:Aaronontheweb,项目名称:isolatedstorage-extensions,代码行数:17,代码来源:IsolatedStorageHelper.Directory.cs

示例8: CreateDirIfNecessary

        private void CreateDirIfNecessary(IsolatedStorageFile local, string path)
        {
            int pos = 0;
            string dir = path;

            while ((pos = dir.IndexOf('\\', pos)) != -1)
            {
                var dirname = dir.Substring(0, pos);
                if (!local.DirectoryExists(dirname))
                    local.CreateDirectory(dirname);
                pos++;
            }
        }
开发者ID:5nophilwu,项目名称:S1Nyan,代码行数:13,代码来源:IsolatedStorageHelper.cs

示例9: MainPage

        public MainPage()
        {
            InitializeComponent();

            _recorder = new Recorder(new WaveFormat());
            _storage = IsolatedStorageFile.GetUserStoreForApplication();

            if (!_storage.DirectoryExists(STORAGE_DIRECTORY))
            {
                _storage.CreateDirectory(STORAGE_DIRECTORY);
            }

            UpdateRecordings();
        }
开发者ID:jaslong,项目名称:Recorder,代码行数:14,代码来源:MainPage.xaml.cs

示例10: CheckDir

 private static bool CheckDir(IsolatedStorageFile storage)
 {
     if (!storage.DirectoryExists(Folder))
     {
         try
         {
             storage.CreateDirectory(Folder);
         }
         catch (Exception)
         {
             return false;
         }
     }
     return true;
 }
开发者ID:asizikov,项目名称:PinHolder,代码行数:15,代码来源:CardProvider.cs

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

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

示例13: OpenLogFile

        private static Stream OpenLogFile(IsolatedStorageFile store)
        {
            if (Profile == null)
            {
                return Stream.Null;
            }

            try
            {
                var fileName = string.Format(LOGFILE_TEMPLATE, DateTime.UtcNow.ToString("yyyy-MM-dd"));
                var folderPath = Path.Combine(Profile.CurrentProfilePath(), LOGFOLDER);

                if (!store.DirectoryExists(folderPath))
                {
                    store.CreateDirectory(folderPath);
                }

                var filePath = Path.Combine(folderPath, fileName);

                if (store.FileExists(filePath))
                {
                    return store.OpenFile(filePath, FileMode.Append);
                }
                else
                {
                    CleanupLogs(store, folderPath);

                    return store.OpenFile(filePath, FileMode.Create);
                }
            }
            catch (Exception ex)
            {
                // Logging Failed, don't kill the process because of it
                Debugger.Break();

                return Stream.Null;
            }
        }
开发者ID:SNSB,项目名称:DiversityMobile,代码行数:38,代码来源:LogFile.cs

示例14: CopyDirectory

        public void CopyDirectory(string sourcePath, string destinationPath, IsolatedStorageFile iso)
        {
            if (!iso.DirectoryExists(sourcePath))
            return;

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

              foreach (var folder in folders)
              {
            string sourceFolderPath = sourcePath + "/" + folder;
            string destinationFolderPath = destinationPath + "/" + folder;

            iso.CreateDirectory(destinationFolderPath);
            CopyDirectory(sourceFolderPath, destinationFolderPath, iso);
              }

              foreach (var file in iso.GetFileNames(sourcePath + "/" + "*.*"))
              {
            string sourceFilePath = sourcePath + "/" + file;
            string destinationFilePath = destinationPath + "/" + file;

            iso.CopyFile(sourceFilePath, destinationFilePath);
              }
        }
开发者ID:msachs,项目名称:TestRepo2,代码行数:24,代码来源:StoragePhone7.cs

示例15: ExtractFile

        private bool ExtractFile(StreamResourceInfo xapStream, IsolatedStorageFile isf, string fileName)
        {
            try
            {
                if (!isf.DirectoryExists("Temp"))
                    isf.CreateDirectory("Temp");
                if (!isf.DirectoryExists(IsoTempFolderPath))
                    isf.CreateDirectory(IsoTempFolderPath);

                var streamResource = Application.GetResourceStream(xapStream, new Uri(fileName, UriKind.Relative));

                if (streamResource == null)
                    return false;

                string shortFileName = ShortenFileName(fileName);

                var fs = new IsolatedStorageFileStream(IsoTempFolderPath + "\\" + shortFileName, FileMode.Create, isf);

                Byte[] bytes = new Byte[streamResource.Stream.Length];
                streamResource.Stream.Read(bytes, 0, bytes.Length);
                fs.Write(bytes, 0, bytes.Length);
                fs.Close();

                streamResource.Stream.Close();
                return true;
            }
            catch (Exception ex)
            {
            }
            return false;
        }
开发者ID:ultrashot,项目名称:xapdeployer,代码行数:31,代码来源:XapReaderViewModel.cs


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