internal void SetData(byte[] data, ToxSaveDataType type) { if (type == ToxSaveDataType.SecretKey && data.Length != ToxConstants.SecretKeySize) throw new ArgumentException("Data must have a length of ToxConstants.SecretKeySize bytes", "data"); SaveDataType = type; SaveDataLength = (uint)data.Length; SaveData = Marshal.AllocHGlobal(data.Length); Marshal.Copy(data, 0, SaveData, data.Length); }
internal void SetData(byte[] data, ToxSaveDataType type) { if (type == ToxSaveDataType.SecretKey && data.Length != ToxConstants.SecretKeySize) { throw new ArgumentException("Data must have a length of ToxConstants.SecretKeySize bytes", "data"); } SaveDataType = type; SaveDataLength = (uint)data.Length; SaveData = Marshal.AllocHGlobal(data.Length); Marshal.Copy(data, 0, SaveData, data.Length); }