Esempio n. 1
0
 private void btn_SaveFile_Click(object sender, EventArgs e)
 {
     //if (!File.Exists(rootPath + @"\resources_en.jar.bak")) new FileInfo(rootPath + @"\resources_en.jar").CopyTo(rootPath + @"\resources_en.jar.bak");
     new DirectoryInfo(rootPath + @"\JetBrainsTrasnTemp\messages\").Delete(true);
     Directory.Move(rootPath + @"\JetBrainsTransMesTmp\messages\", rootPath + @"\JetBrainsTrasnTemp\messages\");
     ZipTool.Compress(rootPath + @"\JetBrainsTrasnTemp\", rootPath + @"\resources_cn.jar");
     new DirectoryInfo(rootPath + @"\JetBrainsTrasnTemp").Delete(true);
     new DirectoryInfo(rootPath + @"\JetBrainsTransMesTmp").Delete(true);
     if (MessageBox.Show("汉化完毕!") == System.Windows.Forms.DialogResult.OK)
     {
         Application.Exit();
     }
 }
Esempio n. 2
0
        /// <summary>
        /// 解压文件并得到文件列表
        /// </summary>
        /// <param name="fromPath"></param>
        /// <returns></returns>
        private async Task ExtractFile(string fromPath)
        {
            if (!fromPath.IsNullOrEmptyOrSpace())
            {
                rootPath = Path.GetDirectoryName(fromPath);         //取得根目录
                tempPath = rootPath + @"\JetBrainsTrasnTemp\";      //缓存处理目录
                if (Directory.Exists(tempPath))
                {
                    Directory.Delete(tempPath, true);
                }
                Directory.CreateDirectory(tempPath); //创建一个目录

                await Task.Run(() =>                 // 等待解压文件完成
                {
                    ZipTool.Extract(fromPath, tempPath);
                });

                fileList = Directory.GetFiles(tempPath + @"messages\");     //取得目录下所有文件的文件名
            }
        }