public WindowsEvtInputListener(WindowsEvent arguments, CancellationToken cancelToken)
            : base(cancelToken, "Win32-Eventlog")
        {
            _arguments = arguments;
            _pollingIntervalInSeconds = arguments.Interval;
            _tasks = new List<Thread>();

            foreach (string eventHive in _arguments.Source.Split(','))
            {
                var thread = new Thread(EventWatcher) {Name = "Win32-Eventlog-" + eventHive};
                _tasks.Add(thread);
                thread.Start(eventHive);
            }
        }
示例#2
0
        public LingvisticsProcessor()
        {
            if (!File.Exists(ProcessorFilePath))
            {
                throw (new Exception("ЕБАТЬ ВАШУ МАТЬ - '" + ProcessorFilePath + "' - НЕТ ТАКОГО ФАЙЛА"));
            }

            WindowsEvent startEvent = null;

            try
            {
                _Process = Process.Start(
                    new ProcessStartInfo()
                {
                    FileName         = ProcessorFilePath,
                    WorkingDirectory = ProcessorWorkingDirectory,
                    Arguments        = "LingvisticsServicePID=" + Process.GetCurrentProcess().Id,     //"",//string.Format("{0} {1}", _port, _uri),
                    CreateNoWindow   = true,
                    UseShellExecute  = false
                }
                    );
                var url = string.Format("ipc://LP:{0}/{1}", _Process.Id, ProcessorUri);

                //ожидание запуска и сетевой инициализации процессора
                startEvent = new WindowsEvent(string.Format("LPStartEvent_{0}", _Process.Id));
                while (!startEvent.Wait(10))
                {
                    if (_Process.HasExited)
                    {
                        throw (new ApplicationException(string.Format("Proc({0}) stopped", _Process.Id)));
                    }
                }

                _ILingvisticsProcessor = (ILingvisticsProcessor)Activator.GetObject(typeof(ILingvisticsProcessor), url);
            }
            catch (Exception ex)
            {
                Logger.Error(ex.ToString());
                throw (new ApplicationException("Error on start new proc"));
            }
            finally
            {
                if (startEvent != null)
                {
                    startEvent.Close();
                }
            }
            Logger.InfoFormat("New proc({0}) start", _Process.Id);
        }
        static LingvisticsWorkProcessor()
        {
//System.Diagnostics.Debugger.Break();
            _CoreferenceResolver = new CoreferenceResolver();

            _StopEvent = new ManualResetEvent(false);

            _WaitThread = new Thread(WorkThreadRoutine);
            _WaitThread.Start();

            //Выставить событие инициализации
            //---Thread.Sleep( 10000 ); - WTF???

            _StartEvent = new WindowsEvent(string.Format("LPStartEvent_{0}", Process.GetCurrentProcess().Id));
            _StartEvent.Set();
        }
示例#4
0
    // Use this for initialization
    void Start()
    {
        bsod              = crash = windows = intialStart = firstGlitch = false;
        intialTimer       = nextGlitchTimer = 0f;
        timeToFirstGlitch = intialDelay + Random.Range(-intialRandomOffset, intialRandomOffset);
        timeToNextGlitch  = 50f;

        gc = FindObjectOfType <GameController>();

        bsodEvent    = FindObjectOfType <EventBSOD>();
        windowsEvent = FindObjectOfType <WindowsEvent>();
        crashEvent   = FindObjectOfType <ProgCrashEvent>();
        staticEvent  = FindObjectOfType <StaticEvent>();

        //for testing only
        intialStart = true;
    }
示例#5
0
 public void PushWindowsEvent(WindowsEvent windowsEvent)
 {
     _eventLog.WriteEntry(windowsEvent.EventPath, EventLogEntryType.Information, Cycle);
 }
示例#6
0
        // will add more in future
        private void OnChanged(object source, FileSystemEventArgs e)
        {
            var eventModel = new WindowsEvent(e.FullPath);

            _logWriter.PushWindowsEvent(eventModel);
        }