private static WorkFiles SelectTypeOfWorkFiles() { Console.WriteLine("Select the type of file management:\n\t1 - Browsing\n\t2 - Recoil"); switch (Сhecking.RangeInsert(1, 2)) { case 1: return(WorkFiles.Browsing); case 2: return(WorkFiles.Recoil); default: throw new ArgumentOutOfRangeException("Incorrect input!"); } }
private static string SelectRecoil(string path) { int id = 0; Console.WriteLine("\nInput Id of DateTime to recoil for this DateTime"); Dictionary <int, string> dict = new Dictionary <int, string>(); foreach (var item in Directory.GetDirectories(path)) { dict.Add(id, item.Substring(item.LastIndexOf('\\') + 1)); Console.WriteLine($"ID: {id}, DateTime: {item.Substring(item.LastIndexOf('\\') + 1)}"); id++; } int select = Сhecking.RangeInsert(0, dict.Keys.Count - 1); return(dict[select]); }
public static string GetFolder(WorkFiles type) { Console.WriteLine($"\nPress number of folder which you want to {type.ToString().ToLower()}?\n" + $"1 - Default\n2 - Enter your folder"); switch (Сhecking.RangeInsert(1, 2)) { case 1: string path = Path.Combine(Directory.GetParent(Environment.CurrentDirectory).Parent.FullName, @"ExampleFolder"); if (!File.Exists(path)) { Directory.CreateDirectory(path); } return(path); case 2: return(GetCorrectPath()); default: throw new ArgumentOutOfRangeException("\nIncorrect input!"); } }