public override void Load()
        {
            var nonSharedPath = Path.Combine(Server.Get.Files.ConfigDirectory, "SCP914Recipes.syml");
            var path          = File.Exists(nonSharedPath) ? nonSharedPath : Path.Combine(Server.Get.Files.SharedConfigDirectory, "SCP914Recipes.syml");

            SYMLConfig = new SYML(path);

            //Wait 3 Seconds so that the Game has enough time to load the default Values
            Timing.CallDelayed(3f, () =>
            {
                DefaultConfig.Scp914Recipes = Map.Get.Scp914.Recipes.ToList();
                ReloadConfigs();
            });
        }
Example #2
0
        public void SaveSchematic(SynapseSchematic schematic, string fileName)
        {
            if (IsIDRegistered(schematic.ID))
            {
                return;
            }
            AddSchematic(schematic);

            var syml    = new SYML(Path.Combine(Server.Get.Files.SchematicDirectory, fileName + ".syml"));
            var section = new ConfigSection {
                Section = schematic.Name
            };

            section.Import(schematic);
            syml.Sections.Add(schematic.Name, section);
            syml.Store();
        }
Example #3
0
        internal void Load()
        {
            var list = Schematics.ToList();

            foreach (var schematic in list.ToList())
            {
                if (schematic.reload)
                {
                    list.Remove(schematic);
                }
            }

            Schematics = list.AsReadOnly();

            foreach (var file in Directory.GetFiles(Server.Get.Files.SchematicDirectory, "*.syml"))
            {
                try
                {
                    var syml = new SYML(file);
                    syml.Load();
                    if (syml.Sections.Count == 0)
                    {
                        continue;
                    }
                    var section   = syml.Sections.First().Value;
                    var schematic = section.LoadAs <SynapseSchematic>();

                    if (IsIDRegistered(schematic.ID))
                    {
                        continue;
                    }

                    AddSchematic(schematic);
                }
                catch (Exception ex)
                {
                    Logger.Get.Error($"Synapse-Schematic: Loading Schematic failed - path: {file}\n{ex}");
                }
            }
        }
Example #4
0
 internal void Init()
 {
     _permissionSYML = new SYML(Server.Get.Files.PermissionFile);
     Reload();
 }
Example #5
0
 public SynapseTranslation(string path)
 {
     translationSYML = new SYML(path);
     translationSYML.Load();
 }