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


C# Settings.LoadFromDisk方法代码示例

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


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

示例1: Main

 static void Main()
 {
     string[] args = Environment.GetCommandLineArgs();
     if (args.Count() > 1) {
         if (UACHelperFunctions.UACHelper.IsAdmin()) {
             Load.FilesCache = Load.FilesCache.LoadFromDisk<Dictionary<UInt32, Item>>(
                 Path.Combine(Application.UserAppDataPath, "FilesCache"));
             Settings settings = new Settings();
             settings =
                 settings.LoadFromDisk<Settings>(Path.Combine(Application.UserAppDataPath,
                                                              "Settings"));
             Dictionary<string, List<string>> aprioriData = new Dictionary<string, List<string>>();
             var allEnabledItems = (from directory in settings.EnabledDirectories select directory.Items).SelectMany(item => item).ToList();
             foreach (Item item in allEnabledItems) {
                 aprioriData[item.Path] = (from tag in item.Tags select tag.Name).ToList();
             }
             Apriori.Apriori apriori = new Apriori.Apriori(aprioriData, 5);
             var frequentSets = apriori.getFrequentSets();
             var filesToSort = from file in allEnabledItems where file.Invalidated select file;
             foreach (Item file in filesToSort) {
                 TreeHelper.createSortedTree(file, frequentSets, settings);
             }
             Load.FilesCache.SaveToDisk(Path.Combine(Application.UserAppDataPath, "FilesCache"));
             Application.Exit();
             return;
         }
     }
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     Application.Run(new TwilightSortle());
 }
开发者ID:Phoshi,项目名称:Twilight-Sortle,代码行数:31,代码来源:Program.cs

示例2: beginLoad

        private void beginLoad(bool async = true)
        {
            Action action = (() => {
                TwoLight_Sortle.Load.FilesCache =
                    TwoLight_Sortle.Load.FilesCache.LoadFromDisk<Dictionary<UInt32, Item>>(
                        Path.Combine(Application.UserAppDataPath, "FilesCache"));
            });
            Action deleteAction = (() => {
                IEnumerable<Item> deletedItems = from kvPair in TwoLight_Sortle.Load.FilesCache
                                                 where !kvPair.Value.Exists
                                                 select kvPair.Value;
                foreach (Item item in deletedItems) {
                    item.Delete();
                }
                TwoLight_Sortle.Load.FilesCache =
                    TwoLight_Sortle.Load.FilesCache.Where(kvPair => kvPair.Value.Exists).
                        ToDictionary(
                            kvPair => kvPair.Key,
                            kvPair => kvPair.Value);
            });
            Action filesAction = (() => {
                Tags.TagList = Tags.TagList.LoadFromDisk<Dictionary<string, Tag>>(Path.Combine(
                    Application.UserAppDataPath, "Tags"));
                TwoLight_Sortle.Load.FilesCache.ToList().ForEach(item => item.Value.Tags.ToList().ForEach(tag => tag.AddedImage(item.Value)));
            });
            settings = new Settings();
            Action loadSettingsAction = (() => {
                settings =
                    settings.LoadFromDisk<Settings>(Path.Combine(Application.UserAppDataPath,
                                                                 "Settings"));
            });
            Action callback = (() => {
                updateMainListing(search.Items);
                updateSearchOptionsMenuCheckedStatus();
                updatePreferencesPanel();
                buildQuickFolderAccessList();
            });
            Action dirStateAction = (() => {
                search = new Search(allEnabledItems(), "", settings.SearchOptions);
                startupComplete = true;
            });
            if (async) {
                runLongOperation(action, null, "Verifying File Cache Integrity");
                runLongOperation(deleteAction, null, "Reticulating Splines");
                runLongOperation(filesAction, null, "Loading Tags Cache");
                runLongOperation(loadSettingsAction, null, "Loading Directory Data");
                runLongOperation(dirStateAction, callback, "Generating Directory State");
            }
            else {
                action();
                deleteAction();
                filesAction();
                loadSettingsAction();
                dirStateAction();
                callback();

            }
        }
开发者ID:Phoshi,项目名称:Twilight-Sortle,代码行数:58,代码来源:TwilightSortle.cs


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