public AppInfo(LauncherCore core, AppSpec spec, string path) { this.core = core; AppSpec = spec; Path = path; try { ScreenshotImage = new BitmapImage(new Uri(toAbsolutePath(spec.ScreenshotPath))); ScreenshotImage.Freeze(); } catch { } }
public async Task LoadAppsAsync() { Apps.Clear(); // カウントの読み込み countData.Clear(); if (File.Exists(CountFilePath)) { await Task.Run(() => { try { using (var fs = new FileStream(CountFilePath, FileMode.Open)) using (var decomp = new GZipStream(fs, CompressionMode.Decompress)) countData.AddRange(XDocument.Load(decomp).Root.Elements().Select(n => new CountData(n))); } catch { } }); } // アプリケーションの読み込み if (Directory.Exists(DataDirectoryPath)) { var dirs = Directory.GetDirectories(DataDirectoryPath); foreach (var dir in dirs) { try { var yamlPath = new[] { "spec.yml", "spec.yaml" }.Select(p => Path.Combine(dir, p)).FirstOrDefault(File.Exists); if (!string.IsNullOrEmpty(yamlPath)) { var spec = await AppSpec.LoadAsync(yamlPath); Apps.Add(new AppInfo(this, spec, dir)); } } catch { } } } }