示例#1
0
        static void Main(string[] args)
        {
            if (args.Length == 0)
            {
                Console.WriteLine("Please provide file name");
                return;
            }

            const string dbName   = @"events.db";
            var          dbFolder = AppDomain.CurrentDomain.BaseDirectory;

            var dbPath = Path.Combine(dbFolder, dbName);

            if (File.Exists(dbPath))
            {
                File.Delete(dbPath);
            }

            using (var eventLogger = new EventLogger(dbFolder, dbName))
            {
                var eventLoader = new EventLoader(
                    eventLogger,
                    new EventStreamProvider(),
                    new EventStreamTaskDurationProcessor(6));

                var filePath = Path.Join(AppDomain.CurrentDomain.BaseDirectory, args[0]);
                eventLoader.Load(filePath);

                Console.WriteLine("Finished importing log files. Total imported: {0}", eventLogger.TotalLogged);
            }
        }
示例#2
0
        public void Begin(CancellationToken masterCancellationToken)
        {
            if (masterCancellationToken == null || masterCancellationToken.IsCancellationRequested)
            {
                throw new ArgumentException("Invalid CancellationToken.");
            }

            _cancelToken = masterCancellationToken;

            Task.Factory.StartNew(ConnectionSweeper, TaskCreationOptions.LongRunning);
            //Task.Factory.StartNew(DayCycle, TaskCreationOptions.LongRunning);

            //Task.Factory.StartNew(CheckCreatureWalk, TaskCreationOptions.LongRunning);
            //Task.Factory.StartNew(CheckCreatureAutoAttack, TaskCreationOptions.LongRunning);

            Task.Factory.StartNew(NotificationsProcessor, TaskCreationOptions.LongRunning);
            //Task.Factory.StartNew(CombatProcessor, TaskCreationOptions.LongRunning);

            EventsCatalog = EventLoader.Load(ServerConfiguration.MoveUseFileName);

            _scheduler.OnEventFired += ProcessFiredEvent;

            // Leave this at the very end, when everything is ready...
            Status = WorldState.Open;
        }