Example #1
0
        private void tsbCreate_Click(object sender, EventArgs e)
        {
            string  distPath        = op.DistPath;
            CfgInfo cfg             = op.GetCfgInfo();
            string  sourceJarFile   = cfg.Source;
            string  distJarFilePath = cfg.Dist;
            string  distJarFileName = Path.Combine(distJarFilePath, distJarName);
            string  cmdExecuteFile  = Path.Combine(System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase, @"Dll\UnPress.exe");
            string  cmd             = "a " + distJarFileName + " -ibck -o+ messages";

            if (!Directory.Exists(distPath))
            {
                this.ShowAlert("无对应资源,请执行【开始】汉化后再操作");
                return;
            }
            if (!File.Exists(sourceJarFile))
            {
                this.ShowAlert("无英文资源文件" + Path.GetFileName(sourceJarFile) + "\r\n请在【设置】中设置它的正确路径");
                return;
            }
            //中文资源存放路径不存在,建立
            if (!Directory.Exists(distJarFilePath))
            {
                Directory.CreateDirectory(distJarFilePath);
            }
            //复制英文文件,然后替换
            File.Copy(sourceJarFile, distJarFileName, true);

            System.Diagnostics.Process.Start(cmdExecuteFile, cmd);
            this.ShowAlert("成功生成中文语言资源文件【" + this.distJarName + "】");
        }
        private void InitFrom()
        {
            CfgInfo cfg = op.GetCfgInfo();

            this.txtSourcePath.Text = cfg.Source;
            this.txtDistPath.Text   = cfg.Dist;
            this.toolTip1.SetToolTip(this.lblSourcePath, "原始的英文资源文件");
            this.toolTip1.SetToolTip(this.lblDistPath, "汉化后的中文资源文件(resources_cn.jar)存放路径");
        }