protected static void ReadEntry(Dictionary<string, ManifestEntry> entries,
                                 RepositoryInfo repInfo, XmlNode node)
 {
     ManifestEntry entry = new ManifestEntry();
     entry.repository = repInfo;
     entry.name = node.Attributes["name"].Value.ToString();
     entry.type = node.Attributes["kind"].Value.ToString();
     if (entry.type == "file") {
         entry.DigestString = node.Attributes["sha1_digest"].Value.ToString();
         entry.length = long.Parse(node.Attributes["size"].Value);
     }
     entries[entry.name] = entry;
 }
        /// <summary>
        ///   Process a directory (including subdirectories) to generate 
        ///   information about the files and directories that are present.
        ///   This will be used in a later pass to determine what actions
        ///   must be taken to bring this in line with the patch info.
        ///   An entry for the directory will be added to the 
        ///   currentManifestDict map.
        /// </summary>
        /// <param name="baseDir">Base directory to patch (e.g. C:\Foo\Bar)</param>
        /// <param name="dir">directory we are scanning (e.g. C:\Foo\Bar\Interface\FrameXML)</param>
        /// <param name="ignores">list of entries that should be ignored</param>
        /// <param name="repInfo">information about the repository</param>
        protected void ProcessDir(string baseDir, string dir, List<IgnoreEntry> ignores, RepositoryInfo repInfo)
        {
            string[] dirs = Directory.GetDirectories(dir);
            string[] files = Directory.GetFiles(dir);

            // Add an entry for our directory
            string shortDir = dir.Substring(baseDir.Length);
            shortDir = shortDir.Replace('\\', '/');
            if (shortDir.StartsWith("/"))
                shortDir = shortDir.Substring(1);
            // If we are excluded from the manifest, just return
            // Do not process subdirectories or files
            if (IsExcluded(repInfo.excludes, shortDir))
                return;

            if (!IsIgnored(ignores, shortDir)) {
                ManifestEntry entry = new ManifestEntry();
                entry.repository = repInfo;
                entry.name = shortDir;
                entry.type = "dir";
                entry.length = 0;
                entry.digest = null;
                currentManifestDict[entry.name] = entry;
            }

            // Add entries for the files in this directory
            foreach (string file in files) {
                if (file.StartsWith(baseDir)) {
                    string name = file.Substring(baseDir.Length);
                    name = name.Replace('\\', '/');
                    if (name.StartsWith("/"))
                        name = name.Substring(1);
                    if (IsIgnored(ignores, name))
                        continue;
                    ProcessFile(name, file, repInfo);
                }
            }

            // Process our subdirectories
            foreach (string subdir in dirs)
                ProcessDir(baseDir, subdir, ignores, repInfo);
        }
 /// <summary>
 ///   Process the given file and add an entry for it in the 
 ///   currentManifestDict map
 /// </summary>
 /// <param name="name">name of the file (relative to base dir)</param>
 /// <param name="file">full path of the file</param>
 /// <param name="repInfo">info about the repository</param>
 protected void ProcessFile(string name, string file, RepositoryInfo repInfo)
 {
     ManifestEntry entry = new ManifestEntry();
     entry.repository = repInfo;
     entry.name = name;
     entry.type = "file";
     try {
         Stream data = File.Open(file, FileMode.Open);
         try {
             long fileLength = data.Length;
             entry.length = fileLength;
             HashAlgorithm digester = new SHA1CryptoServiceProvider();
             byte[] digest = digester.ComputeHash(data);
             entry.digest = digest;
         } finally {
             data.Close();
         }
     } catch (IOException e) {
         Trace.TraceError("Failed to access file: {0} - {1}", file, e.Message);
         entry.length = 0;
         entry.digest = null;
     }
     currentManifestDict[entry.name] = entry;
 }
        protected static void RegisterEntry(Dictionary<string, ManifestEntry> dict,
											ManifestEntry entry)
        {
            dict[entry.name] = entry;
        }