Пример #1
0
        /// <summary>
        /// Create an new Instance of the TCP-Listener on Port 5000
        /// </summary>
        internal Server()
        {
            try
            {
                AnrlDB.AnrlDataContext db = new AnrlDB.AnrlDataContext();
                if (!db.DatabaseExists())
                {
                    db.CreateDatabase();
                }

                CalculateTabels = new System.Timers.Timer(20000);
                CalculateTabels.Elapsed += new ElapsedEventHandler(CalculateTabels_Elapsed);
                CalculateTabels.Start();

                running = true;
                this.tcpListener = new TcpListener(IPAddress.Any, 5000);
                this.listenThread = new Thread(new ThreadStart(ListenForClients));
                this.listenThread.Start();
                db.Dispose();
            }
            catch (Exception ex)
            {
                Logger.Log("Exception in Server.Server" + ex.ToString(), 11);
            }
        }
Пример #2
0
 public GPSRequestProcessor()
 {
     AnrlDataContext db = new AnrlDataContext();
     if (!db.DatabaseExists())
     {
         db.CreateDatabase();
     }
     db.Dispose();
 }
Пример #3
0
        public RequestProcessor()
        {
            //Make sure DB is existent
            AnrlDataContext db = new AnrlDataContext();
            if (!db.DatabaseExists())
            {
                db.CreateDatabase();
            }
            db.Dispose();

            processorMap = new Dictionary<int, IProcessor>();
            processorMap.Add((int)EObjectType.Picture, new PictureProcessor());
            processorMap.Add((int)EObjectType.Penalty, new PenaltyProcessor());
            processorMap.Add((int)EObjectType.Map, new MapProcessor());
            processorMap.Add((int)EObjectType.Parcour, new ParcourProcessor());
            processorMap.Add((int)EObjectType.Pilot, new PilotProcessor());
            processorMap.Add((int)EObjectType.Tracker, new TrackerProcessor());
            processorMap.Add((int)EObjectType.Team, new TeamProcessor());
            processorMap.Add((int)EObjectType.GPSData, new GPSDataProcessor((TrackerProcessor)processorMap[(int)EObjectType.Tracker]));
            processorMap.Add((int)EObjectType.Competition, new CompetitionProcessor());
            processorMap.Add((int)EObjectType.CompetitionSet, new CompetitionSetProcesor());
        }