示例#1
0
        // plugin variables are declared in 'Global Vars' region above
        // ASSIGN values to program globals FROM server_ip.cfg and from Plugin Settings pane
        public void SetPluginVariable(string strVariable, string raw_strValue)
        {
            try
            {
                string strValue = CPluginVariable.Decode(raw_strValue);
                switch (strVariable)
                {
                    case "Game":
                        game_id = (GameIdEnum)Enum.Parse(typeof(GameIdEnum), strValue);
                        break;
                    case "Delay before kill":
                        kill_delay = Int32.Parse(strValue);
                        break;
                    case "Yell seconds":
                        yell_delay = Int32.Parse(strValue);
                        break;
                    //case "Player keeps items on respawn":
                    //    reservationMode = (ReserveItemEnum)Enum.Parse(typeof(ReserveItemEnum), strValue);
                    //    break;
                    case "EA Rules of Conduct read and accepted":
                        roc_read = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
                        break;
                    case "Trace rules":
                        trace_rules = (enumBoolYesNo)Enum.Parse(typeof(enumBoolYesNo), strValue);
                        break;
                    case "Protect these players from Kick or Kill":
                        protect_players
                            = (ProtectEnum)Enum.Parse(typeof(ProtectEnum), strValue);
                        break;
                    case "Rules":
                        string strValueHtmlDecode = raw_strValue.Contains(" ") ? raw_strValue : raw_strValue.Replace("+", " ");
                        string strValueUnencoded;
                        try
                        {
                            strValueUnencoded = Uri.UnescapeDataString(strValueHtmlDecode);
                        }
                        catch
                        {
                            strValueUnencoded = strValueHtmlDecode;
                        }
                        unparsed_rules = new List<string>(strValueUnencoded.Split(new char[] { '|' }));
                        rulz_vars.reset();
                        reset_counts();
                        parse_rules();
                        break;
                    case "Rulz .txt filenames":
                        rulz_filenames = new List<string>(CPluginVariable.DecodeStringArray(strValue));
                        // look for rulz files and add those to unparsed_rules
                        load_rulz_from_files();
                        rulz_vars.reset();
                        reset_counts();
                        parse_rules();
                        break;
                    case "Player name whitelist":
                        whitelist_players = new List<string>(CPluginVariable.DecodeStringArray(strValue));
                        break;
                    case "Clan name whitelist":
                        whitelist_clans = new List<string>(CPluginVariable.DecodeStringArray(strValue));
                        break;
                    case "Send ProconRulz Log messages to:":
                        log_file = (LogFileEnum)Enum.Parse(typeof(LogFileEnum), strValue);
                        break;

                    default:
                        break;
                }
            }
            catch (Exception ex)
            {
                PrintException(ex);
            }
        }
示例#2
0
 public void WriteLog(LogFileEnum logFile, string msg)
 {
     WriteLog(logFile.ToString(), msg);
 }