internal void WriteData(MyBinaryWriter bw) { DataOffset = (int)bw.BaseStream.Position; bw.Write(file_name); if (guid == null) { guid = new byte[16]; } if (hash == null) { try { using (var fs = PclFileAccess.OpenFileStream(file_name)) { var md5 = Microsoft.CodeAnalysis.CryptographicHashProvider.TryGetAlgorithm(System.Reflection.AssemblyHashAlgorithm.MD5); hash = md5.ComputeHash(fs); } } catch { hash = new byte [16]; } } bw.Write(guid); bw.Write(hash); bw.Write((byte)(auto_generated ? 1 : 0)); }
public bool CheckChecksum() { try { using (var fs = PclFileAccess.OpenFileStream(file_name)) { var md5 = Microsoft.CodeAnalysis.CryptographicHashProvider.TryGetAlgorithm(System.Reflection.AssemblyHashAlgorithm.MD5); byte[] data = md5.ComputeHash(fs); for (int i = 0; i < 16; i++) { if (data [i] != hash [i]) { return(false); } } return(true); } } catch { return(false); } }
public static MonoSymbolFile ReadSymbolFile(string mdbFilename) { return(ReadSymbolFile(PclFileAccess.OpenFileStream(mdbFilename))); }