Ejemplo 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());
            }
        }
Ejemplo n.º 2
0
        public Systemdata()
        {
            try
            {
                monster_data = new Dictionary <int, List <Monster> >();
                item_data2   = new Dictionary <int, List <Item2> >();

                map_data  = new Dictionary <int, string>();
                system_db = new System_DB();
                map_data  = system_db.SendMap();

                // 파티 퀘스트 맵 아이디 저장
                party_quest_map_id = new Dictionary <int, int[]>();
                party_quest_map_id.Add(1, new int[] { 51, 1015 });
                party_quest_map_id.Add(2, new int[] { 113, 1143 });
                party_quest_map_id.Add(3, new int[] { 404, 1152 });
            }
            catch (Exception e)
            {
                mainForm.write_log(e.ToString());
            }
        }
Ejemplo n.º 3
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);
        }