示例#1
0
    public static void CompareFileListXml()
    {
        string newPath = EditorUtility.OpenFilePanel("选择新版FileList", last_newFileList_dir, "");
        string oldPath = EditorUtility.OpenFilePanel("选择旧版FileList", last_oldFileList_dir, "");

        if (string.IsNullOrEmpty(newPath) || string.IsNullOrEmpty(oldPath))
        {
            return;
        }
        last_newFileList_dir = Path.GetDirectoryName(newPath);
        last_oldFileList_dir = Path.GetDirectoryName(oldPath);

        FileListCompareAll compareAll = Compare(newPath, oldPath);

        if (compareAll == null)
        {
            EditorUtility.DisplayDialog("比较失败", "比较失败,详情看Log", "好的");
            return;
        }

        if (!EditorUtility.DisplayDialog("比较完成", string.Format("{0}\n{1}\n{2}", newPath, oldPath, compareAll.ToString()), "保存", "好的"))
        {
            return;
        }

        string savePath = EditorUtility.SaveFilePanel("保存", "", "filelist_compare", "xml");

        if (string.IsNullOrEmpty(savePath))
        {
            return;
        }

        compareAll.SaveXml(savePath);
        Debug.LogFormat("保存");
    }
示例#2
0
    public static void CompareFileListTxt()
    {
        string newPath = EditorUtility.OpenFilePanel("选择新版FileList", last_newFileList_dir, "");
        string oldPath = EditorUtility.OpenFilePanel("选择旧版FileList", last_oldFileList_dir, "");

        if (string.IsNullOrEmpty(newPath) || string.IsNullOrEmpty(oldPath))
        {
            return;
        }
        last_newFileList_dir = Path.GetDirectoryName(newPath);
        last_oldFileList_dir = Path.GetDirectoryName(oldPath);

        FileListCompareAll compareAll = Compare(newPath, oldPath);

        if (compareAll == null)
        {
            EditorUtility.DisplayDialog("比较失败", "比较失败,详情看Log", "好的");
            return;
        }

        if (!EditorUtility.DisplayDialog("比较完成", string.Format("{0}\n{1}\n{2}", newPath, oldPath, compareAll.ToString()), "保存", "好的"))
        {
            return;
        }

        string savePath = EditorUtility.SaveFilePanel("保存", "", "filelist_compare", "txt");

        if (string.IsNullOrEmpty(savePath))
        {
            return;
        }

        BuildCommon.WriteJsonToFile("", savePath, compareAll);
        Debug.LogFormat("保存");

//         return;
//
//         FileList newFileList = BuildCommon.ReadJsonFromFile<FileList>(newPath);
//         FileList oldFileList = BuildCommon.ReadJsonFromFile<FileList>(oldPath);
//
//         if (newFileList == null || oldFileList == null)
//         {
//             return;
//         }
//
//
//         FileListCompareData comData = FileList.Compare(newFileList, oldFileList);
//         Debug.LogErrorFormat("{0}, {1}, {2}", comData.addList.Count, comData.deleteList.Count, comData.modifiyList.Count);
    }