private void AddInstallationPath(InstallationPaths paths)
        {
            Icon?       icon   = System.Drawing.Icon.ExtractAssociatedIcon(paths.ChromeExePath !);
            ImageSource?source = icon != null?Imaging.CreateBitmapSourceFromHIcon(icon.Handle, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()) : null;                // Turn the icon into an ImageSource for the WPF gui

            this.mainModel.BrowserListModel.ElementList.Add(new InstallationElement(paths.Name, paths)
            {
                Description = paths.ChromeDllPath,
                IconImage   = source,
                Tooltip     = paths.ChromeExePath + " & " + paths.ChromeDllPath,
                IsSelected  = true
            });
        }
        private void AddChromiumInstallation(InstallationPaths chromePaths, bool suppressErrors = true)
        {
            if (!chromePaths.Is64Bit())
            {
                if (!suppressErrors)
                {
                    MessageBox.Show("A 64-bit Chromium installation is required", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                }
                return;
            }

            CustomCheckBox installationBox = new CustomCheckBox(chromePaths.ChromeDllPath);

            installationBox.IsChecked = true;
            installationBox.ToolTip   = chromePaths.ChromeDllPath + " & " + chromePaths.ChromeExePath;

            InstallationList.Items.Add(installationBox);
            Log("Added Chromium installation at " + chromePaths.ChromeDllPath);
        }
Example #3
0
        private static byte[] GetPatchFileBinary(InstallationPaths paths)
        {
            MemoryStream stream = new MemoryStream();
            BinaryWriter writer = new BinaryWriter(stream);

            writer.Write(FILE_HEADER);
            writer.Write(paths.ChromeDllPath.Length);             // Needed, so it takes 4 bytes
            writer.Write(Encoding.ASCII.GetBytes(paths.ChromeDllPath));

            foreach (BytePatch patch in Program.bytePatchManager.BytePatches)
            {
                if (Program.bytePatchManager.DisabledGroups.Contains(patch.group))
                {
                    continue;
                }

                writer.Write(PATCH_HEADER);
                writer.Write(patch.pattern.AlternativePatternsX64.Count);

                foreach (byte[] pattern in patch.pattern.AlternativePatternsX64)
                {
                    writer.Write(pattern.Length);
                    writer.Write(pattern);
                }

                writer.Write(patch.offsets.Count);
                foreach (int offset in patch.offsets)
                {
                    writer.Write(offset);
                }

                writer.Write(patch.origByte);
                writer.Write(patch.patchByte);
                writer.Write(patch.isSig);
                writer.Write(patch.sigOffset);
            }

            writer.Close();
            byte[] data = stream.ToArray();
            stream.Close();
            return(data);
        }
        private static byte[] GetPatchFileBinary(InstallationPaths paths, List <int> disabledGroups)
        {
            MemoryStream stream = new MemoryStream();
            BinaryWriter writer = new BinaryWriter(stream);

            writer.Write(FILE_HEADER);
            writer.Write(paths.ChromeDllPath !.Length);            // Needed, so it takes 4 bytes
            writer.Write(Encoding.ASCII.GetBytes(paths.ChromeDllPath));

            foreach (BytePatch patch in MainClass.BytePatchManager !.BytePatches)
            {
                if (disabledGroups.Contains(patch.Group))
                {
                    continue;
                }

                writer.Write(PATCH_HEADER);
                writer.Write(patch.Pattern.AlternativePatternsX64.Count);

                foreach (byte[] pattern in patch.Pattern.AlternativePatternsX64)                   // Write all possible patterns
                {
                    writer.Write(pattern.Length);
                    writer.Write(pattern);
                }

                writer.Write(patch.Offsets.Count);
                foreach (int offset in patch.Offsets)
                {
                    writer.Write(offset);
                }

                writer.Write(patch.OrigByte);
                writer.Write(patch.PatchByte);
                writer.Write(patch.IsSig);
                writer.Write(patch.SigOffset);
            }

            writer.Close();
            byte[] data = stream.ToArray();
            stream.Close();
            return(data);
        }
Example #5
0
 public InstallationElement(string name, InstallationPaths paths) : base(name)
 {
     this.Paths = paths;
 }