Exemplo n.º 1
0
 public bool LoadDefinitionsFromString(string data)
 {
     if (data.Length > 1) //YEP. THATS TOTALLY SAFE.
     {
         var tr = new XmlTextReader(new StringReader(data));
         JobSettings = (JobSettings)Serializer.Deserialize(tr); //Deserialize.
         return(false);
     }
     else
     {
         return(true);
     }
 }
Exemplo n.º 2
0
        public void CreateTemplate()
        {
            JobSettings JobSettingsTemplate = new JobSettings();

            JobDefinition jobDef = new JobDefinition();

            jobDef.Name        = "Security Officer";
            jobDef.Description = "Keeps the inhabitants of the station safe.";
            jobDef.SpawnEquipment.Add(new SpawnEquipDefinition()
            {
                Location = EquipmentSlot.Outer, ObjectType = "Atom.Item.Wearable.Outer.Armour"
            });
            jobDef.SpawnEquipment.Add(new SpawnEquipDefinition()
            {
                Location = EquipmentSlot.Inner, ObjectType = "Atom.Item.Wearable.Inner.Jumpsuit.Assistant_Grey"
            });
            jobDef.SpawnEquipment.Add(new SpawnEquipDefinition()
            {
                Location = EquipmentSlot.Head, ObjectType = "Atom.Item.Wearable.Head.Helmet"
            });
            jobDef.SpawnEquipment.Add(new SpawnEquipDefinition()
            {
                Location = EquipmentSlot.Feet, ObjectType = "Atom.Item.Wearable.Feet.Shoes"
            });
            jobDef.Department = "Security";

            JobSettingsTemplate.JobDefinitions = new List <JobDefinition> {
                jobDef
            };

            DepartmentDefinition depDef = new DepartmentDefinition();

            depDef.DepartmentIcon  = "department_security";
            depDef.Description     = "The security department handles the security of the station in all matters.";
            depDef.Name            = "Security";
            depDef.DepartmentColor = Color.FromArgb(255, 125, 125, 125);

            JobSettingsTemplate.DepartmentDefinitions = new List <DepartmentDefinition>()
            {
                depDef
            };

            XmlWriterSettings settings = new XmlWriterSettings();

            settings.Indent             = true;
            settings.OmitXmlDeclaration = false;

            XmlWriter writer = XmlTextWriter.Create("JobDefinitions.xml", settings);

            Serializer.Serialize(writer, JobSettingsTemplate);
        }
Exemplo n.º 3
0
 public bool LoadDefinitionsFromFile(string path)
 {
     if (File.Exists(path))
     {
         XmlReader reader = XmlReader.Create(path); //Create reader for file.
         JobSettings = (JobSettings)Serializer.Deserialize(reader);
         //Deserialize and save inside class.
         return(false);
     }
     else
     {
         CreateTemplate();
         return(true);
     }
 }
Exemplo n.º 4
0
 public bool LoadDefinitionsFromString(string data)
 {
     if (data.Length > 1) //YEP. THATS TOTALLY SAFE.
     {
         var tr = new XmlTextReader(new StringReader(data));
         JobSettings = (JobSettings)Serializer.Deserialize(tr); //Deserialize.
         return false;
     }
     else
     {
         return true;
     }
 }
Exemplo n.º 5
0
 public bool LoadDefinitionsFromFile(string path)
 {
     if (File.Exists(path))
     {
         XmlReader reader = XmlReader.Create(path); //Create reader for file.
         JobSettings = (JobSettings)Serializer.Deserialize(reader);
         //Deserialize and save inside class.
         return false;
     }
     else
     {
         CreateTemplate();
         return true;
     }
 }
Exemplo n.º 6
0
        public void CreateTemplate()
        {
            JobSettings JobSettingsTemplate = new JobSettings();

            JobDefinition jobDef = new JobDefinition();
            jobDef.Name = "Security Officer";
            jobDef.Description = "Keeps the inhabitants of the station safe.";
            jobDef.SpawnEquipment.Add(new SpawnEquipDefinition() { Location = EquipmentSlot.Outer, ObjectType = "Atom.Item.Wearable.Outer.Armour" });
            jobDef.SpawnEquipment.Add(new SpawnEquipDefinition() { Location = EquipmentSlot.Inner, ObjectType = "Atom.Item.Wearable.Inner.Jumpsuit.Assistant_Grey" });
            jobDef.SpawnEquipment.Add(new SpawnEquipDefinition() { Location = EquipmentSlot.Head, ObjectType = "Atom.Item.Wearable.Head.Helmet" });
            jobDef.SpawnEquipment.Add(new SpawnEquipDefinition() { Location = EquipmentSlot.Feet, ObjectType = "Atom.Item.Wearable.Feet.Shoes" });
            jobDef.Department = "Security";

            JobSettingsTemplate.JobDefinitions = new List<JobDefinition> {jobDef};

            DepartmentDefinition depDef = new DepartmentDefinition();
            depDef.DepartmentIcon = "department_security";
            depDef.Description = "The security department handles the security of the station in all matters.";
            depDef.Name = "Security";
            depDef.DepartmentColor = Color.FromArgb(255, 125, 125, 125);

            JobSettingsTemplate.DepartmentDefinitions = new List<DepartmentDefinition>() {depDef};

            XmlWriterSettings settings = new XmlWriterSettings();
            settings.Indent = true;
            settings.OmitXmlDeclaration = false;

            XmlWriter writer = XmlTextWriter.Create("JobDefinitions.xml", settings);
            Serializer.Serialize(writer, JobSettingsTemplate);
        }