Exemplo n.º 1
0
        //------------------------------------------------------------------------------------------------------
        //EXPERIMENT!
        private void cmdMacBuildPatchesFromSrc_Click(object sender, EventArgs e)
        {
            //EXPERIMENT!
            string srcRootDir = @"D:\projects\cef_binary_3.3071.1647.macos\tests\cefclient";

            PatchBuilder builder = new PatchBuilder(new string[] {
                srcRootDir,
                @"D:\projects\cef_binary_3.3071.1647.macos\tests\shared"
            });

            builder.MakePatch();

            //2. save patch to...
            string saveFolder = "d:\\WImageTest\\cefbridge_patches_mac";

            builder.Save(saveFolder);

            ////3. test load those patches
            //PatchBuilder builder2 = new PatchBuilder(srcRootDir);
            //builder2.LoadPatchesFromFolder(saveFolder);

            //----------
            //copy extension code
            FolderUtils.CopyFileInFolder(saveFolder,
                                         @"D:\projects\Kneadium\NativePatcher\cefbridge_patches_mac"
                                         );
            //copy ext from actual src
            FolderUtils.CopyFileInFolder(srcRootDir + "\\myext",
                                         @"D:\projects\Kneadium\NativePatcher\BridgeBuilder\Patcher_ExtCode_mac\myext");
        }
Exemplo n.º 2
0
        private void cmdCreatePatchFiles_Click(object sender, EventArgs e)
        {
            //1. analyze modified source files, in source folder
            PatchBuilder builder = new PatchBuilder(new string[] {
                _cefSrcRootDir + @"\tests\cefclient",
                _cefSrcRootDir + @"\tests\shared"
            });

            builder.MakePatch();

            //2. save patch to...
            string newPatchFolder = _selectedPreSet.NewlyCreatedPatchSaveToFolder;

            builder.Save(newPatchFolder);

            ////----------------------------------
            //3.1 copy newly generate patch to backup folder
            //this code will push to github ***
            //----------------------------------
            string backup_NativePatcher = _selectedPreSet.Backup_NativePatcher_Folder;
            string backup_NativePatcher_BridgeBuilder_folder = _selectedPreSet.Backup_NativePatcher_BridgeBuilder;

            FolderUtils.CopyFileInFolder(newPatchFolder, backup_NativePatcher);

            //3.2 copy newly generate patch to backup folder
            //this code will push to github (same)
            FolderUtils.CopyFileInFolder(
                _cefSrcRootDir + @"\tests\cefclient\myext",
                backup_NativePatcher_BridgeBuilder_folder + @"\Patcher_ExtCode\myext");
            //3.3 copy newly generate patch to backup folder
            //this code will push to github  (same)
            FolderUtils.CopyFileInFolder(
                _cefSrcRootDir + @"\libcef_dll\myext",
                backup_NativePatcher_BridgeBuilder_folder + @"\Patcher_ExtCode_libcef_dll\myext");
            //----------
            //3.4 copy file by file
            //this code will push to github  (same)
            FolderUtils.CopyFile(_cefSrcRootDir + "\\include\\cef_base.h",
                                 backup_NativePatcher_BridgeBuilder_folder + @"\Patcher_ExtCode_Others");
            //3.5 //this code will push to github  (same)
            FolderUtils.CopyFile(_cefSrcRootDir + "\\libcef_dll\\ctocpp\\ctocpp_ref_counted.h",
                                 backup_NativePatcher_BridgeBuilder_folder + @"\Patcher_ExtCode_Others");
            //3.6 //this code will push to github  (same)
            FolderUtils.CopyFile(_cefSrcRootDir + "\\libcef_dll\\cpptoc\\cpptoc_ref_counted.h",
                                 backup_NativePatcher_BridgeBuilder_folder + @"\Patcher_ExtCode_Others");
            //
        }
Exemplo n.º 3
0
        private void cmdCopyDevSnap_Click(object sender, EventArgs e)
        {
            string snapBackupFolder = _selectedPreSet.Backup_NativePatcher_BridgeBuilder_DevSnapFolder;

            //check if we have snap folder,
            //if not => create it
            FolderUtils.CopyFolder(_cefSrcRootDir + "\\libcef_dll", snapBackupFolder);
            FolderUtils.CopyFolder(_cefSrcRootDir + "\\tests", snapBackupFolder);
            FolderUtils.CopyFolder(_cefSrcRootDir + "\\include", snapBackupFolder);

            //----------
            //backup existing generated patch result
            string newPatchFolder      = _selectedPreSet.NewlyCreatedPatchSaveToFolder;
            string devSnap_tempPatches = _selectedPreSet.Backup_NativePatcher_BridgeBuilder_DevSnapFolder_TempPatches;

            string backup_NativePatcher_BridgeBuilder_folder = _selectedPreSet.Backup_NativePatcher_BridgeBuilder;

            FolderUtils.CopyFileInFolder(newPatchFolder, devSnap_tempPatches);

            //3.2 copy newly generate patch to backup folder
            //this code will push to github (same)
            FolderUtils.CopyFileInFolder(
                _cefSrcRootDir + @"\tests\cefclient\myext",
                backup_NativePatcher_BridgeBuilder_folder + @"\Patcher_ExtCode\myext");
            //3.3 copy newly generate patch to backup folder
            //this code will push to github  (same)
            FolderUtils.CopyFileInFolder(
                _cefSrcRootDir + @"\libcef_dll\myext",
                backup_NativePatcher_BridgeBuilder_folder + @"\Patcher_ExtCode_libcef_dll\myext");
            //----------
            //3.4 copy file by file
            //this code will push to github  (same)
            FolderUtils.CopyFile(_cefSrcRootDir + "\\include\\cef_base.h",
                                 backup_NativePatcher_BridgeBuilder_folder + @"\Patcher_ExtCode_Others");
            //3.5 //this code will push to github  (same)
            FolderUtils.CopyFile(_cefSrcRootDir + "\\libcef_dll\\ctocpp\\ctocpp_ref_counted.h",
                                 backup_NativePatcher_BridgeBuilder_folder + @"\Patcher_ExtCode_Others");
            //3.6 //this code will push to github  (same)
            FolderUtils.CopyFile(_cefSrcRootDir + "\\libcef_dll\\cpptoc\\cpptoc_ref_counted.h",
                                 backup_NativePatcher_BridgeBuilder_folder + @"\Patcher_ExtCode_Others");
        }
Exemplo n.º 4
0
 void SetCurrentPreset(PatcherPreset preset)
 {
     _selectedPreSet = preset;
     _cefSrcRootDir  = preset.CefSrcFolder;
     //create some target folder if not exists
     FolderUtils.CreateFolderIfNotExist(preset.NewlyCreatedPatchSaveToFolder);
     FolderUtils.CreateFolderIfNotExist(preset.PatchFolder);
     FolderUtils.CreateFolderIfNotExist(preset.Backup_NativePatcher_Folder);
     //
     FolderUtils.CreateFolderIfNotExist(preset.Backup_NativePatcher_BridgeBuilder);
     FolderUtils.CreateFolderIfNotExist(preset.Backup_NativePatcher_BridgeBuilder + "\\Patcher");
     FolderUtils.CreateFolderIfNotExist(preset.Backup_NativePatcher_BridgeBuilder + "\\Patcher_ExtCode");
     FolderUtils.CreateFolderIfNotExist(preset.Backup_NativePatcher_BridgeBuilder + "\\Patcher_ExtCode\\myext");
     FolderUtils.CreateFolderIfNotExist(preset.Backup_NativePatcher_BridgeBuilder + "\\Patcher_ExtCode_libcef_dll");
     FolderUtils.CreateFolderIfNotExist(preset.Backup_NativePatcher_BridgeBuilder + "\\Patcher_ExtCode_libcef_dll\\myext");
     FolderUtils.CreateFolderIfNotExist(preset.Backup_NativePatcher_BridgeBuilder + "\\Patcher_ExtCode_mac");
     FolderUtils.CreateFolderIfNotExist(preset.Backup_NativePatcher_BridgeBuilder + "\\Patcher_ExtCode_Others");
     //
     FolderUtils.CreateFolderIfNotExist(preset.Backup_NativePatcher_BridgeBuilder_DevSnapFolder);
     FolderUtils.CreateFolderIfNotExist(preset.Backup_NativePatcher_BridgeBuilder_DevSnapFolder_TempPatches);
 }
Exemplo n.º 5
0
        private void cmdLoadPatchAndApplyPatch_Click(object sender, EventArgs e)
        {
            string backup_nativePatcher = _selectedPreSet.Backup_NativePatcher_Folder;
            string backup_NativePatcher_BridgeBuilder_folder = _selectedPreSet.Backup_NativePatcher_BridgeBuilder;
            string srcRootDir0 = _cefSrcRootDir;

            //where is patch folder
            string cefBridge_PatchFolder     = _selectedPreSet.PatchFolder;
            string org_cefclient_test_folder = srcRootDir0 + "\\tests";

            //copy my extension file relative folder to this project
            FolderUtils.CopyFolder(backup_NativePatcher_BridgeBuilder_folder + @"\Patcher_ExtCode\myext", org_cefclient_test_folder + "\\cefclient");
            //copy my extension file
            FolderUtils.CopyFolder(backup_NativePatcher_BridgeBuilder_folder + @"\Patcher_ExtCode_libcef_dll\myext", srcRootDir0 + "\\libcef_dll");
            //-----------
            ManualPatcher manualPatcher = new ManualPatcher(org_cefclient_test_folder);

            //1.
            System.IO.File.Copy(backup_NativePatcher_BridgeBuilder_folder + @"\Patcher_ExtCode_Others\cef_base.h",
                                srcRootDir0 + "\\include\\cef_base.h", true);
            //2.
            System.IO.File.Copy(backup_NativePatcher_BridgeBuilder_folder + @"\Patcher_ExtCode_Others\cpptoc_ref_counted.h",
                                srcRootDir0 + "\\libcef_dll\\cpptoc\\cpptoc_ref_counted.h", true);
            //3.
            System.IO.File.Copy(backup_NativePatcher_BridgeBuilder_folder + @"\Patcher_ExtCode_Others\ctocpp_ref_counted.h",
                                srcRootDir0 + "\\libcef_dll\\ctocpp\\ctocpp_ref_counted.h", true);
            //-----------

            manualPatcher.Do_LibCefDll_CMake_txt(srcRootDir0 + "\\libcef_dll\\CMakeLists.txt");
            manualPatcher.Do_CefClient_CMake_txt();
            //-----------
            PatchBuilder builder2 = new PatchBuilder(new string[] {
                org_cefclient_test_folder,
            });

            builder2.LoadPatchesFromFolder(cefBridge_PatchFolder);

            List <PatchFile> pfiles = builder2.GetAllPatchFiles();

            //string oldPathName = srcRootDir;


            for (int i = pfiles.Count - 1; i >= 0; --i)
            {
                //can change original filename before patch

                PatchFile pfile = pfiles[i];

                string onlyFileName = System.IO.Path.GetFileName(pfile.OriginalFileName);
                string onlyPath     = System.IO.Path.GetDirectoryName(pfile.OriginalFileName);

                int indexOfCefClient = onlyPath.IndexOf("\\cefclient\\");
                if (indexOfCefClient < 0)
                {
                    indexOfCefClient = onlyPath.IndexOf("\\shared\\");
                    if (indexOfCefClient < 0)
                    {
                        indexOfCefClient = onlyPath.IndexOf("\\cefclient");
                        if (indexOfCefClient < 0)
                        {
                            throw new NotSupportedException();
                        }
                    }
                }
                string rightSide   = onlyPath.Substring(indexOfCefClient);
                string replaceName = org_cefclient_test_folder + rightSide;
                if (onlyFileName.Contains("performance_test.cc"))
                {
                }
                pfile.OriginalFileName = replaceName + "//" + onlyFileName;
                pfile.PatchContent();
            }
        }