public Dictionary <string, string> GetTcgSetBySet() { FsPath setMapFile = _resourcesDir.Join("tcg.sets.map.txt"); var tcgSetBySet = setMapFile.ReadAllLines() .Where(l => l != string.Empty) .Select(l => l.Split('\t')) .ToDictionary(p => p[0], p => p[1]); return(tcgSetBySet); }
static string detect() { var queryProcess = Process.Start( new ProcessStartInfo("xdg-mime", "query default inode/directory") { RedirectStandardOutput = true, UseShellExecute = false, CreateNoWindow = true }); if (queryProcess == null) { return(string.Empty); } queryProcess.WaitForExit(); string output = queryProcess.StandardOutput.ReadToEnd(); var appDesktopName = output.TrimEnd(); var appDesktopFile = new FsPath($"/usr/share/applications/{appDesktopName}"); if (!appDesktopFile.IsFile()) { return(string.Empty); } string[] lines; try { lines = appDesktopFile.ReadAllLines(); } catch { return(string.Empty); } const string prefix = "Exec="; string line = lines.FirstOrDefault(_ => _.StartsWith(prefix)); if (line == null) { return(string.Empty); } string command = line.Substring(prefix.Length); string name = new Regex(@"( %\w)+$").Replace(command, ""); return(name); }
public void Mtgo() { var mtgoCardsFile = new FsPath(TestContext.CurrentContext.TestDirectory, "Resources", "Mtgo", "cards.txt"); var mtgoCardNames = mtgoCardsFile.ReadAllLines().Distinct().OrderBy(Str.Comparer); Log.Debug("Unmatched mtgo cards"); var cardsByMtgoName = Repo.Cards.GroupBy(MtgoDeckFormatter.ToMtgoName) .ToDictionary(_ => _.Key, _ => _.ToList()); foreach (string name in mtgoCardNames) { if (!cardsByMtgoName.ContainsKey(name)) { Log.Debug(name); } } }