Esempio n. 1
0
        public override (string, double) Break(string cipher = null)
        {
            if (cipher == null)
            {
                cipher = this.Cipher;
            }

            string plain   = cipher;
            double maxProb = FrequencyAnalyst.Analyze(cipher);

            for (int i = 1; i < LetterSetSize; i++)
            {
                (string str, bool ok)result = Decode(cipher, i.ToString());
                if (result.ok)
                {
                    double prob = FrequencyAnalyst.Analyze(result.str);
                    if (prob > maxProb)
                    {
                        plain   = result.str;
                        maxProb = prob;
                    }
                }
            }

            this.Plain = plain;
            ProcessLog.Enqueue(plain);
            ProcessLog.Enqueue("");
            return(plain, Math.Pow(Math.E, maxProb));
        }
Esempio n. 2
0
        public async Task <IActionResult> Edit(int id, [Bind("LogId,TradingPartnerCode,RecordYear,RecordMonth,GrievanceTotal,GrievanceSubmits,GrievanceErrors,AppealTotal,AppealSubmits,AppealErrors,COCTotal,COCSubmits,COCErrors,OONTotal,OONSubmits,OONErrors,PCPATotal,PCPASubmits,PCPAErrors,RunStatus,RunTime,RunBy")] ProcessLog processLog)
        {
            if (id != processLog.LogId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(processLog);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProcessLogExists(processLog.LogId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(processLog));
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            // Remove this to get on-screen logging
            ProcessLog.Subscribe(Console.WriteLine);

            var ping = ProcessId.None;
            var pong = ProcessId.None;

            // Start a process which simply writes the messages it receives to std-out
            var logger = spawn <string>("logger", Console.WriteLine);

            // Ping process
            ping = spawn <string>("ping", msg =>
            {
                tell(logger, msg);
                tell(pong, "ping", TimeSpan.FromMilliseconds(100));
            });

            // Pong process
            pong = spawn <string>("pong", msg =>
            {
                tell(logger, msg);
                tell(ping, "pong", TimeSpan.FromMilliseconds(100));
            });

            // Trigger
            tell(pong, "start");


            Console.ReadKey();
        }
Esempio n. 4
0
        //
        //  Launch a process that adds the int sent in a message to its state
        //  Then calls itself after a second to do the same again.  The state value gradually
        //  increases.
        //
        //  If you stop the sample and restart you'll notice the state has been persisted
        //
        static void Main(string[] args)
        {
            // Log what's going on
            ProcessLog.Subscribe(Console.WriteLine);

            // Let Language Ext know that Redis exists
            RedisCluster.register();

            // Connect to the Redis cluster
            Cluster.connect("redis", "redis-test", "localhost", "0");

            // Spawn the process
            var pid = spawn <string>("redis-inbox-sample", Inbox, ProcessFlags.PersistInbox);

            Console.WriteLine("Press a key to add 100 messages to the process queue");
            Console.WriteLine(" - The process queue has a Thread.Sleep(200) in it");
            Console.WriteLine(" - So it takes 20 seconds to get through all of the messages");
            Console.WriteLine(" - If you quit the sample and restart, you should see the ");
            Console.WriteLine(" - inbox has persisted.");
            Console.WriteLine("");
            Console.WriteLine("Press a key");
            Console.ReadKey();

            var rnd = new Random();

            for (var i = 0; i < 100; i++)
            {
                tell(pid, "Message sent: " + DateTime.Now + " " + DateTime.Now.Ticks + " " + rnd.Next());
            }

            Console.ReadKey();
        }
        public async Task <Guid> Handle(AddMoneyToWallet request, CancellationToken cancellationToken)
        {
            Money money = new Money
            {
                Amount       = request.Amount,
                WalletId     = request.WalletId,
                CreatedDate  = DateTime.Now,
                CurrencyCode = request.CurrencyCode,
                Id           = Guid.NewGuid()
            };
            ProcessLog processLog = new ProcessLog
            {
                Amount       = request.Amount,
                CurrencyCode = request.CurrencyCode,
                CreatedDate  = DateTime.Now,
                LogType      = ProcessLogType.Deposit
            };
            await _context.Moneys.AddAsync(money, cancellationToken);

            await _context.ProcessLogs.AddAsync(processLog, cancellationToken);

            var create = await _context.SaveChangesAsync(cancellationToken);

            return(money.Id);
        }
Esempio n. 6
0
        public List <CompareResult> SourceCompare(string sourcePath, string destinationPath)
        {
            List <CompareResult> _sourceResults = new List <CompareResult>();

            try
            {
                List <string> sourceFiles      = FolderLister.GetAllFiles(sourcePath);
                List <string> destinationFiles = FolderLister.GetAllFiles(destinationPath);

                _worker.ReportProgress(15);

                foreach (string fileOrFolder in sourceFiles)
                {
                    if (fileOrFolder.IsFile())
                    {
                        _sourceResults.Add(ProcessFile(fileOrFolder, destinationFiles, CompareDirection.SOURCE));
                    }
                    else if (BaseInfo.IncludeSubDiretory)
                    {
                        _sourceResults.AddRange(ProcessFolder(fileOrFolder, destinationFiles, CompareDirection.SOURCE));
                    }
                }

                _worker.ReportProgress(30);
            }
            catch (Exception ex)
            {
                ProcessLog.logError(ex.Message);
            }
            return(_sourceResults);
        }
Esempio n. 7
0
        private void bWComparer_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            string status = "Process completed";

            ProcessLog.logInfo(status);
            MessageBox.Show(status, "Folder Replicater");
            return;
        }
Esempio n. 8
0
 private void FrmMain_Load(object sender, EventArgs e)
 {
     ProcessLog.logInfo("loading user data");
     txtSourcePath.Text       = Properties.Settings.Default.SourcePath;
     txtDestinationPath.Text  = Properties.Settings.Default.DestinationPath;
     chkDontDelete.Checked    = Properties.Settings.Default.DoNotDelete;
     chkIncludeSubDir.Checked = Properties.Settings.Default.IncludeSubDirectory;
 }
Esempio n. 9
0
        string Tweet(DateTime start, DateTime exit)
        {
            var today = ProcessLog.Count(exit);
            var all   = ProcessLog.Count();
            var time  = (exit - start).PrettyPrint();

            return(String.Format(tweetFormat, today, all, time));
        }
Esempio n. 10
0
//  Sample data:
//log 1 init:    ***OK***,,,,
//log 1 status:    ***OK***,,,,
//log 1 SD card:    ***OK***,,,,
//log 1 root dir:    ***OK***,,,,
//log 1 log file:    ***OK***,,,,
//log 2 init:    ***OK***,,,,
//log 2 status:    ***OK***,,,,
//log 2 SD card:    ***OK***,,,,
//log 2 root dir:    ***OK***,,,,
//log 2 log file:    ***OK***,,,,
//real-time clock:    ***OK***,,,,
//light sensor:    ***OK***,,,,
//Reading settings...,,,,
//Gain:,2, Integration Time:,800,
//,,,,
//date,time,lux,sound,temp(F)
//5/14/2020,16:10:27,235,79,69.7
//5/14/2020,16:10:38,227,80.3,69.5
//5/14/2020,16:10:49,235,74.2,69.1
//5/14/2020,16:11:00,235,44.1,69
//5/14/2020,16:11:11,233,82.9,68.9
//5/14/2020,16:11:21,235,41.5,68.8



    public SleepEnvironment()
    {
        //
        // TODO: Add constructor logic here
        //
        log = new ProcessLog("SleepEnvironment processing log");
        CreateTable();
    }
Esempio n. 11
0
        private static void GetPock()
        {
            ProcessLog log = new ProcessLog("pockLog\\");

            var           pn      = "7";
            var           sa      = "1000";
            List <string> list    = new List <string>();
            string        context = string.Empty;
            DZPockService service = new DZPockService();
            //service.showPock();
            var eq = service.OprationShuffle();

            service.CreatePockRoom(int.Parse(pn), int.Parse(sa));

            while (true)
            {
                try
                {
                    log.Logger.Debug("Staret.......");
                    //Console.Write("P:");
                    //var pn = Console.ReadLine();
                    //Console.Write("S:");
                    //var sa = Console.ReadLine();

                    Console.WriteLine(string.Format("P:{0}  S:{1}", pn, sa));

                    service.PlayPock();
                    service.showComPock();
                    service.GetCapitall();
                    service.RecyclePock();

                    //var allCount = eq.Count;
                    //for (int i = 0; i < allCount; i++)
                    //{
                    //    var p = eq.Dequeue();
                    //    context += p.Num + "-" + p.Col + "\t";
                    //    if ((i + 1) % 13 == 0)
                    //    {
                    //        Console.WriteLine(context);
                    //        context = string.Empty;
                    //    }
                    //}
                    if (Console.ReadLine().ToUpper() == "CLOSE")
                    {
                        break;
                    }
                    else
                    {
                        Console.WriteLine("==========================================================================");
                    }
                }
                catch (Exception ex)
                {
                    log.Logger.Error("Error: " + ex.Message);
                    Console.WriteLine("Error: " + ex.Message);
                }
            }
        }
Esempio n. 12
0
        public Docvers(int mydocversid, string filepath, bool noColHeaders)
        {
            noColumnHeaders    = noColHeaders;
            processing_results = new ProcessLog(String.Format("Load Doc (docversid={0})", mydocversid));

            docversid = mydocversid;

            LoadDoc(filepath);
        }
Esempio n. 13
0
        public REDCap(int studyID)
        {
            _studyID        = studyID;
            idfld           = "id";
            _import_results = new ProcessLog("REDCap import");

            LoadTokens();
            GetAPIInfo();
        }
Esempio n. 14
0
 private void FrmMain_FormClosing(object sender, FormClosingEventArgs e)
 {
     ProcessLog.logInfo("Saving user data");
     Properties.Settings.Default.SourcePath          = txtSourcePath.Text;
     Properties.Settings.Default.DestinationPath     = txtDestinationPath.Text;
     Properties.Settings.Default.IncludeSubDirectory = chkIncludeSubDir.Checked;
     Properties.Settings.Default.DoNotDelete         = chkDontDelete.Checked;
     Properties.Settings.Default.Save();
 }
Esempio n. 15
0
        public override void Attack()
        {
            TargetProcess targetProcess = new TargetProcess();

            targetProcess.GeneralID = TagetGeneral.GeneralID;
            targetProcess.Position  = TagetGeneral.Position.ToShort();
            targetProcess.Role      = TagetRole;
            targetProcess.LiveNum   = TagetGeneral.LifeNum;
            targetProcess.Momentum  = TagetGeneral.Momentum;

            ProccessExtendAttack();
            int     damageNum  = GetPhysicalDamageNum(TagetGeneral);
            decimal hitPercent = 0;
            bool    isHit      = General.TriggerHitPercent(TagetGeneral, out hitPercent);

            ProcessLog.AddPercent(1, hitPercent);
            if (isHit)
            {
                targetProcess.IsShanBi = false;
                //普通攻击\防御加气势
                General.Momentum = MathUtils.Addition(General.Momentum, MomentumAttack, short.MaxValue);
                if (!TagetGeneral.IsJueduifangyuStatus)
                {
                    TagetGeneral.Momentum = MathUtils.Addition(TagetGeneral.Momentum, MomentumDefense, short.MaxValue);
                }
                DoTargetDefense(damageNum, targetProcess, false);
                //攻击加血
                decimal attackLife = TrumpAbilityAttack.GetEffect(General, AbilityType.AttackLife);
                if (attackLife > 0)
                {
                    ProcessLog.TrumpStatusList.Add(TrumpAbilityAttack.GetSkillprocess(AbilityType.AttackLife, -(int)(damageNum * attackLife)));
                    General.LifeNum = (int)Math.Floor(MathUtils.Addition(General.LifeNum, damageNum * attackLife, General.LifeMaxNum));
                }

                //反伤
                decimal fangShang = TrumpAbilityAttack.GetEffect(TagetGeneral, AbilityType.FanShang);
                if (fangShang > 0)
                {
                    int num = (int)(damageNum * fangShang);
                    targetProcess.TrumpStatusList.Add(TrumpAbilityAttack.GetSkillprocess(AbilityType.FanShang, num));
                    General.LifeNum = (int)Math.Floor(MathUtils.Subtraction(General.LifeNum, damageNum * fangShang));
                }
            }
            else
            {
                targetProcess.IsShanBi = true;
                TagetGeneral.TriggerShanBi();
            }
            targetProcess.Momentum     = TagetGeneral.Momentum;
            targetProcess.TargetStatus = TagetGeneral.BattleStatus;
            ProcessLog.Momentum        = General.Momentum;
            ProcessLog.LiveNum         = General.LifeNum;
            ProcessLog.AttStatus       = General.BattleStatus;
            ProcessLog.IsMove          = General.IsMove;
            ProcessLog.TargetList.Add(targetProcess);
        }
Esempio n. 16
0
        protected void Application_Start(object sender, EventArgs e)
        {
            ProcessLog.startup(None);

            // Ping-pong server process
            spawn <string>("pingpong", PingPong.Inbox);

            // Chat server process
            spawn <string>("chat", msg => publish(msg));
        }
        private void Seed(StorageContext context, ProcessLog model)
        {
            var items = new[]
            {
                model
            };

            context.ProcessLogs.AddRange(items);
            context.SaveChanges();
        }
Esempio n. 18
0
        public ProcessLog SetProcessLog(ProcessLogTypes type, int id, DateTime time)
        {
            var log = new ProcessLog();

            log.Type          = (int)type;
            log.SourceId      = id;
            log.TargetRunTime = time;
            log.Timestamp     = DateTime.UtcNow;

            return(SaveProcessLog(log));
        }
Esempio n. 19
0
        public async Task <ProcessLog> SetProcessLogAsync(ProcessLogTypes type, int id, DateTime time, CancellationToken cancellationToken = default(CancellationToken))
        {
            var log = new ProcessLog();

            log.Type          = (int)type;
            log.SourceId      = id;
            log.TargetRunTime = time;
            log.Timestamp     = DateTime.UtcNow;

            return(await SaveProcessLogAsync(log, cancellationToken));
        }
Esempio n. 20
0
        public async Task <IActionResult> Create([Bind("LogId,TradingPartnerCode,RecordYear,RecordMonth,GrievanceTotal,GrievanceSubmits,GrievanceErrors,AppealTotal,AppealSubmits,AppealErrors,COCTotal,COCSubmits,COCErrors,OONTotal,OONSubmits,OONErrors,PCPATotal,PCPASubmits,PCPAErrors,RunStatus,RunTime,RunBy")] ProcessLog processLog)
        {
            if (ModelState.IsValid)
            {
                _context.Add(processLog);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(processLog));
        }
Esempio n. 21
0
        public ProcessLog CreateEmptyLog()
        {
            ProcessLog p = new ProcessLog()
            {
                Detail = ""
            };

            _context.Add(p);
            _context.SaveChanges();
            return(p);
        }
Esempio n. 22
0
 public int UpdateLog(ProcessLog _Log)
 {
     try
     {
         _context.ProcessLogs.Update(_Log);
         return(_context.SaveChanges());
     }
     catch (Exception ex)
     {
         return(0);
     }
 }
Esempio n. 23
0
 public static void Inbox(string msg)
 {
     if (msg == "ping")
     {
         ProcessLog.tellInfo("pong");
         Process.tell(Process.Sender, "pong");
     }
     else
     {
         ProcessLog.tellInfo("ping");
         Process.tell(Process.Sender, "ping");
     }
 }
Esempio n. 24
0
        private static void WriteResult(ContextService db, int idProcess, int idStep, String message)
        {
            ProcessLog log = new ProcessLog();

            log.IdProcess     = idProcess;
            log.IdProcessStep = idStep;
            log.AsignarId();
            log.Result = message;
            log.UsrIng = "admin";
            log.FecIng = DateTime.Now;
            db.ProcessLogs.Insert(log);
            db.Save();
        }
Esempio n. 25
0
        public static void WriteError(int idProcess, int idStep, string ex)
        {
            ProcessLog log = new ProcessLog();

            log.IdProcess     = idProcess;
            log.IdProcessStep = idStep;
            log.AsignarId();
            log.ErrorLog = ex;
            log.UsrIng   = "admin";
            log.FecIng   = DateTime.Now;
            db.ProcessLogs.Insert(log);
            db.Save();
        }
Esempio n. 26
0
        public void Update(int bugId, string toAppend, string statusName, string assignTo, string project)
        {
            var bug       = GetById(bugId);
            var now       = DateTime.Now;
            var newStatus = GetStatusByName(statusName);

            // dont trigger an update if to append is an empty string
            if (toAppend != null && toAppend != "")
            {
                // format new message
                var newMessage = now + "<br />" + toAppend + "<br /><br />";
                // if log is empty, create. if not, append
                if (bug.LogDetail == null)
                {
                    ProcessLog newLog = new ProcessLog()
                    {
                        Detail = newMessage
                    };
                    bug.LogDetail = newLog;
                    _context.Add(newLog);
                }
                else
                {
                    _context.Update(bug);
                    bug.LogDetail.Detail = bug.LogDetail.Detail + newMessage;
                }
            }
            if (project != null)
            {
                _context.Update(bug);
                bug.ProjectAffected = GetProjectByName(project);
            }
            if (assignTo != null)
            {
                _context.Update(bug);
                bug.AssignedTo = _context.Users.FirstOrDefault(user => user.UserName == assignTo);
                if (statusName == "Open")
                {
                    bug.Status = GetStatusByName("Assigned");
                    _context.SaveChanges();
                    return;
                }
            }
            // check if update is nessecary
            if (newStatus != null && bug.Status != newStatus)
            {
                _context.Update(bug);
                bug.Status = newStatus;
            }
            _context.SaveChanges();
        }
Esempio n. 27
0
 public long AddLog(ProcessLog NewLog)
 {
     try
     {
         var LogRes = _context.ProcessLogs.Add(NewLog);
         _context.SaveChanges();
         return(Int32.Parse(LogRes.Entity.Id.ToString()));
     }
     catch (Exception ex)
     {
         var r = ex.Message;
         return(0);
     }
 }
Esempio n. 28
0
        private List <CompareResult> ProcessFolder(string fileOrFolder, List <string> otherFiles, CompareDirection direction)
        {
            List <CompareResult> results = new List <CompareResult>();

            try
            {
                string dirName          = '\\' + fileOrFolder.GetCurrentDir();
                string correspondingDir = otherFiles.SingleOrDefault(r => r.IsDirectory() && r.EndsWith(dirName));
                if (correspondingDir != null)
                {
                    List <string> sourceFiles      = FolderLister.GetAllFiles(fileOrFolder);
                    List <string> destinationFiles = FolderLister.GetAllFiles(correspondingDir);

                    if (sourceFiles.Count == 0 && destinationFiles.Count == 0)
                    {
                        results.Add(ProcessEmptyDirectory(fileOrFolder, correspondingDir, direction));
                    }
                    else
                    {
                        foreach (string fileorFolder in destinationFiles)
                        {
                            results.AddRange(ProcessByType(fileorFolder, destinationFiles, direction));
                        }
                    }
                }
                else
                {
                    List <string> files = FolderLister.GetAllFiles(fileOrFolder);

                    if (files.Count > 0)
                    {
                        foreach (var file in files)
                        {
                            results.AddRange(ProcessByType(file, null, direction));
                        }
                    }
                    else
                    {
                        results.Add(ProcessEmptyDirectory(fileOrFolder, string.Empty, direction));
                    }
                }
            }
            catch (Exception ex)
            {
                ProcessLog.logError(ex.Message);
            }

            return(results);
        }
Esempio n. 29
0
        /// <summary>
        /// Thread de interface exibe o progresso de execução do processo
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Cicle_Run_ProgressChanged(object sender, ProgressChangedEventArgs e)
        {
            UpdateCounters();
            try
            {
                UpdateInExecutionProcess(motor.To_run);

                while (motor.Escalonamento_log.Count() > 0)
                {
                    ProcessLog get = (ProcessLog)(motor.Escalonamento_log.Remover());
                    listlog.Items.Add("Processo de ID " + get.Processo.Pid + " foi removido da prioridade " + get.Operation_from + " e inserido na prioridade " + get.Operation_to);
                    item_to_execute.SubItems[2].Text = get.Operation_to.ToString();

                    listProcessos.Select();
                    item_to_execute.Selected = true;
                    item_to_execute.BackColor = Color.Yellow;
                    listProcessos.EnsureVisible(item_to_execute.Index);

                    if (motor.ToUP != null)
                    {
                        ListViewItem item = GetProcessInListView(motor.ToUP);
                        item.SubItems[2].Text = get.Operation_to.ToString();
                        motor.ToUP = null;
                    }
                }
                if (item_to_execute != null && motor.To_run != null)
                {
                    item_to_execute.SubItems[item_to_execute.SubItems.Count - 2].Text = "Em execução";
                    item_to_execute.SubItems[item_to_execute.SubItems.Count - 3].Text = motor.To_run.Ciclos_executados.ToString();
                    item_to_execute.SubItems[item_to_execute.SubItems.Count - 1].Text = CalcPercentage(motor.To_run.Ciclo, motor.To_run.Ciclos_executados).ToString() + "%";
                    if (motor.To_run.Ciclos_executados == motor.To_run.Ciclo)
                    {
                        item_to_execute.SubItems[item_to_execute.SubItems.Count - 2].Text = "Finalizado";
                        listProcessos.Items[item_to_execute.Index].Remove();
                        ListViewItem item_finalizado = new ListViewItem();

                        item_finalizado.Text = item_to_execute.Text;
                        item_finalizado.SubItems.Add(item_to_execute.SubItems[1]);
                        item_finalizado.SubItems.Add(item_to_execute.SubItems[2]);
                        item_finalizado.SubItems.Add(item_to_execute.SubItems[3]);
                        item_finalizado.SubItems.Add(item_to_execute.SubItems[4]);
                        ListFinalizados.Items.Add(item_finalizado);
                        SelectLastFinished();
                    }
                    else item_to_execute.SubItems[item_to_execute.SubItems.Count - 2].Text = "Em espera";
                }
            }
            catch { }
        }
Esempio n. 30
0
        // POST api/<controller>
        public HttpStatusCodeResult Post([FromBody] ProcessView value)
        {
            if (!ModelState.IsValid)
            {
                var errors = ModelState.Values.SelectMany(v => v.Errors).Select(e => e.Exception);
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest, string.Join(" | ", errors)));
            }
            ProcessLog log = new ProcessLog();

            log.Type      = value.Type;
            log.ProcessID = dal.GetEntities <Process>(c => c.name == value.ProcessName).FirstOrDefault().id;
            log.FkId      = value.FkId;
            log.LogAT     = DateTime.UtcNow;
            dal.Add <ProcessLog>(log);
            return(new HttpStatusCodeResult(HttpStatusCode.OK));
        }
Esempio n. 31
0
        public XMLClient( string ftp,
                        string id,
                        string pwd,
                        string unzipPwd,
                        string downloadPath,
                        string dbString )
        {
            this.ftp = ftp;
            this.id = id;
            this.pwd = pwd;
            this.unzipPwd = unzipPwd;
            this.downloadPath = downloadPath;
            this.dbString = dbString;
            ecKey = Config.getConfig("EC_KEY");
            execDate = Config.getConfig("EXEC_DATE");

            if (execDate == "") { execDate = DateTime.Now.ToString("yyyyMMdd"); }

            pl= new ProcessLog(execDate + ".log");
        }
Esempio n. 32
0
        /// <summary>
        /// Keeps reading a log file as it's being written to by another process until it exits.
        /// </summary>
        /// <param name="LogFilename">Name of the log file.</param>
        /// <param name="LogProcess">Process that writes to the log file.</param>
        /// <param name="OnLogRead">Callback used to process the recently read log contents.</param>
        protected static void LogFileReaderProcess(string LogFilename, ProcessResult LogProcess, ProcessLog OnLogRead = null)
        {
            while (!FileExists(LogFilename) && !LogProcess.HasExited)
            {
                Log("Waiting for logging process to start...");
                Thread.Sleep(2000);
            }
            Thread.Sleep(1000);

            using (FileStream ProcessLog = File.Open(LogFilename, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
            {
                StreamReader LogReader = new StreamReader(ProcessLog);
                bool bKeepReading = true;

                // Read until the process has exited.
                while (!LogProcess.HasExited && bKeepReading)
                {
                    while (!LogReader.EndOfStream && bKeepReading)
                    {
                        string Output = LogReader.ReadToEnd();
                        if (Output != null && OnLogRead != null)
                        {
                            bKeepReading = OnLogRead(Output);
                        }
                    }

                    while (LogReader.EndOfStream && !LogProcess.HasExited && bKeepReading)
                    {
                        Thread.Sleep(250);
                        // Tick the callback so that it can respond to external events
                        if (OnLogRead != null)
                        {
                            bKeepReading = OnLogRead(null);
                        }
                    }
                }
            }
        }