コード例 #1
0
    public bool AddTable(string key, LoadComplateCB lcCB)
    {
        if (tableList_ == null)
        {
            try {
                hashWaiting_.Add(key, lcCB);
            } catch {
                MagiDebug.LogError(string.Format("Table key already {0}", key));
            }
            return(true);
        }
        else
        {
            string tableName;
            if (hashTableName_.TryGetValue(key, out tableName) == false)
            {
                if (key.Contains("weapontrail") || key.Contains("sound"))
                {
                    MagiDebug.Log(string.Format("{0} table not found.", key));
                    return(false);
                }

                MagiDebug.LogError(string.Format("{0} table not found.", key));
                return(false);
            }
            StartCoroutine(OpenTable(key, tableName, lcCB));
        }
        return(true);
    }
コード例 #2
0
    public static bool ReadAssetBundleCheckInfo(out Dictionary <string, CAssetBundleCheck> hashAssetBundleCheck, string filename)
    {
        hashAssetBundleCheck = new Dictionary <string, CAssetBundleCheck>();
        if (File.Exists(filename) == false)
        {
            return(false);
        }
        string[] pathFile = File.ReadAllLines(filename);

        char[] separators = new char[] { ',' };
        foreach (string file in pathFile)
        {
            string[] assetBundleCheck = file.Split(separators);
            if (assetBundleCheck.Length != 4)
            {
                MagiDebug.LogError("assetBundleCheck.Length != 4");
                return(false);
            }

            CAssetBundleCheck abc = new CAssetBundleCheck();
            abc.count = System.UInt32.Parse(assetBundleCheck[1], System.Globalization.NumberStyles.Integer);
            abc.size  = System.UInt64.Parse(assetBundleCheck[2], System.Globalization.NumberStyles.Integer);
            abc.crc   = System.UInt64.Parse(assetBundleCheck[3], System.Globalization.NumberStyles.Integer);

            hashAssetBundleCheck.Add(assetBundleCheck[0], abc);
        }
        return(true);
    }
コード例 #3
0
    void TableListLoadComplateCB(Table table)
    {
        if (table == null)
        {
            return;
        }
        tableList_ = table;
        string name, filename;

        foreach (var id in tableList_.Line.Keys)
        {
            tableList_.GetString(out name, id, "szName", true);
            tableList_.GetString(out filename, id, "szTableFile", true);
            if (name == "")
            {
                continue;
            }
            if (hashTableName_.ContainsKey(name) == true)
            {
                MagiDebug.LogError(string.Format("tablelist already key = , {0}", name));
                continue;
            }
            hashTableName_.Add(name, filename);
        }
        loadComplate_ = true;
    }
コード例 #4
0
ファイル: ChatManager.cs プロジェクト: 1010MMR/Portfolio
    /// <summary>
    /// <para>name : TcpReceiveCallBack</para>
    /// <para>parameter : System.IAsyncResult</para>
    /// <para>return : void</para>
    /// <para>describe : Receive message result callback.</para>
    /// </summary>
    private void TcpReceiveCallBack(System.IAsyncResult asynResult)
    {
        try {
            Socket socket   = asynResult.AsyncState as Socket;
            int    readSize = socket.EndReceive(asynResult);

            if (readSize > 0)
            {
                messageQueue.Enqueue(new UTF8Encoding().GetString(receiveBuffer, 0, MAXSIZE));

                receiveBuffer = new byte[MAXSIZE];
                Receive();
            }

            else
            {
                MagiDebug.Log(string.Format("Close Server Connect."));

                CloseSocket(SendMessageErrorType.RES_CONNECT_RETRY);
                InitSocket();
            }
        } catch (SocketException ex) {
            MagiDebug.Log(string.Format("Cannot Receive Chat Server > {0}", ex.Message));

            CloseSocket(SendMessageErrorType.RES_RECEIVE_RETRY);
            InitSocket();
        }
    }
コード例 #5
0
 public void ErrorMessageBox(int id, string columnName, bool errorCheck)
 {
     if (errorCheck == false)
     {
         return;
     }
     MagiDebug.LogError(string.Format("Table = {0}, ID = {1}, Column = {2}", name_, id, columnName));
 }
コード例 #6
0
    static void CleanCache()
    {
        Caching.CleanCache();

        string dbPath = Application.persistentDataPath + "/rustyhearts.db";

        MagiDebug.Log(dbPath);

        File.Delete(dbPath);
    }
コード例 #7
0
    public static bool GetAssetBundleCheck(Object o, ref CAssetBundleCheck abc)
    {
        string collectDependenciesAssetPath = AssetDatabase.GetAssetPath(o).ToLower();

        Object[] dependencies;

        //        dependencies = new[] { o };
        if (o is GameObject)
        {
            dependencies = EditorUtility.CollectDependencies(new[] { o });
        }
        else if (o is TextAsset || o is Texture2D || o is AudioClip)
        {
            dependencies = new[] { o };
        }
        else
        {
            return(false);
        }

        foreach (var od in dependencies)
        {
            //if (od is TextAsset == false && od is GameObject == false && od is Texture2D == false && od is AudioClip == false)
            //{
            //    continue;
            //}

            string assetPath = AssetDatabase.GetAssetPath(od).ToLower();
            if (Path.GetExtension(assetPath) == ".cs")
            {
                MagiDebug.Log("GetAssetBundleCheck .cs - " + assetPath);
                continue;
            }

            var path = System.Environment.CurrentDirectory + "/" + assetPath;
            if (File.Exists(path) == false)
            {
                continue;
            }

            uint crc;
            if (MakeCRC.Make(path, out crc) == true)
            {
                abc.crc += crc;
            }
            FileInfo fi = new FileInfo(path);
            abc.size += (ulong)fi.Length;
            abc.count++;
        }
        dependencies = null;
        return(true);
    }
コード例 #8
0
    public Table FindTable(string name)
    {
        string strlower = name.ToLower();

        Table table = new Table(strlower);

        if (hashTable_.TryGetValue(strlower, out table) == false)
        {
            MagiDebug.Log(string.Format("Invalid TableName {0}", name));
            return(null);
        }
        return(table);
    }
コード例 #9
0
ファイル: ChatManager.cs プロジェクト: 1010MMR/Portfolio
    /// <summary>
    /// <para>name : Send</para>
    /// <para>parameter : string</para>
    /// <para>return : void</para>
    /// <para>describe : Send message if socket is not closed.</para>
    /// </summary>
    void Send(string message)
    {
        try {
            byte[] sendBuffer = new UTF8Encoding().GetBytes(message);
            tcpSocket.BeginSend(sendBuffer, 0, sendBuffer.Length, SocketFlags.None, new System.AsyncCallback(TcpSendCallBack), message);
        } catch (SocketException ex) {
            MagiDebug.LogError(string.Format("Send Fail. {0}", ex.Message));

            CloseSocket(SendMessageErrorType.RES_SEND_RETRY);
            InitSocket();
        } catch (System.ObjectDisposedException obEx) {
            MagiDebug.LogError(string.Format("Socket DisposedException, {0}", obEx));
            InitSocket(false);
        }
    }
コード例 #10
0
ファイル: ChatManager.cs プロジェクト: 1010MMR/Portfolio
    /// <summary>
    /// <para>name : BeginConnect</para>
    /// <para>parameter : </para>
    /// <para>return : void</para>
    /// <para>describe : Begin connect if socket is not connected.</para>
    /// </summary>
    void BeginConnect()
    {
        doConnect = false;

        if (tcpSocket == null ||
            tcpSocket.Connected)
        {
            return;
        }

        try {
            tcpSocket.BeginConnect(ipAddress, port, new System.AsyncCallback(TcpConnectCallBack), tcpSocket);
        } catch (SocketException ex) {
            MagiDebug.LogError(string.Format("Connect Fail. {0}:{1}, {2}", ipAddress, port, ex));
            InitSocket();
        } catch (System.ObjectDisposedException obEx) {
            MagiDebug.LogError(string.Format("Socket DisposedException, {0}", obEx));
            InitSocket(false);
        }
    }
コード例 #11
0
ファイル: MakeCRC.cs プロジェクト: 1010MMR/Portfolio
    public static bool Make(string fileName, out uint crc)
    {
        if (File.Exists(fileName) == false)
        {
            crc = 0;
            MagiDebug.Log(string.Format("File not found.{0}", fileName));
            return(false);
        }

        uint crc32 = 0xFFFFFFFF;

        byte[] buffer = File.ReadAllBytes(fileName);

        for (int i = 0; i < buffer.Length; ++i)
        {
            crc32 = (crc32 >> 8) ^ s_arrdwCrc32Table[(crc32 & 0xFF) ^ buffer[i]];
        }
        crc = crc32;

        buffer = null;
        return(true);
    }
コード例 #12
0
    public bool ReadColumnName(int nColumnNum, ref Table table, BinaryReader binReader)
    {
        string strName = "";

        if (table == null)
        {
            return(false);
        }

        try {
            table.ColumnName.Clear();
            for (int i = 0; i < nColumnNum; i++)
            {
                ReadString(out strName, binReader);
                table.ColumnName.Add(strName, i);
                strName = "";
            }
        } catch (Exception ex) {
            MagiDebug.LogError(string.Format("{0}, {1}, {2}, {3}", table.Name, strName, nColumnNum, ex.Message));
        }
        return(true);
    }
コード例 #13
0
        public bool GetFloatSplit(out float[] value, int id, string columnName, bool errorCheck, params char[] separator)
        {
            int    index = GetIndex(columnName);
            string temp;
            bool   result = GetString(out temp, id, index, columnName, errorCheck);

            if (temp == "")
            {
                value = null;
                return(true);
            }
            string[] valueTemp = temp.Split(separator);
            value = new float[valueTemp.Length];
            for (int i = 0; i < valueTemp.Length; ++i)
            {
                try {
                    value[i] = Convert.ToSingle(valueTemp[i]);
                } catch {
                    MagiDebug.LogError(string.Format("GetFloatSplit Error - {0}, {1}", id, columnName));
                }
            }
            return(result);
        }
コード例 #14
0
ファイル: ChatManager.cs プロジェクト: 1010MMR/Portfolio
    /// <summary>
    /// <para>name : TcpSendCallBack</para>
    /// <para>parameter : System.IAsyncResult</para>
    /// <para>return : void</para>
    /// <para>describe : Send message result callback.</para>
    /// </summary>
    private void TcpSendCallBack(System.IAsyncResult asynResult)
    {
        try {
            string    sendMessage = (string)asynResult.AsyncState;
            Hashtable result      = sendMessage.hashtableFromJson();

            int pno = 0;
            if (result.ContainsKey("pno"))
            {
                int.TryParse(result["pno"].ToString(), out pno);
            }

            if (pno.Equals((int)SendMessageType.Type_Disconnect))
            {
                CloseSocket();
            }
        } catch (SocketException ex) {
            MagiDebug.Log(string.Format("Cannot Send Chat Server > {0}", ex.Message));

            CloseSocket(SendMessageErrorType.RES_RECEIVE_RETRY);
            InitSocket();
        }
    }
コード例 #15
0
ファイル: ChatManager.cs プロジェクト: 1010MMR/Portfolio
    /// <summary>
    /// <para>name : TcpConnectCallBack</para>
    /// <para>parameter : System.IAsyncResult</para>
    /// <para>return : void</para>
    /// <para>describe : Socket connect result callback.</para>
    /// </summary>
    private void TcpConnectCallBack(System.IAsyncResult asynResult)
    {
        try {
            Socket socket = asynResult.AsyncState as Socket;

            MagiDebug.Log(string.Format("Connect Chat Server > {0}", socket.RemoteEndPoint));

            socket.EndConnect(asynResult);

            callBackSocket = socket;
            callBackSocket.BeginReceive(receiveBuffer, 0, MAXSIZE, SocketFlags.None, new System.AsyncCallback(TcpReceiveCallBack), callBackSocket);

            if (isUserConnectComplete)
            {
                UserConnect();
            }
        } catch (SocketException ex) {
            MagiDebug.Log(string.Format("Cannot Connect Chat Server > {0}", ex.Message));

            CloseSocket(SendMessageErrorType.RES_CONNECT_RETRY);
            InitSocket(false);
        }
    }
コード例 #16
0
        public bool GetVectorSplit(out Vector3 vector, int id, string columnName, bool errorCheck, params char[] separator)
        {
            int    index = GetIndex(columnName);
            string temp;
            bool   result = GetString(out temp, id, index, columnName, errorCheck);

            vector = Vector3.zero;

            if (temp == "")
            {
                return(true);
            }

            string[] valueTemp = temp.Split(separator);
            float[]  value     = new float[valueTemp.Length];

            if (value.Length > 3)
            {
                MagiDebug.LogError(string.Format("GetVectorSplit Error - more 3 vec."));
                return(false);
            }

            for (int i = 0; i < valueTemp.Length; ++i)
            {
                try {
                    value[i] = Convert.ToSingle(valueTemp[i]);
                } catch {
                    MagiDebug.LogError(string.Format("GetVectorSplit Error - {0}, {1}", id, columnName));
                }
            }

            Vector3 reVec = new Vector3(value[0], value[1], value[2]);

            vector = reVec;

            return(result);
        }
コード例 #17
0
    void Update()
    {
        if (PatchManager.Instance == null)
        {
            return;
        }
        if (PatchManager.Instance.IsLoadComplate == false)
        {
            return;
        }

        if (first_ == true)
        {
            AddTableList();
            first_ = false;
        }

        if (tableList_ != null)
        {
            if (hashTableName_.Count != 0)
            {
                foreach (var p in hashWaiting_)
                {
                    string tableName;
                    if (hashTableName_.TryGetValue(p.Key, out tableName) == false)
                    {
                        MagiDebug.Log(string.Format("table not found. {0}", p.Key));
                        continue;
                    }

                    StartCoroutine(OpenTable(p.Key, tableName, p.Value));
                }

                hashWaiting_.Clear();
            }
        }
    }
コード例 #18
0
    static void GetPrefabsFolderFileNameList(out List <string> fileList)
    {
        fileList = new List <string>();

        int    currentDirectoryLength = System.Environment.CurrentDirectory.Length + 1;
        string prefabsPath            = System.Environment.CurrentDirectory + @"/Assets/Prefabs";

        MagiDebug.Log(prefabsPath);

        string[] files = Directory.GetFiles(prefabsPath, "*.*", SearchOption.AllDirectories);
        foreach (var file in files)
        {
            if (Path.GetExtension(file).ToLower() == ".meta")
            {
                continue;
            }
            if (Path.GetExtension(file).ToLower() == ".php")
            {
                continue;
            }
            if (Path.GetExtension(file).ToLower() == ".csv")
            {
                continue;
            }

            if (file.ToLower().Contains("nopatch") == true)
            {
                MagiDebug.Log(file);
                continue;
            }

            string temp = file.Remove(0, currentDirectoryLength);
            MagiDebug.Log(temp);
            fileList.Add(temp);
        }
    }
コード例 #19
0
    IEnumerator OpenTable(string key, string tableName, LoadComplateCB lcCB)
    {
        string url = "";

        MemoryStream stream = null;

        switch (OptionManager.Instance.pathType)
        {
        case OptionManager.EPathType.Develop: {
            url = OptionManager.ROOT_PATH + "/" + tableUrl_ + "/bytes/" + tableName + ".bytes";

            TextAsset bytes = Resources.LoadAssetAtPath(url, typeof(TextAsset)) as TextAsset;
            if (bytes == null)
            {
                MagiDebug.Log(string.Format("{0}, bytes==null", url));
                break;
            }
            stream = new MemoryStream(bytes.bytes);
        }
        break;

        case OptionManager.EPathType.Live: {
            AssetBundle assetBundle;
            if (PatchManager.Instance.FindAssetBundle("table", out assetBundle))
            {
                TextAsset bytes = assetBundle.Load(key, typeof(TextAsset)) as TextAsset;
                if (bytes == null)
                {
                    MagiDebug.LogError(key + " table not found.");
                    yield break;
                }

                stream = new MemoryStream(bytes.bytes);
            }
        }
        break;
        }

        if (stream == null)
        {
            MagiDebug.Log(stream + "," + key + "," + tableName);
            yield break;
        }

        BinaryReader binReader = new BinaryReader(stream);
        Table        table     = new Table(key);

        int lineNum   = binReader.ReadInt32();
        int columnNum = binReader.ReadInt32();

        if (ReadColumnName(columnNum, ref table, binReader) == false)
        {
            yield break;
        }
        if (ReadColumnType(columnNum, ref table, binReader) == false)
        {
            yield break;
        }

        for (int i = 0; i < lineNum; i++)
        {
            if (ReadData(columnNum, ref table, binReader) == false)
            {
                yield break;
            }
        }

        try {
            hashTable_.Add(key, table);
        } catch {
            MagiDebug.LogError(string.Format("Table key already {0}, {1}", key, tableName));
        }
        if (lcCB != null)
        {
            lcCB(table);
        }
    }
コード例 #20
0
    public bool ReadData(int nColumnNum, ref Table table, BinaryReader binReader)
    {
        SLineTable lineTable = new SLineTable();

        try {
            foreach (var columnType in table.ColumnType)
            {
                switch (columnType)
                {
                case Table.Type.INT: {
                    int nInt = binReader.ReadInt32();
                    lineTable.listIndex.Add(nInt);
                }
                break;

                case Table.Type.FLOAT: {
                    float fFloat = binReader.ReadSingle();
                    lineTable.listFloat.Add(fFloat);
                    int nIdx = lineTable.listFloat.Count - 1;
                    lineTable.listIndex.Add(nIdx);
                }
                break;

                case Table.Type.STRING: {
                    string strString;
                    ReadString(out strString, binReader);
                    lineTable.listString.Add(strString);
                    int nIdx = lineTable.listString.Count - 1;
                    lineTable.listIndex.Add(nIdx);
                }
                break;

                case Table.Type.WSTRING: {
                    string strString;
                    ReadWString(out strString, binReader);
                    lineTable.listWString.Add(strString);
                    int nIdx = lineTable.listWString.Count - 1;
                    lineTable.listIndex.Add(nIdx);
                }
                break;

                case Table.Type.INT64: {
                    long nInt64 = binReader.ReadInt64();
                    lineTable.listInt64.Add(nInt64);
                    int nIdx = lineTable.listInt64.Count - 1;
                    lineTable.listIndex.Add(nIdx);
                }
                break;
                }
                ;
            }

            if (lineTable.listIndex.Count == 0)
            {
                return(false);
            }

            table.Line.Add(lineTable.listIndex[0], lineTable);
        } catch (Exception ex) {
            MagiDebug.LogError(string.Format("{0}, {1}, {2}", table.Name, lineTable.listIndex[0], ex.Message));
        }
        return(true);
    }
コード例 #21
0
    static void ExecutePatch(string local, string target)
    {
        //        System.DateTime nowDateTime = System.DateTime.Now.ToString("yyyy-MM-dd_HH:mm:ss");
        System.DateTime nowDateTime = System.DateTime.Now;

        BuildTarget buildTarget;
        string      targetPath = "";

        switch (target)
        {
        case "Android": {
            targetPath  = "android/";
            buildTarget = BuildTarget.Android;
        }
        break;

        case "iPhone": {
            targetPath  = "iphone/";
            buildTarget = BuildTarget.iPhone;
        }
        break;

        default:
            return;
        }

        string localPath = local.ToLower() + "/";

        //patch revision info 로딩.
        int    lastRevision          = 0;
        string version               = "";
        string infoPatchRevisionInfo = GetAssetbundlePath(buildTarget) + localPath + targetPath + @"patchRevisionInfo.txt";

        if (File.Exists(infoPatchRevisionInfo) == true)
        {
            string[] infoPatchRevision = File.ReadAllLines(infoPatchRevisionInfo);
            if (infoPatchRevision.Length <= 2)
            {
                MagiDebug.LogError(string.Format("{0} file error", infoPatchRevisionInfo));
                return;
            }

            lastRevision = System.Int32.Parse(infoPatchRevision[0]);
            version      = infoPatchRevision[1];
        }

        else
        {
            version = nowDateTime.ToString("yyyy-MM-dd_HH:mm:ss");
        }

        lastRevision++;

        EditorUtility.UnloadUnusedAssets();

        string lastAssetBundleCheckInfoFileName = "AssetBundleCheckInfo3_" + target + ".txt";
        //        Object[] listObject = Selection.GetFiltered(typeof(Object), SelectionMode.DeepAssets);

        List <string> fileList;

        GetPrefabsFolderFileNameList(out fileList);

        //pathlist 작업.
        string newAssetbundlePath = GetAssetbundlePath(buildTarget) + localPath + targetPath + lastRevision.ToString() + "/";
        string lastAssetBundleCheckInfoPathName = System.Environment.CurrentDirectory + @"/Assets/Prefabs/" + lastAssetBundleCheckInfoFileName;
        string errorListPath = System.Environment.CurrentDirectory + @"/Assets/Prefabs/" + "AssetBundleError.txt";

        Dictionary <string, CAssetBundleCheck> lastAssetBundleCheckInfo = new Dictionary <string, CAssetBundleCheck>();

        ReadAssetBundleCheckInfo(out lastAssetBundleCheckInfo, lastAssetBundleCheckInfoPathName);
        Dictionary <string, CAssetBundleCheck> assetBundleCheckInfo = new Dictionary <string, CAssetBundleCheck>();

        Dictionary <string, List <Object> > hashAssetBundle = new Dictionary <string, List <Object> >();
        //        for (int i = 0; i < listObject.Length; ++i)
        //        {
        //            Object o = listObject[i];

        List <ePatchInfo> newPathInfoAssetBundle = new List <ePatchInfo>();
        ePatchInfo        currentPatchInfo       = new ePatchInfo();

        for (int i = 0; i < fileList.Count; ++i)
        {
            Object o = null;
            try {
                o = AssetDatabase.LoadMainAssetAtPath(fileList[i]);
            } catch {
                MagiDebug.LogError(string.Format("AssetDatabase.LoadMainAssetAtPath error, {0}", fileList[i]));
                continue;
            }

            if (o == null)
            {
                MagiDebug.LogError("AssetDatabase.LoadMainAssetAtPath == false, " + fileList[i]);
                continue;
            }
            //Object o = fileList[i];

            //            MagiDebug.Log(o);

            string assetPath = AssetDatabase.GetAssetPath(o).ToLower();
            if (assetPath.Contains("assets/prefabs/") == false)
            {
                continue;
            }
            if (assetPath.Contains("assets/prefabs/pathinfo") == true)
            {
                continue;
            }
            if (assetPath.Contains("assets/prefabs/patchrevisioninfo.txt") == true)
            {
                continue;
            }

            float s = (float)i / fileList.Count;
            EditorUtility.DisplayProgressBar("Make AssetBundleCheckInfo", assetPath, s);

            string assetBundleName = GetAssetBundleName(assetPath);
            if (assetBundleName == "")
            {
                continue;
            }

            if (assetBundleCheckInfo.ContainsKey(assetBundleName) == true)
            {
                CAssetBundleCheck temp = assetBundleCheckInfo[assetBundleName];
                GetAssetBundleCheck(o, ref temp);
            }
            else
            {
                CAssetBundleCheck temp = new CAssetBundleCheck();
                GetAssetBundleCheck(o, ref temp);
                assetBundleCheckInfo.Add(assetBundleName, temp);
            }

            if (hashAssetBundle.ContainsKey(assetBundleName) == true)
            {
                hashAssetBundle[assetBundleName].Add(o);
            }
            else
            {
                var listO = new List <Object>();
                listO.Add(o);
                hashAssetBundle.Add(assetBundleName, listO);
            }

            System.GC.Collect();
            for (int n = 0; n < System.GC.MaxGeneration; ++n)
            {
                System.GC.Collect(n, System.GCCollectionMode.Forced);
            }
            System.GC.WaitForPendingFinalizers();
            EditorUtility.UnloadUnusedAssets();
        }
        EditorUtility.ClearProgressBar();

        if (assetBundleCheckInfo.Count == 0)
        {
            return;
        }

        string buildAssetBundle = System.Environment.CurrentDirectory + @"/Assets/Prefabs/" + "BuildAssetBundle.txt";

        int  c   = 0;
        uint crc = 0;

        foreach (var p in hashAssetBundle)
        {
            c++;
            float s = (float)c / hashAssetBundle.Count;
            EditorUtility.DisplayProgressBar("BuildAssetBundle", p.Key, s);

            CAssetBundleCheck abc;
            if (assetBundleCheckInfo.TryGetValue(p.Key, out abc) == false)
            {
                continue;
            }

            if (lastAssetBundleCheckInfo.ContainsKey(p.Key) == true)
            {
                CAssetBundleCheck lastAbc;
                lastAssetBundleCheckInfo.TryGetValue(p.Key, out lastAbc);
                if (abc.count == lastAbc.count && abc.crc == lastAbc.crc && abc.size == lastAbc.size)
                {
                    continue;
                }
            }

            string path = newAssetbundlePath + p.Key + ".assetbundle";
            MagiDebug.Log(path);

            if (!Directory.Exists(newAssetbundlePath))
            {
                Directory.CreateDirectory(newAssetbundlePath);
            }

            File.WriteAllText(buildAssetBundle, path);

            BuildPipeline.PushAssetDependencies();

            if (BuildPipeline.BuildAssetBundle(p.Value[0], p.Value.ToArray(), path, out crc, BuildAssetBundleOptions.CollectDependencies, buildTarget) == false)
            {
                MagiDebug.LogError("BuildPipeline.BuildAssetBundle == false, " + path);
            }

            BuildPipeline.PopAssetDependencies();

            currentPatchInfo         = new ePatchInfo();
            currentPatchInfo.key     = p.Key;
            currentPatchInfo.version = lastRevision;
            currentPatchInfo.crc     = crc;

            newPathInfoAssetBundle.Add(currentPatchInfo);
        }

        EditorUtility.ClearProgressBar();

        // 패치할 파일이 없으면 pass
        if (newPathInfoAssetBundle.Count == 0)
        {
            return;
        }

        //revision 버젼 저장.
        List <ePatchInfo> finalPatchInfo = new List <ePatchInfo>();

        if (File.Exists(infoPatchRevisionInfo) == true)
        {
            string[] infoPatchRevision = File.ReadAllLines(infoPatchRevisionInfo);
            if (infoPatchRevision.Length <= 2)
            {
                MagiDebug.LogError(string.Format("{0} file error", infoPatchRevisionInfo));
                return;
            }

            ePatchInfo newPatchInfo;
            ePatchInfo patchInfo;
            string[]   szAssetBundleInfo;
            for (int i = 2; i < infoPatchRevision.Length; i++)
            {
                szAssetBundleInfo = infoPatchRevision[i].Split(',');

                if (szAssetBundleInfo.Length < 3)
                {
                    continue;
                }

                patchInfo         = new ePatchInfo();
                patchInfo.key     = szAssetBundleInfo[0];
                patchInfo.version = System.Int32.Parse(szAssetBundleInfo[1]);
                patchInfo.crc     = System.UInt32.Parse(szAssetBundleInfo[2]);

                newPatchInfo = newPathInfoAssetBundle.Find(delegate(ePatchInfo a) {
                    return(a.key.Equals(patchInfo.key));
                });

                if (newPatchInfo != null)
                {
                    finalPatchInfo.Add(newPatchInfo);
                }
                else
                {
                    finalPatchInfo.Add(patchInfo);
                }
            }
        }

        else
        {
            finalPatchInfo.AddRange(newPathInfoAssetBundle);
        }

        finalPatchInfo.Sort(delegate(ePatchInfo a, ePatchInfo b) {
            return(a.key.CompareTo(b.key));
        });

        List <string> szFinalPatchInfo = new List <string>();

        for (int i = 0; i < finalPatchInfo.Count; i++)
        {
            szFinalPatchInfo.Add(string.Format("{0},{1},{2}", finalPatchInfo[i].key, finalPatchInfo[i].version.ToString(), finalPatchInfo[i].crc.ToString()));
        }

        List <string> revisionInfo = new List <string>();

        revisionInfo.Add(lastRevision.ToString());
        revisionInfo.Add(version.ToString());

        revisionInfo.AddRange(szFinalPatchInfo);

        if (File.Exists(infoPatchRevisionInfo) == true)
        {
            File.Delete(infoPatchRevisionInfo);
        }

        File.WriteAllLines(infoPatchRevisionInfo, revisionInfo.ToArray());

        WriteAssetBundleCheckInfo(assetBundleCheckInfo, lastAssetBundleCheckInfoPathName);

        MagiDebug.Log(System.DateTime.Now - nowDateTime);

        #region FTP unload작업.
        //{
        //    //            string ftpRoot = "app/rustyhearts/" + targetPath + lastRevision.ToString() + "/";
        //    string ftpRoot = localPath + targetPath + lastRevision.ToString() + "/";
        //    MagiFtp magiFtp = new MagiFtp("1.214.41.130", "rh_rpg", "z00games?!ftp");

        //    string ftpRoot2 = localPath + targetPath + lastRevision.ToString();
        //    magiFtp.MakeDirectory(ftpRoot2);

        //    for (int i = 0; i < pathInfoAssetBundle.Count; )
        //    {
        //        string ftpFile = ftpRoot + pathInfoAssetBundle[i] + ".assetbundle";
        //        string clientPath = newAssetbundlePath + pathInfoAssetBundle[i] + ".assetbundle";

        //        //                FtpDelete(magiFtp, ftpFile);
        //        CreateNewAssetbundles.FtpUpload(magiFtp, ftpFile, clientPath);

        //        float s = (float)i / pathInfoAssetBundle.Count;
        //        EditorUtility.DisplayProgressBar("Upload", clientPath, s);
        //        ++i;
        //    }
        //    EditorUtility.ClearProgressBar();

        //    // fileinfo.txt upload
        //    {
        //        string ftpDir = ftpRoot + Path.GetFileName(newFileInfoPathName);
        //        string clientPath = newFileInfoPathName;
        //        CreateNewAssetbundles.FtpUpload(magiFtp, ftpDir, clientPath);
        //    }

        //    // patchRevisionInfo.txt upload
        //    {
        //        string ftpDir = localPath + targetPath + "patchRevisionInfo.txt";
        //        string clientPath = infoPatchRevisionInfo;
        //        CreateNewAssetbundles.FtpUpload(magiFtp, ftpDir, clientPath);
        //    }
        //}
        #endregion
    }