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
|
}
|
|
}
|