Exemplo n.º 1
0
        public static async Task Initialize(ServicesManagerBase serviceHandler)
        {
            ChannelSession.Services = serviceHandler;

            try
            {
                Type mixItUpSecretsType = Type.GetType("MixItUp.Base.MixItUpSecrets");
                if (mixItUpSecretsType != null)
                {
                    ChannelSession.Services.SetSecrets((SecretsService)Activator.CreateInstance(mixItUpSecretsType));
                }
            }
            catch (Exception ex) { Logger.Log(ex); }

            try
            {
                Type voicemodServiceType = Type.GetType("MixItUp.Base.Services.External.VoicemodService");
                if (voicemodServiceType != null)
                {
                    ChannelSession.Services.Voicemod = (IVoicemodService)Activator.CreateInstance(voicemodServiceType);
                }
            }
            catch (Exception ex) { Logger.Log(ex); }

            ChannelSession.AppSettings = await ApplicationSettingsV2Model.Load();
        }
Exemplo n.º 2
0
        public static async Task Initialize(ServicesManagerBase serviceHandler)
        {
            ChannelSession.Services = serviceHandler;

            try
            {
                Type mixItUpSecretsType = Type.GetType("MixItUp.Base.MixItUpSecrets");
                if (mixItUpSecretsType != null)
                {
                    ChannelSession.Services.SetSecrets((SecretsService)Activator.CreateInstance(mixItUpSecretsType));
                }
            }
            catch (Exception ex) { Logger.Log(ex); }

            ChannelSession.PreMadeChatCommands = new List <PreMadeChatCommand>();

            ChannelSession.AppSettings = await ApplicationSettingsV2Model.Load();
        }
Exemplo n.º 3
0
        public App()
        {
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;

            try
            {
                // We need to load the language setting VERY early, so this is the minimal code necessary to get this value
                WindowsServicesManager servicesManager = new WindowsServicesManager();
                servicesManager.Initialize();
                ChannelSession.Initialize(servicesManager).Wait();
                var selectedLanguageTask = ApplicationSettingsV2Model.Load();
                selectedLanguageTask.Wait();

                var culture = System.Threading.Thread.CurrentThread.CurrentCulture;
                if (LanguageMaps.TryGetValue(selectedLanguageTask.Result.LanguageOption, out string locale))
                {
                    culture = new System.Globalization.CultureInfo(locale);
                }

                System.Threading.Thread.CurrentThread.CurrentUICulture = culture;
            }
            catch { }
        }