예제 #1
0
 public void update(BotCommand temp)
 {
     helpString = temp.helpString;
     isEnabled = temp.isEnabled;
     isMasterOnly = temp.isMasterOnly;
 }
예제 #2
0
        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;
            }
        }