示例#1
0
        static void Main(string[] args)
        {
            Log.Texte("", "-------------------------------", ConsoleColor.DarkBlue);
            Log.Texte("", "          _____   _____ ", ConsoleColor.Cyan);
            Log.Texte("", "    /\\   |  __ \\ / ____|", ConsoleColor.Cyan);
            Log.Texte("", "   /  \\  | |__) | (___  ", ConsoleColor.Cyan);
            Log.Texte("", "  / /\\ \\ |  ___/ \\___ \\ ", ConsoleColor.Cyan);
            Log.Texte("", " / ____ \\| |     ____) |", ConsoleColor.Cyan);
            Log.Texte("", "/_/    \\_\\_|    |_____/ APB-File", ConsoleColor.Cyan);
            Log.Texte("", "http://AllPrivateServer.com", ConsoleColor.DarkCyan);
            Log.Texte("", "-------------------------------", ConsoleColor.DarkBlue);

            Assembly.Load("Common");

            Log.Info("FileServer", "Starting...");

            ConfigMgr.LoadConfigs();
            Config = ConfigMgr.GetConfig <FileServerConfig>();

            if (!Log.InitLog(Config.LogLevel, "FileServer"))
            {
                ConsoleMgr.WaitAndExit(2000);
            }

            Server = new RpcServer(Config.RpcInfo.RpcClientStartingPort, 0);
            if (!Server.Start(Config.RpcInfo.RpcIp, Config.RpcInfo.RpcPort))
            {
                ConsoleMgr.WaitAndExit(2000);
            }

            Log.Success("FileServer", "Server loaded.");
            ConsoleMgr.Start();
        }
示例#2
0
        static void Main(string[] args)
        {
            Log.Texte("", "-------------------------------", ConsoleColor.DarkBlue);
            Log.Texte("", "          _____   _____ ", ConsoleColor.Cyan);
            Log.Texte("", "    /\\   |  __ \\ / ____|", ConsoleColor.Cyan);
            Log.Texte("", "   /  \\  | |__) | (___  ", ConsoleColor.Cyan);
            Log.Texte("", "  / /\\ \\ |  ___/ \\___ \\ ", ConsoleColor.Cyan);
            Log.Texte("", " / ____ \\| |     ____) |", ConsoleColor.Cyan);
            Log.Texte("", "/_/    \\_\\_|    |_____/ APB-Char", ConsoleColor.Cyan);
            Log.Texte("", "http://AllPrivateServer.com", ConsoleColor.DarkCyan);
            Log.Texte("", "-------------------------------", ConsoleColor.DarkBlue);

            Assembly.Load("Common");

            Log.Info("CharacterServer", "Starting...");

            ConfigMgr.LoadConfigs();
            Config = ConfigMgr.GetConfig<CharacterServerConfig>();

            if (!Log.InitLog(Config.LogLevel, "CharacterServer"))
                ConsoleMgr.WaitAndExit(2000);

            CharacterMgr.Database = DBManager.Start(Config.CharacterDatabase.Total(), ConnectionType.DATABASE_MYSQL, "CharDB");
            if(CharacterMgr.Database == null)
                ConsoleMgr.WaitAndExit(2000);

            Server = new RpcServer(Config.RpcInfo.RpcClientStartingPort, 0);
            if (!Server.Start(Config.RpcInfo.RpcIp, Config.RpcInfo.RpcPort))
                ConsoleMgr.WaitAndExit(2000);

            Log.Success("CharacterServer", "Server loaded.");
            ConsoleMgr.Start();
        }
示例#3
0
文件: Program.cs 项目: Indifer/Test
        static void Main(string[] args)
        {
            var config = new RpcServerConfiguration();

            config.BindingEndPoint = new IPEndPoint(IPAddress.Loopback, 8089);

            config.PreferIPv4 = true;

            config.IsDebugMode = true;
            //UseFullMethodName is a property that if it is false allows you in the CLIENT to call the         methods only by it's name, check example further.
            config.UseFullMethodName = false;

            var defaultServiceTypeLocator = new DefaultServiceTypeLocator();

            //Methods is the class I created with all the methods to be called.
            defaultServiceTypeLocator.AddService(typeof(Methods));

            config.ServiceTypeLocatorProvider = conf => defaultServiceTypeLocator;

            using (var server = new RpcServer(config))
            {
                server.Start();
                Console.ReadKey();
            }
        }
示例#4
0
        static void Main(string[] args)
        {
            Log.Texte("", "-------------------------------", ConsoleColor.DarkBlue);
            Log.Texte("", "          _____   _____ ", ConsoleColor.Cyan);
            Log.Texte("", "    /\\   |  __ \\ / ____|", ConsoleColor.Cyan);
            Log.Texte("", "   /  \\  | |__) | (___  ", ConsoleColor.Cyan);
            Log.Texte("", "  / /\\ \\ |  ___/ \\___ \\ ", ConsoleColor.Cyan);
            Log.Texte("", " / ____ \\| |     ____) |", ConsoleColor.Cyan);
            Log.Texte("", "/_/    \\_\\_|    |_____/ APB-File", ConsoleColor.Cyan);
            Log.Texte("", "http://AllPrivateServer.com", ConsoleColor.DarkCyan);
            Log.Texte("", "-------------------------------", ConsoleColor.DarkBlue);

            Assembly.Load("Common");

            Log.Info("FileServer", "Starting...");

            ConfigMgr.LoadConfigs();
            Config = ConfigMgr.GetConfig<FileServerConfig>();

            if (!Log.InitLog(Config.LogLevel, "FileServer"))
                ConsoleMgr.WaitAndExit(2000);

            Server = new RpcServer(Config.RpcInfo.RpcClientStartingPort, 0);
            if (!Server.Start(Config.RpcInfo.RpcIp, Config.RpcInfo.RpcPort))
                ConsoleMgr.WaitAndExit(2000);

            Log.Success("FileServer", "Server loaded.");
            ConsoleMgr.Start();
        }
示例#5
0
        static void Main(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(onError);

            Log.Texte("", "-------------------- Account Cacher  -------------------", ConsoleColor.DarkRed);

            // Loading all configs files
            ConfigMgr.LoadConfigs();
            Config = ConfigMgr.GetConfig <AccountConfigs>();

            // Loading log level from file
            if (!Log.InitLog(Config.LogLevel, "AccountCacher"))
            {
                ConsoleMgr.WaitAndExit(2000);
            }

            AccountMgr.Database = DBManager.Start(Config.AccountDB.Total(), Config.AccountDB.ConnectionType, "Accounts", Config.AccountDB.Database);
            if (AccountMgr.Database == null)
            {
                ConsoleMgr.WaitAndExit(2000);
            }

            Server = new RpcServer(Config.RpcInfo.RpcClientStartingPort, 1);
            if (!Server.Start(Config.RpcInfo.RpcIp, Config.RpcInfo.RpcPort))
            {
                ConsoleMgr.WaitAndExit(2000);
            }

            AcctMgr = Server.GetLocalObject <AccountMgr>();
            AcctMgr.LoadRealms();

            ConsoleMgr.Start();
        }
示例#6
0
        static void Main(String[] args)
        {
            XTrace.UseConsole();

            var sc = new RpcServer()
            {
                Port       = 1234,
                Log        = XTrace.Log,
                EncoderLog = XTrace.Log,

                NameSpace = "NewLife.Test",
            };

            var star = new StarClient("tcp://127.0.0.1:6666")
            {
                Code   = "test",
                Secret = "pass"
            };

            sc.Star = star;

            sc.Start();

            _Server = sc;

            Thread.Sleep(-1);
        }
 public void StartRPCService()
 {
     server = new RpcServer(this);
     string[] uriPrefix = new string[1];
     uriPrefix[0] = "http://localhost:10033";
     server.Start(uriPrefix, "", "");
 }
示例#8
0
        static void Main(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(onError);

            // Loading all configs files
            ConfigMgr.LoadConfigs();
            Config = ConfigMgr.GetConfig<AccountConfigs>();

            // Loading log level from file
            if (!Log.InitLog(Config.LogLevel, "AccountCacher"))
                ConsoleMgr.WaitAndExit(2000);

            AccountMgr.Database = DBManager.Start(Config.AccountDB.Total(), ConnectionType.DATABASE_MYSQL, "Accounts");
            if (AccountMgr.Database == null)
                ConsoleMgr.WaitAndExit(2000);

            Server = new RpcServer(Config.RpcInfo.RpcClientStartingPort, 1);
            if (!Server.Start(Config.RpcInfo.RpcIp, Config.RpcInfo.RpcPort))
                ConsoleMgr.WaitAndExit(2000);

            AcctMgr = Server.GetLocalObject<AccountMgr>();
            AcctMgr.LoadRealms();

            ConsoleMgr.Start();
        }
示例#9
0
        static void Main(string[] args)
        {
            Log.Texte("", "-------------------------------", ConsoleColor.DarkBlue);
            Log.Texte("", "          _____   _____ ", ConsoleColor.Cyan);
            Log.Texte("", "    /\\   |  __ \\ / ____|", ConsoleColor.Cyan);
            Log.Texte("", "   /  \\  | |__) | (___  ", ConsoleColor.Cyan);
            Log.Texte("", "  / /\\ \\ |  ___/ \\___ \\ ", ConsoleColor.Cyan);
            Log.Texte("", " / ____ \\| |     ____) |", ConsoleColor.Cyan);
            Log.Texte("", "/_/    \\_\\_|    |_____/ Rift", ConsoleColor.Cyan);
            Log.Texte("", "http://AllPrivateServer.com", ConsoleColor.DarkCyan);
            Log.Texte("", "-------------------------------", ConsoleColor.DarkBlue);

            // Loading all configs files
            ConfigMgr.LoadConfigs();
            Config = ConfigMgr.GetConfig<RealmConfig>();
            Config.RealmInfo.GenerateName();

            // Loading log level from file
            if (!Log.InitLog(Config.LogLevel,"Realm"))
                ConsoleMgr.WaitAndExit(2000);

            CharactersMgr.CharactersDB = DBManager.Start(Config.CharactersDB.Total(), ConnectionType.DATABASE_MYSQL, "Characters");
            if (CharactersMgr.CharactersDB == null)
                ConsoleMgr.WaitAndExit(2000);

            WorldMgr.WorldDB = DBManager.Start(Config.WorldDB.Total(), ConnectionType.DATABASE_MYSQL, "World");
            if (WorldMgr.WorldDB == null)
                ConsoleMgr.WaitAndExit(2000);

            PacketProcessor.RegisterDefinitions();

            // Starting Remote Client
            Client = new RpcClient("Realm-" + Config.RealmInfo.RealmId, Config.RpcCharacter.RpcLocalIp, 1);
            if (!Client.Start(Config.RpcCharacter.RpcServerIp, Config.RpcCharacter.RpcServerPort))
                ConsoleMgr.WaitAndExit(2000);

            Server = new RpcServer(Config.RpcMapServer.RpcClientStartingPort, 2);
            if (!Server.Start(Config.RpcMapServer.RpcIp, Config.RpcMapServer.RpcPort))
                ConsoleMgr.WaitAndExit(2000);

            World = Client.GetLocalObject<WorldMgr>();
            Accounts = Client.GetServerObject<AccountMgr>();
            Characters = Client.GetLocalObject<CharactersMgr>();

            // 1 : Loading WorldMgr
            World.Load();

            // 2 : Loading CharactersMgr
            CharactersMgr.Client = Client;
            CharactersMgr.MyRealm = Config.RealmInfo;
            CharactersMgr.MyRealm.RpcInfo = Client.Info;
            Characters.Load();

            // 3 : Loading AccountsMgr
            Accounts.RegisterRealm(Config.RealmInfo, Client.Info);

            ConsoleMgr.Start();
        }
示例#10
0
        public static void Main(string[] args)
        {
            var       url    = ConfigurationManager.AppSettings["urlPrefix"];
            RpcServer server = new RpcServer();

            server.Register <IRpcServiceSample, RpcServiceSample>();
            server.Start(url);
            Console.ReadLine();
        }
示例#11
0
        static void Main(string[] args)
        {
            Console.Title = "RpcServer";
            var server = new RpcServer();

            server.Start();
            Console.WriteLine("服务器启动成功");
            Console.ReadLine();
            server.Close();
        }
示例#12
0
        static void Main(string[] args)
        {
            Log.Texte("", "---------------------------------------------------------------", ConsoleColor.DarkBlue);
            Log.Texte("", " _______ _________ _______ _________ _______  _______          ", ConsoleColor.Cyan);
            Log.Texte("", "(  ____ )\\__   __/(  ____ \\__   __/(  ____ \\(       )|\\     /|", ConsoleColor.Cyan);
            Log.Texte("", "| (    )|   ) (   | (    \\/   ) (   | (    \\/| () () || )   ( |", ConsoleColor.Cyan);
            Log.Texte("", "| (____)|   | |   | (__       | |   | (__    | || || || |   | |", ConsoleColor.Cyan);
            Log.Texte("", "|     __)   | |   |  __)      | |   |  __)   | |(_)| || |   | |", ConsoleColor.Cyan);
            Log.Texte("", "| (\\ (      | |   | (         | |   | (      | |   | || |   | |", ConsoleColor.Cyan);
            Log.Texte("", "| ) \\ \\_____) (___| )         | |   | (____/\\| )   ( || (___) |", ConsoleColor.Cyan);
            Log.Texte("", "|/   \\__/\\_______/|/          )_(   (_______/|/     \\|(_______)", ConsoleColor.Cyan);
            Log.Texte("", "www.Strawberry-Pr0jcts.com", ConsoleColor.DarkCyan);
            Log.Texte("", "---------------------------------------------------------------", ConsoleColor.DarkBlue);

            // Loading all configs files
            ConfigMgr.LoadConfigs();
            Config = ConfigMgr.GetConfig <CharacterConfig>();

            // Loading log level from file
            if (!Log.InitLog(Config.LogLevel, "Character"))
            {
                ConsoleMgr.WaitAndExit(2000);
            }

            AccountMgr.AccountDB = DBManager.Start(Config.AccountDB.Total(), ConnectionType.DATABASE_MYSQL, "Accounts");
            if (AccountMgr.AccountDB == null)
            {
                ConsoleMgr.WaitAndExit(2000);
            }

            // Starting Remote Server
            Server = new RpcServer(Config.RpcClientStartingPort, 1);
            if (!Server.Start(Config.RpcIP, Config.RpcPort))
            {
                ConsoleMgr.WaitAndExit(2000);
            }

            // Starting Accounts Manager
            AcctMgr = Server.GetLocalObject <AccountMgr>();
            if (AcctMgr == null)
            {
                ConsoleMgr.WaitAndExit(2000);
            }

            AcctMgr.LoadRealms();

            // Listening Client
            if (!TCPManager.Listen <RiftServer>(Config.CharacterServerPort, "CharacterServer"))
            {
                ConsoleMgr.WaitAndExit(2000);
            }

            ConsoleMgr.Start();
        }
示例#13
0
        static void Main(string[] args)
        {
            GC.AddMemoryPressure(55 * 1024 * 1024);

            var threadPoolSize = 20;

            ThreadPool.SetMaxThreads(threadPoolSize, threadPoolSize);
            ThreadPool.SetMinThreads(threadPoolSize, threadPoolSize);

            WriteMessage(string.Format("thread pool size:{0}", threadPoolSize));

            LogAgent.LogAction = (level, message, ex) =>
            {
                if (level != LogLevel.Error)
                {
                    return;
                }

                WriteMessage(message);

                if (ex != null)
                {
                    WriteMessage(ex.Message);
                }
            };

            int port = 7777;

            _rpcServer = new RpcServer();
            _rpcServer.Bind(IPAddress.Any, port);

            Task.Factory.StartNew(() =>
            {
                try
                {
                    _rpcServer.Start <CustomMessageProcessor>();
                    WriteMessage(string.Format("server started,port:{0}", port));
                }
                catch (Exception ex)
                {
                    _rpcServer = null;
                    WriteMessage("server start failed");
                }
            }, TaskCreationOptions.LongRunning);


            while (true)
            {
                if (Console.ReadLine() == "exit")
                {
                    break;
                }
            }
        }
示例#14
0
 protected internal override void OnStart(string[] args)
 {
     Blockchain.RegisterBlockchain(new LevelDBBlockchain(Settings.Default.DataDirectoryPath));
     LocalNode = new LocalNode();
     LocalNode.Start(Settings.Default.NodePort);
     if (args.Length >= 1 && args[0] == "/rpc")
     {
         rpc = new RpcServer(LocalNode);
         rpc.Start();
     }
 }
示例#15
0
        static void Main(string[] args)
        {
            Log.Texte("", "-------------------------------", ConsoleColor.DarkBlue);
            Log.Texte("", "          _____   _____ ", ConsoleColor.Cyan);
            Log.Texte("", "    /\\   |  __ \\ / ____|", ConsoleColor.Cyan);
            Log.Texte("", "   /  \\  | |__) | (___  ", ConsoleColor.Cyan);
            Log.Texte("", "  / /\\ \\ |  ___/ \\___ \\ ", ConsoleColor.Cyan);
            Log.Texte("", " / ____ \\| |     ____) |", ConsoleColor.Cyan);
            Log.Texte("", "/_/    \\_\\_|    |_____/ Rift", ConsoleColor.Cyan);
            Log.Texte("", "http://AllPrivateServer.com", ConsoleColor.DarkCyan);
            Log.Texte("", "-------------------------------", ConsoleColor.DarkBlue);

            // Loading all configs files
            ConfigMgr.LoadConfigs();
            Config = ConfigMgr.GetConfig <CharacterConfig>();

            // Loading log level from file
            if (!Log.InitLog(Config.LogLevel, "Character"))
            {
                ConsoleMgr.WaitAndExit(2000);
            }

            AccountMgr.AccountDB = DBManager.Start(Config.AccountDB.Total(), ConnectionType.DATABASE_MYSQL, "Accounts");
            if (AccountMgr.AccountDB == null)
            {
                ConsoleMgr.WaitAndExit(2000);
            }

            // Starting Remote Server
            Server = new RpcServer(Config.RpcClientStartingPort, 1);
            if (!Server.Start(Config.RpcIP, Config.RpcPort))
            {
                ConsoleMgr.WaitAndExit(2000);
            }

            // Starting Accounts Manager
            AcctMgr = Server.GetLocalObject <AccountMgr>();
            if (AcctMgr == null)
            {
                ConsoleMgr.WaitAndExit(2000);
            }

            AcctMgr.LoadRealms();

            // Listening Client
            if (!TCPManager.Listen <RiftServer>(Config.CharacterServerPort, "CharacterServer"))
            {
                ConsoleMgr.WaitAndExit(2000);
            }

            ConsoleMgr.Start();
        }
示例#16
0
        public async Task Start()
        {
            Util.SavePidToFile(_rpcConfig.PidFile);

            // Create Logger
            RpcUtils.CreateLogger(_rpcConfig.LogDirectory, _rpcConfig.LogName, _rpcConfig.LogTarget);

            // Create Rpc server
            var server = new RpcServer().Create(_rpcConfig.HostName, _rpcConfig.RpcPort);

            // Start Rpc server
            await server.Start();
        }
示例#17
0
        static void Main(string[] args)
        {
            RpcServerConfig configOne = new RpcServerConfig {
                ServerId = 1, Name = "one", IP = "127.0.0.1", Port = 8088, BufferSize = 1024, MaxFixedBufferPoolSize = 1024 * 4, MaxConnections = 8000
            };

            configOne.BinPath = AppDomain.CurrentDomain.BaseDirectory;
            RpcServer listener = new RpcServer(configOne, loger);

            listener.Start();
            Console.WriteLine("服务区启动成功");
            Console.ReadLine();
        }
示例#18
0
        static void Main(string[] args)
        {
            var containerBuilder = new ContainerBuilder();

            ContainerManager.UseAutofacContainer(containerBuilder)
            .RegisterType <IUser, User>(lifeStyle: LifeStyle.PerLifetimeScope)
            ;
            using (RpcServer rpcServer = new RpcServer(11025))
            {
                rpcServer.Start();
                Console.WriteLine("输入任意键退出");
                Console.ReadLine();
            }
        }
示例#19
0
文件: Program.cs 项目: Xenoage/RpcLib
        static async Task Main(string[] args)
        {
            Console.Write("Starting the chat server. Kill the process to stop it.");

            server = new RpcServer("http://localhost:7000/chat/", new List <Type> {
                typeof(ChatServerRpc)
            },
                                   new ChatAuth(), new RpcPeerSettings {
                DefaultOptions = new RpcOptions {
                    TimeoutMs = 1000
                },
                Backlog = new JsonFileRpcBacklog(new DirectoryInfo("RpcBacklog"))
            });
            await server.Start();
        }
示例#20
0
        static void Main(string[] args)
        {
            var rpcServer = new RpcServer("server01", "http://localhost:58355/");

            rpcServer.Connection.Received += (data) => Console.WriteLine("ECHO: " + data);
            rpcServer.OnRpc("add", (long a, long b) => a + b);
            rpcServer.OnRpc("getFile", (string name) => {
                return(System.IO.File.OpenRead(System.IO.Path.GetFileName(name)));
            });
            rpcServer.Start().Wait();
            rpcServer.Register().Wait();

            Console.WriteLine("Ready");
            Console.ReadLine();
            rpcServer.Unregister().Wait();
        }
示例#21
0
        public static async Task Main(string[] args)
        {
            // Parse args
            var argsOption = ParseArgs(args);

            Util.SavePidToFile(argsOption.PidFile);

            // Create Logger
            Util.CreateLogger(argsOption.LogDirectory, argsOption.LogName, argsOption.LogTarget);

            // Create Rpc server
            var server = new RpcServer().Create(argsOption.HostName, argsOption.RpcPort);

            // Start Rpc server
            await server.Start();
        }
示例#22
0
        static Task runServer(int limit)
        {
            var server = new RpcServer(new IPEndPoint(IPAddress.Loopback, port));

            server.OnException = x => Console.WriteLine("server: " + x.Message);
            return(server.Start((r, w) =>
            {
                r.OnAdd = (x, y) =>
                {
                    if (limit == Interlocked.Increment(ref serverCounter))
                    {
                        server.Stop().Wait();
                    }
                    return x + y;
                };
            }));
        }
    public static void Main(string[] args1)
    {
        var config = new RpcServerConfiguration();
        config.BindingEndPoint = new IPEndPoint(IPAddress.Loopback, 8089);
        config.PreferIPv4 = true;
        config.IsDebugMode = true;
 //UseFullMethodName is a property that if it is false allows you in the CLIENT to call the         methods only by it's name, check example further.
        config.UseFullMethodName = false;
        var defaultServiceTypeLocator = new DefaultServiceTypeLocator();
        //Methods is the class I created with all the methods to be called.
        defaultServiceTypeLocator.AddService(typeof(Methods));
        config.ServiceTypeLocatorProvider = conf => defaultServiceTypeLocator;
        using (var server = new RpcServer(config))
        {
            server.Start();
            Console.ReadKey();
        }
    }
示例#24
0
        static void Main(string[] args)
        {
            Log.Texte("", "---------------------------------------------------------------", ConsoleColor.DarkBlue);
            Log.Texte("", " _______ _________ _______ _________ _______  _______          ", ConsoleColor.Cyan);
            Log.Texte("", "(  ____ )\__   __/(  ____ \\__   __/(  ____ \(       )|\     /|", ConsoleColor.Cyan);
            Log.Texte("", "| (    )|   ) (   | (    \/   ) (   | (    \/| () () || )   ( |", ConsoleColor.Cyan);
            Log.Texte("", "| (____)|   | |   | (__       | |   | (__    | || || || |   | |", ConsoleColor.Cyan);
            Log.Texte("", "|     __)   | |   |  __)      | |   |  __)   | |(_)| || |   | |", ConsoleColor.Cyan);
            Log.Texte("", "| (\ (      | |   | (         | |   | (      | |   | || |   | |", ConsoleColor.Cyan);
            Log.Texte("", "| ) \ \_____) (___| )         | |   | (____/\| )   ( || (___) |", ConsoleColor.Cyan);
            Log.Texte("", "|/   \__/\_______/|/          )_(   (_______/|/     \|(_______)", ConsoleColor.Cyan);
            Log.Texte("", "www.Strawberry-Pr0jcts.com", ConsoleColor.DarkCyan);
            Log.Texte("", "---------------------------------------------------------------", ConsoleColor.DarkBlue);

            // Loading all configs files
            ConfigMgr.LoadConfigs();
            Config = ConfigMgr.GetConfig<CharacterConfig>();

            // Loading log level from file
            if (!Log.InitLog(Config.LogLevel,"Character"))
                ConsoleMgr.WaitAndExit(2000);

            AccountMgr.AccountDB = DBManager.Start(Config.AccountDB.Total(), ConnectionType.DATABASE_MYSQL, "Accounts");
            if (AccountMgr.AccountDB == null)
                ConsoleMgr.WaitAndExit(2000);

            // Starting Remote Server
            Server = new RpcServer(Config.RpcClientStartingPort, 1);
            if (!Server.Start(Config.RpcIP, Config.RpcPort))
                ConsoleMgr.WaitAndExit(2000);

            // Starting Accounts Manager
            AcctMgr = Server.GetLocalObject<AccountMgr>();
            if(AcctMgr == null)
                ConsoleMgr.WaitAndExit(2000);

            AcctMgr.LoadRealms();

            // Listening Client
            if (!TCPManager.Listen<RiftServer>(Config.CharacterServerPort, "CharacterServer"))
                ConsoleMgr.WaitAndExit(2000);

            ConsoleMgr.Start();
        }
示例#25
0
        static void Main(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(onError);

            Log.Texte("", "-------------------- Account Cacher -------------------", ConsoleColor.DarkRed);
            Log.Texte("", " █     █░ ▄▄▄       ██▀███  ▓█████  ███▄ ▄███▓ █    ██ ", ConsoleColor.Red);
            Log.Texte("", "▓█░ █ ░█░▒████▄    ▓██ ▒ ██▒▓█   ▀ ▓██▒▀█▀ ██▒ ██  ▓██▒", ConsoleColor.Red);
            Log.Texte("", "▒█░ █ ░█ ▒██  ▀█▄  ▓██ ░▄█ ▒▒███   ▓██    ▓██░▓██  ▒██░", ConsoleColor.Red);
            Log.Texte("", "░█░ █ ░█ ░██▄▄▄▄██ ▒██▀▀█▄  ▒▓█  ▄ ▒██    ▒██ ▓▓█  ░██░", ConsoleColor.Red);
            Log.Texte("", "░░██▒██▓  ▓█   ▓██▒░██▓ ▒██▒░▒████▒▒██▒   ░██▒▒▒█████▓ ", ConsoleColor.Red);
            Log.Texte("", "░ ▓░▒ ▒   ▒▒   ▓▒█░░ ▒▓ ░▒▓░░░ ▒░ ░░ ▒░   ░  ░░▒▓▒ ▒ ▒ ", ConsoleColor.Red);
            Log.Texte("", "  ▒ ░ ░    ▒   ▒▒ ░  ░▒ ░ ▒░ ░ ░  ░░  ░      ░░░▒░ ░ ░ ", ConsoleColor.Red);
            Log.Texte("", "  ░   ░    ░   ▒     ░░   ░    ░   ░      ░    ░░░ ░ ░ ", ConsoleColor.Red);
            Log.Texte("", "    ░          ░  ░   ░        ░  ░       ░      ░    ", ConsoleColor.Red);
            Log.Texte("", "-------------------http://WarEmu.com-------------------", ConsoleColor.DarkRed);

            // Loading all configs files
            ConfigMgr.LoadConfigs();
            Config = ConfigMgr.GetConfig <AccountConfigs>();

            // Loading log level from file
            if (!Log.InitLog(Config.LogLevel, "AccountCacher"))
            {
                ConsoleMgr.WaitAndExit(2000);
            }

            AccountMgr.Database = DBManager.Start(Config.AccountDB.Total(), ConnectionType.DATABASE_MYSQL, "Accounts");
            if (AccountMgr.Database == null)
            {
                ConsoleMgr.WaitAndExit(2000);
            }

            Server = new RpcServer(Config.RpcInfo.RpcClientStartingPort, 1);
            if (!Server.Start(Config.RpcInfo.RpcIp, Config.RpcInfo.RpcPort))
            {
                ConsoleMgr.WaitAndExit(2000);
            }

            AcctMgr = Server.GetLocalObject <AccountMgr>();
            AcctMgr.LoadRealms();

            ConsoleMgr.Start();
        }
示例#26
0
        static void Main(string[] args)
        {
            Log.Texte("", "-------------------------------",    ConsoleColor.DarkBlue);
            Log.Texte("", "          _____   _____ ",           ConsoleColor.Cyan);
            Log.Texte("", "    /\\   |  __ \\ / ____|",         ConsoleColor.Cyan);
            Log.Texte("", "   /  \\  | |__) | (___  ",          ConsoleColor.Cyan);
            Log.Texte("", "  / /\\ \\ |  ___/ \\___ \\ ",       ConsoleColor.Cyan);
            Log.Texte("", " / ____ \\| |     ____) |",          ConsoleColor.Cyan);
            Log.Texte("", "/_/    \\_\\_|    |_____/ Rift",     ConsoleColor.Cyan);
            Log.Texte("", "http://AllPrivateServer.com",        ConsoleColor.DarkCyan);
            Log.Texte("", "-------------------------------",    ConsoleColor.DarkBlue);

            // Loading all configs files
            ConfigMgr.LoadConfigs();
            Config = ConfigMgr.GetConfig<CharacterConfig>();

            // Loading log level from file
            if (!Log.InitLog(Config.LogLevel,"Character"))
                ConsoleMgr.WaitAndExit(2000);

            AccountMgr.AccountDB = DBManager.Start(Config.AccountDB.Total(), ConnectionType.DATABASE_MYSQL, "Accounts");
            if (AccountMgr.AccountDB == null)
                ConsoleMgr.WaitAndExit(2000);

            // Starting Remote Server
            Server = new RpcServer(Config.RpcClientStartingPort, 1);
            if (!Server.Start(Config.RpcIP, Config.RpcPort))
                ConsoleMgr.WaitAndExit(2000);

            // Starting Accounts Manager
            AcctMgr = Server.GetLocalObject<AccountMgr>();
            if(AcctMgr == null)
                ConsoleMgr.WaitAndExit(2000);

            AcctMgr.LoadRealms();

            // Listening Client
            if (!TCPManager.Listen<RiftServer>(Config.CharacterServerPort, "CharacterServer"))
                ConsoleMgr.WaitAndExit(2000);

            ConsoleMgr.Start();
        }
示例#27
0
        static void Main(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(onError);

            Log.Texte("", "-------------------------------", ConsoleColor.DarkBlue);
            Log.Texte("", "          _____   _____ ", ConsoleColor.Cyan);
            Log.Texte("", "    /\\   |  __ \\ / ____|", ConsoleColor.Cyan);
            Log.Texte("", "   /  \\  | |__) | (___  ", ConsoleColor.Cyan);
            Log.Texte("", "  / /\\ \\ |  ___/ \\___ \\ ", ConsoleColor.Cyan);
            Log.Texte("", " / ____ \\| |     ____) |", ConsoleColor.Cyan);
            Log.Texte("", "/_/    \\_\\_|    |_____/ Warhammer", ConsoleColor.Cyan);
            Log.Texte("", "http://AllPrivateServer.com", ConsoleColor.DarkCyan);
            Log.Texte("", "-------------------------------", ConsoleColor.DarkBlue);

            // Loading all configs files
            ConfigMgr.LoadConfigs();
            Config = ConfigMgr.GetConfig <AccountConfigs>();

            // Loading log level from file
            if (!Log.InitLog(Config.LogLevel, "AccountCacher"))
            {
                ConsoleMgr.WaitAndExit(2000);
            }

            AccountMgr.Database = DBManager.Start(Config.AccountDB.Total(), ConnectionType.DATABASE_MYSQL, "Accounts");
            if (AccountMgr.Database == null)
            {
                ConsoleMgr.WaitAndExit(2000);
            }

            Server = new RpcServer(Config.RpcInfo.RpcClientStartingPort, 1);
            if (!Server.Start(Config.RpcInfo.RpcIp, Config.RpcInfo.RpcPort))
            {
                ConsoleMgr.WaitAndExit(2000);
            }

            AcctMgr = Server.GetLocalObject <AccountMgr>();
            AcctMgr.LoadRealms();

            ConsoleMgr.Start();
        }
示例#28
0
        static void Main(string[] args)
        {
            RpcProcessor p = new RpcProcessor();

            p.UrlPrefix = "";
            p.Mount("/example", new RpcServerExample());


            //RPC via MQ
            RpcServer server = new RpcServer(p);

            server.MqServerAddress = "localhost:15555";

            //server.AuthEnabled = true;
            //server.ApiKey = "2ba912a8-4a8d-49d2-1a22-198fd285cb06";
            //server.SecretKey = "461277322-943d-4b2f-b9b6-3f860d746ffd";

            server.Mq = "MyRpc";

            server.Start();
        }
示例#29
0
        static void Main(string[] args)
        {
            //var server = new Server("127.0.0.1", 5000);
            //server.Start();
            //Console.WriteLine("按任意键关闭server...");
            //Console.ReadLine();
            //server.Stop();

            var server = new RpcServer("127.0.0.1", 5000);

            var simpleContract = new DataContractImpl();

            server.AddService <IDataContract>(simpleContract);

            server.Start();

            Console.WriteLine("按任意键关闭server...");
            Console.ReadLine();
            server.Stop();

            Console.Read();
        }
示例#30
0
        static void Main(string[] args)
        {
            Log.Texte("", "-------------------------------", ConsoleColor.DarkBlue);
            Log.Texte("", "          _____   _____ ", ConsoleColor.Cyan);
            Log.Texte("", "    /\\   |  __ \\ / ____|", ConsoleColor.Cyan);
            Log.Texte("", "   /  \\  | |__) | (___  ", ConsoleColor.Cyan);
            Log.Texte("", "  / /\\ \\ |  ___/ \\___ \\ ", ConsoleColor.Cyan);
            Log.Texte("", " / ____ \\| |     ____) |", ConsoleColor.Cyan);
            Log.Texte("", "/_/    \\_\\_|    |_____/ APB-Char", ConsoleColor.Cyan);
            Log.Texte("", "http://AllPrivateServer.com", ConsoleColor.DarkCyan);
            Log.Texte("", "-------------------------------", ConsoleColor.DarkBlue);

            Assembly.Load("Common");

            Log.Info("CharacterServer", "Starting...");

            ConfigMgr.LoadConfigs();
            Config = ConfigMgr.GetConfig <CharacterServerConfig>();

            if (!Log.InitLog(Config.LogLevel, "CharacterServer"))
            {
                ConsoleMgr.WaitAndExit(2000);
            }

            CharacterMgr.Database = DBManager.Start(Config.CharacterDatabase.Total(), ConnectionType.DATABASE_MYSQL, "CharDB");
            if (CharacterMgr.Database == null)
            {
                ConsoleMgr.WaitAndExit(2000);
            }

            Server = new RpcServer(Config.RpcInfo.RpcClientStartingPort, 0);
            if (!Server.Start(Config.RpcInfo.RpcIp, Config.RpcInfo.RpcPort))
            {
                ConsoleMgr.WaitAndExit(2000);
            }

            Log.Success("CharacterServer", "Server loaded.");
            ConsoleMgr.Start();
        }
示例#31
0
        static void Test1()
        {
            var sc = new RpcServer()
            {
                Port       = 1234,
                Log        = XTrace.Log,
                EncoderLog = XTrace.Log,

                NameSpace = "NewLife.Test",
            };

            var star = new StarClient("tcp://127.0.0.1:6666")
            {
                Code   = "test",
                Secret = "pass"
            };

            sc.Star = star;

            sc.Start();

            _Server = sc;
        }
示例#32
0
文件: Program.cs 项目: dzikun/WarEmu
        static void Main(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(onError);

            Log.Texte("", "-------------------- Account Cacher -------------------", ConsoleColor.DarkRed);
            Log.Texte("", " █     █░ ▄▄▄       ██▀███  ▓█████  ███▄ ▄███▓ █    ██ ", ConsoleColor.Red);
            Log.Texte("", "▓█░ █ ░█░▒████▄    ▓██ ▒ ██▒▓█   ▀ ▓██▒▀█▀ ██▒ ██  ▓██▒", ConsoleColor.Red);
            Log.Texte("", "▒█░ █ ░█ ▒██  ▀█▄  ▓██ ░▄█ ▒▒███   ▓██    ▓██░▓██  ▒██░", ConsoleColor.Red);
            Log.Texte("", "░█░ █ ░█ ░██▄▄▄▄██ ▒██▀▀█▄  ▒▓█  ▄ ▒██    ▒██ ▓▓█  ░██░", ConsoleColor.Red);
            Log.Texte("", "░░██▒██▓  ▓█   ▓██▒░██▓ ▒██▒░▒████▒▒██▒   ░██▒▒▒█████▓ ", ConsoleColor.Red);
            Log.Texte("", "░ ▓░▒ ▒   ▒▒   ▓▒█░░ ▒▓ ░▒▓░░░ ▒░ ░░ ▒░   ░  ░░▒▓▒ ▒ ▒ ", ConsoleColor.Red);
            Log.Texte("", "  ▒ ░ ░    ▒   ▒▒ ░  ░▒ ░ ▒░ ░ ░  ░░  ░      ░░░▒░ ░ ░ ", ConsoleColor.Red);
            Log.Texte("", "  ░   ░    ░   ▒     ░░   ░    ░   ░      ░    ░░░ ░ ░ ", ConsoleColor.Red);
            Log.Texte("", "    ░          ░  ░   ░        ░  ░       ░      ░    ", ConsoleColor.Red);
            Log.Texte("", "-------------------http://WarEmu.com-------------------", ConsoleColor.DarkRed);

            // Loading all configs files
            ConfigMgr.LoadConfigs();
            Config = ConfigMgr.GetConfig<AccountConfigs>();

            // Loading log level from file
            if (!Log.InitLog(Config.LogLevel, "AccountCacher"))
                ConsoleMgr.WaitAndExit(2000);

            AccountMgr.Database = DBManager.Start(Config.AccountDB.Total(), ConnectionType.DATABASE_MYSQL, "Accounts");
            if (AccountMgr.Database == null)
                ConsoleMgr.WaitAndExit(2000);

            Server = new RpcServer(Config.RpcInfo.RpcClientStartingPort, 1);
            if (!Server.Start(Config.RpcInfo.RpcIp, Config.RpcInfo.RpcPort))
                ConsoleMgr.WaitAndExit(2000);

            AcctMgr = Server.GetLocalObject<AccountMgr>();
            AcctMgr.LoadRealms();

            ConsoleMgr.Start();
        }
示例#33
0
        private static void StartRpcServer(CliArgs args)
        {
            // Create a factory used to instantiate all the service implementations
            // that are needed to initialize the server.
            Factory factory = new Factory("config/application.conf");

            // Build a gRPC server instance.
            ServerBuilder serverBuilder = ServerBuilder
                                          .ForPort(args.port)
                                          .ReportErrorDetails()
                                          .WithAccountService(factory.AccountService())
                                          .WithAccountLinkingService(factory.AccountLinkingService())
                                          .WithTransferService(factory.TransferService())
                                          .WithStorageService(factory.StorageService())
                                          .WithAccountManagementService(factory.AccountManagementService())
                                          .WithConsentManagementService(factory.ConsentManagementService())
                                          .WithNotificationService(factory.NotificationService());

            if (args.useSsl)
            {
                serverBuilder.WithTls(
                    "config/tls/cert.pem",
                    "config/tls/key.pem",
                    "config/tls/trusted-certs.pem");
            }

            RpcServer server = serverBuilder.Build();

            // You will need to Ctrl-C to exit.
            server.Start();
            logger.Info("Hit return to stop the server ");
            Console.ReadKey();
            logger.Info("Stopping the server....");
            server.Close();
            logger.Info("Server stopped");
        }
示例#34
0
        static void Main(string[] args)
        {
//			string baseUrl = "http://localhost:49826";
            string baseUrl   = "http://ldicocco.azurewebsites.net/";
            var    rpcServer = new RpcServer("server01", baseUrl);

            rpcServer.Connection.Received += (data) => Console.WriteLine("ECHO: " + data);
            rpcServer.OnRpc("getFileSystemEntries", (string root, string path) =>
            {
                if (!Roots.Instance.ContainsRoot(root) || path.Contains("../"))
                {
                    return(null);
                }

                var rootPath = Roots.Instance[root];
                var di       = new DirectoryInfo(rootPath + path);
                var dirs     = di.EnumerateFileSystemInfos().Select(i => new { i.Name, Path = i.FullName.Replace(rootPath, ""), IsDirectory = i.Attributes.HasFlag(FileAttributes.Directory) }).ToArray();
                return(dirs.OrderByDescending(i => i.IsDirectory).ThenBy(i => i.Name));
            });
            rpcServer.OnRpc("getFile", (string path, string root) =>
            {
                if (!Roots.Instance.ContainsRoot(root) || path.Contains("../"))
                {
                    return(null);
                }

                var rootPath = Roots.Instance[root];
                return(File.OpenRead(rootPath + path));
            });
            rpcServer.Start().Wait();
            rpcServer.Register().Wait();

            Console.WriteLine("Ready");
            Console.ReadLine();
            rpcServer.Unregister().Wait();
        }
示例#35
0
 public void StartRpc(IPAddress bindAddress, int port, Wallet wallet = null, string sslCert = null, string password = null, string[] trustedAuthorities = null)
 {
     rpcServer = new RpcServer(this, wallet);
     rpcServer.Start(bindAddress, port, sslCert, password, trustedAuthorities);
 }
示例#36
0
 public void StartRpc(IPAddress bindAddress, int port, Wallet wallet = null, string sslCert = null, string password = null,
                      string[] trustedAuthorities = null, Fixed8 maxGasInvoke = default(Fixed8))
 {
     RpcServer = new RpcServer(this, wallet, maxGasInvoke);
     RpcServer.Start(bindAddress, port, sslCert, password, trustedAuthorities);
 }
示例#37
0
 public void StartRpc(IPAddress bindAddress, int port, Wallet wallet = null, string sslCert = null, string password = null,
                      string[] trustedAuthorities = null, int maxConcurrentConnections      = 40)
 {
     RpcServer = new RpcServer(this, wallet);
     RpcServer.Start(bindAddress, port, sslCert, password, trustedAuthorities, maxConcurrentConnections);
 }
示例#38
0
        public void TestStart()
        {
            Action action = () => server.Start(IPAddress.Parse("127.0.0.1"), 8999);

            action.Should().NotThrow <Exception>();
        }