public override bool Verify()
        {
            bool flag = !WmiWrapper.IsFileExisting(base.ComputerName, base.PathName);

            TaskLogger.Trace("FileNotExistCondition.Verify() returns {0}: <Server '{1}', FileName '{2}'>", new object[]
            {
                flag,
                base.ComputerName,
                base.PathName
            });
            return(flag);
        }
        internal void SuspendDatabaseCopyIfNecessary(ReplayConfiguration config)
        {
            string text = string.Empty;

            text = config.TargetMachine;
            if (!this.m_fConfigOnly && !WmiWrapper.IsFileExisting(text, config.DestinationEdbPath))
            {
                string fileName = string.Empty;
                fileName = Path.Combine(config.DestinationLogPath, EseHelper.MakeLogfileName(config.LogFilePrefix, "." + config.LogExtension, 1L));
                if (!WmiWrapper.IsFileExisting(SharedHelper.GetFqdnNameFromNode(config.SourceMachine), fileName))
                {
                    try
                    {
                        this.WriteWarning(Strings.EnableDBCSuspendReplayNoDbComment(config.Name));
                        ReplayRpcClientWrapper.RequestSuspend(text, config.IdentityGuid, Strings.EnableDBCSuspendReplayNoDbComment(config.Name));
                        ReplayEventLogConstants.Tuple_DbSeedingRequired.LogEvent(null, new object[]
                        {
                            config.Name,
                            text
                        });
                    }
                    catch (TaskServerTransientException ex)
                    {
                        ExTraceGlobals.CmdletsTracer.TraceDebug <TaskServerTransientException>((long)this.GetHashCode(), "SeedDatabase: Caught exception in RPC: {0}", ex);
                        base.WriteError(new InvalidOperationException(Strings.SgcFailedToSuspendRpc(config.Name, ex.Message)), ErrorCategory.InvalidOperation, this.Identity);
                    }
                    catch (TaskServerException ex2)
                    {
                        ExTraceGlobals.CmdletsTracer.TraceDebug <TaskServerException>((long)this.GetHashCode(), "SeedDatabase: Caught exception in RPC: {0}", ex2);
                        if (!(ex2 is ReplayServiceSuspendWantedSetException))
                        {
                            if (ex2 is ReplayServiceSuspendRpcPartialSuccessCatalogFailedException)
                            {
                                base.WriteWarning(ex2.Message);
                            }
                            else
                            {
                                base.WriteError(new InvalidOperationException(Strings.SgcFailedToSuspendRpc(config.Name, ex2.Message)), ErrorCategory.InvalidOperation, this.Identity);
                            }
                        }
                    }
                }
            }
        }
        public static bool CheckSeedingPath(string machineFqdn, string logFolderPath, string edbFilePath, string logPrefix)
        {
            LocalLongFullPath.Parse(logFolderPath);
            LocalLongFullPath.Parse(edbFilePath);
            string directoryName = Path.GetDirectoryName(edbFilePath);

            string[] array = new string[]
            {
                logFolderPath,
                directoryName
            };
            string[] array2 = new string[]
            {
                "LogFolderPath",
                "EdbFolderPath"
            };
            for (int i = 0; i < array.Length; i++)
            {
                if (WmiWrapper.IsFileExisting(machineFqdn, array[i]))
                {
                    throw new SeedingPathErrorException(Strings.SeedingErrorDirectoryIsFile(array2[i], array[i]));
                }
            }
            string text = Path.Combine(logFolderPath, logPrefix + ".log");

            if (WmiWrapper.IsDirectoryExisting(machineFqdn, text))
            {
                throw new SeedingPathErrorException(Strings.SeedingErrorFileIsDirectory("CopyLogFile", text));
            }
            if (WmiWrapper.IsDirectoryExisting(machineFqdn, edbFilePath))
            {
                throw new SeedingPathErrorException(Strings.SeedingErrorFileIsDirectory("CopyEdbFilePath", edbFilePath));
            }
            if (WmiWrapper.IsFileExisting(machineFqdn, edbFilePath))
            {
                throw new SeedingPathWarningException(Strings.SeedingEdbFileExists(edbFilePath));
            }
            if (WmiWrapper.IsFileExisting(machineFqdn, text))
            {
                throw new SeedingPathWarningException(Strings.SeedingLogFileExists(text));
            }
            return(true);
        }
        public override bool Verify()
        {
            string dirName = null;

            try
            {
                dirName = LocalLongFullPath.ParseFromPathNameAndFileName(base.PathName, this.logPrefix + ".log").PathName;
            }
            catch (ArgumentException ex)
            {
                TaskLogger.Trace("LogLocationAvailableCondition.Verify() caught exception '{0}': <Server '{1}', PathName '{2}'>", new object[]
                {
                    ex.Message,
                    base.ComputerName,
                    base.PathName
                });
                return(false);
            }
            bool flag = true;

            if (WmiWrapper.IsDirectoryExisting(base.ComputerName, dirName))
            {
                flag = false;
            }
            else if (WmiWrapper.IsFileExistingInPath(base.ComputerName, base.PathName, new WmiWrapper.FileFilter(this.LogFileFilter)))
            {
                flag = false;
            }
            else if (WmiWrapper.IsFileExisting(base.ComputerName, base.PathName))
            {
                flag = false;
            }
            TaskLogger.Trace("LogLocationAvailableCondition.Verify() returns {0}: <Server '{1}', PathName '{2}'>", new object[]
            {
                flag,
                base.ComputerName,
                base.PathName
            });
            return(flag);
        }
Example #5
0
        public override bool Verify()
        {
            string text = null;

            try
            {
                text = LocalLongFullPath.ParseFromPathNameAndFileName(base.PathName, "tmp.edb").PathName;
            }
            catch (ArgumentException ex)
            {
                TaskLogger.Trace("SystemPathAvailableCondition.Verify() caught exception '{0}': <Server '{1}', PathName '{2}'>", new object[]
                {
                    ex.Message,
                    base.ComputerName,
                    base.PathName
                });
                return(false);
            }
            bool flag = true;

            if (WmiWrapper.IsDirectoryExisting(base.ComputerName, text))
            {
                flag = false;
            }
            else if (WmiWrapper.IsFileExisting(base.ComputerName, text))
            {
                flag = false;
            }
            else if (WmiWrapper.IsFileExisting(base.ComputerName, base.PathName))
            {
                flag = false;
            }
            TaskLogger.Trace("SystemPathAvailableCondition.Verify() returns {0}: <Server '{1}', PathName '{2}'>", new object[]
            {
                flag,
                base.ComputerName,
                base.PathName
            });
            return(flag);
        }