/// <summary> /// Analyse a certain drive's mark. /// </summary> /// <param name="drive">Drive's root directory.</param> /// <returns>Drive's Alias.</returns> public string Analyse(char drive) { if (!CopyManager.IsMarked(drive)) { Guid guid = Guid.NewGuid(); string alias = guid.ToString().Substring(0, 8); CopyManager.AddMark(drive, guid.ToString()); dict.Add(alias, guid); WriteToFile(); ConsoleHelper.EventWriteLine($"New Disk. Init in ({alias},{guid.ToString()})."); return(alias); } else { string mark = CopyManager.GetMark(drive); foreach (var i in dict) { if (i.Value.ToString().Equals(mark)) { ConsoleHelper.EventWriteLine($"Found Disk of ({i.Key},{i.Value})."); return(i.Key); } } string alias = mark.Substring(0, 8); dict.Add(alias, new Guid(mark)); WriteToFile(); ConsoleHelper.EventWriteLine($"New Disk but has mark. Init in ({alias},{mark})."); return(alias); } }
void InputRmMark(List <string> args) { foreach (char i in args[1]) { if (CopyManager.IsMarked(i)) { CopyManager.RemoveMark(i); } else { Console.WriteLine($"No mark in {i} ."); } } }