ReadExistingTextFile() public static method

public static ReadExistingTextFile ( string fileName ) : string
fileName string
return string
コード例 #1
0
        private bool WaitForBackupCompletion()
        {
            Assert.IsNotNull(_application);

            for (int i = 0; i < 40; i++)
            {
                try
                {
                    string logFile = _application.Settings.Backup.LogFile;

                    string contents = Utilities.ReadExistingTextFile(logFile);

                    if (contents.IndexOf("Backup completed successfully") > 0)
                    {
                        return(true);
                    }

                    if (contents.IndexOf("BACKUP ERROR:") > 0)
                    {
                        return(false);
                    }
                }
                catch (Exception)
                {
                    // probably a share access violation.
                }

                Thread.Sleep(250);
            }

            return(false);
        }