public override void OnLoadData() { try { Log.Info("SerializableDataExtension.OnLoadData() ...", true); byte[] data = serializableDataManager.LoadData(DATA_ID); if (data == null) { NetworkExtensionManager.Deserialize(null); } else { var s = SimpleDataSerializer.Reader(data); NetworkExtensionManager.Deserialize(s); } Log.Info("SerializableDataExtension.OnLoadData() was successful!", true); } catch (Exception ex) { ex.Log(); } }
static void Test() { return; LogCalled(); byte[] data; { var man = NetworkExtensionManager.CreateNew(); man.LaneBuffer[1].m_flags = NetLaneExt.Flags.Custom0; Log.Debug("Serialize lane flags:" + man.LaneBuffer[1].m_flags); var s = SimpleDataSerializer.Writer(new Version(1, 1), 100); man.Serialize(s); data = s.GetBytes(); } { var man = NetworkExtensionManager.CreateNew(); Log.Debug("Before Deserialize lane flags :" + man.LaneBuffer[1].m_flags); var s = SimpleDataSerializer.Reader(data); man.DeserializeImp(s); Log.Debug("After Deserialize lane flags :" + man.LaneBuffer[1].m_flags); } }
static SimpleDataSerializer GetReader(byte [] data) => SimpleDataSerializer.Reader(data);