private void ReadHeader() { byte[] b = new byte[len_header]; fs.Read(b, 0, len_header); HEADER = (LPS_HEADER)b.ToStruct(typeof(LPS_HEADER)); fs.Seek(0, SeekOrigin.Begin); }
public void Initialize(int Magic, string signature, string dest, byte[] EncKey = null) { magic = Magic; header = new LPS_HEADER(); lve = new LPS_VERIFIED(); lve.VE_KEY = new byte[26]; if (EncKey != null) { header.H_PWD_ACT_LEN = EncKey.Length; Array.Copy(EncKey, 0, lve.VE_KEY, 0, EncKey.Length); } header.H_MAGIC = EncKey == null ? Magic : Magic.XorEncrypt(EncKey); header.H_FH_LOC = new long[32]; header.H_SIG = signature; header.H_ENCRYPTED = EncKey != null; if (File.Exists(dest)) { File.Delete(dest); } fs = new FileStream(dest, FileMode.OpenOrCreate); }