public void Run()
        {
            // Load the imput file.
            XDocument       InputDoc  = XDocument.Load(InputFilename);
            XDocument       PatchDoc  = XDocument.Load(PatchFilename);
            List <XElement> resources = PatchDoc.Root.Element("files").Elements().ToList();

            for (int i = 0; i < resources.Count; i++)
            {
                string             filepath = "";
                DependencyResource resource = new DependencyResource(resources[i], filepath);

                // Find the record in the patch.
                XElement        patchElement = null;
                List <XElement> patchFiles   = PatchDoc.Root.Element("files").Elements().ToList();
                for (int j = 0; j < patchFiles.Count; j++)
                {
                    if (patchFiles[j].Name.ToString().Equals(resource.name))
                    {
                        patchElement = patchFiles[i];
                        break;
                    }
                }

                // Stage the differences.
                resource.Stage(this, patchElement);
            }

            // Save the patch.
            PatchDoc.Save(PatchFilename);
        }
        public void Run()
        {
            // Load the imput file.
            XDocument InputDoc = XDocument.Load(InputFilename);
            XDocument PatchDoc = XDocument.Load(PatchFilename);
            List<XElement> resources = PatchDoc.Root.Element("files").Elements().ToList();
            for (int i = 0; i < resources.Count; i++)
            {
                string filepath = "";
                DependencyResource resource = new DependencyResource(resources[i], filepath);

                // Find the record in the patch.
                XElement patchElement = null;
                List<XElement> patchFiles = PatchDoc.Root.Element("files").Elements().ToList();
                for (int j = 0; j < patchFiles.Count; j++)
                {
                    if (patchFiles[j].Name.ToString().Equals(resource.name))
                    {
                        patchElement = patchFiles[i];
                        break;
                    }
                }

                // Stage the differences.
                resource.Stage(this, patchElement);
            }

            // Save the patch.
            PatchDoc.Save(PatchFilename);
        }
        public static bool VerifyFile(string filename, DependencyResource resource)
        {
            // Get file info.
            FileInfo f = new FileInfo(filename);

            // Get the size and hash we're checking against.
            long size = 0;
            string checkHash = "";
            if (f.Extension.Equals(".lzma"))
            {
                size = resource.downloadSize;
                checkHash = resource.downloadHash;
            }
            else
            {
                size = resource.size;
                checkHash = resource.hash;
            }

            return VerifyFile(filename, checkHash, size);
        }
        public static bool VerifyFile(string filename, DependencyResource resource)
        {
            // Get file info.
            FileInfo f = new FileInfo(filename);

            // Get the size and hash we're checking against.
            long   size      = 0;
            string checkHash = "";

            if (f.Extension.Equals(".lzma"))
            {
                size      = resource.downloadSize;
                checkHash = resource.downloadHash;
            }
            else
            {
                size      = resource.size;
                checkHash = resource.hash;
            }

            return(VerifyFile(filename, checkHash, size));
        }