public void update(BotCommand temp) { helpString = temp.helpString; isEnabled = temp.isEnabled; isMasterOnly = temp.isMasterOnly; }
public static void DeSerialaze(BotCommand cmd) { BotCommand temp = null; try { string path = @"Settings\Seija_commands\c_" + cmd.CommandName + @".ext"; if (File.Exists(path)) { var stream = new StreamReader(path); if (stream.BaseStream.Length != 0) { var ser = new XmlSerializer(cmd.GetType()); if (cmd.GetType() == typeof(BotCommand)) { temp = (BotCommand)ser.Deserialize(stream); cmd.update(temp); } else if (cmd.GetType() == typeof(MoraleCommand)) { temp = (MoraleCommand)ser.Deserialize(stream); ((MoraleCommand)cmd).updateM((MoraleCommand)temp); } } stream.Close(); } } catch (Exception ex) { string e = ex.Message; } }