| Utility/SevenZipUtility.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| Utility/SevenZipUtility.cs.meta | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| Utility/SystemCMD.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| Utility/SystemCMD.cs.meta | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
Utility/SevenZipUtility.cs
New file @@ -0,0 +1,43 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; using System.IO; public class SevenZipUtility { static string m_SevenZipToolPath = string.Empty; static string sevenZipToolPath { get { if (string.IsNullOrEmpty(m_SevenZipToolPath)) { if (Directory.Exists("C:/Program Files/7-Zip")) { m_SevenZipToolPath = "C:/Program Files/7-Zip"; } else { m_SevenZipToolPath = "C:/Program Files (x86)/7-Zip"; } } return m_SevenZipToolPath; } } public static void Compress(string from, string to) { if (File.Exists(to)) { File.Delete(to); } var cmd = string.Format("\"{0}\\7z\" a {1} {2} -mx9", sevenZipToolPath, to, from); SystemCMD.RunCmd(cmd); } public static void DeCompress(string from, string to) { lzma.doDecompress7zip(from, to, false, true); } } Utility/SevenZipUtility.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: f144847788b6f254083b077d968bc6f4 timeCreated: 1541055675 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Utility/SystemCMD.cs
New file @@ -0,0 +1,36 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; public class SystemCMD { /// <summary> /// 调用终端执行命令 /// </summary> /// <param name="command"></param> /// <returns></returns> public static string RunCmd(string command) { System.Diagnostics.Process p = new System.Diagnostics.Process(); p.StartInfo.FileName = "cmd.exe"; //确定程序名 p.StartInfo.Arguments = "/c " + command; //确定程式命令行 p.StartInfo.UseShellExecute = false; //Shell的使用 p.StartInfo.RedirectStandardInput = true; //重定向输入 p.StartInfo.RedirectStandardOutput = true; //重定向输出 p.StartInfo.RedirectStandardError = true; //重定向输出错误 p.StartInfo.CreateNoWindow = true; //设置置不显示示窗口 p.Start(); p.WaitForExit(); string err = p.StandardError.ReadToEnd(); string standoutput = p.StandardOutput.ReadToEnd(); if (string.IsNullOrEmpty(err)) { return standoutput; } else { return err; //输出出流取得命令行结果果 } } } Utility/SystemCMD.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 6de2d4b13bfadaf419c682196b36e001 timeCreated: 1541043601 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: