示例#1
0
        /// <summary>
        /// Checks that the file exists
        /// </summary>
        /// <param name="notifier"></param>
        public void Check(ICheckNotifier notifier)
        {
            try
            {
                FileInfo fileInfo = new FileInfo(URL);

                if (fileInfo.Exists)
                {
                    notifier.OnCheckPerformed(
                        new CheckEventArgs(
                            "Found intact attachment file " + fileInfo + " with length " +
                            UsefulStuff.GetHumanReadableByteSize(fileInfo.Length), CheckResult.Success));
                }
                else
                {
                    notifier.OnCheckPerformed(
                        new CheckEventArgs(
                            "File " + fileInfo.FullName + " does not exist (for GovernanceDocument '" + this + "' (ID=" +
                            ID + ")", CheckResult.Fail));
                }
            }
            catch (Exception ex)
            {
                notifier.OnCheckPerformed(
                    new CheckEventArgs(
                        "Failed to check for existance of the file described by GovernanceDocument '" + this + "' (ID=" +
                        ID + ")", CheckResult.Fail, ex));
            }
        }