Esempio n. 1
0
        protected override void OnStart(string[] args)
        {
            LogProcess.Info("Start");

            timer.Enabled = true;
            timer.Start();
        }
Esempio n. 2
0
        protected override void OnStop()
        {
            LogProcess.Info("Stop");

            timer.Enabled = false;
            timer.Stop();
        }
Esempio n. 3
0
        private void HDForm_Load(object sender, EventArgs e)
        {
            if (_needActive)
            {
                LogProcess.AddLog("Kích hoạt phần mềm");

                Process currentProcess     = Process.GetCurrentProcess();
                string  currentProcessName = currentProcess.ProcessName;

                string cpuId = CryptorEngine.GetCPUID() + "_" + currentProcessName;
                string keyId = CryptorEngine.GetMD5String(CryptorEngine.GetMD5String(cpuId));

                string licenseFile = Path.Combine(Application.StartupPath, "license.hd");

CheckActive:
                string license = "";
                if (File.Exists(licenseFile))
                {
                    try
                    {
                        StreamReader read = new StreamReader(licenseFile);
                        license = read.ReadLine();
                        read.Close();
                    }
                    catch { }
                }

                if (keyId != license)
                {
                    LogProcess.AddLog("Chưa kích hoạt");

                    if (XtraMessageBox.Show("Phần mềm chưa được kích hoạt!\nBạn có muốn kích hoạt ngay bây giờ?",
                                            "Kích hoạt phần mềm", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) != DialogResult.Yes)
                    {
                        LogProcess.AddLog("Không kích hoạt");
                        Process.GetCurrentProcess().Kill();
                        Application.Exit();
                        return;
                    }
                    else
                    {
                        if (new ActivateForm().ShowDialog() == DialogResult.OK)
                        {
                            goto CheckActive;
                        }
                        else
                        {
                            LogProcess.AddLog("Không kích hoạt");
                            Process.GetCurrentProcess().Kill();
                            Application.Exit();
                            return;
                        }
                    }
                }
                else
                {
                    LogProcess.AddLog("Đã kích hoạt");
                }
            }
        }
Esempio n. 4
0
        static void Main()
        {
            gXMLProcess = new xmlDataProcess();
            xmlConfigStart(false);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            mMainSystemManagerForm = new MainSystemManagerForm();
            mNetworkSystemProcess  = new NetworkSystemProcess(mMainSystemManagerForm,
                                                              gXMLDataConfig.mSystemManager.controlServerPort);
            mNetworkSystemProcess.startServer();
            mNetworkSystemProcess.NetworkDataReceivedHandler += NetworkDataReceivedHandler;
            ntTest = new networkTestUtil();

            mLogProc = new LogProcess(gXMLDataConfig.mSystemManager.saveLogfile, mMainSystemManagerForm);

            listener = new Listener(gXMLDataConfig.mSystemManager.NetworkManagerServerPort);
            listener.SocketAccepted += new Listener.SocketAcceptedHandler(listener_SocketAccepted);

            listener.Start("0.0.0.0");

            mMediaControl = new MediaControl();
            string url = gXMLDataConfig.mSystemManager.audioFile;

            mMediaControl.Open(url);

            mLogProc.DebugLog("System Start");
            Application.Run(mMainSystemManagerForm);
        }
        public void ParseLogBuildTest()
        {
            ProjectRebuilding p = new ProjectRebuilding();
            LogProcess        l = p.ParseLogBuild(Utils.ReadFileContent(@"..\..\..\TestingApplication\Log Output\building.log"));

            Assert.AreEqual(l.Warning_count, 0);
            Assert.AreEqual(l.Error_count, 2);
        }
        public IActionResult Logs(LogProcess logProcess)
        {
            var logs = ServiceLocator.AppLogger.Get(logProcess);

            var content = CompileLogs(logs, $"Logs type: {logProcess}");

            return(Content(content));
        }
Esempio n. 7
0
        public void TTT()
        {
            LogProcess.LoginToNess();
            string URL    = SeleniumHelper.GetCurrentURL();
            bool   result = URL.Equals("https://homeil.ness.com/israel/Pages/home.aspx");

            Assert.IsTrue(result, String.Format("Expected for '{0}': true; Actual: {1}",
                                                URL, result));
        }
        private void btnFinalChecker_Click(object sender, EventArgs e)
        {
            if (CurrentModel.Passenger.NowCountryID == CurrentModel.CountryID)
            {
                if (!(cmbxToTheCity.SelectedIndex >= 0))
                {
                    MessageBox.Show("Zehmet Olmasa Gedilen Olkeni Qeyd Edin!", "Melumatlandirma", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    CurrentModel.Passenger.NowCountryID = countryManager.Get(x => x.ID == cmbxToTheCity.SelectedIndex + 1).ID;
                    passengerManager.Update(CurrentModel.Passenger);

                    LogProcess logProcess = new LogProcess();
                    logProcess.ActCode          = (int)ActCode.UgurluSernisinKecidi;
                    logProcess.ProcessDateTime  = DateTime.Now;
                    logProcess.SeriePassengerID = CurrentModel.Passenger.IdentitySerie;
                    logProcess.SerieWorkerID    = CurrentModel.SerieWorkerID;
                    logm.Insert(logProcess);

                    CurrentModel.Passenger   = null;
                    gbxPassengerCard.Visible = false;
                    gbxAirTraectory.Visible  = false;
                    pcbSuccess.Visible       = true;
                }
            }
            else
            {
                LogProcess lastChecking = logm.Get(x => x.ProcessDateTime.Day == DateTime.Now.Day && x.SeriePassengerID == CurrentModel.Passenger.IdentitySerie);
                if (lastChecking != null)
                {
                    MessageBox.Show("Bu Sernisin Artiq Qeydiyyatdan Kecmisdir", "Kecid Melumatlandirma", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    LogProcess logProcess = new LogProcess
                    {
                        ActCode          = (int)ActCode.LokasiyaUyumsuzlugu,
                        ProcessDateTime  = DateTime.Now,
                        SeriePassengerID = CurrentModel.Passenger.IdentitySerie,
                        SerieWorkerID    = CurrentModel.SerieWorkerID
                    };
                    logm.Insert(logProcess);
                    FormMessage formMessage = new FormMessage();
                    formMessage.Show();
                    this.Hide();
                }
            }
        }
Esempio n. 9
0
        public void Success(string key, string message)
        {
            if (!dataCounter.ContainsKey(key))
            {
                dataCounter.Add(key, new Counter()
                {
                    Success = 0,
                    Error   = 0
                });
            }

            ++((Counter)dataCounter[key]).Success;

            LogProcess.WriteLog(LogProcess.LOGTYPE.SUCCESS, message);
        }
Esempio n. 10
0
        public void Error(string key, Exception e)
        {
            if (!dataCounter.ContainsKey(key))
            {
                dataCounter.Add(key, new Counter()
                {
                    Success = 0,
                    Error   = 0
                });
            }

            ++((Counter)dataCounter[key]).Error;

            LogProcess.Error(e, string.Empty);
        }
Esempio n. 11
0
        public Recipient(string name, string address)
        {
            if (Regex.IsMatch(address, @"^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$"))
            {
                this.Name    = name;
                this.Address = address;
            }
            else
            {
                Exception e = new FormatException();

                LogProcess.Error(e, address);

                throw e;
            }
        }
Esempio n. 12
0
        private void InitSMTPServer()
        {
            LogProcess.Info("Initialize SMTP Server Information");

            this.smtpServer = new List <SMTPServer>();

            foreach (string server in ConfigurationManager.AppSettings["SMTPServer"].Split(new char[] { ';', '|' }, StringSplitOptions.RemoveEmptyEntries))
            {
                string[] trimedServer = server.Trim().Split(new char[] { ':' });
                smtpServer.Add(new SMTPServer()
                {
                    Host   = trimedServer[0].Trim(),
                    Port   = Convert.ToInt32(trimedServer[1].Trim()),
                    Weight = 0
                });
            }
        }
Esempio n. 13
0
        static void Main()
        {
            gXMLProcess = new xmlDataProcess();
            xmlConfigStart(false);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            mMainsystemForm = new MainSystemForm();
            mLogProc        = new LogProcess(gXMLDataConfig.SystemConfig.SaveLogFile, mMainsystemForm);

            mSystemManager   = new SystemManager(mMainsystemForm);
            mWatchdogManager = new WatchdogManager(mMainsystemForm);
            mNetworkProecss  = new NetworkProcess(mMainsystemForm);

            mLogProc.LogWrite(LogProcess.LOGTYPE.NORMAL, "Start watchdog Program");
            Application.Run(mMainsystemForm);
        }
Esempio n. 14
0
        static void Main()
        {
            var trace    = ComputerTraceProcess.CreateComputerTrace();
            var log      = new LogProcess().log;
            var textFile = new StudyProcess().study;

            var t = new Timer(1000);

            t.Start();
            t.Elapsed += delegate
            {
                t.Stop();
                try
                {
                    //var ct= ComputerTraceProcess.CreateComputerTrace();

                    //var lst = ct.GetLastInputTime();
                    //var tm = ct.GetIdleTime();

                    //Console.WriteLine($"Last : {lst},MiliSecond : {tm}");

                    ////Console.WriteLine(GetLastUserInput.GetLastUserInput.GetLastInputTime());
                    ////Console.WriteLine(GetLastUserInput.GetIdleTickCount());

                    var msj = $"Last : {trace.GetLastInputTime()},MiliSecond : {trace.GetIdleTime()}";

                    Console.WriteLine(msj);
                    log.WriteLog(msj);

                    textFile.WriteDetail("test.txt", $"Merhaba Dünya {DateTime.Now.Millisecond}");
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }
                finally
                {
                    t.Start();
                }
            };
            Console.ReadLine();
        }
Esempio n. 15
0
        public void Process()
        {
            if (processing || this.smtpServer == null)
            {
                return;
            }
            lock (lockObj)
            {
                processing = true;
            }

            QueueProcess queueProcess = new QueueProcess();

            int blockSleep = Convert.ToInt32(ConfigurationManager.AppSettings["BlockSleep"]);

            ClickOnceDMLib.Structs.Queue queue = queueProcess.GetQueue();

            if (queue != null)
            {
                InitSMTPServer();

                LogProcess.Info("In-Process Start");

                ILog log = new LogCounter(); // log interface

                foreach (Recipient recipient in queue.RecipientData)
                {
                    long baseTick = DateTime.Now.Ticks;

                    var smtp = from s1 in this.smtpServer
                               orderby s1.Weight ascending
                               select s1;

                    SMTPServer serverInfo = smtp.First();

                    SendMailProcess sendMailProcess = new SendMailProcess(log);

                    sendMailProcess.SetHostAndPort(serverInfo.Host, serverInfo.Port);

                    MailAddress mailAddress = null;

                    try
                    {
                        mailAddress = new MailAddress(recipient.Address.Trim(), recipient.Name);
                    }
                    catch (Exception ex)
                    {
                        LogProcess.Error(ex);
                        continue;
                    }

                    if (mailAddress != null)
                    {
                        sendMailProcess.Send(
                            new MailAddress(queue.TicketData.SenderAddress, queue.TicketData.SenderName),
                            new MailAddress[] { mailAddress },
                            queue.TicketData.Subject,
                            queue.TicketData.Body
                            );

                        serverInfo.SetWeight(TimeSpan.FromTicks(DateTime.Now.Ticks - baseTick).Milliseconds);
                    }
                }

                log.Flush(); // write log

                LogProcess.Info("In-Process End");

                Thread.Sleep(blockSleep);
            }

            processing = false;
        }