Пример #1
0
        static void Main(string[] args)
        {
            JsonConfigurationDeserializer jsonConfigurationDeserializer = new JsonConfigurationDeserializer();
            XmlConfigurationDeserializer  xmlConfigurationDeserializer  = new XmlConfigurationDeserializer();

            RandomItemAccess randomItemAccess = new RandomItemAccess();
            LogLineDirector  logLineDirector  = new LogLineDirector();

            LogGenerator jsonConfigurationLogGenerator = new LogGenerator(jsonConfigurationDeserializer.Deserialize(@"..\..\InputData\LogConfiguration_.json"), randomItemAccess, logLineDirector);

            jsonConfigurationLogGenerator.GenerateLog();

            LogGenerator xmlConfigurationLogGenerator = new LogGenerator(xmlConfigurationDeserializer.Deserialize(@"..\..\InputData\LogConfiguration_.xml"), randomItemAccess, logLineDirector);

            xmlConfigurationLogGenerator.GenerateLog();

            /*string fileName = @"..\..\OutputData\json_correctlog1.txt";
             * Mutator mutator = new Mutator();
             * mutator.HideDateByRandomDate(fileName);
             * mutator.HideIpAddressByLocalhost(fileName);
             *
             * Analyzer analyzer = new Analyzer();
             * analyzer.GetNumberOfClassStatusCodes(fileName, HttpStatusClass.ClientError);
             *
             * Validator validator = new Validator();
             * validator.ValidateRandomLogs(fileName, "%h %l %u %t %r %s %b");*/
        }
Пример #2
0
        static void Main(string[] args)
        {
            //Assumption is Program should run infinitely with all the exception handled
            //Unless user closes the console application
            while (true)
            {
                try
                {
                    Console.WriteLine("Please key in the path to the input file\n");
                    Console.Write(":>");
                    var path = Console.ReadLine();
                    if (string.IsNullOrEmpty(path))
                    {
                        throw new FileNotFoundException();
                    }

                    StreamReader  streamReader = new StreamReader(path);
                    List <string> inputList    = new List <string>();
                    var           inputLine    = streamReader.ReadLine();
                    while (inputLine != null)
                    {
                        inputList.Add(inputLine);
                        inputLine = streamReader.ReadLine();
                    }

                    var inputRefactor = new InputRefactor(new InputValidator());
                    var result        = inputRefactor.InputValidator(inputList);
                    if (result)
                    {
                        ServiceProvider.GenerateFlightAsync(inputRefactor.input).Wait();
                    }
                }

                #region Exception Handlers

                catch (FileNotFoundException)
                {
                    Console.WriteLine("Incorrect File format or wrong path! please retry!\n");
                }
                catch (DirectoryNotFoundException)
                {
                    Console.WriteLine("wrong path! please retry!\n");
                }
                catch (UnauthorizedAccessException)
                {
                    Console.WriteLine("Access to the path is denied! please retry!\n");
                }
                catch (Exception e)
                {
                    LogGenerator.GenerateLog(e);
                }

                #endregion
            }
        }
Пример #3
0
 /// <summary>
 /// Starts the download.
 /// </summary>
 public IEnumerator StartDownload()
 {
     if (!downloadInProgress)
     {
         string totalSize          = "";
         System.Net.WebRequest req = System.Net.HttpWebRequest.Create(HTTPGameFileLocation + "upload_" + currentVer + ".flamacore");
         req.Method = "HEAD";
         using (System.Net.WebResponse resp = req.GetResponse())
         {
             long ContentLength;
             if (long.TryParse(resp.Headers.Get("Content-Length"), out ContentLength))
             {
                 totalSize = GetBytesReadable(ContentLength);
             }
         }
         DownloadStatus = LocalizationManager.LangStrings [5];
         LogGenerator.GenerateDownloadLog("Download started: " + HTTPGameFileLocation + "upload_" + currentVer + ".flamacore");
         CompFileToDownload = new WWW(HTTPGameFileLocation + "upload_" + currentVer + ".flamacore");
         while (!CompFileToDownload.isDone)
         {
             downloadInProgress      = true;
             progressFill.fillAmount = CompFileToDownload.progress;
             DownloadProgress        = (CompFileToDownload.progress * 100).ToString("F2") + "%/100% --- " + totalSize;
             yield return(null);
         }
         DownloadProgress        = (CompFileToDownload.progress * 100).ToString("F2") + "%/100% --- " + totalSize;
         progressFill.fillAmount = CompFileToDownload.progress;
         if (!string.IsNullOrEmpty(CompFileToDownload.error))
         {
             Debug.Log(CompFileToDownload.text + CompFileToDownload.error);
         }
         else
         {
             downloadInProgress = false;
             LogGenerator.GenerateDownloadLog("Download done.");
             Debug.Log("done");
             File.WriteAllBytes(Application.dataPath + "/upload_" + currentVer + ".flamacore", CompFileToDownload.bytes);
             downloadInProgress      = true;
             progressFill.fillAmount = 0;
             string pth = Application.dataPath;
             //Decompressor.DecompressToDirectory (pth + "/upload_" + currentVer + ".flamacore", pth + "/" + GameName + "/");
             t2_ = new Thread(() => Decompressor.DecompressToDirectory(pth + "/upload_" + currentVer + ".flamacore", pth + "/" + GameName + "/"));
             if (!t2_.IsAlive)
             {
                 t2_.Start();
             }
             LogGenerator.GenerateLog("Decompression Thread Launched");
         }
     }
 }