public PListFile(byte[] plistBytes) { m_format = PListHelper.DetectFormat(plistBytes); MemoryStream stream = new MemoryStream(plistBytes); RootNode = PList.Load(stream); }
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); } }
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; } }
public byte[] GetFileHash(string fileName) { DictionaryNode filesNode = PListHelper.GetDictionaryValueFromPList(RootNode, "files"); return(PListHelper.GetDataValueFromPList(filesNode, fileName)); }