public static Notification FromFile(string filename) { var result = new Notification(); result.InflatedData = File.ReadAllText(filename).ToByteArray(); result.Hash = Crc32Provider.ComputeChecksum(result.InflatedData); result.Deflate(); return(result); }
private static void CompileTemplate(Metafile metaFile) { using (var stream = new MemoryStream()) { metaFile.Save(stream); metaFile.InflatedData = stream.ToArray(); } metaFile.Hash = Crc32Provider.ComputeChecksum(metaFile.InflatedData); metaFile.Compress(); }
public static Notification FromFile(string filename) { var result = new Notification(); var message = File.ReadAllText(filename); result.InflatedData = message.ToByteArray(); result.Hash = Crc32Provider.ComputeChecksum(result.InflatedData); result.Compress(); ServerContextBase.GlobalMessage = message; return(result); }
public static MServerTable FromFile(string filename) { MServerTable result; using (var stream = File.OpenRead(filename)) { result = new XmlSerializer(typeof(MServerTable)).Deserialize(stream) as MServerTable; } using (var stream = new MemoryStream()) { result.Save(stream); result.InflatedData = stream.ToArray(); } result.Hash = Crc32Provider.ComputeChecksum(result.InflatedData); result.Deflate(); return(result); }
public override void Load(MemoryStream stream) { using (var reader = new BufferReader(stream)) { int length = reader.ReadUInt16(); for (var i = 0; i < length; i++) { var node = new MetafileNode(reader.ReadStringA()); var atomSize = reader.ReadUInt16(); for (var j = 0; j < atomSize; j++) { node.Atoms.Add( reader.ReadStringB()); } Nodes.Add(node); } } Hash = Crc32Provider.ComputeChecksum(InflatedData); Name = Path.GetFileName(Filename); }