本文整理汇总了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());
}
示例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();
}
}