Exemple #1
0
        public static void RegisterGlobals()
        {
            Log4NetHelper.AddAppender(Log4NetHelper.ConsoleAppender(Level.All));
            Log4NetHelper.AddAppender(Log4NetHelper.FileAppender(Level.All));


            RequestContext.Parser = new POGOProtosProtoParser();
            AppConfig.Logger.Info("Attempting to load the plugins");
            //RequestContext.Modifiers = new List<IModifierPlugin> { new GetMyIP()};
            RequestContext.Modifiers = PluginLoader.LoadPlugins <IModifierPlugin>();
            if (RequestContext.Modifiers != null && RequestContext.Modifiers.Count > 0)
            {
                RequestContext.Modifiers = RequestContext.Modifiers.ToList();
                AppConfig.Logger.Info(
                    $"Loaded Modifier Plugins: {string.Join(", ", RequestContext.Modifiers.Where(m => m.Enabled).Select(m => m.GetType().Name))}");
            }

            PluginLoader.PluginChanged += (file, plugin) =>
            {
                // get all plugin back from loader
                RequestContext.Modifiers = PluginLoader.LoadPlugins <IModifierPlugin>();
            };

            RequestContext.RequestPacker  = new POGOProtosRequestPacker();
            RequestContext.ResponsePacker = new POGOProtosResponsePacker();

            //var decryptorPath = FileLocation.GetFileLocation("pcrypt.dll");
            //if (decryptorPath != null)
            //{
            //    var assembly = Assembly.LoadFile(decryptorPath);
            //    var encryptionType = assembly.GetExportedTypes().FirstOrDefault(t => t.Name == "SignatureDecryptor");
            //    if (encryptionType != null)
            //    {
            //        RequestContext.Parser.SignatureEncryption = Activator.CreateInstance(encryptionType);
            //    }
            //}
            //else
            //{

            //}

            StaticConfiguration.DisableErrorTraces = false;
            JsonConvert.DefaultSettings            = () =>
            {
                var settings = new JsonSerializerSettings();
                settings.Converters.Add(new StringEnumConverter {
                    CamelCaseText = true
                });
                settings.Converters.Add(new LongConverter());
                settings.Converters.Add(new ULongConverter());
                return(settings);
            };
        }