示例#1
0
        public PListFile(byte[] plistBytes)
        {
            m_format = PListHelper.DetectFormat(plistBytes);
            MemoryStream stream = new MemoryStream(plistBytes);

            RootNode = PList.Load(stream);
        }
示例#2
0
        public void UpdateFileHash(string fileName, byte[] fileBytes)
        {
            DictionaryNode filesNode = PListHelper.GetDictionaryValueFromPList(RootNode, "files");

            byte[] hash = new SHA1Managed().ComputeHash(fileBytes);
            if (filesNode.ContainsKey(fileName))
            {
                filesNode[fileName] = new DataNode(hash);
            }

            DictionaryNode files2Node = PListHelper.GetDictionaryValueFromPList(RootNode, "files2");

            if (files2Node != null && files2Node.ContainsKey(fileName))
            {
                files2Node[fileName] = new DataNode(hash);
            }
        }
示例#3
0
        public void UpdateFileHash(string fileName, byte[] fileBytes)
        {
            DictionaryNode filesNode = PListHelper.GetDictionaryValueFromPList(RootNode, "files");

            byte[] sha1Hash   = new SHA1Managed().ComputeHash(fileBytes);
            byte[] sha256Hash = new SHA256Managed().ComputeHash(fileBytes);
            if (filesNode.ContainsKey(fileName))
            {
                filesNode[fileName] = new DataNode(sha1Hash);
            }

            DictionaryNode files2Node = PListHelper.GetDictionaryValueFromPList(RootNode, "files2");

            if (files2Node != null && files2Node.ContainsKey(fileName))
            {
                DictionaryNode entryNode = new DictionaryNode();
                entryNode.Add("hash", new DataNode(sha1Hash));
                entryNode.Add("hash2", new DataNode(sha256Hash));
                files2Node[fileName] = entryNode;
            }
        }
示例#4
0
        public byte[] GetFileHash(string fileName)
        {
            DictionaryNode filesNode = PListHelper.GetDictionaryValueFromPList(RootNode, "files");

            return(PListHelper.GetDataValueFromPList(filesNode, fileName));
        }