Esempio n. 1
0
        internal static bool isValidData(string data)
        {
            if (String.IsNullOrEmpty(data))
            {
                return(false);
            }
            NanoXMLDocument doc = new NanoXMLDocument(data);

            return(doc.RootNode.Name == "vcfroot");
        }
Esempio n. 2
0
        internal static bool IsValidPatternData(string data)
        {
            if (string.IsNullOrEmpty(data))
            {
                return(false);
            }
            NanoXMLDocument doc = new NanoXMLDocument(data);

            //TODO change how below is detected to account for xml meta tag being before it.
            return(doc.RootNode.Name == "pattern");
        }
Esempio n. 3
0
        static void LoadCustomPattern(Tuple <string, string, string> pattData)
        {
            Light.Patterns.CustomPattern pattern = new Light.Patterns.CustomPattern(150, 200, 200, new Dictionary <int, string>());
            NanoXMLDocument      doc             = new NanoXMLDocument(pattData.Item3);
            List <StringBuilder> builders        = new List <StringBuilder>();

            for (int i = 0; i < 10; i++)
            {
                builders.Add(new StringBuilder());
            }
            foreach (NanoXMLNode n in doc.RootNode.SubNodes)
            {
                switch (n.Name)
                {
                case "PRIMARY":
                    pattern.PrmDelay = int.Parse(n.GetAttribute("speed").Value);
                    foreach (NanoXMLNode state in n.SubNodes)
                    {
                        for (int i = 0; i < 4; i++)
                        {
                            if (state.GetAttribute($"Extra{i + 1}") != null)
                            {
                                builders[i].Append(bool.Parse(state.GetAttribute($"Extra{i + 1}").Value) ? "1" : "0");
                            }
                        }
                    }
                    break;

                case "SECONDARY":
                    pattern.SecDelay = int.Parse(n.GetAttribute("speed").Value);
                    foreach (NanoXMLNode state in n.SubNodes)
                    {
                        for (int i = 5; i < 9; i++)
                        {
                            if (state.GetAttribute($"Extra{i + 1}") != null)
                            {
                                builders[i].Append(bool.Parse(state.GetAttribute($"Extra{i + 1}").Value) ? "1" : "0");
                            }
                        }
                    }
                    break;

                case "ADVISOR":
                    pattern.TADelay = int.Parse(n.GetAttribute("speed").Value);
                    foreach (NanoXMLNode state in n.SubNodes)
                    {
                        for (int i = 7; i < 9; i++)
                        {
                            if (state.GetAttribute($"Extra{i + 1}") != null)
                            {
                                builders[i].Append(bool.Parse(state.GetAttribute($"Extra{i + 1}").Value) ? "1" : "0");
                            }
                        }
                    }
                    break;
                }
            }
            if (builders[0].Length > 0)
            {
                pattern.PatternData.Add(1, builders[0].ToString());
            }
            if (builders[1].Length > 0)
            {
                pattern.PatternData.Add(2, builders[1].ToString());
            }
            if (builders[2].Length > 0)
            {
                pattern.PatternData.Add(3, builders[2].ToString());
            }
            if (builders[3].Length > 0)
            {
                pattern.PatternData.Add(4, builders[3].ToString());
            }
            if (builders[4].Length > 0)
            {
                pattern.PatternData.Add(5, builders[4].ToString());
            }
            if (builders[5].Length > 0)
            {
                pattern.PatternData.Add(6, builders[5].ToString());
            }
            if (builders[6].Length > 0)
            {
                pattern.PatternData.Add(7, builders[6].ToString());
            }
            if (builders[7].Length > 0)
            {
                pattern.PatternData.Add(8, builders[7].ToString());
            }
            if (builders[8].Length > 0)
            {
                pattern.PatternData.Add(9, builders[8].ToString());
            }
            foreach (int hash in ELSVehicle.Keys)
            {
                if (ELSVehicle[hash].root.CustomPatterns == null)
                {
                    ELSVehicle[hash].root.CustomPatterns = new Dictionary <string, Light.Patterns.CustomPattern>();
                }
                if (ELSVehicle[hash].root.CustomPatterns.ContainsKey(Path.GetFileNameWithoutExtension(pattData.Item2).ToLower()))
                {
                    ELSVehicle[hash].root.CustomPatterns[Path.GetFileNameWithoutExtension(pattData.Item2).ToLower()] = pattern;
                }
                else
                {
                    ELSVehicle[hash].root.CustomPatterns.Add(Path.GetFileNameWithoutExtension(pattData.Item2).ToLower(), pattern);
                }
            }
        }
Esempio n. 4
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}");
            }
        }