Example #1
0
        static void Main(string[] args)
        {
            var config = GetConfiguration(args);

            var rootConfig = new RootConfig(config);

            var serviceProvider = new ServiceCollection()
                                  .AddLogging(configure =>
            {
                configure.AddConsole();
                configure.SetMinimumLevel(LogLevel.Information);
            })
                                  .AddSingleton <IConfiguration>(config)
                                  .AddSingleton(rootConfig)
                                  .AddSingleton <SessionOrchestrator>()
                                  .AddSingleton <HttpClient>()
                                  .AddSingleton <RootQueryRunner>()
                                  .AddSingleton <BrowserRunner>()
                                  .BuildServiceProvider();

            var orc    = serviceProvider.GetService <SessionOrchestrator>();
            var logger = serviceProvider.GetService <ILogger <Program> >();

            logger.LogDebug("Starting application");

            orc.Start();

            StartConsoleLoop(serviceProvider);

            logger.LogDebug("All done!");
        }
Example #2
0
        private IRootConfig CreateRootConfig(IServerSettings settings)
        {
            RootConfig rootConfig = new RootConfig();

            if (settings.MaxWorkingThreads != 0)
            {
                rootConfig.MaxWorkingThreads = settings.MaxWorkingThreads;
            }

            if (settings.MinWorkingThreads != 0)
            {
                rootConfig.MinWorkingThreads = settings.MinWorkingThreads;
            }

            if (settings.MaxIOThreads != 0)
            {
                rootConfig.MaxCompletionPortThreads = settings.MaxIOThreads;
            }

            if (settings.MinIOThreads != 0)
            {
                rootConfig.MinCompletionPortThreads = settings.MinIOThreads;
            }

            return(rootConfig);
        }
    static void Main(string[] args)
    {
        wsServer = new WebSocketServer();
        var config = new ServerConfig();

        config.Port = 8088;
        config.Ip   = "Any";
        config.Mode = SocketMode.Tcp;
        config.MaxConnectionNumber = 1000;
        config.Name = "ChatServer";
        config.ReceiveBufferSize = 16384;
        config.SendBufferSize    = 1024;
        var rootConfig = new RootConfig()
        {
        };
        var ret = wsServer.Setup(rootConfig, config, null, null, new ConsoleLogFactory(), null, null);

        if (!ret)
        {
            throw new Exception("Server is not setup correctly");
        }
        else
        {
            wsServer.NewSessionConnected += wsServer_NewSessionConnected;
            wsServer.NewMessageReceived  += wsServer_NewMessageReceived;
            wsServer.NewDataReceived     += wsServer_NewDataReceived;
            wsServer.SessionClosed       += wsServer_SessionClosed;
            wsServer.Start();
            int maxConn = wsServer.Config.MaxConnectionNumber;
            Console.WriteLine("Server is running on port " + config.Port + ". Max Connection is " + maxConn.ToString() + ". Press Enter to exit...");
            Console.ReadKey();
            wsServer.Stop();
        }
    }
Example #4
0
        IEnumerator CheckDataLoaded(List <System.Object> allData, Action callback)
        {
            RootConfig rootConfig = null;


            while (rootConfig == null)
            {
                rootConfig = RootConfig.Instance;

                yield return(null);
            }
#if DevMode
            //add console
            GameObject console = GameObject.Find(m_consolePrefabName);
            if (console == null)
            {
                PrefabManager.Instance.InstantiateAsync <GameObject> (m_consolePrefabName, (result) => {
                    Debug.Log($"===========aas:{result.key}加载完成.");
                    console      = result.result as GameObject;
                    console.name = m_consolePrefabName;
                });
            }
#endif

            callback();
        }
        public override List <ExplorerItem> GetSchemaAndBuildAssembly(IConnectionInfo cxInfo, AssemblyName assemblyToBuild, ref string nameSpace, ref string typeName)
        {
#if DEBUG
            //File.Delete(@"C:\Users\ronnie.overby\Desktop\dbug\4c5b497501bc4040a0c41dbf47805704");
            Debugger.Launch();
#endif

            var cxProps = new ConnectionProperties(cxInfo);
            var root    = new DirectoryInfo(cxProps.DataDirectoryPath);
            typeName = $"{SchemaNameSpace}.{root.Name.ToIdentifier()}.{SchemaClassName}";
            var rootConfig = RootConfig.LoadRootConfig(root);
            var schema     = FileVisitor.VisitRoot(root, rootConfig);
            rootConfig.Save(root);
            var cSharpSourceCode = GenerateCode(ref nameSpace, schema, root);

#if DEBUG
            File.WriteAllText(
                Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "the source codez.cs"),
                cSharpSourceCode);
#endif

            Compile(cSharpSourceCode, assemblyToBuild.CodeBase);

            return(schema);
        }
Example #6
0
 private void button_StartListen_Click(object sender, EventArgs e)
 {
     try
     {
         #region [=>自定义服务配置]
         IServerConfig serverConfig = new ServerConfig
         {
             Name = "ABenNET.SuperSocket.AppServer",                      // "AgileServer",//服务器实例的名称
             //ServerType = "AgileServer.Socket.TelnetServer, AgileServer.Socket",
             Ip                      = "Any",                             //Any - 所有的IPv4地址 IPv6Any - 所有的IPv6地址
             Mode                    = SocketMode.Tcp,                    //服务器运行的模式, Tcp (默认) 或者 Udp
             Port                    = int.Parse(this.textBox_port.Text), //服务器监听的端口
             SendingQueueSize        = 5000,                              //发送队列最大长度, 默认值为5
             MaxConnectionNumber     = 5000,                              //可允许连接的最大连接数
             LogCommand              = false,                             //是否记录命令执行的记录
             LogBasicSessionActivity = false,                             //是否记录session的基本活动,如连接和断开
             LogAllSocketException   = false,                             //是否记录所有Socket异常和错误
             //Security = "tls",//Empty, Tls, Ssl3. Socket服务器所采用的传输层加密协议
             MaxRequestLength         = 5000,                             //最大允许的请求长度,默认值为1024
             TextEncoding             = "UTF-8",                          //文本的默认编码,默认值是 ASCII,(###改成UTF-8,否则的话中文会出现乱码)
             KeepAliveTime            = 60,                               //网络连接正常情况下的keep alive数据的发送间隔, 默认值为 600, 单位为秒
             KeepAliveInterval        = 60,                               //Keep alive失败之后, keep alive探测包的发送间隔,默认值为 60, 单位为秒
             ClearIdleSession         = true,                             // 是否定时清空空闲会话,默认值是 false;(###如果开启定时60秒钟情况闲置的连接,为了保证客户端正常不掉线连接到服务器,故我们需要设置10秒的心跳数据包检查。也就是说清除闲置的时间必须大于心跳数据包的间隔时间,否则就会出现服务端主动踢掉闲置的TCP客户端连接。)
             ClearIdleSessionInterval = 60,                               //: 清空空闲会话的时间间隔, 默认值是120, 单位为秒;
             SyncSend = true,                                             //:是否启用同步发送模式, 默认值: false;
         };
         var rootConfig = new RootConfig()
         {
             MaxWorkingThreads               = 5000, //线程池最大工作线程数量
             MinWorkingThreads               = 10,   // 线程池最小工作线程数量;
             MaxCompletionPortThreads        = 5000, //线程池最大完成端口线程数量;
             MinCompletionPortThreads        = 10,   // 线程池最小完成端口线程数量;
             DisablePerformanceDataCollector = true, // 是否禁用性能数据采集;
             PerformanceDataCollectInterval  = 60,   // 性能数据采集频率 (单位为秒, 默认值: 60);
             LogFactory = "ConsoleLogFactory",       //默认logFactory的名字
             Isolation  = IsolationMode.AppDomain    // 服务器实例隔离级别
         };
         #endregion
         tcpServerEngine = new AppServer();
         if (tcpServerEngine.Setup(rootConfig: rootConfig, config: serverConfig))
         {
             if (tcpServerEngine.Start())
             {
                 tcpServerEngine.NewSessionConnected += tcpServerEngine_NewSessionConnected;
                 tcpServerEngine.NewRequestReceived  += tcpServerEngine_NewRequestReceived;
                 tcpServerEngine.SessionClosed       += tcpServerEngine_SessionClosed;
                 this.ShowListenStatus();
                 this.ShowMessage("服务启动成功!");
             }
             else
             {
                 this.ShowMessage("服务启动失败!");
             }
         }
     }
     catch (Exception ex)
     {
         ShowMessage(ex.Message);
     }
 }
        public ConnectionListener(RootConfig config, IMediator mediator)
        {
            _mediator    = mediator;
            _config      = config.NetworkConfig;
            _tcpListener = TcpListener.Create(_config.Port);

            ThreadPool.QueueUserWorkItem(AcceptNewClientThread);
        }
Example #8
0
        void PreloadData()
        {
            RootConfig rootConfig = RootConfig.Instance;

            allData.Add(rootConfig);


            StartCoroutine(CheckDataLoaded(allData, AfterLoadData));
        }
Example #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ConfigPod"/> class.
 /// </summary>
 /// <param name="rootConfig">
 /// The RootConfig object.
 /// </param>
 /// <param name="exception">
 /// The exception if any.
 /// </param>
 /// <param name="path">
 /// The path of the configuration file.
 /// </param>
 public ConfigPod(
     RootConfig rootConfig,
     Exception?exception,
     string?path)
 {
     RootConfig = rootConfig;
     Exception  = exception;
     Path       = path;
 }
Example #10
0
        public ConnectionListener(RootConfig config, IMessenger messenger)
        {
            _config      = config;
            _messenger   = messenger;
            _workingMres = new ManualResetEventSlim(false);
            _tcpListener = TcpListener.Create(_config.Port);

            ThreadPool.QueueUserWorkItem(AcceptNewClientThread);
        }
Example #11
0
            public override string ToStandAloneSystemConfig()
            {
                var cfg = new RootConfig(
                    new LogConfig(LogVerbosity.Info, false),
                    new StandAloneConfig(Network),
                    new PersistenceConfig(new PersistenceJournalConfig(Persistence, new DomainEventAdaptersConfig(), typeof(SlowDomainJournal)),
                                          new PersistenceSnapshotConfig(this)));

                return(cfg.Build());
            }
Example #12
0
        public string ToClusterNonSeedNodeSystemConfig(params IAkkaNetworkAddress[] seeds)
        {
            var cfg = new RootConfig(
                new LogConfig(_logVerbosity, false),
                ClusterConfig.NonSeedNode(Network, seeds),
                new PersistenceConfig(new PersistenceJournalConfig(Persistence, new DomainEventAdaptersConfig()),
                                      new PersistenceSnapshotConfig(this)));

            return(cfg.Build());
        }
Example #13
0
        public virtual string ToStandAloneSystemConfig()
        {
            var cfg = new RootConfig(
                new LogConfig(_logVerbosity, false),
                new StandAloneConfig(Network),
                new PersistenceConfig(new PersistenceJournalConfig(Persistence, new DomainEventAdaptersConfig()),
                                      new PersistenceSnapshotConfig(this)));

            return(cfg.Build());
        }
Example #14
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            RootConfig.Entry(services, Configuration);
            services.Configure <UserConfiguration>(Configuration.GetSection("UserConfiguration"));
            //services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
            //    .AddJwtBearer(options =>
            //    {
            //        options.Audience = "http://dev.authorize.reso.vn";
            //        options.ClaimsIssuer = "http://dev.authorize.reso.vn";
            //        options.Authority = "issuers";
            //    });
            //var DBConnect = this.Configuration.GetConnectionString("DBContext");
            //var IdentityConnect = this.Configuration.GetConnectionString("IdentityContext");
            //services.AddDbContext<ApplicationDbContext>(o =>
            //{
            //    o.UseSqlServer(IdentityConnect);
            //});

            // service context
            //services.AddDbContext<Pea_devContext>(o =>
            //{
            //    o.UseSqlServer(DBConnect);
            //});

            //add identity
            //services.AddIdentity<IdentityUser, IdentityRole>()
            //    .AddEntityFrameworkStores<ApplicationDbContext>()
            //    .AddDefaultTokenProviders();

            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
            services.AddMvc(options =>
            {
                // add an instance of the filter, like we used to do it
                //options.Filters.Add(new BlockCustomAttribute());
            });
            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new Info {
                    Title = "Pea API", Version = "v1"
                });
                c.AddSecurityDefinition("Bearer", new ApiKeyScheme {
                    In = "header", Description = "Please enter JWT with Bearer into field", Name = "Authorization", Type = "apiKey"
                });
                c.AddSecurityRequirement(new Dictionary <string, IEnumerable <string> > {
                    { "Bearer", Enumerable.Empty <string>() },
                });
                var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
                var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
                //c.DocumentFilter<ApplyDocumentVendorExtensions>();
                c.IncludeXmlComments(xmlPath);
            });

            services.AddMvc();
        }
Example #15
0
    public void SetWater(float water)
    {
        Color color = RootConfig.GetColorByWater(water);

        var gradient = new Gradient();

        gradient.SetKeys(
            new GradientColorKey[] { new GradientColorKey(color, 0f), new GradientColorKey(color, 1f) },
            new GradientAlphaKey[] { new GradientAlphaKey(1f, 0f), new GradientAlphaKey(1f, 0f) }
            );
        this.line.colorGradient = gradient;
    }
Example #16
0
        public virtual string ToStandAloneInMemorySystemConfig()
        {
            var cfg = new RootConfig(
                new LogConfig(_logVerbosity, false),
                new StandAloneConfig(Network),
                new PersistenceConfig(new InMemoryJournalConfig(
                                          new DomainEventAdaptersConfig()),
                                      new LocalFilesystemSnapshotConfig())
                );

            return(cfg.Build());
        }
Example #17
0
        public ErrorHandlerVm(ILogger logger, ISettingsService settingsService, IUnityContainer container, IEmailService emailSevice)
        {
            _logger      = logger;
            _emailSevice = emailSevice;
            _config      = settingsService.GetConfig();

            _view = container.Resolve <ErrorHandlerForm>();
            _view.OnSendButtonClick    += View_OnSendButtonClick;
            _view.OnShowErrorLinkClick += View_OnShowErrorLink;
            _view.OnLogFileLinkClick   += View_OnLogFileLinkClick;
            _view.OnDebugButtonClick   += View_OnDebugButtonClick;
        }
        private bool StartServer()
        {
            if (!int.TryParse(Port, out var port))
            {
                return(false);
            }

            var server    = new WebSocketServer();
            var config    = new RootConfig();
            var srvConfig = new ServerConfig
            {
                Port = port,
                Ip   = "Any",
                MaxConnectionNumber = 1,
                Mode = SocketMode.Tcp,
                Name = "GroundSwiper Server"
            };

            server.NewSessionConnected += s => session = s;
            server.NewDataReceived     += (s, d) =>
            {
                // d[0]: mode (0: down 1: up)
                // d[1]: keyCode
                if (d.Length != 2)
                {
                    LogWrite($"Invalid Data Length {d.Length}!");
                    return;
                }

                switch (d[0])
                {
                case 0:
                    KeySender.KeyDown(d[1]);
                    break;

                case 1:
                    KeySender.KeyUp(d[1]);
                    break;

                default:
                    LogWrite($"Invalid Data Mode {d[0]}");
                    break;
                }
            };
            server.Setup(config, srvConfig);

            server.Start();

            this.server  = server;
            isConnecting = true;
            return(true);
        }
Example #19
0
        public RoomManager(RootConfig config, IMessenger messenger)
        {
            _applicationMessenger = messenger;

            _config         = config.RoomManagerConfig;
            _chatRooms      = new List <Room>();
            _newClientQueue = new ConcurrentQueue <TcpClient>();

            messenger.Register <NewClientAvaliableMessage>(this, PutNewClientToQueue);

            ThreadPool.QueueUserWorkItem(RoomCleanerThread);
            ThreadPool.QueueUserWorkItem(NewClientProcessingThread);
        }
Example #20
0
        public Plugin()
        {
            HARMONY_GUID_HANDS   = GUID + ".hands";
            HARMONY_GUID_MAGPALM = GUID + ".magpalm";
            HARMONY_GUID_CHEAT   = GUID + ".cheats";

            Instance = this;

            Configs = new RootConfig(Config);
            PatchInit(Configs);

            SceneManager.sceneLoaded += OnSceneLoaded;
        }
Example #21
0
        public Settings(IMessenger messenger, ISettingsService settingsService)
        {
            InitializeComponent();

            _messenger       = messenger;
            _settingsService = settingsService;
            _config          = _settingsService.GetConfig();

            Text = $"{_config.AppName} - Settings";
            Icon = Resources.ResourceManager.GetObject(_config.IconName) as Icon;

            LoadSettings();
        }
Example #22
0
        public GameClient(RootConfig config, IMessenger messenger, IPipeline <NetworkMessage> networkMessagePipe)
        {
            _config             = config;
            _messenger          = messenger;
            _networkMessagePipe = networkMessagePipe;
            _bufferedClient     = new ConnectionBuffer(false);
            _messenger.Register <NumberGeneratedMessage>(this, OnNumberGenerated);
            _workingMres   = new ManualResetEventSlim(false);
            _connectedMres = new ManualResetEventSlim(false);

            ThreadPool.QueueUserWorkItem(ConnectionControlThread);
            ThreadPool.QueueUserWorkItem(ReadingMessagesThread);
        }
Example #23
0
        private void buttonWait_Click(object sender, EventArgs e)
        {
            if (server != null)
            {
                opened = true;
                return;
            }

            server = new WebSocketServer();
            var rootConfig   = new RootConfig();
            var serverConfig = new ServerConfig()
            {
                Ip   = "Any",
                Port = 30304,
                MaxConnectionNumber = 5,
                Mode = SuperSocket.SocketBase.SocketMode.Tcp,
                Name = "WebSocket Test Server"
            };

            server.NewSessionConnected += s =>
            {
                if (opened)
                {
                    clients.Add(s, null);
                    Invoke(new updateDelegate(update));
                }
                else
                {
                    s.Close(SuperSocket.SocketBase.CloseReason.ServerClosing);
                }
            };
            server.SessionClosed += (s, reason) =>
            {
                clients.Remove(s);
                Invoke(new updateDelegate(update));
            };
            server.NewMessageReceived += (s, message) =>
            {
                clients[s] = message;
                Invoke(new updateDelegate(update));
                Parallel.ForEach(clients, c =>
                {
                    c.Key.Send(new ArraySegment <byte>(Encoding.UTF8.GetBytes(message)));
                });
            };

            server.Setup(rootConfig, serverConfig);

            opened = true;
            server.Start();
        }
Example #24
0
        public void TestECHO()
        {
            IServerConfig config = new ServerConfig
            {
                Name = "My Custom Server",
                Ip   = "Any",
                Port = 100,
                Mode = SocketMode.Async,
                MaxConnectionNumber = 1
            };

            var rootConfig = new RootConfig
            {
                LoggingMode = LoggingMode.Console
            };

            YourServer server = new YourServer();

            server.Setup(rootConfig, config, SocketServerFactory.Instance);

            server.Start();

            EndPoint serverAddress = new IPEndPoint(IPAddress.Parse("127.0.0.1"), config.Port);

            using (Socket socket = new Socket(serverAddress.AddressFamily, SocketType.Stream, ProtocolType.Tcp))
            {
                socket.Connect(serverAddress);
                Stream socketStream = new NetworkStream(socket);
                using (StreamReader reader = new StreamReader(socketStream, Encoding.Default, true))
                    using (StreamWriter writer = new StreamWriter(socketStream, Encoding.Default, 1024 * 8))
                    {
                        //ignore welcome message
                        reader.ReadLine();

                        string   command    = "CMD:ECHO ";
                        string[] parameters = new string[] { "Kerry", "Jiang", "China", "Shanghai" };
                        string   parameter  = Convert.ToBase64String(Encoding.ASCII.GetBytes(string.Join(" ", parameters)));
                        writer.WriteLine(command + parameter);
                        writer.Flush();

                        foreach (var p in parameters)
                        {
                            string param = reader.ReadLine();
                            Console.WriteLine(param);
                            Assert.AreEqual(p, param);
                        }
                    }
            }

            server.Stop();
        }
        protected void Setup(WebSocketServer websocketServer, Action<ServerConfig> configurator)
        {
            var rootConfig = new RootConfig { DisablePerformanceDataCollector = true };
            websocketServer.NewSessionConnected += new SessionHandler<WebSocketSession>(m_WebSocketServer_NewSessionConnected);
            websocketServer.SessionClosed += new SessionHandler<WebSocketSession, CloseReason>(m_WebSocketServer_SessionClosed);

            var config = new ServerConfig();
            configurator(config);

            var ret = websocketServer.Setup(rootConfig, config, null, null, new ConsoleLogFactory(), null, null);

            Assert.IsTrue(ret);

            m_WebSocketServer = websocketServer;
        }
Example #26
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            RootConfig.Entry(services, Configuration);

            services.AddCors(options =>
            {
                options.AddPolicy("AllowSpecificOrigin", builder =>
                                  builder
                                  .AllowAnyOrigin()
                                  .AllowAnyMethod()
                                  .AllowAnyHeader());
            });

            services.AddMvc().SetCompatibilityVersion(Microsoft.AspNetCore.Mvc.CompatibilityVersion.Version_2_1);
        }
Example #27
0
 private void Load()
 {
     if (!File.Exists(NormaConstants.ConfigurationFile))
     {
         Root = new RootConfig();
         Migrate();
         return;
     }
     using (var sr = File.OpenText(NormaConstants.ConfigurationFile))
     {
         var serializer = new JsonSerializer();
         Root = (RootConfig)serializer.Deserialize(sr, typeof(RootConfig));
     }
     Migrate();
 }
        static AWSConfigsMobileAnalytics()
        {
#if BCL||AWSSDK_UNITY
            var root = new RootConfig();
            var section = root.GetServiceSection(mobileAnalyticsKey);
            if (section == null)
            {
                return;
            }

            var rootSection = new MobileAnalyticsConfigSectionRoot(section);
            if (rootSection.MobileAnalytics != null)
                AWSConfigsMobileAnalytics.Configure(rootSection.MobileAnalytics);
#endif
        }
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            RootConfig.Entry(services, Configuration);

            services.AddImageSharpCore()
            .SetRequestParser <QueryCollectionRequestParser>()
            .SetMemoryAllocatorFromMiddlewareOptions()
            .SetCache(provider => new PhysicalFileSystemCache(
                          provider.GetRequiredService <IHostingEnvironment>(),
                          provider.GetRequiredService <MemoryAllocator>(),
                          provider.GetRequiredService <IOptions <ImageSharpMiddlewareOptions> >())
            {
                Settings =
                {
                    [PhysicalFileSystemCache.Folder] = PhysicalFileSystemCache.DefaultCacheFolder
                }
            })
            .SetCacheHash <CacheHash>()
            .AddProvider <PhysicalFileSystemProvider>()
            .AddProcessor <ResizeWebProcessor>()
            .AddProcessor <FormatWebProcessor>()
            .AddProcessor <BackgroundColorWebProcessor>();


            services.AddCors(options =>
            {
                options.AddPolicy("AllowSpecificOrigin", builder =>
                                  builder
                                  .AllowAnyOrigin()
                                  .AllowAnyMethod()
                                  .AllowAnyHeader());
            });

            services.Configure <ForwardedHeadersOptions>(options =>
            {
            });

            services.AddMvc().SetCompatibilityVersion(Microsoft.AspNetCore.Mvc.CompatibilityVersion.Version_2_1);

            // Swagger Configuration
            // Register the Swagger generator, defining 1 or more Swagger documents
            services.AddSwaggerDocument(c =>
            {
                c.DocumentName = "Doitsu Fandom Api";
                c.Version      = "1.6";
                c.Title        = "Doitsu Fandom Api";
            });
        }
Example #30
0
        public TrayNotificator(IMessenger messanger, ISettingsService settingsService)
        {
            _messanger = messanger;
            _config    = settingsService.GetConfig();

            var icon = Resources.ResourceManager.GetObject(_config.IconName) as Icon;

            _trayIcon = new NotifyIcon
            {
                Icon            = icon,
                Visible         = true,
                BalloonTipTitle = _config.TrayConfig.BalloonTitle,
                ContextMenu     = CreateMenu()
            };
            _trayIcon.DoubleClick += TrayIconOnDoubleClick;
        }
        protected void Setup(WebSocketServer websocketServer, Action <ServerConfig> configurator)
        {
            var rootConfig = new RootConfig {
                DisablePerformanceDataCollector = true
            };

            websocketServer.NewDataReceived += new SessionHandler <WebSocketSession, byte[]>(WebSocketServer_NewDataReceived);

            var config = new ServerConfig();

            configurator(config);

            var ret = websocketServer.Setup(rootConfig, config, null, null, new ConsoleLogFactory(), null, null);

            WebSocketServer = websocketServer;
        }
Example #32
0
        static AWSConfigsS3()
        {
#if BCL
            var appSettingValue = AWSConfigs.GetConfig(S3UseSignatureVersion4Key);
            if (!string.IsNullOrEmpty(appSettingValue))
                UseSignatureVersion4 = bool.Parse(appSettingValue);

            var root = new RootConfig();
            var section = root.GetServiceSection(s3Key);
            if (section == null)
            {
                return;
            }

            var rootSection = new V4ClientSectionRoot(section);
            if (rootSection.S3 != null)
                AWSConfigsS3.Configure(rootSection.S3);
#endif
        }
        /// <summary>
        /// Constructor of <see cref="Amazon.MobileAnalytics.MobileAnalyticsManager.MobileAnalyticsManagerConfig"/>
        /// </summary>
        public MobileAnalyticsManagerConfig()
        {
            SessionTimeout = defaultSessionTimeout;
            MaxDBSize = defaultMaxDBSize;
            DBWarningThreshold = defaultDBWarningThreshold;
            MaxRequestSize = defaultMaxRequestSize;
            AllowUseDataNetwork = defaultAllowUseDataNetwork;
#if BCL
            ClientContextConfiguration = new ClientContextConfig();
#endif

#if UNITY
            var root = new RootConfig();
            var section = root.GetServiceSection(mobileAnalyticsKey);
            if (section == null)
            {
                return;
            }

            var rootSection = new MobileAnalyticsManagerConfigSectionRoot(section);
            if (rootSection.SectionConfig != null)
                Configure(rootSection.SectionConfig);
#endif
        }
Example #34
0
        public static void Initialize( string[] args )
        {
            ParseArguments( args );

            SetupConsoleLogging();

            m_Thread = Thread.CurrentThread;
            m_Process = Process.GetCurrentProcess();
            m_Assembly = Assembly.GetEntryAssembly();

            if ( m_Thread != null )
                m_Thread.Name = "Core Thread";

            if ( BaseDirectory.Length > 0 )
                Directory.SetCurrentDirectory( BaseDirectory );

            Version ver = m_Assembly.GetName().Version;
            CoreVersion = ver;

            int platform = (int) System.Environment.OSVersion.Platform;
            if ( platform == 4 || platform == 128 )
                m_Unix = true;

            GCSettings.LatencyMode = GCLatencyMode.LowLatency;

            Console.WriteLine( "X-RunUO Server - Version {0}.{1}.{2}, Build {3}", ver.Major, ver.Minor, ver.Build, ver.Revision );
            Console.WriteLine( "Core: Running on OS {0}", System.Environment.OSVersion );
            Console.WriteLine( "Core: Running on {0} {1}", Unix ? "Mono" : ".NET Framework", System.Environment.Version );

            if ( MultiProcessor || Is64Bit )
                Console.WriteLine( "Core: Optimizing for {0} {2}processor{1}", ProcessorCount, ProcessorCount == 1 ? "" : "s", Is64Bit ? "64-bit " : "" );

            Console.WriteLine( "Core: Using GC {0} {1} mode", GCSettings.IsServerGC ? "Server" : "Workstation", GCSettings.LatencyMode.ToString() );

            m_Config = new RootConfig( BaseDirectory, "x-runuo.xml" );
        }