Esempio n. 1
0
        static DiabloInterfaceServer CreatePipeServer(GameService gameService, SettingsService settingsService)
        {
            var logger = LogServiceLocator.Get(typeof(Program));

            logger.Info("Initializing pipe server.");

            var pipeServer = new DiabloInterfaceServer(settingsService.CurrentSettings.PipeName);

            var dataReader = gameService.DataReader;

            pipeServer.AddRequestHandler(@"version", () => new VersionRequestHandler(Assembly.GetEntryAssembly()));
            pipeServer.AddRequestHandler(@"items", () => new AllItemsRequestHandler(dataReader));
            pipeServer.AddRequestHandler(@"items/(\w+)", () => new ItemRequestHandler(dataReader));
            pipeServer.AddRequestHandler(@"characters/(current|active)", () => new CharacterRequestHandler(dataReader));
            pipeServer.AddRequestHandler(@"quests/(\d+)", () => new QuestRequestHandler(dataReader));

            return(pipeServer);
        }
Esempio n. 2
0
        private void CreateServer(string pipeName)
        {
            Logger.Info($"Creating Server: {pipeName}");
            var s = new DiabloInterfaceServer(pipeName);

            s.AddRequestHandler(@"version", () => new VersionRequestHandler(Assembly.GetEntryAssembly()));
            s.AddRequestHandler(@"game", () => new GameRequestHandler(di.game.DataReader));
            s.AddRequestHandler(@"items", () => new AllItemsRequestHandler(di.game.DataReader));
            s.AddRequestHandler(@"items/(\w+)", () => new ItemRequestHandler(di.game.DataReader));
            s.AddRequestHandler(@"characters/(current|active)", () => new CharacterRequestHandler(di.game.DataReader));
            s.AddRequestHandler(@"quests/completed", () => new CompletedQuestsRequestHandler(di.game.DataReader));
            s.AddRequestHandler(@"quests/(\d+)", () => new QuestRequestHandler(di.game.DataReader));
            s.Start();
            Servers.Add(pipeName, s);

            ApplyChanges();
        }
Esempio n. 3
0
        private void CreateServer(string pipeName)
        {
            Logger.Info($"Creating Server: {pipeName}");
            var pipeServer = new DiabloInterfaceServer(pipeName);
            var dataReader = gameService.DataReader;

            pipeServer.AddRequestHandler(@"version", () => new VersionRequestHandler(Assembly.GetEntryAssembly()));
            pipeServer.AddRequestHandler(@"game", () => new GameRequestHandler(dataReader));
            pipeServer.AddRequestHandler(@"items", () => new AllItemsRequestHandler(dataReader));
            pipeServer.AddRequestHandler(@"items/(\w+)", () => new ItemRequestHandler(dataReader));
            pipeServer.AddRequestHandler(@"characters/(current|active)", () => new CharacterRequestHandler(dataReader));
            pipeServer.AddRequestHandler(@"quests/completed", () => new CompletedQuestsRequestHandler(dataReader));
            pipeServer.AddRequestHandler(@"quests/(\d+)", () => new QuestRequestHandler(dataReader));
            pipeServer.Start();
            Servers.Add(pipeName, pipeServer);

            StatusChanged?.Invoke(this, new ServerStatusEventArgs(ServerStatuses));
        }