Beispiel #1
0
        static void Main(string[] args)
        {
            Log.Write("Welcome to Cheng's Blaise AuditTrail parser. Version 1.0.0");

            //get server/table names
            try
            {
                SetInitialData();
            }
            catch (Exception e)
            {
                Log.Write("Failed to set server and project initial values. Message: " + e.Message);
                throw;
            }



            //get all new cases
            var ListNewCase = CaseManager.GetNewCase();

            for (int i = 0; i < ListNewCase.Count; i++)
            //   for (int i = 0; i < 1; i++)
            {
                Log.Write("Parsing a new case " + i.ToString() + " : " + ListNewCase[i] + " ...");
                var myParser = new Parser();
                myParser.Start(ListNewCase[i]);
            }


            //get  all updated cases
            Log.Write("Finished! ");
            Console.ReadKey();
        }
Beispiel #2
0
        private static void StartParsing()
        {
            //decide batch run or single sid run
            string SampleId = "5205500010"; //"0167150040";// "5022420010";
            int    Choice   = 1;            //1 for batach run, parse all new and updated sampleId; 2 for single SampleId run;

            if (argsdict["KeyValue"] != "")
            {
                Choice   = 2;
                SampleId = argsdict["KeyValue"]; //use SID from commmand line arguments.
            }


            //start to parse
            try
            {
                //1 for batach run, parse all new and updated sampleId, 2 for single SampleId run;
                switch (Choice)
                {
                case 1:
                    Log.Write("Batch run,self discovery mode");

                    ///get  new case and updated cases
                    var ListNewCase = CaseManager.GetNewAndUpdatedCase();


                    // var ListNewCase = CaseManager.getParsedSampleId2();
                    for (var i = 0; i < ListNewCase.Count; i++)
                    //   for (int i = 0; i < 1000; i++)
                    {
                        Log.Write("-----------------------------------------------------------------");

                        Log.Write("Parsing case (" + i + "/" + ListNewCase.Count + "): " + ListNewCase[i]);
                        var myParser1 = new Parser();

                        try
                        {
                            myParser1.Start(ListNewCase[i]);
                        }
                        catch (Exception e)
                        {
                            Log.WriteError("Error!" + " Failed to parse case " + ListNewCase[i] + ". Message: " +
                                           e.Message);
                        }
                    }

                    break;

                case 2:
                    Log.Write("Single case mode");
                    Log.Write("-----------------------------------------------------------------");
                    Log.Write("Parsing " + SampleId);
                    var myParser2 = new Parser();
                    try
                    {
                        myParser2.Start(SampleId);
                    }
                    catch (Exception e)
                    {
                        Log.WriteError("Error!" + " Failed to parse case " + SampleId + ". Message: " +
                                       e.Message);
                    }
                    break;
                }
            }
            catch (Exception e)
            {
                Log.WriteError("Error!" + Log.path() + " " + " Faild to finish. Message: " + e.Message);
            }
        }