Esempio n. 1
0
    public ResDiffInfo[] GetDiffInfos(ResListFile otherFile)
    {
        ResDiffInfo[] ret = null;

        if (otherFile != null)
        {
            /*
             * string writePath = Utils.FilePathMgr.Instance.WritePath;
             * if (string.IsNullOrEmpty(writePath))
             *      return ret;
             */

            Dictionary <string, ResInfo> .Enumerator otherIter = otherFile.GetIter();
            List <ResDiffInfo> diffList = new List <ResDiffInfo>();
            while (otherIter.MoveNext())
            {
                bool   isDiff = false;
                string srcMd5 = GetFileContentMd5(otherIter.Current.Key);
                if (!string.IsNullOrEmpty(srcMd5))
                {
                    if (string.Compare(srcMd5, otherIter.Current.Value.fileContentMd5, StringComparison.CurrentCultureIgnoreCase) != 0)
                    {
                        isDiff = true;
                    }

                    /*
                     * else
                     * {
                     *      string fileName = string.Format("{0}/{1}", writePath, otherIter.Current.Key);
                     *      if (!File.Exists(fileName))
                     *      {
                     *              isDiff = true;
                     *      }
                     * }*/
                }
                else
                {
                    isDiff = true;
                }

                if (isDiff)
                {
                    ResDiffInfo diffInfo = new ResDiffInfo();
                    diffInfo.fileName       = otherIter.Current.Key;
                    diffInfo.fileContentMd5 = otherIter.Current.Value.fileContentMd5;
                    diffInfo.fileSize       = otherIter.Current.Value.fileSize;
                    diffList.Add(diffInfo);
                }
            }
            otherIter.Dispose();
            ret = diffList.ToArray();
        }

        return(ret);
    }
Esempio n. 2
0
    public void Load(ResListFile other)
    {
        Clear();
        var iter = other.GetIter();

        while (iter.MoveNext())
        {
            m_FileMd5Map.Add(iter.Current.Key, iter.Current.Value);
            m_ContentMd5ToNameMd5Map.Add(iter.Current.Value.fileContentMd5, iter.Current.Key);
        }
        iter.Dispose();
    }