Beispiel #1
0
        public update()
        {
            this.run_log.Enqueue("升级模块初始化");


            rsa UserRsa = new rsa();

            //不存在就创建
            if (!File.Exists("Private.xml") || !File.Exists("Public.xml"))
            {
                UserRsa.RSAKey("Private.xml", "Public.xml");
                this.uid = UserRsa.sha1(UserRsa.readFile("Public.xml"));
            }
            else
            {
                this.uid = UserRsa.sha1(UserRsa.readFile("Public.xml"));
            }
        }
        public UdpListener()
        {
            local_ip = get_local_ip();

            //不存在就创建
            if (!File.Exists("Private.xml") || !File.Exists("Public.xml"))
            {
                UserRsa.RSAKey("Private.xml", "Public.xml");
                this.id = UserRsa.sha1(UserRsa.readFile("Public.xml"));
            }
            else
            {
                this.id = UserRsa.sha1(UserRsa.readFile("Public.xml"));
            }

            if (!Directory.Exists("node"))
            {
                Directory.CreateDirectory("node");
            }
        }
Beispiel #3
0
        public update()
        {
            this.run_log.Enqueue("升级模块初始化");


            rsa UserRsa = new rsa();

            //不存在就创建
            if (!File.Exists("Private.xml") || !File.Exists("Public.xml"))
            {
                UserRsa.RSAKey("Private.xml", "Public.xml");
                this.uid = UserRsa.sha1(UserRsa.readFile("Public.xml"));
            }
            else
            {
                this.uid = UserRsa.sha1(UserRsa.readFile("Public.xml"));
            }

            if (File.Exists(Application.StartupPath + @"\config.ini"))
            {
                this.config = new INI(Application.StartupPath + @"\config.ini");
            }
        }
Beispiel #4
0
        public UdpListener()
        {
            //获取Host Name
            var name = Dns.GetHostName();

            //从当前Host Name解析IP地址,筛选IPv4地址是本机的内网IP地址。
            local_ip = Dns.GetHostEntry(name).AddressList.Where(i => i.AddressFamily == AddressFamily.InterNetwork).FirstOrDefault();

            //不存在就创建
            if (!File.Exists("Private.xml") || !File.Exists("Public.xml"))
            {
                UserRsa.RSAKey("Private.xml", "Public.xml");
                this.id = UserRsa.sha1(UserRsa.readFile("Public.xml"));
            }
            else
            {
                this.id = UserRsa.sha1(UserRsa.readFile("Public.xml"));
            }

            if (!Directory.Exists("node"))
            {
                Directory.CreateDirectory("node");
            }
        }