Ejemplo n.º 1
0
        private void FileLoader_OnSettingsLoaded(SettingsType.Type type, string Data)
        {
            if (type == SettingsType.Type.GLOBAL)
            {
                var u = SharpConfig.Configuration.LoadFromString(Data);
                var t = u["CONTROL"]["Sound_Ahorn"].IntValue;
                KeyBindings.Sound_Ahorn = (Control)t;

                t = u["CONTROL"]["Snd_SrnTon1"].IntValue;
                KeyBindings.Snd_SrnTon1 = (Control)t;

                t = u["CONTROL"]["Snd_SrnTon2"].IntValue;
                KeyBindings.Snd_SrnTon2 = (Control)t;

                t = u["CONTROL"]["Snd_SrnTon3"].IntValue;
                KeyBindings.Snd_SrnTon3 = (Control)t;

                t = u["CONTROL"]["Snd_SrnTon4"].IntValue;
                KeyBindings.Snd_SrnTon4 = (Control)t;

                t = u["CONTROL"]["Sound_Manul"].IntValue;
                KeyBindings.Sound_Manul = (Control)t;

                t = u["CONTROL"]["Toggle_SIRN"].IntValue;
                KeyBindings.Toggle_SIRN = (Control)t;

                t = u["CONTROL"]["Toggle_DSRN"].IntValue;
                KeyBindings.Toggle_DSRN = (Control)t;

                t = u["CONTROL"]["TogInfoPanl"].IntValue;
                KeyBindings.TogInfoPanl = (Control)t;

                ControlsUpdated?.Invoke(KeyBindings);
            }
        }
Ejemplo n.º 2
0
        private void FileLoader_OnSettingsLoaded(SettingsType.Type type, string data)
        {
            switch (type)
            {
            case SettingsType.Type.GLOBAL:
                var u = Configuration.LoadFromString(data);
                var t = u["GENERAL"]["MaxActiveVehs"].IntValue;
                if (_sirens != null)
                {
                    _sirens.Capacity = t;
                }
                break;

            case SettingsType.Type.LIGHTING:
                break;
            }
        }
Ejemplo n.º 3
0
        private void FileLoader_OnSettingsLoaded(SettingsType.Type type, string Data)
        {
            if (type == SettingsType.Type.GLOBAL)
            {
                var u = SharpConfig.Configuration.LoadFromString(Data);
                var t = u["KEYBOARD"]["Sound_Ahorn"].IntValue;
                KBBindings.Sound_Ahorn = (Control)t;

                t = u["KEYBOARD"]["Snd_SrnTon1"].IntValue;
                KBBindings.Snd_SrnTon1 = (Control)t;

                t = u["KEYBOARD"]["Snd_SrnTon2"].IntValue;
                KBBindings.Snd_SrnTon2 = (Control)t;

                t = u["KEYBOARD"]["Snd_SrnTon3"].IntValue;
                KBBindings.Snd_SrnTon3 = (Control)t;

                t = u["KEYBOARD"]["Snd_SrnTon4"].IntValue;
                KBBindings.Snd_SrnTon4 = (Control)t;

                t = u["KEYBOARD"]["Sound_Manul"].IntValue;
                KBBindings.Sound_Manul = (Control)t;

                t = u["KEYBOARD"]["Toggle_SIRN"].IntValue;
                KBBindings.Toggle_SIRN = (Control)t;

                t = u["KEYBOARD"]["Toggle_DSRN"].IntValue;
                KBBindings.Toggle_DSRN = (Control)t;

                t = u["KEYBOARD"]["TogInfoPanl"].IntValue;
                KBBindings.TogInfoPanl = (Control)t;

                t = u["KEYBOARD"]["Snd_SrnPnic"].IntValue;
                KBBindings.Snd_SrnPnic = (Control)t;

                t = u["KEYBOARD"]["Toggle_SECL"].IntValue;
                KBBindings.ToggleSecL = (Control)t;

                t = u["KEYBOARD"]["Toggle_WRNL"].IntValue;
                KBBindings.ToggleWrnL = (Control)t;

                t = u["KEYBOARD"]["Toggle_CRSL"].IntValue;
                KBBindings.ToggleCrsL = (Control)t;

                t = u["KEYBOARD"]["ChgPat_PRML"].IntValue;
                KBBindings.ChgPattPrmL = (Control)t;

                t = u["KEYBOARD"]["ChgPat_SECL"].IntValue;
                KBBindings.ChgPattSecL = (Control)t;

                t = u["KEYBOARD"]["ChgPat_WRNL"].IntValue;
                KBBindings.ChgPattWrnL = (Control)t;

                t = u["KEYBOARD"]["Toggle_LSTG"].IntValue;
                KBBindings.ToggleLstg = (Control)t;

                t = u["KEYBOARD"]["Toggle_TKDL"].IntValue;
                KBBindings.ToggleTdl = (Control)t;

                t = u["KEYBOARD"]["Toggle_BRD"].IntValue;
                KBBindings.ToggleBoard = (Control)t;

                t = u["KEYBOARD"]["Toggle_LIND"].IntValue;
                KBBindings.ToggleLIND = (Control)t;

                t = u["KEYBOARD"]["Toggle_RIND"].IntValue;
                KBBindings.ToggleRIND = (Control)t;

                t = u["KEYBOARD"]["Toggle_HAZ"].IntValue;
                KBBindings.ToggleHAZ = (Control)t;

                //Gamepad

                t = u["GAMEPAD"]["Toggle_TKDL"].IntValue;
                GPBindings.ToggleTdl = (Control)t;

                t = u["GAMEPAD"]["Sound_Ahorn"].IntValue;
                GPBindings.Sound_Ahorn = (Control)t;

                t = u["GAMEPAD"]["Snd_SrnTon1"].IntValue;
                GPBindings.Snd_SrnTon1 = (Control)t;

                t = u["GAMEPAD"]["Snd_SrnTon3"].IntValue;
                GPBindings.Snd_SrnTon3 = (Control)t;

                t = u["GAMEPAD"]["Toggle_LSTG"].IntValue;
                GPBindings.ToggleLstg = (Control)t;

                t = u["GAMEPAD"]["Toggle_SIRN"].IntValue;
                GPBindings.Toggle_SIRN = (Control)t;


                //ControlsUpdated?.Invoke(KeyBindings);
                Global.EnabeTrafficControl    = u["GENERAL"]["ElsTrafCtrlOn"].BoolValue;
                Global.DisableSirenOnExit     = u["GENERAL"]["ElsSirenOffonExit"].BoolValue;
                Global.NonElsOnly             = u["GENERAL"]["NonElsOnly"].BoolValue;
                Global.RegistrationDelay      = u["GENERAL"]["ElsRegistrationDelay"].IntValue;
                Global.ResetTakedownSpotlight = u["GENERAL"]["ResetTakeDownSpotlight"].BoolValue;
                Global.PrimDelay             = u["LIGHTING"]["LightFlashDelayMainLts"].IntValue;
                Global.DeleteInterval        = u["Admin"]["VehicleDeleteInterval"].FloatValue * 60 * 1000;
                Global.EnvLightRng           = u["LIGHTING"]["EnvLtMultExtraLts_Rng"].FloatValue * 25f;
                Global.EnvLightInt           = u["LIGHTING"]["EnvLtMultExtraLts_Int"].FloatValue * .02f;
                Global.TkdnRng               = u["LIGHTING"]["EnvLtMultTakedwns_Rng"].FloatValue * 25f;
                Global.TkdnInt               = u["LIGHTING"]["EnvLtMultTakedwns_Int"].FloatValue * 1f;
                Global.DayLtBrightness       = u["LIGHTING"]["DayLtBrightness"].FloatValue * 100f;
                Global.NightLtBrightness     = u["LIGHTING"]["NightLtBrightness"].FloatValue * 100f;
                Global.SoundVolume           = u["AUDIO"]["BtnClicksVolume"].FloatValue / 100;
                Global.BtnClicksBtwnSrnTones = u["AUDIO"]["BtnClicksBtwnSrnTones"].BoolValue;
                Global.BtnClicksBtwnHrnTones = u["AUDIO"]["BtnClicksBtwnHrnTones"].BoolValue;
                Global.BtnClicksIndicators   = u["AUDIO"]["BtnClicksIndicators"].BoolValue;
                Global.AllowController       = u["GAMEPAD"]["AllowController"].BoolValue;
                Utils.DebugWrite($"Configuration ran \n ---------------------- \n Traffic Control: {Global.EnabeTrafficControl} \n Delay: {Global.PrimDelay} \n Delete Interval: {Global.DeleteInterval} \n Env Lighting Range: {Global.EnvLightRng}\n");
            }
        }
Ejemplo n.º 4
0
        private void FileLoader_OnSettingsLoaded(SettingsType.Type type, string Data)
        {
            if (type == SettingsType.Type.GLOBAL)
            {
                var u = SharpConfig.Configuration.LoadFromString(Data);
                var t = u["CONTROL"]["Sound_Ahorn"].IntValue;
                KeyBindings.Sound_Ahorn = (Control)t;

                t = u["CONTROL"]["Snd_SrnTon1"].IntValue;
                KeyBindings.Snd_SrnTon1 = (Control)t;

                t = u["CONTROL"]["Snd_SrnTon2"].IntValue;
                KeyBindings.Snd_SrnTon2 = (Control)t;

                t = u["CONTROL"]["Snd_SrnTon3"].IntValue;
                KeyBindings.Snd_SrnTon3 = (Control)t;

                t = u["CONTROL"]["Snd_SrnTon4"].IntValue;
                KeyBindings.Snd_SrnTon4 = (Control)t;

                t = u["CONTROL"]["Sound_Manul"].IntValue;
                KeyBindings.Sound_Manul = (Control)t;

                t = u["CONTROL"]["Toggle_SIRN"].IntValue;
                KeyBindings.Toggle_SIRN = (Control)t;

                t = u["CONTROL"]["Toggle_DSRN"].IntValue;
                KeyBindings.Toggle_DSRN = (Control)t;

                t = u["CONTROL"]["TogInfoPanl"].IntValue;
                KeyBindings.TogInfoPanl = (Control)t;

                t = u["CONTROL"]["Snd_SrnPnic"].IntValue;
                KeyBindings.Snd_SrnPnic = (Control)t;

                t = u["CONTROL"]["Toggle_SECL"].IntValue;
                KeyBindings.ToggleSecL = (Control)t;

                t = u["CONTROL"]["Toggle_WRNL"].IntValue;
                KeyBindings.ToggleWrnL = (Control)t;

                t = u["CONTROL"]["Toggle_CRSL"].IntValue;
                KeyBindings.ToggleCrsL = (Control)t;

                t = u["CONTROL"]["ChgPat_PRML"].IntValue;
                KeyBindings.ChgPattPrmL = (Control)t;

                t = u["CONTROL"]["ChgPat_SECL"].IntValue;
                KeyBindings.ChgPattSecL = (Control)t;

                t = u["CONTROL"]["ChgPat_WRNL"].IntValue;
                KeyBindings.ChgPattWrnL = (Control)t;

                t = u["CONTROL"]["Toggle_LSTG"].IntValue;
                KeyBindings.ToggleLstg = (Control)t;

                t = u["CONTROL"]["Toggle_TKDL"].IntValue;
                KeyBindings.ToggleTdl = (Control)t;

                t = u["CONTROL"]["Toggle_BRD"].IntValue;
                KeyBindings.ToggleBoard = (Control)t;

                t = u["CONTROL"]["Toggle_LIND"].IntValue;
                KeyBindings.ToggleLIND = (Control)t;

                t = u["CONTROL"]["Toggle_RIND"].IntValue;
                KeyBindings.ToggleRIND = (Control)t;

                t = u["CONTROL"]["Toggle_HAZ"].IntValue;
                KeyBindings.ToggleHAZ = (Control)t;


                ControlsUpdated?.Invoke(KeyBindings);
                Global.EnabeTrafficControl = u["GENERAL"]["ElsTrafCtrlOn"].BoolValue;
                Global.PrimDelay           = u["LIGHTING"]["LightFlashDelayMainLts"].IntValue;
                Global.DeleteInterval      = u["Admin"]["VehicleDeleteInterval"].FloatValue * 60 * 1000;
                Global.EnvLightRng         = u["LIGHTING"]["EnvLtMultExtraLts_Rng"].FloatValue * 25f;
                Global.EnvLightInt         = u["LIGHTING"]["EnvLtMultExtraLts_Int"].FloatValue * .02f;
                Global.TkdnRng             = u["LIGHTING"]["EnvLtMultTakedwns_Rng"].FloatValue * 25f;
                Global.TkdnInt             = u["LIGHTING"]["EnvLtMultTakedwns_Int"].FloatValue * 1f;
                Global.AllowController     = u["CONTROL"]["AllowController"].BoolValue;
                Utils.DebugWrite($"Configuration ran \n ---------------------- \n Traffic Control: {Global.EnabeTrafficControl} \n Delay: {Global.PrimDelay} \n Delete Interval: {Global.DeleteInterval} \n Env Lighting Range: {Global.EnvLightRng}");
            }
        }
Ejemplo n.º 5
0
        static void load(SettingsType.Type type, string name, string Data, string ResourceName)
        {
            var bytes = Encoding.UTF8.GetBytes(Data);

            if (bytes[0] == 0xEF && bytes[1] == 0xBB && bytes[2] == 0xBF)
            {
                var ex = new Exception($"Error Loading:{name}\n" +
                                       $"Please save {name} with UTF-8 no BOM/Signature Encoding");
                throw (ex);
            }
            Encoding.UTF8.GetPreamble();
            Model hash = Game.GenerateHash(Path.GetFileNameWithoutExtension(name).ToLower());
            var   data = new VCFEntry(Path.GetFileNameWithoutExtension(name), ResourceName, hash, new Vcfroot());

            if (type == SettingsType.Type.VCF)
            {
                //System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
                NanoXMLDocument doc = new NanoXMLDocument(Data);
                // doc.LoadXml(Data);
                bool res;
                //data.filename = Path.GetFileNameWithoutExtension(name);
                if (data.root == null)
                {
                    Debug.WriteLine("Null issue");
                    return;
                }
                Dictionary <string, NanoXMLNode> subNodes = new Dictionary <string, NanoXMLNode>();
                foreach (NanoXMLNode node in doc.RootNode.SubNodes)
                {
                    subNodes.Add(node.Name, node);
                }
                #region VCF Info
                Utils.ReleaseWriteLine($"Parsing VCF Info for vehicle {name}");
                //VCF Description
                if (doc.RootNode.GetAttribute("Description") != null)
                {
                    data.root.Description = doc.RootNode.GetAttribute("Description").Value;
                }

                //VCF Author
                if (doc.RootNode.GetAttribute("Author") != null)
                {
                    data.root.Author = doc.RootNode.GetAttribute("Author").Value;
                }
                #endregion
                #region Interface

                try
                {
                    foreach (NanoXMLNode n in subNodes["INTERFACE"].SubNodes)
                    {
                        switch (n.Name)
                        {
                        case "LstgActivationType":
                            data.root.INTERFACE.LstgActivationType = n.Value;
                            break;

                        case "DefaultSirenMode":
                            data.root.INTERFACE.DefaultSirenMode = n.Value;
                            break;

                        case "InfoPanelHeaderColor":
                            data.root.INTERFACE.InfoPanelHeaderColor = n.Value;
                            break;

                        case "InfoPanelButtonLightColor":
                            data.root.INTERFACE.InfoPanelButtonLightColor = n.Value;
                            break;
                        }
                    }
                }
                catch (Exception e)
                {
                    Utils.ReleaseWriteLine($"Interface for {name} failed to parse due to {e.Message} with inner of {e.InnerException}");
                }
                #endregion

                #region Extras Override

                try
                {
                    foreach (NanoXMLNode n in subNodes["EOVERRIDE"].SubNodes)
                    {
                        switch (n.Name)
                        {
                        case "Extra01":
                            data.root.EOVERRIDE.Extra01.SetData(n);
                            break;

                        case "Extra02":
                            data.root.EOVERRIDE.Extra02.SetData(n);
                            break;

                        case "Extra03":
                            data.root.EOVERRIDE.Extra03.SetData(n);
                            break;

                        case "Extra04":
                            data.root.EOVERRIDE.Extra04.SetData(n);
                            break;

                        case "Extra05":
                            data.root.EOVERRIDE.Extra05.SetData(n);
                            break;

                        case "Extra06":
                            data.root.EOVERRIDE.Extra06.SetData(n);
                            break;

                        case "Extra07":
                            data.root.EOVERRIDE.Extra07.SetData(n);
                            break;

                        case "Extra08":
                            data.root.EOVERRIDE.Extra08.SetData(n);
                            break;

                        case "Extra09":
                            data.root.EOVERRIDE.Extra08.SetData(n);
                            break;

                        case "Extra10":
                            data.root.EOVERRIDE.Extra10.IsElsControlled = bool.Parse(n.GetAttribute("IsElsControlled").Value);
                            //data.root.EOVERRIDE.Extra10.AllowEnvLight = bool.Parse(n.GetAttribute("AllowEnvLight").Value);
                            //data.root.EOVERRIDE.Extra10.Color = n.GetAttribute("Color").Value;
                            //data.root.EOVERRIDE.Extra10.OffsetX = float.Parse(n.GetAttribute("OffsetX").Value);
                            //data.root.EOVERRIDE.Extra10.OffsetY = float.Parse(n.GetAttribute("OffsetY").Value);
                            //data.root.EOVERRIDE.Extra10.OffsetZ = float.Parse(n.GetAttribute("OffsetZ").Value);
                            break;

                        case "Extra11":
                            data.root.EOVERRIDE.Extra11.IsElsControlled = bool.Parse(n.GetAttribute("IsElsControlled").Value);
                            //data.root.EOVERRIDE.Extra11.AllowEnvLight = bool.Parse(n.GetAttribute("AllowEnvLight").Value);
                            //data.root.EOVERRIDE.Extra11.Color = n.GetAttribute("Color").Value;
                            //data.root.EOVERRIDE.Extra11.OffsetX = float.Parse(n.GetAttribute("OffsetX").Value);
                            //data.root.EOVERRIDE.Extra11.OffsetY = float.Parse(n.GetAttribute("OffsetY").Value);
                            //data.root.EOVERRIDE.Extra11.OffsetZ = float.Parse(n.GetAttribute("OffsetZ").Value);
                            break;

                        case "Extra12":
                            data.root.EOVERRIDE.Extra12.IsElsControlled = bool.Parse(n.GetAttribute("IsElsControlled").Value);
                            //data.root.EOVERRIDE.Extra12.AllowEnvLight = bool.Parse(n.GetAttribute("AllowEnvLight").Value);
                            //data.root.EOVERRIDE.Extra12.Color = n.GetAttribute("Color").Value;
                            //data.root.EOVERRIDE.Extra12.OffsetX = float.Parse(n.GetAttribute("OffsetX").Value);
                            //data.root.EOVERRIDE.Extra12.OffsetY = float.Parse(n.GetAttribute("OffsetY").Value);
                            //data.root.EOVERRIDE.Extra12.OffsetZ = float.Parse(n.GetAttribute("OffsetZ").Value);
                            break;
                        }
                    }
                }
                catch (Exception e)
                {
                    Utils.ReleaseWriteLine($"EOverride for {name} failed to parse due to {e.Message} with inner of {e.InnerException}");
                }
                #endregion

                #region MISC
#if DEBUG
                Utils.DebugWriteLine("Parsing Misc");
#endif

                try
                {
                    foreach (NanoXMLNode n in subNodes["MISC"].SubNodes)
                    {
                        switch (n.Name)
                        {
                        case "VehicleIsSlicktop":
                            data.root.MISC.VehicleIsSlicktop = bool.Parse(n.Value);
                            break;

                        case "ArrowboardType":
                            data.root.MISC.ArrowboardType = n.Value;
                            break;

                        case "UseSteadyBurnLights":
                            data.root.MISC.UseSteadyBurnLights = bool.Parse(n.Value);
                            break;

                        case "DfltSirenLtsActivateAtLstg":
                            data.root.MISC.DfltSirenLtsActivateAtLstg = int.Parse(n.Value);
                            break;

                        case "Takedowns":
                            data.root.MISC.Takedowns.AllowUse = bool.Parse(n.GetAttribute("AllowUse").Value);
                            data.root.MISC.Takedowns.Mirrored = bool.Parse(n.GetAttribute("Mirrored").Value);
                            break;

                        case "SceneLights":
                            data.root.MISC.SceneLights.AllowUse            = bool.Parse(n.GetAttribute("AllowUse").Value);
                            data.root.MISC.SceneLights.IlluminateSidesOnly = bool.Parse(n.GetAttribute("IlluminateSidesOnly").Value);
                            break;

                        case "LadderControl":
                            data.root.MISC.HasLadderControl = bool.Parse(n.GetAttribute("enabled").Value);
                            foreach (NanoXMLNode sn in n.SubNodes)
                            {
                                switch (sn.Name)
                                {
                                case "HoriztonalControl":
                                    data.root.MISC.LadderControl.HorizontalControl = sn.Value;
                                    break;

                                case "VerticalControl":
                                    data.root.MISC.LadderControl.VerticalControl = sn.Value;
                                    break;

                                case "MovementSpeed":
                                    data.root.MISC.LadderControl.MovementSpeed = int.Parse(sn.Value);
                                    break;
                                }
                            }
                            break;
                        }
                    }
                }
                catch (Exception e)
                {
                    Utils.ReleaseWriteLine($"Misc for {name} failed to parse due to {e.Message} with inner of {e.InnerException}");
                }
                #endregion

                #region Cruise
#if DEBUG
                Utils.DebugWriteLine("Parsing Cruise");
#endif
                try
                {
                    foreach (NanoXMLNode n in subNodes["CRUISE"].SubNodes)
                    {
                        switch (n.Name)
                        {
                        case "DisableAtLstg3":
                            data.root.CRUISE.DisableAtLstg3 = bool.Parse(n.Value);
                            break;

                        case "UseExtras":
                            data.root.CRUISE.UseExtras.Extra1 = bool.Parse(n.GetAttribute("Extra1").Value);
                            data.root.CRUISE.UseExtras.Extra2 = bool.Parse(n.GetAttribute("Extra2").Value);
                            data.root.CRUISE.UseExtras.Extra3 = bool.Parse(n.GetAttribute("Extra3").Value);
                            data.root.CRUISE.UseExtras.Extra4 = bool.Parse(n.GetAttribute("Extra4").Value);
                            break;
                        }
                    }
                }
                catch (Exception e)
                {
                    Utils.ReleaseWriteLine($"Cruise for {name} failed to parse due to {e.Message} with inner of {e.InnerException}");
                }
                #endregion

                #region Sounds
#if DEBUG
                Utils.DebugWriteLine("Parsing Sounds");
#endif
                try
                {
                    foreach (NanoXMLNode n in subNodes["SOUNDS"].SubNodes)
                    {
                        switch (n.Name)
                        {
                        case "ManTone1":
                            data.root.SOUNDS.ManTone1.SetData(n);
                            break;

                        case "ManTone2":
                            data.root.SOUNDS.ManTone2.SetData(n);
                            break;

                        case "MainHorn":
                            data.root.SOUNDS.MainHorn.SetData(n);
                            break;

                        case "SrnTone1":
                            data.root.SOUNDS.SrnTone1.SetData(n);
                            break;

                        case "SrnTone2":
                            data.root.SOUNDS.SrnTone2.SetData(n);
                            break;

                        case "SrnTone3":
                            data.root.SOUNDS.SrnTone3.SetData(n);
                            break;

                        case "SrnTone4":
                            data.root.SOUNDS.SrnTone4.SetData(n);
                            break;

                        case "AuxSiren":
                            data.root.SOUNDS.AuxSiren.SetData(n);
                            break;

                        case "PanicMde":
                            data.root.SOUNDS.PanicMde.SetData(n);
                            break;
                        }
                    }
                }
                catch (Exception e)
                {
                    Utils.ReleaseWriteLine($"Sounds for {name} failed to parse due to {e.Message} with inner of {e.InnerException}");
                }
                #endregion

                #region Warning Lights

#if DEBUG
                Utils.DebugWriteLine("Parsing Warning Lights");
#endif
                try
                {
                    data.root.WRNL.LightingFormat = subNodes["WRNL"].GetAttribute("LightingFormat").Value;
                    if (subNodes["WRNL"].GetAttribute("DisableAtLstg3") != null)
                    {
                        data.root.WRNL.DisableAtLstg3 = bool.Parse(subNodes["WRNL"].GetAttribute("DisableAtLstg3").Value);
                    }

                    data.root.WRNL.ExtrasActiveAtLstg1 = subNodes["WRNL"].GetAttribute("ExtrasActiveAtLstg1")?.Value;
                    data.root.WRNL.ExtrasActiveAtLstg2 = subNodes["WRNL"].GetAttribute("ExtrasActiveAtLstg2")?.Value;
                    data.root.WRNL.ExtrasActiveAtLstg3 = subNodes["WRNL"].GetAttribute("ExtrasActiveAtLstg3")?.Value;

                    foreach (NanoXMLNode n in subNodes["WRNL"].SubNodes)
                    {
                        switch (n.Name)
                        {
                        case "PresetPatterns":
                            foreach (NanoXMLNode sn in n.SubNodes)
                            {
                                switch (sn.Name)
                                {
                                case "Lstg1":
                                    data.root.WRNL.PresetPatterns.Lstg1.SetData(sn);
                                    break;

                                case "Lstg2":
                                    data.root.WRNL.PresetPatterns.Lstg2.SetData(sn);
                                    break;

                                case "Lstg3":
                                    data.root.WRNL.PresetPatterns.Lstg3.SetData(sn);
                                    break;
                                }
                            }
                            break;

                        case "ForcedPatterns":
                            foreach (NanoXMLNode sn in n.SubNodes)
                            {
                                switch (sn.Name)
                                {
                                case "MainHorn":
                                    data.root.WRNL.ForcedPatterns.MainHorn.SetData(sn);
                                    break;

                                case "SrnTone1":
                                    data.root.WRNL.ForcedPatterns.SrnTone1.SetData(sn);
                                    break;

                                case "SrnTone2":
                                    data.root.WRNL.ForcedPatterns.SrnTone2.SetData(sn);
                                    break;

                                case "SrnTone3":
                                    data.root.WRNL.ForcedPatterns.SrnTone3.SetData(sn);
                                    break;

                                case "SrnTone4":
                                    data.root.WRNL.ForcedPatterns.SrnTone4.SetData(sn);
                                    break;

                                case "AuxSiren":
                                    data.root.WRNL.ForcedPatterns.AuxSiren.SetData(sn);
                                    break;

                                case "PanicMde":
                                    data.root.WRNL.ForcedPatterns.PanicMde.SetData(sn);
                                    break;

                                case "OutOfVeh":
                                    data.root.WRNL.ForcedPatterns.OutOfVeh.SetData(sn);
                                    break;
                                }
                            }
                            break;

                        case "ScanPatternCustomPool":
                            data.root.WRNL.ScanPatternCustomPool.Enabled    = bool.Parse(n.GetAttribute("Enabled").Value);
                            data.root.WRNL.ScanPatternCustomPool.Sequential = bool.Parse(n.GetAttribute("Sequential").Value);
                            foreach (NanoXMLNode sn in n.SubNodes)
                            {
                                data.root.WRNL.ScanPatternCustomPool.Pattern.Add(int.Parse(sn.Value));
                            }
                            break;
                        }
                    }
                }
                catch (Exception e)
                {
                    Utils.ReleaseWriteLine($"Warning lights for {name} failed to parse due to {e.Message} with inner of {e.InnerException}");
                }

                #endregion

                #region Primary Lights

#if DEBUG
                Utils.DebugWriteLine("Parsing Primary Lights");
#endif
                try
                {
                    data.root.PRML.LightingFormat = subNodes["PRML"].GetAttribute("LightingFormat").Value;
                    if (subNodes["PRML"].GetAttribute("DisableAtLstg3") != null)
                    {
                        data.root.PRML.DisableAtLstg3 = bool.Parse(subNodes["PRML"].GetAttribute("DisableAtLstg3").Value);
                    }
                    data.root.PRML.ExtrasActiveAtLstg1 = subNodes["PRML"].GetAttribute("ExtrasActiveAtLstg1")?.Value;
                    data.root.PRML.ExtrasActiveAtLstg2 = subNodes["PRML"].GetAttribute("ExtrasActiveAtLstg2")?.Value;
                    data.root.PRML.ExtrasActiveAtLstg3 = subNodes["PRML"].GetAttribute("ExtrasActiveAtLstg3")?.Value;
                    foreach (NanoXMLNode n in subNodes["PRML"].SubNodes)
                    {
                        switch (n.Name)
                        {
                        case "PresetPatterns":
                            foreach (NanoXMLNode sn in n.SubNodes)
                            {
                                switch (sn.Name)
                                {
                                case "Lstg1":
                                    data.root.PRML.PresetPatterns.Lstg1.SetData(sn);
                                    break;

                                case "Lstg2":
                                    data.root.PRML.PresetPatterns.Lstg2.SetData(sn);
                                    break;

                                case "Lstg3":
                                    data.root.PRML.PresetPatterns.Lstg3.SetData(sn);
                                    break;
                                }
                            }
                            break;

                        case "ForcedPatterns":
                            foreach (NanoXMLNode sn in n.SubNodes)
                            {
                                switch (sn.Name)
                                {
                                case "MainHorn":
                                    data.root.PRML.ForcedPatterns.MainHorn.SetData(sn);
                                    break;

                                case "SrnTone1":
                                    data.root.PRML.ForcedPatterns.SrnTone1.SetData(sn);
                                    break;

                                case "SrnTone2":
                                    data.root.PRML.ForcedPatterns.SrnTone2.SetData(sn);
                                    break;

                                case "SrnTone3":
                                    data.root.PRML.ForcedPatterns.SrnTone3.SetData(sn);
                                    break;

                                case "SrnTone4":
                                    data.root.PRML.ForcedPatterns.SrnTone4.SetData(sn);
                                    break;

                                case "AuxSiren":
                                    data.root.PRML.ForcedPatterns.AuxSiren.SetData(sn);
                                    break;

                                case "PanicMde":
                                    data.root.PRML.ForcedPatterns.PanicMde.SetData(sn);
                                    break;

                                case "OutOfVeh":
                                    data.root.PRML.ForcedPatterns.OutOfVeh.SetData(sn);
                                    break;
                                }
                            }
                            break;

                        case "ScanPatternCustomPool":
                            data.root.PRML.ScanPatternCustomPool.Enabled    = bool.Parse(n.GetAttribute("Enabled").Value);
                            data.root.PRML.ScanPatternCustomPool.Sequential = bool.Parse(n.GetAttribute("Sequential").Value);
                            foreach (NanoXMLNode sn in n.SubNodes)
                            {
                                data.root.PRML.ScanPatternCustomPool.Pattern.Add(int.Parse(sn.Value));
                            }
                            break;
                        }
                    }
                }
                catch (Exception e)
                {
                    Utils.ReleaseWriteLine($"Primary Lights for {name} failed to parse due to {e.Message} with inner of {e.InnerException}");
                }

                #endregion

                #region Secondary Lights
#if DEBUG
                Utils.DebugWriteLine("Parsing Secondary Lights");
#endif
                try
                {
                    data.root.SECL.LightingFormat = subNodes["SECL"].GetAttribute("LightingFormat").Value;
                    if (subNodes["SECL"].GetAttribute("DisableAtLstg3") != null)
                    {
                        data.root.SECL.DisableAtLstg3 = bool.Parse(subNodes["SECL"].GetAttribute("DisableAtLstg3").Value);
                    }
                    data.root.SECL.ExtrasActiveAtLstg1 = subNodes["SECL"].GetAttribute("ExtrasActiveAtLstg1")?.Value;
                    data.root.SECL.ExtrasActiveAtLstg2 = subNodes["SECL"].GetAttribute("ExtrasActiveAtLstg2")?.Value;
                    data.root.SECL.ExtrasActiveAtLstg3 = subNodes["SECL"].GetAttribute("ExtrasActiveAtLstg3")?.Value;
                    foreach (NanoXMLNode n in subNodes["SECL"].SubNodes)
                    {
                        switch (n.Name)
                        {
                        case "PresetPatterns":
                            foreach (NanoXMLNode sn in n.SubNodes)
                            {
                                switch (sn.Name)
                                {
                                case "Lstg1":
                                    data.root.SECL.PresetPatterns.Lstg1.SetData(sn);
                                    break;

                                case "Lstg2":
                                    data.root.SECL.PresetPatterns.Lstg2.SetData(sn);
                                    break;

                                case "Lstg3":
                                    data.root.SECL.PresetPatterns.Lstg3.SetData(sn);
                                    break;
                                }
                            }
                            break;

                        case "ForcedPatterns":
                            foreach (NanoXMLNode sn in n.SubNodes)
                            {
                                switch (sn.Name)
                                {
                                case "MainHorn":
                                    data.root.SECL.ForcedPatterns.MainHorn.SetData(sn);
                                    break;

                                case "SrnTone1":
                                    data.root.SECL.ForcedPatterns.SrnTone1.SetData(sn);
                                    break;

                                case "SrnTone2":
                                    data.root.SECL.ForcedPatterns.SrnTone2.SetData(sn);
                                    break;

                                case "SrnTone3":
                                    data.root.SECL.ForcedPatterns.SrnTone3.SetData(sn);
                                    break;

                                case "SrnTone4":
                                    data.root.SECL.ForcedPatterns.SrnTone4.SetData(sn);
                                    break;

                                case "AuxSiren":
                                    data.root.SECL.ForcedPatterns.AuxSiren.SetData(sn);
                                    break;

                                case "PanicMde":
                                    data.root.SECL.ForcedPatterns.PanicMde.SetData(sn);
                                    break;

                                case "OutOfVeh":
                                    data.root.SECL.ForcedPatterns.OutOfVeh.SetData(sn);
                                    break;
                                }
                            }
                            break;

                        case "ScanPatternCustomPool":
                            data.root.SECL.ScanPatternCustomPool.Enabled    = bool.Parse(n.GetAttribute("Enabled").Value);
                            data.root.SECL.ScanPatternCustomPool.Sequential = bool.Parse(n.GetAttribute("Sequential").Value);
                            foreach (NanoXMLNode sn in n.SubNodes)
                            {
                                data.root.SECL.ScanPatternCustomPool.Pattern.Add(int.Parse(sn.Value));
                            }
                            break;
                        }
                    }
                }
                catch (Exception e)
                {
                    Utils.ReleaseWriteLine($"Secondary Lights for {name} failed to parse due to {e.Message} with inner of {e.InnerException}");
                }
                #endregion

                //TODO: add method to remove old file or a file from ELSVehicle
                if (ELSVehicle.ContainsKey(hash))
                {
#if DEBUG
                    Utils.DebugWriteLine($"Removeing preexisting VCF for resource {ResourceName} for {name}");
#endif
                    ELSVehicle.Remove(hash);
                }
                ELSVehicle.Add(hash, data);
                Utils.ReleaseWriteLine($"Added vehicle {data.filename} : {hash}");
            }
        }