public ClientConnectionManager(HazelcastClient client)
        {
            _client = client;

            var config = client.GetClientConfig();

            _networkConfig = config.GetNetworkConfig();

            config.GetNetworkConfig().IsRedoOperation();
            _credentials = config.GetCredentials();

            //init socketInterceptor
            var sic = config.GetNetworkConfig().GetSocketInterceptorConfig();

            if (sic != null && sic.IsEnabled())
            {
                //TODO Socket interceptor
                throw new NotImplementedException("Socket Interceptor not yet implemented.");
            }
            _socketInterceptor = null;

            const int defaultHeartbeatInterval = 5000;
            const int defaultHeartbeatTimeout  = 60000;

            var heartbeatTimeoutMillis =
                EnvironmentUtil.ReadInt("hazelcast.client.heartbeat.timeout") ?? defaultHeartbeatInterval;
            var heartbeatIntervalMillis =
                EnvironmentUtil.ReadInt("hazelcast.client.heartbeat.interval") ?? defaultHeartbeatTimeout;

            _heartbeatTimeout  = TimeSpan.FromMilliseconds(heartbeatTimeoutMillis);
            _heartbeatInterval = TimeSpan.FromMilliseconds(heartbeatIntervalMillis);
        }
        public void TestDLLVersion()
        {
            var version = typeof(EnvironmentUtil).Assembly.GetName().Version.ToString();

            Assert.True(version.StartsWith(EnvironmentUtil.GetDllVersion()));
            Assert.False(EnvironmentUtil.GetDllVersion().EndsWith(".0"));
        }
Пример #3
0
        public void TestJackettVersion()
        {
            var version = EnvironmentUtil.JackettVersion();

            Assert.True(version.StartsWith("v"));
            Assert.AreEqual(3, version.Split('.').Length);
        }
Пример #4
0
        public void OutputLogInfoTestInValid()
        {
            string format = "{code}|{pid}|{start_time}";
            var    logger = new Logger(loggerPath: EnvironmentUtil.GetHomePath() + EnvironmentUtil.GetOSSlash() + "log.txt", template: format);

            SerilogHelper.SetLogger(logger);

            var request = new AssumeRoleRequest
            {
                Url = "https://www.alibabacloud.com"
            };
            var    response    = new HttpResponse();
            long   executeTime = 100;
            string startTime   = DateTime.Now.ToString();

            Assert.Throws <ClientException>(() =>
            {
                SerilogHelper.LogInfo(request, null, executeTime, startTime);
            });

            SerilogHelper.CloseLogger();
            Assert.False(SerilogHelper.EnableLogger);

            SerilogHelper.LogInfo(request, null, 100, "100");
        }
Пример #5
0
        public void GetCredentialFileAlibabaCloudCredentialWithEcsRamRole()
        {
            var ecsRamRoleCredential = new InstanceProfileCredentials("fakeak", "fakeaks", "fakesession", DateTime.Now.ToString(), 4000);
            var homePath             = EnvironmentUtil.GetHomePath();

            TestHelper.CreateIniFileWithEcs(homePath);

            var slash         = EnvironmentUtil.GetOSSlash();
            var finalLocation = EnvironmentUtil.GetComposedPath(homePath, slash);
            var configuration = Configuration.LoadFromFile(finalLocation);

            DefaultProfile profile = DefaultProfile.GetProfile();

            profile.DefaultClientName = "default";

            var mockDefaultCredentialProvider = new Mock <DefaultCredentialProvider>(profile, null);

            mockDefaultCredentialProvider.Setup(x => x.GetInstanceRamRoleAlibabaCloudCredential()).Returns(ecsRamRoleCredential);
            mockDefaultCredentialProvider.Setup(x => x.GetHomePath()).Returns(homePath);
            mockDefaultCredentialProvider.Setup(x => x.LoadFileFromIni(It.IsAny <string>())).Returns(configuration);
            var defaultCredentialProvider = mockDefaultCredentialProvider.Object;
            var credential = (InstanceProfileCredentials)defaultCredentialProvider.GetAlibabaCloudClientCredential();

            TestHelper.DeleteIniFile(homePath);
            Assert.NotNull(credential);
        }
 static GameObjectResolver()
 {
     QuestCoreLibrariesPath     = Path.Combine(EnvironmentUtil.GetQuestInstallationPath(), "Core");
     QuestLanguageLibrariesPath = Path.Combine(QuestCoreLibrariesPath, "Languages");
     ErrorListener = new ParseErrorGatherer();
     ScriptParser.AddErrorListener(ErrorListener);
 }
Пример #7
0
        public ClientConnectionManager(HazelcastClient client)
        {
            _client = client;

            var config = client.GetClientConfig();

            _networkConfig = config.GetNetworkConfig();

            config.GetNetworkConfig().IsRedoOperation();
            _credentials = config.GetCredentials();

            //init socketInterceptor
            var sic = config.GetNetworkConfig().GetSocketInterceptorConfig();

            if (sic != null && sic.IsEnabled())
            {
                //TODO Socket interceptor
                throw new NotImplementedException("Socket Interceptor not yet implemented.");
            }
            _socketInterceptor = null;

            var timeout = EnvironmentUtil.ReadEnvironmentVar("hazelcast.client.invocation.timeout.seconds");

            if (timeout > 0)
            {
                ThreadUtil.TaskOperationTimeOutMilliseconds = timeout.Value * 1000;
            }

            _heartbeatTimeout = EnvironmentUtil.ReadEnvironmentVar("hazelcast.client.heartbeat.timeout") ??
                                _heartbeatTimeout;
            _heartbeatInterval = EnvironmentUtil.ReadEnvironmentVar("hazelcast.client.heartbeat.interval") ??
                                 _heartbeatInterval;
        }
Пример #8
0
        public void CreateOrMigrateSettings()
        {
            try
            {
                if (!Directory.Exists(GetAppDataFolder()))
                {
                    var dir = Directory.CreateDirectory(GetAppDataFolder());
                    if (System.Environment.OSVersion.Platform != PlatformID.Unix)
                    {
                        var access            = dir.GetAccessControl();
                        var directorySecurity = new DirectorySecurity(GetAppDataFolder(), AccessControlSections.All);
                        directorySecurity.AddAccessRule(new FileSystemAccessRule(new SecurityIdentifier(WellKnownSidType.WorldSid, null), FileSystemRights.FullControl, InheritanceFlags.ObjectInherit | InheritanceFlags.ContainerInherit, PropagationFlags.None, AccessControlType.Allow));
                        dir.SetAccessControl(directorySecurity);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Could not create settings directory. " + ex.Message);
            }

            if (Environment.OSVersion.Platform != PlatformID.Unix)
            {
                try
                {
                    var oldDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Jackett");
                    if (Directory.Exists(oldDir))
                    {
                        // On Windows we need admin permissions to migrate as they were made with admin permissions.
                        if (ServerUtil.IsUserAdministrator())
                        {
                            PerformMigration(oldDir);
                        }
                        else
                        {
                            try
                            {
                                processService.StartProcessAndLog(EnvironmentUtil.JackettExecutablePath(), "--MigrateSettings", true);
                            }
                            catch
                            {
                                logger.Error("Unable to migrate settings when not running as administrator.");
                                Environment.ExitCode = 1;
                                return;
                            }
                        }
                    }
                }
                catch (Exception e)
                {
                    logger.Error($"ERROR could not migrate settings directory\n{e}");
                }
            }

            // Perform a migration in case of https://github.com/Jackett/Jackett/pull/11173#issuecomment-787520128
            if (Environment.OSVersion.Platform == PlatformID.Unix)
            {
                PerformMigration("Jackett");
            }
        }
Пример #9
0
        public void GetCredentialFileAlibabaCloudCredentialWithDefaultSection()
        {
            var iniData =
                "[default]  " + Environment.NewLine +
                "enable = true    " + Environment.NewLine +
                "type = access_key # Certification type : access_key " + Environment.NewLine +
                "access_key_id = foo # Key " + Environment.NewLine +
                "access_key_secret = bar # Secret " + Environment.NewLine +
                "region_id = cn-hangzhou # Optional£ Region ";
            var configuration = Configuration.LoadFromString(iniData);

            var homePath = EnvironmentUtil.GetHomePath();

            DefaultProfile profile = DefaultProfile.GetProfile();

            Environment.SetEnvironmentVariable("ALIBABA_CLOUD_CREDENTIALS_FILE", homePath);

            var mockProvider = new Mock <DefaultCredentialProvider>(profile, null);

            mockProvider.Setup(x => x.LoadFileFromIni(It.IsAny <string>())).Returns(configuration);
            var providerObject = mockProvider.Object;

            var credential = providerObject.GetAlibabaCloudClientCredential();

            Environment.SetEnvironmentVariable("ALIBABA_CLOUD_CREDENTIALS_FILE", null);
            Assert.NotNull(credential);
        }
Пример #10
0
        public void GetCredentialFileAlibabaCloudCredentialWithRsaKey()
        {
            var basicSessionCredential = new BasicSessionCredentials("fakeak", "fakeaks", "fakesessiontoken", 4000);
            var homePath = EnvironmentUtil.GetHomePath();

            TestHelper.CreateIniFileWithRsaKey(homePath);

            var slash         = EnvironmentUtil.GetOSSlash();
            var finalLocation = EnvironmentUtil.GetComposedPath(homePath, slash);
            var configurtion  = Configuration.LoadFromFile(finalLocation);

            DefaultProfile profile = DefaultProfile.GetProfile();

            profile.DefaultClientName = "default";

            var mockDefaultCredentialProvider = new Mock <DefaultCredentialProvider>(profile, null);

            mockDefaultCredentialProvider.Setup(x => x.GetRsaKeyPairAlibabaCloudCredential()).Returns(basicSessionCredential);
            mockDefaultCredentialProvider.Setup(x => x.GetHomePath()).Returns(homePath);
            mockDefaultCredentialProvider.Setup(x => x.LoadFileFromIni(It.IsAny <string>())).Returns(configurtion);
            var defaultCredentialProvider = mockDefaultCredentialProvider.Object;

            var credential = (BasicSessionCredentials)defaultCredentialProvider.GetAlibabaCloudClientCredential();

            TestHelper.DeleteIniFile(homePath);
            Assert.NotNull(credential);
        }
Пример #11
0
        public void GetCredentialFileAlibabaCloudCredentialWithRamRole()
        {
            var ramRoleCredential = new InstanceProfileCredentials("fakeak", "fakeaks", "fakesessiontokne",
                                                                   DateTime.Now.ToString(), 4000);

            TestHelper.CreateIniFileWithRam();

            var mockHomePath = EnvironmentUtil.GetHomePath();

            var profile = DefaultProfile.GetProfile();

            profile.DefaultClientName = "default";

            var mockDefaultCredentialProvider = new Mock <DefaultCredentialProvider>(profile, null);

            mockDefaultCredentialProvider.Setup(x => x.GetRamRoleArnAlibabaCloudCredential())
            .Returns(ramRoleCredential);
            mockDefaultCredentialProvider.Setup(x => x.GetHomePath()).Returns(mockHomePath);

            var defaultCredentialProvider = mockDefaultCredentialProvider.Object;

            var credential = (InstanceProfileCredentials)defaultCredentialProvider.GetAlibabaCloudClientCredential();

            TestHelper.DeleteIniFile();
            Assert.NotNull(credential);
        }
Пример #12
0
        public ConnectionManager(HazelcastClient client)
        {
            _client       = client;
            _loadBalancer = client.LoadBalancer;
            //
            var config = client.ClientConfig;

            _networkConfig        = config.GetNetworkConfig();
            IsSmartRoutingEnabled = _networkConfig.IsSmartRouting();
            _labels = client.ClientConfig.Labels;

            var connectionTimeout = _networkConfig.GetConnectionTimeout();

            _connectionTimeout = connectionTimeout == 0 ? int.MaxValue : connectionTimeout;

            //TODO outboundPorts
            // this.networking = initNetworking();
            // this.outboundPorts.addAll(getOutboundPorts());
            // this.outboundPortCount = outboundPorts.size();

            _heartbeat = new HeartbeatManager(client, this);

            _authenticationTimeout = _heartbeat.HeartbeatTimeout;
            _shuffleMemberList     = EnvironmentUtil.ReadBool("hazelcast.client.shuffle.member.list") ?? false;
            _waitStrategy          = InitializeWaitStrategy(client.ClientConfig);

            var connectionStrategyConfig = client.ClientConfig.GetConnectionStrategyConfig();

            _asyncStart    = connectionStrategyConfig.AsyncStart;
            _reconnectMode = connectionStrategyConfig.ReconnectMode;
        }
        internal static int GetMaxToleratedMissCount()
        {
            var maxToleratedMissCount =
                EnvironmentUtil.ReadInt(MaxToleratedMissCountProperty) ?? MaxToleratedMissCountDefault;

            return(ValidationUtil.CheckNotNegative(maxToleratedMissCount,
                                                   $"max-tolerated-miss-count cannot be < 0 but found {maxToleratedMissCount}"));
        }
 protected ClientInvocationService(HazelcastClient client)
 {
     _client                  = client;
     _redoOperations          = client.GetClientConfig().GetNetworkConfig().IsRedoOperation();
     _invocationTimeoutMillis =
         (EnvironmentUtil.ReadInt("hazelcast.client.invocation.timeout.seconds") ??
          DefaultInvocationTimeout) * 1000;
 }
Пример #15
0
        public Main(string updatedVersion)
        {
            Hide();
            InitializeComponent();

            Opacity         = 0;
            Enabled         = false;
            WindowState     = FormWindowState.Minimized;
            FormBorderStyle = FormBorderStyle.FixedToolWindow;

            var runtimeSettings = new RuntimeSettings()
            {
                CustomLogFileName = "TrayLog.txt"
            };

            LogManager.Configuration = LoggingSetup.GetLoggingConfiguration(runtimeSettings);
            logger = LogManager.GetCurrentClassLogger();

            logger.Info("Starting Jackett Tray " + EnvironmentUtil.JackettVersion());

            processService       = new ProcessService(logger);
            windowsService       = new WindowsServiceConfigService(processService, logger);
            trayLockService      = new TrayLockService();
            serializeService     = new SerializeService();
            configurationService = new ConfigurationService(serializeService, processService, logger, runtimeSettings);
            serverConfig         = configurationService.BuildServerConfig(runtimeSettings);

            toolStripMenuItemAutoStart.Checked         = AutoStart;
            toolStripMenuItemAutoStart.CheckedChanged += toolStripMenuItemAutoStart_CheckedChanged;

            toolStripMenuItemWebUI.Click    += toolStripMenuItemWebUI_Click;
            toolStripMenuItemShutdown.Click += toolStripMenuItemShutdown_Click;

            if (Environment.OSVersion.Platform == PlatformID.Win32NT)
            {
                toolStripMenuItemAutoStart.Visible = true;
            }

            if (!windowsService.ServiceExists())
            {
                // We are not installed as a service so just start the web server via JackettConsole and run from the tray.
                logger.Info("Starting server from tray");
                StartConsoleApplication();
            }

            updatedVersion = updatedVersion.Equals("yes", StringComparison.OrdinalIgnoreCase) ? EnvironmentUtil.JackettVersion() : updatedVersion;

            if (!string.IsNullOrWhiteSpace(updatedVersion))
            {
                notifyIcon1.BalloonTipTitle = "Jackett";
                notifyIcon1.BalloonTipText  = $"Jackett has updated to version {updatedVersion}";
                notifyIcon1.BalloonTipIcon  = ToolTipIcon.Info;
                notifyIcon1.ShowBalloonTip(10000);
                logger.Info($"Display balloon tip, updated to {updatedVersion}");
            }

            Task.Factory.StartNew(WaitForEvent);
        }
        public SettingsService()
        {
            settingsPath       = EnvironmentUtil.GetAppDataPath("Settings.json");
            saveTimer          = new DispatcherTimer();
            saveTimer.Interval = TimeSpan.FromMilliseconds(250);
            saveTimer.Tick    += OnSaveSettings;

            LoadSettings();
        }
        public ServiceBaseConfig()
        {
            DelayInterval     = EnvironmentUtil.GetIntEnvironmentVarValue("DELAY_INTERVAL");
            LocalLogPath      = EnvironmentUtil.GetStringEnvironmentVarValue("LOCAL_LOG_PATH");
            ServiceName       = EnvironmentUtil.GetStringEnvironmentVarValue("SERVICE_NAME");
            CloudLoggingQName = EnvironmentUtil.GetStringEnvironmentVarValue("CLOUD_LOGGING_Q_NAME");
            ConnectionString  = EnvironmentUtil.GetStringEnvironmentVarValue("CONNECTION_STRING");
            var strCloudPro = EnvironmentUtil.GetStringEnvironmentVarValue("CLOUD_PROVIDER");

            CloudProvider = strCloudPro.ToEnum <CloudProvidersEnum>();
        }
Пример #18
0
        // ################################################################################################
        // 基本配置参数
        // ################################################################################################
        private static string ToPathString(string key)
        {
            String s = EnvironmentUtil.GetToString(key, "");
            String c = s.Substring(s.Length - 1);

            if (c != "\\" && c != "/")
            {
                return(s + "/");
            }
            return(s);
        }
        public void SetLoggerTest()
        {
            IClientProfile profile = DefaultProfile.GetProfile("cn-hangzhou", AKID, AKSE);
            var client = new DefaultAcsClient(profile);

            var logger = new Logger(EnvironmentUtil.GetHomePath() + EnvironmentUtil.GetOSSlash() + "log.txt");
            // Use Invalid Path will set the default user home path
            client.SetLogger(logger);

            client.CloseLogger();
        }
Пример #20
0
        private void Run(string[] args)
        {
            var runtimeSettings = new RuntimeSettings()
            {
                CustomLogFileName = "updater.txt"
            };

            LogManager.Configuration = LoggingSetup.GetLoggingConfiguration(runtimeSettings);
            logger = LogManager.GetCurrentClassLogger();

            logger.Info("Jackett Updater " + EnvironmentUtil.JackettVersion());
            logger.Info("Options \"" + string.Join("\" \"", args) + "\"");

            var variants = new Variants();

            variant = variants.GetVariant();
            logger.Info("Jackett variant: " + variant.ToString());

            var isWindows = Environment.OSVersion.Platform == PlatformID.Win32NT;

            if (isWindows)
            {
                //The updater starts before Jackett closes
                logger.Info("Pausing for 3 seconds to give Jackett & tray time to shutdown");
                System.Threading.Thread.Sleep(3000);
            }

            processService = new ProcessService(logger);
            windowsService = new WindowsServiceConfigService(processService, logger);

            var commandLineParser = new Parser(settings => settings.CaseSensitive = false);

            try
            {
                var optionsResult = commandLineParser.ParseArguments <UpdaterConsoleOptions>(args);
                optionsResult.WithParsed(options =>
                {
                    ProcessUpdate(options);
                }
                                         );
                optionsResult.WithNotParsed(errors =>
                {
                    logger.Error(HelpText.AutoBuild(optionsResult));
                    logger.Error("Failed to process update arguments!");
                    logger.Error(errors.ToString());
                    Console.ReadKey();
                });
            }
            catch (Exception e)
            {
                logger.Error($"Exception applying update!\n{e}");
            }
        }
Пример #21
0
 public DefaultCredentialProvider(
     IClientProfile profile,
     AlibabaCloudCredentialsProvider alibabaCloudCredentialProvider
     )
 {
     accessKeyId            = EnvironmentUtil.GetEnvironmentAccessKeyId();
     accessKeySecret        = EnvironmentUtil.GetEnvironmentAccessKeySecret();
     regionId               = EnvironmentUtil.GetEnvironmentRegionId();
     credentialFileLocation = EnvironmentUtil.GetEnvironmentCredentialFile();
     roleName               = EnvironmentUtil.GetEnvironmentRoleName();
     defaultProfile         = profile;
     this.alibabaCloudCredentialProvider = alibabaCloudCredentialProvider;
 }
Пример #22
0
 public DefaultCredentialProvider(
     IClientProfile profile,
     string publicKeyId,
     string privateKeyFile,
     AlibabaCloudCredentialsProvider alibabaCloudCredentialsProvider
     )
 {
     defaultProfile                 = profile;
     this.privateKeyFile            = privateKeyFile;
     this.publicKeyId               = publicKeyId;
     regionId                       = EnvironmentUtil.GetEnvironmentRegionId();
     alibabaCloudCredentialProvider = alibabaCloudCredentialsProvider;
 }
Пример #23
0
        public void CheckUpdaterLock()
        {
            // check .lock file to detect errors in the update process
            var lockFilePath = Path.Combine(EnvironmentUtil.JackettInstallationPath(), ".lock");

            if (File.Exists(lockFilePath))
            {
                logger.Error("An error occurred during the last update. If this error occurs again, you need to reinstall " +
                             "Jackett following the documentation. If the problem continues after reinstalling, " +
                             "report the issue and attach the Jackett and Updater logs.");
                File.Delete(lockFilePath);
            }
        }
Пример #24
0
        public InvocationService(HazelcastClient client)
        {
            _client                 = client;
            _redoOperations         = client.ClientConfig.GetNetworkConfig().IsRedoOperation();
            InvocationTimeoutMillis =
                (EnvironmentUtil.ReadInt("hazelcast.client.invocation.timeout.seconds") ?? DefaultInvocationTimeout) * 1000;

            _invocationRetryPauseMillis = EnvironmentUtil.ReadInt("hazelcast.client.invocation.retry.pause.millis") ??
                                          DefaultInvocationRetryPauseMillis;
            var cleanResourceMillis = EnvironmentUtil.ReadInt("hazelcast.client.internal.clean.resources.millis") ??
                                      DefaultCleanResourceMillis;

            _cleanResourceInterval = TimeSpan.FromMilliseconds(cleanResourceMillis);
        }
        public ListenerService(HazelcastClient client)
        {
            _client            = client;
            _connectionManager = client.ConnectionManager;
            var eventTreadCount    = EnvironmentUtil.ReadInt("hazelcast.client.event.thread.count") ?? DefaultEventThreadCount;
            var eventQueueCapacity =
                EnvironmentUtil.ReadInt("hazelcast.client.event.queue.capacity") ?? DefaultEventQueueCapacity;

            _eventExecutor         = new StripedTaskScheduler(eventTreadCount, eventQueueCapacity, client.Name + ".event");
            _registrationScheduler = new StripedTaskScheduler(1, eventQueueCapacity, client.Name + ".eventRegistration");
            _registrations         = new ConcurrentDictionary <Guid, ListenerRegistration>();
            _eventHandlers         = new ConcurrentDictionary <long, DistributedEventHandler>();
            RegisterLocalOnly      = client.ClientConfig.GetNetworkConfig().IsSmartRouting();
        }
Пример #26
0
        public HeartbeatManager(HazelcastClient client, ConnectionManager connectionManager)
        {
            _client            = client;
            _connectionManager = connectionManager;

            const int defaultHeartbeatInterval = 5000;
            const int defaultHeartbeatTimeout  = 60000;

            var heartbeatTimeoutMillis  = EnvironmentUtil.ReadInt("hazelcast.client.heartbeat.timeout") ?? defaultHeartbeatTimeout;
            var heartbeatIntervalMillis =
                EnvironmentUtil.ReadInt("hazelcast.client.heartbeat.interval") ?? defaultHeartbeatInterval;

            HeartbeatTimeout   = TimeSpan.FromMilliseconds(heartbeatTimeoutMillis);
            _heartbeatInterval = TimeSpan.FromMilliseconds(heartbeatIntervalMillis);
        }
Пример #27
0
        public Service()
        {
            InitializeComponent();

            var runtimeSettings = new RuntimeSettings()
            {
                CustomLogFileName = "ServiceLog.txt"
            };

            LogManager.Configuration = LoggingSetup.GetLoggingConfiguration(runtimeSettings);
            logger = LogManager.GetCurrentClassLogger();

            logger.Info("Initiating Jackett Service " + EnvironmentUtil.JackettVersion());

            processService = new ProcessService(logger);
        }
Пример #28
0
        public void OutputLogException()
        {
            string format = "{Exception}";
            var    logger = new Logger(loggerPath: EnvironmentUtil.GetHomePath() + EnvironmentUtil.GetOSSlash() + "log.txt", template: format);

            SerilogHelper.SetLogger(logger);

            var exception = new Exception();

            SerilogHelper.LogException(exception, "errorcode", "errormessage");

            SerilogHelper.CloseLogger();
            Assert.False(SerilogHelper.EnableLogger);

            //Should return directly
            SerilogHelper.LogException(exception, "error", "error");
        }
 private void OnWindowSourceInitialized(object sender, EventArgs e)
 {
     try
     {
         // Attaching to desktop is currently bugged on Windows 7
         // Unknown if its fixable, so we deactivate it there for the time being
         if (EnvironmentUtil.IsWindows7())
         {
             return;
         }
         WindowUtil.AttachToDesktop(Application.Current.MainWindow);
     }
     catch (Exception ex)
     {
         ExceptionUtil.LogAndShowWarning("Could not attach widget to desktop.", ex);
     }
 }
        protected ClientInvocationService(HazelcastClient client)
        {
            _client         = client;
            _redoOperations = client.GetClientConfig().GetNetworkConfig().IsRedoOperation();

            var eventTreadCount = EnvironmentUtil.ReadEnvironmentVar("hazelcast.client.event.thread.count") ??
                                  DefaultEventThreadCount;

            _taskScheduler = new StripedTaskScheduler(eventTreadCount);

            _invocationTimeoutMillis =
                (EnvironmentUtil.ReadEnvironmentVar("hazelcast.client.invocation.timeout.seconds") ??
                 DefaultInvocationTimeout) * 1000;

            _clientConnectionManager = (ClientConnectionManager)client.GetConnectionManager();
            _clientConnectionManager.AddConnectionListener(this);
        }