private static void BackupFiles(ArgumentParser p) { string append = string.Format("_back_{0}", DateTime.Now.Ticks); Console.WriteLine("This command will append {0} to all files currently ending in OSLEBotOutput.xml so as they wont get processed again", append); Console.WriteLine("Are you sure you want to continue? type yes or no"); string response = Console.ReadLine(); if (response.ToLower() == "yes") { var l = new LogAnalyser(p.OfficeDir); l.GetResults().ForEach(getResult => { string newFileName = getResult.LogLocation + append; try { File.Move(getResult.LogLocation, newFileName); Console.WriteLine("Backed up {0} to {1}", getResult.LogLocation, newFileName); } catch (Exception ex) { Console.WriteLine("Cannot move {0} to {1}. please manually move this... {2}", getResult.LogLocation, newFileName, ex.Message); } }); return; } if (response.ToLower() == "no") { Console.WriteLine("Grand job... Bye now!"); return; } Console.WriteLine("Sorry, i did not quite hear you there.... try again..."); BackupFiles(p); }
private static OSLEBot GetOSLEBotObject(LogAnalyser la) { OSLEBot ob = new OSLEBot { start = "Now", version = "1.0" }; List <OSLEBotCO> listOCos = new List <OSLEBotCO>(); XmlSerializer xs = new XmlSerializer(typeof(OSLEBot)); la.GetResults().ForEach(x => { Console.WriteLine("LocGroup: {0} \n Project: {1} \n Language: {2} \n LogFile: {3}", x.LocGroup, x.Project, x.Language, x.LogLocation); OSLEBot o = (OSLEBot)xs.Deserialize(new FileStream(x.LogLocation, FileMode.Open)); Array.ForEach(o.co, listOCos.Add); }); ob.co = listOCos.ToArray(); return(ob); }