public Component(Project associatedProject, string folderName) { AssociatedProject = associatedProject; FolderName = folderName; DisplayName = ""; ReplacementRules = new Dictionary<string, ReplacementRule>(); try { ComponentJSON RawJSON = JsonConvert.DeserializeObject<ComponentJSON>(File.ReadAllText(GetAbsolutePath() + "description.json")); //DisplayName = RawJSON.name; DisplayName = RawJSON.name; foreach (FieldJSON field in RawJSON.fields) { ReplacementRules.Add(field.name, new ReplacementRule(this)); foreach (ReplaceJSON replace in field.replace) { ReplacementRules[field.name].ReplacementLocations.Add(new ReplacementLocation(replace.file, replace.wildcard, replace.inFileName)); } } } catch (Exception e) { } if (DisplayName == "") { DisplayName = FolderName; } }
public static void ProjectSelector() { Console.Clear(); Console.WriteLine("Available options:"); foreach (Projects.Project prj in ProgramData.ProjectList) { Console.WriteLine(string.Format("{0}: {1}", prj.Mnemonic, prj.DisplayName)); } // Itt prjs Console.WriteLine(""); Console.WriteLine("←: Exit"); while (!Console.KeyAvailable) { } ConsoleKeyInfo keyInfo = Console.ReadKey(true); foreach (Projects.Project prj in ProgramData.ProjectList) { if (prj.Mnemonic == keyInfo.KeyChar) { CurrentProject = prj; NextState = State.ComponentSelector; return; } } switch (keyInfo.Key) { case System.ConsoleKey.Backspace: case System.ConsoleKey.LeftArrow: case System.ConsoleKey.X: NextState = State.MainMenu; break; } }