예제 #1
0
    /// <summary>
    /// 解压数据,放在永久性存储文件夹下
    /// </summary>
    static void CreateFile(byte[] data)
    {
        Debug.Log("下载完毕,准备写文件到: " + IOPath.Instance.NowPlatformPath + _UpdateFilePaths[_NowLoadIndex]);
        IOTool.CreateFileBytes(IOPath.Instance.NowPlatformPath + _UpdateFilePaths[_NowLoadIndex], data);

        ++_NowLoadIndex;
        Debug.Log("下载进度-> " + _NowLoadIndex + "/" + _UpdateFilePaths.Count);
        DoUpdateFile();     //循环下载
    }
예제 #2
0
    /// <summary>
    /// 开始导出对应文件
    /// </summary>
    void DoOutputFile(DataTable table, EExprotType type)
    {
        if (type == EExprotType.C && string.IsNullOrEmpty(OutputPath))
        {
            EditorUtility.DisplayDialog("提示", "当前不压缩数据的导出路径不存在", "确定");
            return;
        }
        if (type == EExprotType.C && string.IsNullOrEmpty(OutputPathCompress) && IsNeedCompress)
        {
            EditorUtility.DisplayDialog("提示", "当前压缩数据的导出路径不存在", "确定");
            return;
        }
        if (type == EExprotType.S && string.IsNullOrEmpty(OutputPathServer))
        {
            EditorUtility.DisplayDialog("提示", "当前服务器数据导出路径不存在", "确定");
            return;
        }
        if (type == EExprotType.C && OutputPath == OutputPathCompress)
        {
            EditorUtility.DisplayDialog("提示", "压缩数据路径不能与不压缩数据路径相同", "确定");
            return;
        }
        int _rowCount = table.Rows.Count;
        int _column   = table.Columns.Count;

        //开始循环写数据
        for (int i = _HEADROWNUM; i < _rowCount; i++)
        {
            var _row = table.Rows[i];
            for (int j = 0; j < _column; j++)
            {
                var _s = table.Rows[1][j].ToString().Trim().ToLower();
                switch (type)
                {
                case EExprotType.C:
                    if (_s == NOCS || _s == NOC)
                    {
                        continue;
                    }
                    break;

                case EExprotType.S:
                    if (_s == NOCS || _s == NOS)
                    {
                        continue;
                    }
                    break;

                default:
                    break;
                }
                string _type = table.Rows[3][j].ToString();
                if (_type == "string")
                {
                    WriteData(_type, _row[j].ToString(), uint.Parse(table.Rows[4][j].ToString()));
                }
                else
                {
                    WriteData(_type, _row[j].ToString());
                }
            }
        }
        if (type == EExprotType.C && IsExportClient)
        {
            //数据写入buff完毕,将buff写入不压缩文件
            IOTool.CreateFileBytes(OutputPath + "/" + _TableName + ".bytes", NowBuffer.ToBytes());
        }
        //若是压缩选项,则开始压缩
        if (type == EExprotType.C && IsNeedCompress)
        {
            ZipTool.Zip(ZipTool.ZipType.CompressBySevenZip, null, OutputPath + "/" + _TableName + ".bytes", OutputPathCompress + "/" + _TableName + ".bytes");
        }
        if (type == EExprotType.S && IsExportServer)
        {
            IOTool.CreateFileBytes(OutputPathServer + "/" + _TableName + ".bytes", NowBuffer.ToBytes());
        }
    }