public override void Save() { FileStream objStream = new FileStream(FileName, FileMode.Create, FileAccess.Write, FileShare.ReadWrite); XmlTextWriter objWriter = new XmlTextWriter(objStream, Encoding.UTF8) { Formatting = Formatting.Indented, Indentation = 1, IndentChar = '\t' }; //Start Doc objWriter.WriteStartDocument(); objWriter.WriteStartElement("Item"); objWriter.WriteElementString("Type", "CyberMod"); //Write Universal item Info objWriter.WriteElementString("Name", Name); objWriter.WriteElementString("Description", Description); objWriter.WriteElementString("Rules", Rules); //objWriter.WriteElementString("Picture", picture); TODO: Picture objWriter.WriteElementString("Availability", Avail.ToString()); objWriter.WriteElementString("Cost", Cost.ToString()); objWriter.WriteElementString("DeviceRating", DeviceRating.ToString()); objWriter.WriteElementString("Weight", Weight.ToString()); //End Doc objWriter.WriteEndElement(); objWriter.WriteEndDocument(); objWriter.Close(); objStream.Close(); }
public override void Save() { var objStream = new FileStream(FileName, FileMode.Create, FileAccess.Write, FileShare.ReadWrite); var objWriter = new XmlTextWriter(objStream, Encoding.UTF8) { Formatting = Formatting.Indented, Indentation = 1, IndentChar = '\t' }; //Start Doc objWriter.WriteStartDocument(); objWriter.WriteStartElement("Item"); objWriter.WriteElementString("Type", "Weapon"); //Write Universal item Info objWriter.WriteElementString("Name", Name); objWriter.WriteElementString("Description", Description); objWriter.WriteElementString("Rules", Rules); //objWriter.WriteElementString("Picture", picture); TODO: Picture objWriter.WriteElementString("Availability", Avail); objWriter.WriteElementString("Cost", Cost.ToString()); objWriter.WriteElementString("DeviceRating", DeviceRating.ToString()); objWriter.WriteElementString("Weight", Weight.ToString()); //Write Weapon Info objWriter.WriteElementString("SubCategory", SubCategory); objWriter.WriteElementString("Accuracy", Accuracy.ToString()); objWriter.WriteElementString("DamageValue", DamageValue.ToString()); objWriter.WriteElementString("ArmorPen", ArmorPen.ToString()); objWriter.WriteElementString("RecoilCompensation", RecoilCompensation.ToString()); objWriter.WriteElementString("AmmoCapacity", AmmoCapacity.ToString()); objWriter.WriteElementString("FireModes", FireMode); //Write ModSlots objWriter.WriteStartElement("ModSlots"); objWriter.WriteElementString(Modslots[0] ? "Enabled" : "Disabled", "Stock"); objWriter.WriteElementString(Modslots[1] ? "Enabled" : "Disabled", "Side"); objWriter.WriteElementString(Modslots[2] ? "Enabled" : "Disabled", "Barrel"); objWriter.WriteElementString(Modslots[3] ? "Enabled" : "Disabled", "Top"); objWriter.WriteElementString(Modslots[4] ? "Enabled" : "Disabled", "Under"); objWriter.WriteElementString(Modslots[5] ? "Enabled" : "Disabled", "Misc"); objWriter.WriteEndElement(); //End Doc objWriter.WriteEndElement(); objWriter.WriteEndDocument(); objWriter.Close(); objStream.Close(); }
private DeviceRating QueryDeviceRating() { string message = Command.SendCommand(_appSettings.LibVoltronicPath, DeviceRating.COMMAND); if (DeviceRating.CanProcess(message)) { return(new DeviceRating(message)); } else { _logger.LogInformation($"Error in Command {DeviceRating.COMMAND} : {message}"); } return(null); }
public override void Save() { var objStream = new FileStream(FileName, FileMode.Create, FileAccess.Write, FileShare.ReadWrite); var objWriter = new XmlTextWriter(objStream, Encoding.UTF8) { Formatting = Formatting.Indented, Indentation = 1, IndentChar = '\t' }; //Start Doc objWriter.WriteStartDocument(); objWriter.WriteStartElement("Item"); objWriter.WriteElementString("Type", "Vehicle"); //Write Universal item Info objWriter.WriteElementString("Name", Name); objWriter.WriteElementString("Description", Description); objWriter.WriteElementString("Rules", Rules); //objWriter.WriteElementString("Picture", picture); TODO: Picture objWriter.WriteElementString("Availability", Avail); objWriter.WriteElementString("Cost", Cost.ToString()); objWriter.WriteElementString("DeviceRating", DeviceRating.ToString()); objWriter.WriteElementString("Weight", Weight.ToString()); //Write Vehicle Info objWriter.WriteElementString("Body ", Body.ToString()); objWriter.WriteElementString("Speed", Speed.ToString()); objWriter.WriteElementString("Handling", Handling.ToString()); objWriter.WriteElementString("Armor", Armor.ToString()); objWriter.WriteElementString("Seats", Seats.ToString()); objWriter.WriteElementString("UpCap", UpCap.ToString()); //End Doc objWriter.WriteEndElement(); objWriter.WriteEndDocument(); objWriter.Close(); objStream.Close(); }