コード例 #1
0
        public void CompareTo(FileCollection actual)
        {
            if (this.Count == 0)
                return;

            if (this.Count != actual.Count)
            {
                string files = BuildFileList(actual);
                throw new FormatException("Expected " + this.Count + " files but got " + actual.Count + ":\n" + files);
            }

            Hashtable index = new Hashtable();
            foreach (SourceFile file in actual)
                index[file.Name] = file;

            foreach (SourceFile efile in this.List)
            {
                SourceFile afile = (SourceFile)index[efile.Name];
                if (afile == null)
                {
                    string files = BuildFileList(actual);
                    throw new FormatException("Expected file '" + efile.Name + "' not found in file list:\n" + files);
                }

                efile.CompareTo(afile);
            }
        }
コード例 #2
0
 private string BuildFileList(FileCollection files)
 {
     StringBuilder result = new StringBuilder();
     foreach (SourceFile file in files)
         result.Append(file.Name + "\n");
     return result.ToString();
 }
コード例 #3
0
        public void CompareTo(FileCollection actual)
        {
            if (this.Count == 0)
                return;

            if (this.Count != actual.Count)
                throw new FormatException("Expected " + this.Count + " files but got " + actual.Count);

            Hashtable index = new Hashtable();
            foreach (SourceFile file in actual)
                index[file.Name] = file;

            foreach (SourceFile efile in this.List)
            {
                SourceFile afile = (SourceFile)index[efile.Name];
                if (afile == null)
                {
                    StringBuilder msg = new StringBuilder();
                    msg.Append("Expected file '" + efile.Name + "' not found in file list. Actual list follows:\n");
                    foreach (SourceFile file in actual)
                        msg.Append(file.Name + "\n");
                    throw new FormatException(msg.ToString());
                }

                efile.CompareTo(afile);
            }
        }
コード例 #4
0
ファイル: Package.cs プロジェクト: stahta01/wxCode_components
 public Package()
 {
     Config = new ConfigCollection();
     File = new FileCollection();
 }