Exemplo n.º 1
0
        public override void OnCreated(ILoading loading)
        {
            try
            {
                // Storing default values ASAP (before any mods have the time to change values)
                DefaultOptions.StoreAll();

                // Creating a backup
                AdvancedVehicleOptions.SaveBackup();
            }
            catch (Exception e)
            {
                DebugUtils.LogException(e);
            }
        }
        public override void OnLoadData()
        {
            if (ToolManager.instance.m_properties.m_mode != ItemClass.Availability.Game)
            {
                return;
            }

            // Storing default values ASAP (before any mods have the time to change values)
            DefaultOptions.StoreAll();

            if (!serializableDataManager.EnumerateData().Contains(ID))
            {
                return;
            }
            var data = serializableDataManager.LoadData(ID);

            using (var ms = new MemoryStream(data))
            {
                AdvancedVehicleOptions.config.data = DataSerializer.Deserialize <Configuration>(ms, DataSerializer.Mode.Memory).data;
            }
        }