예제 #1
0
 /// <summary>
 /// Private access point
 /// </summary>
 private Event(IKeywords keywords)
 {
     PiracyEvents = new List <EventLog>();
     ListItem     = new HashSet <string[]>();
     Eventlogs    = new List <EventLog>();
     Keyword      = keywords;
 }
예제 #2
0
        public static void Search(object sender, DoWorkEventArgs e)
        {
            worker = sender as BackgroundWorker;

            try
            {
                /**
                 * Preparations before searching
                 */

                List <string> foundIds      = new List <string>();
                int           eventCounter  = 0; // Counter for total found events
                int           actionCounter = 0; // how many actions have been reported
                SetupTable();
                _keywords = Keyword.GetInstance();
                _event    = Event.GetInstance();
                _event.MapEvents();
                _keywords.Map();

                if (_event.NoEvents())
                {
                    return;
                }

                /**
                 * We're good to search
                 */
                Stopwatch watch = Stopwatch.StartNew();

                Report(0, Arr.ToString(_keywords.Items, ", "), ref actionCounter);
                Report(1, _event.Events.Count, ref actionCounter);

                PerformSearch(ref eventCounter, ref actionCounter, foundIds);

                Report(2, eventCounter, ref actionCounter);
                Report(3, eventCounter, ref actionCounter);

                if (eventCounter == 0)
                {
                    Messages.NoEventLogHasKeyword();
                }

                watch.Stop();
                double elapsedTime = watch.Elapsed.TotalSeconds;

                Report(4, elapsedTime, ref actionCounter);

                e.Result = foundIds;
            }
            catch (Exception error)
            {
                worker.ReportProgress(0, "Log: Error: " + error.Message);
                Messages.ProblemOccured("searching events for keywords");
            }
        }
예제 #3
0
        public Form1()
        {
            InitializeComponent();

            try
            {
                EventSearchEvent += Search;
                saveKeywords     += Helper.SaveKeywords;

                Helper.Form = this;
                dataGridView1.BackgroundColor   = BackColor;
                dataGridView1.ClipboardCopyMode = DataGridViewClipboardCopyMode.Disable;

                // Instantiating
                Bootstrap.Boot();

                SetBackgroundWorkerProperties();

                Keywords = Keyword.GetInstance();
                Events   = Event.GetInstance();

                rtbKeywordsToUse.Text   = Keywords.Items.ToString("\n");
                rtbIgnorables.Text      = Keywords.Ignorable.ToString("\n");
                rtbPiracyKeywords.Text  = Keywords.Piracy.ToString("\n");
                rtbPiracyIgnorable.Text = Keywords.IgnorablePiracy.ToString("\n");

                currentCheckListState = 1;
            }
            catch (Exception error)
            {
                Helper.Report("ERROR LOADING FILES: " + error.Message + error.StackTrace);
            }

            UpdateButtonStyles();

            // Enables key events
            KeyPreview = true;
            AllowDrop  = true;

            openFileDialog1.InitialDirectory = Bootstrap.CurrentLocation;

            Helper.Report("Initialization completed!");
        }
예제 #4
0
 private static void InitProps()
 {
     Events   = Event.GetInstance();
     Keywords = Keyword.GetInstance();
 }
예제 #5
0
 public IdentifierGenerator(IKeywords keywords)
 {
     _keywords = keywords;
 }