示例#1
0
        private static void UploadLocal(ArgumentParser p, ref string htmlResult)
        {
            LogAnalyser la = new LogAnalyser(p.OfficeDir);

            string outputFile = Path.Combine(p.OfficeDir, "oslebot_combined_Output.xml");

            using (FileStream fs = new FileStream(outputFile, FileMode.OpenOrCreate))
            {
                XmlSerializer xs = new XmlSerializer(typeof(OSLEBot));
                xs.Serialize(fs, GetOSLEBotObject(la));

                fs.Flush();
                fs.Close();
            }
            XslCompiledTransform xslTrans = new XslCompiledTransform();

            xslTrans.Load(@"OSLEBot.V1.Output.1.xslt");
            htmlResult = Path.Combine(p.OfficeDir, string.Format("OlseBotOutput_{0}.html", DateTime.Now.Ticks));
            xslTrans.Transform(outputFile, htmlResult);

            using (Process proc = new Process())
            {
                proc.StartInfo.FileName = htmlResult;

                proc.Start();
            }
        }
示例#2
0
        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);
        }
示例#3
0
        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);
        }