少年修仙传客户端代码仓库
lcy
3 天以前 6d8908e1fcfb62e174d1fa60eb6aa31f65dff3e1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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)
    {
#if !(UNITY_IOS || UNITY_IPHONE)
        lzma.doDecompress7zip(from, to, false, true);
#endif
    }
 
}