// Invoke a static method with a positional and default value for a named arg.
 static bool TestInvokeStaticMethodWithArgAndNamedArgDefault()
 {
     return(CheckValue("Hello There Bob",
                       (string)VersionHandler.InvokeStaticMethod(
                           typeof(Greeter), "GenericHelloWithCustomerNameAndPronoun",
                           new object[] { "Bob" }, null)));
 }
示例#2
0
        private static void SecondPass(VersionHandler handler, int[] maxCharacters, List <DeviceResult> initialResults, Results results)
        {
            int lowestScore = int.MaxValue;

            foreach (DeviceResult current in initialResults)
            {
                // Calculate the score for this device.
                int deviceScore = 0;
                for (int segment = 0; segment < handler.VersionRegexes.Length; segment++)
                {
                    deviceScore += (maxCharacters[segment] - current.Scores[segment].CharactersMatched + 1) *
                                   (current.Scores[segment].Difference + maxCharacters[segment] -
                                    current.Scores[segment].CharactersMatched);
                }
                // If the score is lower than the lowest so far then reset the list
                // of best matching devices.
                if (deviceScore < lowestScore)
                {
                    results.Clear();
                    lowestScore = deviceScore;
                }
                // If the device score is the same as the lowest score so far then add this
                // device to the list.
                if (deviceScore == lowestScore)
                {
                    results.Add(current.Device);
                }
            }
        }
示例#3
0
        private static void FirstPass(VersionHandler handler, string userAgent, int[] maxCharacters, List <DeviceResult> initialResults)
        {
            string compare, target;

            foreach (var devices in handler.UserAgents)
            {
                foreach (DeviceInfo device in devices)
                {
                    SegmentScore[] scores = new SegmentScore[handler.VersionRegexes.Length];
                    for (int segment = 0; segment < handler.VersionRegexes.Length; segment++)
                    {
                        target  = handler.VersionRegexes[segment].Match(userAgent).Value;
                        compare = handler.VersionRegexes[segment].Match(device.UserAgent).Value;
                        for (int i = 0; i < target.Length && i < compare.Length; i++)
                        {
                            scores[segment].Difference += Math.Abs((target[i] - compare[i]));
                            scores[segment].CharactersMatched++;
                        }
                        if (scores[segment].CharactersMatched > maxCharacters[segment])
                        {
                            maxCharacters[segment] = scores[segment].CharactersMatched;
                        }
                    }
                    initialResults.Add(new DeviceResult(scores, device));
                }
            }
        }
 // Invoke an overloaded static method with an int arg.
 static bool TestInvokeStaticMethodWithIntArg()
 {
     return(CheckValue("Hello customer #1337",
                       (string)VersionHandler.InvokeStaticMethod(typeof(Greeter),
                                                                 "GenericHelloWithCustomerName",
                                                                 new object[] { 1337 }, null)));
 }
示例#5
0
 public App(
     SfLocator locator,
     SfProjectHandler projectHandler,
     ServiceHashCalculator hasher,
     IHandleClusterConnection fabricRemote,
     VersionHandler versionHandler,
     VersionService versionService,
     Packager packager,
     AppConfig baseConfig,
     DeployScriptCreator scriptCreator,
     ConsoleWriter log,
     ManifestHandler manifestReader,
     VersionMapHandler versionMapHandler,
     Hack hack)
 {
     _locator           = locator;
     _projectHandler    = projectHandler;
     _hasher            = hasher;
     _fabricRemote      = fabricRemote;
     _versionHandler    = versionHandler;
     _versionService    = versionService;
     _packager          = packager;
     _baseConfig        = baseConfig;
     _scriptCreator     = scriptCreator;
     _log               = log;
     _manifestReader    = manifestReader;
     _versionMapHandler = versionMapHandler;
     _hack              = hack;
 }
        /// <summary>
        /// Register a method to call when the Version Handler has enabled all plugins in the
        /// project.
        /// </summary>
        static Runner()
        {
            // Disable stack traces for more condensed logs.
            try {
                foreach (var logType in
                         new [] { UnityEngine.LogType.Log, UnityEngine.LogType.Warning })
                {
                    // Unity 2017 and above have the Application.SetStackTraceLogType to configure
                    // stack traces per log level.
                    VersionHandler.InvokeStaticMethod(
                        typeof(UnityEngine.Application), "SetStackTraceLogType",
                        new object[] { logType, UnityEngine.StackTraceLogType.None });
                }
            } catch (Exception) {
                // Fallback to the legacy method.
                UnityEngine.Application.stackTraceLogType = UnityEngine.StackTraceLogType.None;
            }

            UnityEngine.Debug.Log("Set up callback on Version Handler completion.");
            Google.VersionHandler.UpdateCompleteMethods = new [] {
                "Google.IntegrationTester:Google.IntegrationTester.Runner:VersionHandlerReady"
            };
            UnityEngine.Debug.Log("Enable plugin using the Version Handler.");
            Google.VersionHandler.UpdateNow();
        }
 // Invoke a static method with a default value of a named arg.
 static bool TestInvokeStaticMethodWithNamedArgDefault()
 {
     return(CheckValue("Hello There",
                       (string)VersionHandler.InvokeStaticMethod(typeof(Greeter),
                                                                 "GenericHelloWithPronoun",
                                                                 null, null)));
 }
    // Test adding/removing delegate to a static event.
    static bool TestInvokeStaticEventMethod()
    {
        CheckEvent(funcToTest: (action) =>
                   VersionHandler.InvokeStaticEventAddMethod(typeof(Greeter), "staticEvent", action),
                   invokeEvent: Greeter.InvokeStaticEvent,
                   expectSuccess: true,
                   expectInvoked: true);

        CheckEvent(funcToTest: (action) =>
                   VersionHandler.InvokeStaticEventRemoveMethod(typeof(Greeter), "staticEvent",
                                                                action),
                   invokeEvent: Greeter.InvokeStaticEvent,
                   expectSuccess: true,
                   expectInvoked: false);

        CheckEvent(funcToTest: (action) =>
                   VersionHandler.InvokeStaticEventAddMethod(typeof(Greeter), "foo", action),
                   invokeEvent: Greeter.InvokeStaticEvent,
                   expectSuccess: false,
                   expectInvoked: false);

        CheckEvent(funcToTest: (action) =>
                   VersionHandler.InvokeStaticEventRemoveMethod(typeof(Greeter), "foo", action),
                   invokeEvent: Greeter.InvokeStaticEvent,
                   expectSuccess: false,
                   expectInvoked: false);

        return(true);
    }
 // Invoke an instance method with an default value for a named argument.
 static bool TestInvokeInstanceMethodWithNamedArgDefault()
 {
     return(CheckValue("Hello There Helen, my name is Sam",
                       (string)VersionHandler.InvokeInstanceMethod(
                           new Greeter("Sam"), "HelloWithCustomerNameAndPronoun",
                           new object[] { "Helen" }, null)));
 }
 public void Execute(string[] args)
 {
     if (args.Length == 2)
     {
         if (double.TryParse(args[1], out double requiredVersion))
         {
             if (VersionHandler.IsThereVersion(requiredVersion))
             {
                 UpdateDatabase(requiredVersion);
             }
             else
             {
                 ConsoleUtility.WriteLine($"Version {requiredVersion} is not found.", Program.ErrorColor);
             }
         }
         else
         {
             ConsoleUtility.WriteLine("Invalid database version.", Program.ErrorColor);
         }
     }
     else
     {
         ConsoleUtility.WriteLine("Invalid number of arguments passed for updating database.", Program.ErrorColor);
     }
 }
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (!AllParametersOK())
            {
                return;
            }

            if (EditInstance == null)
            {
                // Check if instance already exist with that name
                foreach (Instance instance in Product.Instances)
                {
                    if (instance.Name.ToUpper() == tbInstanceName.Text.Trim().ToUpper())
                    {
                        MessageBox.Show("An instance with this name already exists! Select another name and try again.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        tbInstanceName.SelectAll();
                        tbInstanceName.Focus();
                        return;
                    }
                }

                EditInstance      = new Instance();
                EditInstance.Name = tbInstanceName.Text.Trim();
                EditInstance.DeployManifestFile      = string.Format("{0}.application", EditInstance.Name);
                EditInstance.VersionPath             = SelectedRunningVersion.Path;
                EditInstance.ProductVersion          = SelectedRunningVersion.Name;
                EditInstance.ApplicationManifestFile = SelectedRunningVersion.FoundFile;
                EditInstance.Description             = tbDescription.Text.Trim();
                EditInstance.Caption = tbCaption.Text.Trim();

                SetParameters(EditInstance);

                ProductVersionChanged = true;
            }
            else
            {
                // Editing an existing instance
                EditInstance.Description = tbDescription.Text.Trim();
                EditInstance.Caption     = tbCaption.Text.Trim();

                SetParameters(EditInstance);

                // Check if product version has changed.
                if (VersionHandler.VersionStringCompare(PreviousProductVersion, SelectedRunningVersion.Name) != 0)
                {
                    EditInstance.VersionPath             = SelectedRunningVersion.Path;
                    EditInstance.ProductVersion          = SelectedRunningVersion.Name;
                    EditInstance.ApplicationManifestFile = SelectedRunningVersion.FoundFile;

                    ProductVersionChanged = true;
                }
                else
                {
                    ProductVersionChanged = false;
                }
            }

            DialogResult = DialogResult.OK;
        }
 static GenerateXmlFromGoogleServicesJson()
 {
     GenerateXmlFromGoogleServicesJson.executable_Name_Windows                  = "generate_xml_from_google_services_json.exe";
     GenerateXmlFromGoogleServicesJson.executable_Name_Generic                  = "generate_xml_from_google_services_json.py";
     GenerateXmlFromGoogleServicesJson.plugin_name                              = "Firebase/Firebase";
     GenerateXmlFromGoogleServicesJson.executable_Location                      = Path.Combine(Path.Combine("Assets", GenerateXmlFromGoogleServicesJson.plugin_name), "Editor");
     GenerateXmlFromGoogleServicesJson.google_Services_File_BaseName            = "google-services";
     GenerateXmlFromGoogleServicesJson.google_services_input_file               = GenerateXmlFromGoogleServicesJson.google_Services_File_BaseName + ".json";
     GenerateXmlFromGoogleServicesJson.google_services_output_file              = GenerateXmlFromGoogleServicesJson.google_Services_File_BaseName + ".xml";
     GenerateXmlFromGoogleServicesJson.google_services_output_directory         = Path.Combine(Path.Combine(Path.Combine(Path.Combine(Path.Combine("Assets", "Plugins"), "Android"), "Firebase"), "res"), "values");
     GenerateXmlFromGoogleServicesJson.google_services_output_path              = Path.Combine(GenerateXmlFromGoogleServicesJson.google_services_output_directory, GenerateXmlFromGoogleServicesJson.google_services_output_file);
     GenerateXmlFromGoogleServicesJson.google_service_info_file_basename        = "GoogleService-Info";
     GenerateXmlFromGoogleServicesJson.google_service_info_input_file           = GenerateXmlFromGoogleServicesJson.google_service_info_file_basename + ".plist";
     GenerateXmlFromGoogleServicesJson.google_services_desktop_output_file      = GenerateXmlFromGoogleServicesJson.google_Services_File_BaseName + "-desktop.json";
     GenerateXmlFromGoogleServicesJson.google_services_desktop_output_directory = Path.Combine("Assets", "StreamingAssets");
     GenerateXmlFromGoogleServicesJson.google_services_desktop_output_path      = Path.Combine(GenerateXmlFromGoogleServicesJson.google_services_desktop_output_directory, GenerateXmlFromGoogleServicesJson.google_services_desktop_output_file);
     GenerateXmlFromGoogleServicesJson.newline_chars                            = new char[]
     {
         '\r',
         '\n'
     };
     GenerateXmlFromGoogleServicesJson.field_delimiter = new char[]
     {
         '='
     };
     GenerateXmlFromGoogleServicesJson.ConfigFileDirectory = new SortedDictionary <string, List <string> >();
     if (VersionHandler.GetUnityVersionMajorMinor() >= 5f)
     {
         GenerateXmlFromGoogleServicesJson.CheckConfiguration();
     }
     else
     {
         Delegate arg_182_0 = EditorApplication.update;
         if (GenerateXmlFromGoogleServicesJson.f__mgcache0 == null)
         {
             GenerateXmlFromGoogleServicesJson.f__mgcache0 = new EditorApplication.CallbackFunction(GenerateXmlFromGoogleServicesJson.CheckConfiguration);
         }
         EditorApplication.update = (EditorApplication.CallbackFunction)Delegate.Remove(arg_182_0, GenerateXmlFromGoogleServicesJson.f__mgcache0);
         Delegate arg_1B3_0 = EditorApplication.update;
         if (GenerateXmlFromGoogleServicesJson.f__mgcache1 == null)
         {
             GenerateXmlFromGoogleServicesJson.f__mgcache1 = new EditorApplication.CallbackFunction(GenerateXmlFromGoogleServicesJson.CheckConfiguration);
         }
         EditorApplication.update = (EditorApplication.CallbackFunction)Delegate.Combine(arg_1B3_0, GenerateXmlFromGoogleServicesJson.f__mgcache1);
     }
     if (GenerateXmlFromGoogleServicesJson.f__mgcache2 == null)
     {
         GenerateXmlFromGoogleServicesJson.f__mgcache2 = new EventHandler <PlayServicesResolver.BundleIdChangedEventArgs>(GenerateXmlFromGoogleServicesJson.OnBundleIdChanged);
     }
     //PlayServicesResolver.remove_BundleIdChanged(GenerateXmlFromGoogleServicesJson.f__mgcache2);
     PlayServicesResolver.BundleIdChanged -= GenerateXmlFromGoogleServicesJson.f__mgcache2;
     if (GenerateXmlFromGoogleServicesJson.f__mgcache3 == null)
     {
         GenerateXmlFromGoogleServicesJson.f__mgcache3 = new EventHandler <PlayServicesResolver.BundleIdChangedEventArgs>(GenerateXmlFromGoogleServicesJson.OnBundleIdChanged);
     }
     //PlayServicesResolver.add_BundleIdChanged(GenerateXmlFromGoogleServicesJson.f__mgcache3);
     PlayServicesResolver.BundleIdChanged += GenerateXmlFromGoogleServicesJson.f__mgcache3;
 }
示例#13
0
 public void Execute(string[] args)
 {
     ConsoleUtility.WriteLine($"All database versions:", Program.TextColor);
     double[] versions = VersionHandler.GetDatabaseVersions();
     foreach (double version in versions)
     {
         ConsoleUtility.WriteLine(version.ToString(), Program.TextColor);
     }
 }
 // Invoke a static method with a named arg.
 static bool TestInvokeStaticMethodWithNamedArg()
 {
     return(CheckValue("Hello Miss",
                       (string)VersionHandler.InvokeStaticMethod(
                           typeof(Greeter), "GenericHelloWithPronoun",
                           null, new Dictionary <string, object> {
         { "pronoun", "Miss" }
     })));
 }
        private void PopulateParameters()
        {
            // Temp dictionary
            Dictionary <string, string> tempDict = new Dictionary <string, string>();

            // Save all values from grid to be able to reuse them again
            foreach (DataGridViewRow row in dgvParameters.Rows)
            {
                tempDict.Add((string)row.Cells["colName"].Value, (string)row.Cells["colValue"].Value);
            }

            // Clear parameterlist
            dgvParameters.Rows.Clear();

            // Get parameters from product
            if (Product.Parameters.Count > 0)
            {
                foreach (Parameter param in Product.Parameters)
                {
                    // Check if parameter should be shown depending on versions
                    if (!string.IsNullOrEmpty(param.ProductVersionIntroduced) &&
                        VersionHandler.IsVersion(param.ProductVersionIntroduced))
                    {
                        // If selected version is less than the version it was introduced then don't show it
                        if (VersionHandler.VersionStringCompare(SelectedRunningVersion.Name, param.ProductVersionIntroduced) < 0)
                        {
                            continue;
                        }
                    }

                    if (!string.IsNullOrEmpty(param.ProductVersionLastUsed) &&
                        VersionHandler.IsVersion(param.ProductVersionLastUsed))
                    {
                        // If selected version is greater than the version it was last used then don't show it
                        if (VersionHandler.VersionStringCompare(SelectedRunningVersion.Name, param.ProductVersionLastUsed) > 0)
                        {
                            continue;
                        }
                    }

                    // Check if we were editing an instance and if the current parameter value could be reused.
                    if (tempDict.ContainsKey(param.Name) && !string.IsNullOrEmpty(tempDict[param.Name]))
                    {
                        AddParameterRow(param.Name, tempDict[param.Name], param.IsMandatory, param.Description);
                    }
                    else if (EditInstance != null && EditInstance.Parameters.ContainsKey(param.Name))
                    {
                        AddParameterRow(param.Name, EditInstance.Parameters[param.Name], param.IsMandatory, param.Description);
                    }
                    else
                    {
                        AddParameterRow(param.Name, param.Default, param.IsMandatory, param.Description);
                    }
                }
            }
        }
示例#16
0
        public static void TestInitialize(TestContext testContext)
        {
            string dataSource           = Path.Combine(Directory.GetCurrentDirectory(), "DoomLauncher.sqlite");
            DbDataSourceAdapter adapter = (DbDataSourceAdapter)TestUtil.CreateAdapter();
            DataAccess          access  = new DataAccess(new SqliteDatabaseAdapter(), DbDataSourceAdapter.CreateConnectionString(dataSource));

            VersionHandler versionHandler = new VersionHandler(access, adapter, new AppConfiguration(adapter));

            versionHandler.HandleVersionUpdate();
        }
 // Invoke a static method with a positional and named arg.
 static bool TestInvokeStaticMethodWithArgAndNamedArg()
 {
     return(CheckValue("Hello Mrs Smith",
                       (string)VersionHandler.InvokeStaticMethod(
                           typeof(Greeter), "GenericHelloWithCustomerNameAndPronoun",
                           new object[] { "Smith" },
                           new Dictionary <string, object> {
         { "pronoun", "Mrs" }
     })));
 }
 // Invoke an instance method with a named argument.
 static bool TestInvokeInstanceMethodWithNamedArg()
 {
     return(CheckValue("Hello Mrs Smith, my name is Sam",
                       (string)VersionHandler.InvokeInstanceMethod(
                           new Greeter("Sam"), "HelloWithCustomerNameAndPronoun",
                           new object[] { "Smith" },
                           new Dictionary <string, object> {
         { "pronoun", "Mrs" }
     })));
 }
        public App()
        {
            Thread.CurrentThread.CurrentCulture   = CultureInfo.InvariantCulture;
            Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture;

            Assembly     = Assembly.GetExecutingAssembly();
            LocalVersion = VersionHandler.GetLocalVersion(Assembly);
            Dispatcher.UnhandledException += OnDispatcherUnhandledException;

            XmlConfigurator.Configure();
        }
示例#20
0
 public void TryParseVersionTest(TestVersion testVersion)
 {
     if (VersionHandler.TryParseVersion(testVersion.version, out VersionHandler.Version test_version))
     {
         Assert.IsTrue(testVersion.version_out.Equals(test_version) && testVersion.can_parse);
     }
     else
     {
         Assert.IsTrue(!testVersion.can_parse);
     }
 }
    // Invoke a static method with a positional and named interface arg.
    static bool TestInvokeStaticMethodWithArgAndNamedInterfaceArg()
    {
        IEnumerable <string> suffixes = new string[] { "BSc", "Hons", "PhD", "Kt", "MPerf" };

        return(CheckValue("Hello Angie BSc Hons PhD Kt MPerf",
                          (string)VersionHandler.InvokeStaticMethod(
                              typeof(Greeter), "GenericHelloWithCustomerNameAndSuffixes",
                              new object[] { "Angie" },
                              new Dictionary <string, object> {
            { "suffixes", suffixes }
        })));
    }
    // Test searching for a class without specifying the assembly name.
    static bool TestFindClassWithoutAssemblyName()
    {
        var expectedType = typeof(UnityEditor.EditorApplication);
        var foundType    = VersionHandler.FindClass(null, "UnityEditor.EditorApplication");

        if (expectedType != foundType)
        {
            UnityEngine.Debug.LogError(String.Format("Unexpected type {0} vs {1}", foundType,
                                                     expectedType));
            return(false);
        }
        return(true);
    }
        /// <summary>
        /// CocoaPodsを更新する
        /// Google/SignInをCocoaPodsに追加する
        /// </summary>
        private static void UpdateCocoaPods()
        {
            Type iosResolver = VersionHandler.FindClass(
                "Google.IOSResolver", "Google.IOSResolver");

            if (iosResolver == null)
            {
                return;
            }

            VersionHandler.InvokeStaticMethod(
                iosResolver, "AddPod",
                new object[] { "Google/SignIn" },
                namedArgs: null//new Dictionary<string, object> (){}
                );
        }
示例#24
0
        internal static Results Match(string userAgent, VersionHandler handler)
        {
            int[] maxCharacters = new int[handler.VersionRegexes.Length];
            List <DeviceResult> initialResults = new List <DeviceResult>(handler.UserAgents.Count);
            Results             results        = new Results();

            // The 1st pass calculates the scores for every segment of every device
            // available against the target useragent.
            FirstPass(handler, userAgent, maxCharacters, initialResults);

            // The 2nd pass returns the devices with the lowest difference across all the
            // versions available.
            SecondPass(handler, maxCharacters, initialResults, results);

            // Return the best device matches.
            return(results);
        }
示例#25
0
        public string Execute(string[] args)
        {
            string result = "All database versions:";

            try
            {
                foreach (VersionHandler.Version version in VersionHandler.GetDatabaseVersions())
                {
                    result += $"\n{version.ToString()}";
                }
            }
            catch (Exception ex)
            {
                result = $"E: {ex.Message}";
            }

            return(result);
        }
示例#26
0
    public void Can_Process_Version()
    {
        // Arrange
        var sut                = new VersionHandler();
        var instance           = new Version(1, 2, 3, 4);
        var request            = TestHelpers.CreateCustomTypeHandlerRequest(instance);
        var typeHandlers       = Enumerable.Empty <ICustomTypeHandler>();
        var typeNameFormatters = new[] { new DefaultTypeNameFormatter() };
        var callback           = TestHelpers.CreateCallback(typeHandlers, typeNameFormatters);

        // Act
        var actual = sut.Process(request, callback);
        var code   = callback.Builder.ToString();

        // Assert
        actual.Should().BeTrue();
        code.Should().Be(@"new System.Version(1, 2, 3, 4)");
    }
示例#27
0
文件: Startup.cs 项目: pinndulum/cset
        public void Configuration(IAppBuilder app)
        {
            //AreaRegistration.RegisterAllAreas();
            //FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            //RouteConfig.RegisterRoutes(RouteTable.Routes);
            //BundleConfig.RegisterBundles(BundleTable.Bundles);
            //NotificationManager.SetConfigurationManager(new ConfigWrapper());
            // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=316888
            TransactionSecurity.GenerateSecret();
            GlobalConfiguration.Configuration.UseSqlServerStorage("HangfireConn").UseConsole();
            VersionHandler version = new VersionHandler();

            VersionInjected.Version = version.CSETVersionString;

            app.UseHangfireDashboard();
            app.UseHangfireServer();
            //SwaggerConfig.Register();
            //app.UseWebApi(WebApiConfig.Register());
        }
示例#28
0
        public string Execute(string[] args)
        {
            string result;

            if (args.Length == 2)
            {
                if (VersionHandler.IsThereVersion(args[1]))
                {
                    result = UpdateDatabase(args[1]);
                }
                else
                {
                    result = $"E: Version {args[1]} is not found.";
                }
            }
            else
            {
                result = "E: Invalid number of arguments passed for updating database.";
            }

            return(result);
        }
示例#29
0
        public FrostbiteClient(FrostbiteConnection connection) {
            Connection = connection;
            Connection.PacketReceived += new FrostbiteConnection.PacketDispatchHandler(Connection_PacketRecieved);
            Connection.PacketCacheIntercept += new FrostbiteConnection.PacketCacheDispatchHandler(Connection_PacketCacheIntercept);
            // Register.

            Login += new EmptyParamterHandler(FrostbiteClient_Login);
            Version += new VersionHandler(FrostbiteClient_Version);

            VersionNumberToFriendlyName = new Dictionary<string, string>();

            ResponseDelegates = new Dictionary<string, ResponsePacketHandler>() {
                #region Global/Login

                {"login.plainText", DispatchLoginPlainTextResponse},
                {"login.hashed", DispatchLoginHashedResponse},
                {"logout", DispatchLogoutResponse},
                {"quit", DispatchQuitResponse},
                {"version", DispatchVersionResponse},
                {"eventsEnabled", DispatchEventsEnabledResponse},
                {"help", DispatchHelpResponse},
                {"admin.runScript", DispatchAdminRunScriptResponse},
                {"punkBuster.pb_sv_command", DispatchPunkbusterPbSvCommandResponse},
                {"serverInfo", DispatchServerInfoResponse},
                {"admin.say", DispatchAdminSayResponse},
                {"admin.yell", DispatchAdminYellResponse},

                #endregion

                #region Map list functions

                {"admin.restartMap", DispatchAdminRestartRoundResponse},
                {"admin.supportedMaps", DispatchAdminSupportedMapsResponse},
                {"admin.getPlaylists", DispatchAdminGetPlaylistsResponse},
                {"admin.listPlayers", DispatchAdminListPlayersResponse},
                {"admin.endRound", DispatchAdminEndRoundResponse},
                {"admin.runNextRound", DispatchAdminRunNextRoundResponse},
                {"admin.restartRound", DispatchAdminRestartRoundResponse},

                #endregion

                #region Banlist

                {"banList.add", DispatchBanListAddResponse},
                {"banList.remove", DispatchBanListRemoveResponse},
                {"banList.clear", DispatchBanListClearResponse},
                {"banList.save", DispatchBanListSaveResponse},
                {"banList.load", DispatchBanListLoadResponse},
                {"banList.list", DispatchBanListListResponse},

                #endregion

                #region Text Chat Moderation

                {"textChatModerationList.addPlayer", DispatchTextChatModerationAddPlayerResponse},
                {"textChatModerationList.removePlayer", DispatchTextChatModerationListRemovePlayerResponse},
                {"textChatModerationList.clear", DispatchTextChatModerationListClearResponse},
                {"textChatModerationList.save", DispatchTextChatModerationListSaveResponse},
                {"textChatModerationList.load", DispatchTextChatModerationListLoadResponse},
                {"textChatModerationList.list", DispatchTextChatModerationListListResponse},

                #endregion

                {"vars.textChatModerationMode", DispatchVarsTextChatModerationModeResponse},
                {"vars.textChatSpamTriggerCount", DispatchVarsTextChatSpamTriggerCountResponse},
                {"vars.textChatSpamDetectionTime", DispatchVarsTextChatSpamDetectionTimeResponse},
                {"vars.textChatSpamCoolDownTime", DispatchVarsTextChatSpamCoolDownTimeResponse},

                #region Maplist

                {"mapList.configFile", DispatchMapListConfigFileResponse},
                {"mapList.load", DispatchMapListLoadResponse},
                {"mapList.save", DispatchMapListSaveResponse},
                {"mapList.list", DispatchMapListListResponse},
                {"mapList.clear", DispatchMapListClearResponse},
                {"mapList.append", DispatchMapListAppendResponse},
                {"mapList.nextLevelIndex", DispatchMapListNextLevelIndexResponse},
                {"mapList.remove", DispatchMapListRemoveResponse},
                {"mapList.insert", DispatchMapListInsertResponse},

                #endregion

                // Details
                {"vars.serverName", DispatchVarsServerNameResponse},
                {"vars.serverDescription", DispatchVarsServerDescriptionResponse},
                {"vars.bannerUrl", DispatchVarsBannerUrlResponse},

                // Configuration
                {"vars.adminPassword", DispatchVarsAdminPasswordResponse},
                {"vars.gamePassword", DispatchVarsGamePasswordResponse},
                {"vars.punkBuster", DispatchVarsPunkbusterResponse},
                {"vars.ranked", DispatchVarsRankedResponse},
                {"vars.playerLimit", DispatchVarsPlayerLimitResponse},
                {"vars.currentPlayerLimit", DispatchVarsCurrentPlayerLimitResponse},
                {"vars.maxPlayerLimit", DispatchVarsMaxPlayerLimitResponse},
                {"vars.idleTimeout", DispatchVarsIdleTimeoutResponse},
                {"vars.profanityFilter", DispatchVarsProfanityFilterResponse},
                
                // Gameplay
                {"vars.friendlyFire", DispatchVarsFriendlyFireResponse},
                {"vars.hardCore", DispatchVarsHardCoreResponse},

                #region Team killing

                {"vars.teamKillCountForKick", DispatchVarsTeamKillCountForKickResponse},
                {"vars.teamKillValueForKick", DispatchVarsTeamKillValueForKickResponse},
                {"vars.teamKillValueIncrease", DispatchVarsTeamKillValueIncreaseResponse},
                {"vars.teamKillValueDecreasePerSecond", DispatchVarsTeamKillValueDecreasePerSecondResponse},

                #endregion

                #region Level vars

                {"levelVars.set", DispatchLevelVarsSetResponse},
                {"levelVars.get", DispatchLevelVarsGetResponse},
                {"levelVars.evaluate", DispatchLevelVarsEvaluateResponse},
                {"levelVars.clear", DispatchLevelVarsClearResponse},
                {"levelVars.list", DispatchLevelVarsListResponse},

                #endregion

                {"admin.kickPlayer", DispatchAdminKickPlayerResponse},
                {"admin.killPlayer", DispatchAdminKillPlayerResponse},
                {"admin.movePlayer", DispatchAdminMovePlayerResponse},
                {"admin.shutDown", DispatchAdminShutDownResponse},
            };

            RequestDelegates = new Dictionary<string, RequestPacketHandler>() {
                {"player.onJoin", DispatchPlayerOnJoinRequest},
                {"player.onLeave", DispatchPlayerOnLeaveRequest},
                {"player.onDisconnect", DispatchPlayerOnDisconnectRequest},
                {"player.onAuthenticated", DispatchPlayerOnAuthenticatedRequest},
                {"player.onKill", DispatchPlayerOnKillRequest},
                {"player.onChat", DispatchPlayerOnChatRequest},
                {"player.onKicked", DispatchPlayerOnKickedRequest},
                {"player.onTeamChange", DispatchPlayerOnTeamChangeRequest},
                {"player.onSquadChange", DispatchPlayerOnSquadChangeRequest},
                {"player.onSpawn", DispatchPlayerOnSpawnRequest},
                {"server.onLoadingLevel", DispatchServerOnLoadingLevelRequest},
                {"server.onLevelStarted", DispatchServerOnLevelStartedRequest},
                {"server.onLevelLoaded", DispatchServerOnLevelLoadedRequest},
                {"server.onRoundOver", DispatchServerOnRoundOverRequest},
                {"server.onRoundOverPlayers", DispatchServerOnRoundOverPlayersRequest},
                {"server.onRoundOverTeamScores", DispatchServerOnRoundOverTeamScoresRequest},
                {"punkBuster.onMessage", DispatchPunkBusterOnMessageRequest},
            };

            GetPacketsPattern = new Regex(@"^punkBuster\.pb_sv_command|^version|^help|^serverInfo|^admin\.listPlayers|^listPlayers|^admin\.supportMaps|^admin\.getPlaylists|^admin\.currentLevel|^mapList\.nextLevelIndex|^mapList\.list|^textChatModerationList\.list|^banList\.list|^levelVars\.list|^levelVars\.evaluate|^levelVars\.get|^vars\.[a-zA-Z]*?$");
        }
 // Invoke an instance method with no args.
 static bool TestInvokeInstanceMethodWithNoArgs()
 {
     return(CheckValue("Hello, my name is Sam",
                       (string)VersionHandler.InvokeInstanceMethod(new Greeter("Sam"), "Hello",
                                                                   null, null)));
 }
 // Invoke a static method with no arguments.
 static bool TestInvokeStaticMethodWithNoArgs()
 {
     return(CheckValue("Hello",
                       (string)VersionHandler.InvokeStaticMethod(typeof(Greeter), "GenericHello",
                                                                 null, null)));
 }