Exemplo n.º 1
0
        static void ProcessConsolePublish(string p_publish_version)
        {
            string root_dir = Directory.GetCurrentDirectory().Replace("install-setup", "");

            string            mmria_console_zip_file_name  = Path.Combine(root_dir, "install-setup", "bin", $"MMRIA-console-{p_publish_version}-{current_version}.zip");
            string            mmria_console_publish_folder = Path.Combine(root_dir, "mmria-console", "bin", "Release", "netcoreapp2.1", p_publish_version, "publish");
            cFolderCompressor folder_compressor            = new cFolderCompressor();

            if (File.Exists(mmria_console_zip_file_name))
            {
                File.Delete(mmria_console_zip_file_name);
            }

            folder_compressor.Compress
            (
                System.IO.Path.Combine(mmria_console_zip_file_name),
                null,                // string password
                System.IO.Path.Combine(mmria_console_publish_folder)
            );
        }
Exemplo n.º 2
0
        static void ProcessServerPublish(string p_publish_version)
        {
            string root_dir = Directory.GetCurrentDirectory().Replace("install-setup", "");

            // version number -- Start
            System.Text.RegularExpressions.Regex version_tag = new System.Text.RegularExpressions.Regex("<\\%=version\\%>");
            string mmria_server_publish_directory            = Path.Combine(root_dir, "mmria-server", "bin", "Release", "netcoreapp2.1", p_publish_version, "publish");

            if (p_publish_version == "win7-x64")
            {
                mmria_server_publish_directory = Path.Combine(root_dir, "mmria-server", "bin", "Release", "net471", p_publish_version, "publish");
            }

            string profile_text = System.IO.File.ReadAllText(mmria_server_publish_directory + "/wwwroot/scripts/profile.js");

            System.IO.File.WriteAllText(mmria_server_publish_directory + "/wwwroot/scripts/profile.js", version_tag.Replace(profile_text, current_version));

            string index_text = System.IO.File.ReadAllText(mmria_server_publish_directory + "/wwwroot/index.html");

            System.IO.File.WriteAllText(mmria_server_publish_directory + "/wwwroot/index.html", version_tag.Replace(index_text, current_version));

            string instruction_text = System.IO.File.ReadAllText(Path.Combine(root_dir, "install-setup", "Install-Instructions.txt"));

            System.IO.File.WriteAllText(mmria_server_publish_directory + "/Install-Instructions.txt", version_tag.Replace(instruction_text, current_version));

            // version number -- End

            // move database scripts -- start
            string mmria_server_database_scripts_directory = Path.Combine(root_dir, "mmria-server", "database-scripts");

            System.IO.File.Copy(Path.Combine(mmria_server_database_scripts_directory, "metadata_design_auth.json"), Path.Combine(mmria_server_publish_directory, "database-scripts", "metadata_design_auth.json"), true);
            System.IO.File.Copy(Path.Combine(mmria_server_database_scripts_directory, "metadata.json"), Path.Combine(mmria_server_publish_directory, "database-scripts", "metadata.json"), true);
            System.IO.File.Copy(Path.Combine(mmria_server_database_scripts_directory, "MMRIA_calculations.js"), Path.Combine(mmria_server_publish_directory, "database-scripts", "MMRIA_calculations.js"), true);
            System.IO.File.Copy(Path.Combine(mmria_server_database_scripts_directory, "mmria-check-code.js"), Path.Combine(mmria_server_publish_directory, "database-scripts", "mmria-check-code.js"), true);

            System.IO.File.Copy(Path.Combine(mmria_server_database_scripts_directory, "case_design_sortable.json"), Path.Combine(mmria_server_publish_directory, "database-scripts", "case_design_sortable.json"), true);
            System.IO.File.Copy(Path.Combine(mmria_server_database_scripts_directory, "case_store_design_auth.json"), Path.Combine(mmria_server_publish_directory, "database-scripts", "case_store_design_auth.json"), true);

            //System.IO.File.Copy (Path.Combine (mmria_server_database_scripts_directory, "case_store_design_auth.json"), Path.Combine(mmria_server_publish_directory, "database-scripts", "case_store_design_auth.json"), true);



            // move database scripts -- end

            // remove unneeded files -- start
            if (System.IO.Directory.Exists(mmria_server_publish_directory + "/wwwroot/metadata"))
            {
                System.IO.Directory.Delete(mmria_server_publish_directory + "/wwwroot/metadata", true);
            }

            if (File.Exists(mmria_server_publish_directory + "/wwwroot/grid-test-1.html"))
            {
                File.Delete(mmria_server_publish_directory + "/wwwroot/grid-test-1.html");
            }

            if (File.Exists(mmria_server_publish_directory + "/wwwroot/grid-test-2.html"))
            {
                File.Delete(mmria_server_publish_directory + "/wwwroot/grid-test-2.html");
            }

            if (File.Exists(mmria_server_publish_directory + "/wwwroot/grid-test-3.html"))
            {
                File.Delete(mmria_server_publish_directory + "/wwwroot/grid-test-3.html");
            }

            if (File.Exists(mmria_server_publish_directory + "/wwwroot/socket-test.html"))
            {
                File.Delete(mmria_server_publish_directory + "/wwwroot/socket-test.html");
            }

            if (File.Exists(mmria_server_publish_directory + "/wwwroot/socket-test2.html"))
            {
                File.Delete(mmria_server_publish_directory + "/wwwroot/socket-test2.html");
            }

            if (File.Exists(mmria_server_publish_directory + "/appsettings.Development.json"))
            {
                File.Delete(mmria_server_publish_directory + "/appsettings.Development.json");
            }

            if (File.Exists(mmria_server_publish_directory + "/appsettings.json"))
            {
                File.Delete(mmria_server_publish_directory + "/appsettings.json");
            }

            // remove uneeded files -- end

            File.Copy(Path.Combine(root_dir, "install-setup", "mmria-server.appsettings.json"), mmria_server_publish_directory + "/appsettings.json");


            string            mmria_server_zip_file_name = Path.Combine(root_dir, "install-setup", "bin", $"MMRIA-server-{p_publish_version}-{current_version}.zip");
            cFolderCompressor folder_compressor          = new cFolderCompressor();

            if (File.Exists(mmria_server_zip_file_name))
            {
                File.Delete(mmria_server_zip_file_name);
            }

            folder_compressor.Compress
            (
                System.IO.Path.Combine(mmria_server_zip_file_name),
                null,                // string password
                System.IO.Path.Combine(mmria_server_publish_directory)
            );
        }