U 3 D呼び出し7 zファイルの解凍

1313 ワード

using UnityEngine;

using System;

using System.IO;

using System.Diagnostics;



public class Test : MonoBehaviour

{

    //7z 

    private string _7zExeUrl ;



    void Start()

    {

        _7zExeUrl = Application.dataPath + "/StreamingAssets/7z.exe";

        DecompressFileToDirectory(Application.dataPath + "/StreamingAssets/test.zip", Application.dataPath + "/StreamingAssets/");

    }



    public void DecompressFileToDirectory(string inFileath, string outFilePath)

    {

        try

        {

            Process process = new Process();

            string info = " x " + inFileath + " -o" + outFilePath + " -r ";

            ProcessStartInfo startInfo = new ProcessStartInfo(_7zExeUrl, info);

            process.StartInfo = startInfo;

            // DOS   

            process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;

            process.Start();

            process.WaitForExit();

            process.Close();

        }

        catch (Exception e)

        {

            UnityEngine.Debug.Log(e);

        }

        

    }

}


http://blog.csdn.net/awnuxcvbn/article/details/16886211