Esempio n. 1
0
        public MainForm()
        {
            sd                 = new Systemdata();
            system_db          = sd.system_db; // new System_DB();
            sd.mainForm        = this;
            system_db.mainform = this;

            InitializeComponent();
            radioButton_1.Select(); // 처음에 공지로 미리 선택됨

            // 타이머 생성 및 시작
            System.Windows.Forms.Timer timer2 = new System.Windows.Forms.Timer();
            timer2.Interval = 1000; // 몹 리젠 시간
            timer2.Tick    += new EventHandler(timer_tick);
            timer2.Start();

            // 서버 시작할 때 몹 데이터 정리
            write_log("------------------------------");
            write_log("서버 시작");
            write_log("몬스터 데이터 삭제");


            try
            {
                string   dir      = "./";
                FileInfo fileInfo = new FileInfo(dir + "version.txt");
                if (!fileInfo.Exists)
                {
                    using (StreamWriter verFile = new StreamWriter(@dir + "version.txt", true))
                    {
                        verFile.WriteLine(version);
                    }
                }
                using (StreamReader verFile = new StreamReader(@dir + "version.txt", true))
                {
                    version = verFile.ReadLine();
                    Console.WriteLine(version);
                }
                write_log("현재 버전 : " + version);
            }
            catch (Exception e)
            {
                write_log(e.ToString());
            }
        }
Esempio n. 2
0
        public void startClient(TcpClient clientSocket)
        {
            sd        = mainform.sd;
            system_db = mainform.system_db;
            // Get Packet List
            plist = sd.getAllpacketList();

            // Get UserCode Randomly
            Random random  = new Random();
            int    randval = random.Next(0, 9999999);

            UserCode = randval.ToString();

            // Create Client Socket & Thread
            client = clientSocket;
            thread = new Thread(NetListener);
            thread.IsBackground = true;
            thread.Start();

            timer2          = new System.Timers.Timer();
            timer2.Interval = 1000;
            timer2.Elapsed += new System.Timers.ElapsedEventHandler(timer_tick);
        }