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

            RootNode = PList.Load(stream);
        }
Example #2
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;
            }
        }
Example #3
0
        public byte[] GetFileHash(string fileName)
        {
            DictionaryNode filesNode = PListHelper.GetDictionaryValueFromPList(RootNode, "files");

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