コード例 #1
0
ファイル: ABTools.cs プロジェクト: freedomWind/p.csk2
    //判断文件是否被修改,升级版本
    public static void IsAlterFile(DataConfig new_config, DataConfig old_config)
    {
        string strKey;

        foreach (var item in new_config.DicAseetsData)
        {
            strKey = item.Key;
            if (old_config.DicAseetsData.ContainsKey(strKey))
            {
                if (!File.Exists(outputPath + strKey) || !File.Exists(oldassetsbundlePath + strKey))
                {
                    continue;
                }
                string new_ab_path = outputPath + strKey;
                if (!isValidFileContent(new_ab_path, oldassetsbundlePath + strKey))
                {
                    item.Value.Version = old_config.DicAseetsData[strKey].UpdateVersion();                    //升级版本号
                    new_config.DicDataTable[strKey]["version"] = item.Value.Version;
                    if (!Directory.Exists(alterfilePath))
                    {
                        Directory.CreateDirectory(alterfilePath);
                    }

                    if (File.Exists(alterfilePath + strKey))
                    {
                        File.Copy(new_ab_path, alterfilePath + strKey, true);
                    }
                    else
                    {
                        File.Copy(new_ab_path, alterfilePath + strKey);
                    }


                    m_alter_dc.AddRow(new_config.DicAseetsData[strKey]);

                    Debug.Log("文件" + item.Value.FileName + "被修改," + "version = " + item.Value.Version);
                }
            }
        }
        //保存修改文件的表
        m_alter_dc.Save(alterfilePath + "data.csv");
    }