Ejemplo n.º 1
0
        protected override Boolean PatchFile(String fileName)
        {
            PatchFinder finder = UXThemePatchFinderFactory.Create(fileName);
            Patch       patch  = finder.GetPatchStatus();

            if (patch.CanPatch)
            {
                patch.ApplyPatch();

                Miscellaneous.CorrectPEChecksum(fileName);

                return(true);
            }
            else
            {
                File.Delete(fileName);

                String reason = "";
                foreach (PatchEntry entry in patch.Entries)
                {
                    reason += entry.Status + "; ";
                }

                Package.Log.Add(LogSeverity.Warning, "Did not UxTheme Patch: " + fileName + " because \"" + reason + "\", deleted working file");

                return(false);
            }
        }
Ejemplo n.º 2
0
        public override void CommitChanges()
        {
            if (IsReadOnly)
            {
                throw new InvalidOperationException(
                          "Changes cannot be commited because the current ResourceSource is read-only"
                          );
            }

            var finalizeNT6 = false;

            if (System.Environment.OSVersion.Version.Major >= 6)
            {
                finalizeNT6 = PrepareNT6Update();
            }

            // Unload self
            if (LoadMode > 0)
            {
                Unload(); // don't unload before PrepareNT6Update() because it needs the valid handle to load the MUI bytes first
            }
            CommitChangesImpl();

            if (finalizeNT6)
            {
                FinishNT6Update();
            }

            Miscellaneous.CorrectPEChecksum(FileInfo.FullName);

            if (LoadMode > 0)
            {
                Reload();
            }
        }