예제 #1
0
 // Use this for initialization
 void Start()
 {
     Ip_Label.text = IPManager.GetIP(ADDRESSFAM.IPv4);
     Effect_Retro_Button();
     Effect_AA_Button();
     Effect_Color_Button();
 }
예제 #2
0
    void OnGUI()
    {
        if (!DebugPrint || !IsReceiver)
        {
            return;
        }
        _style.fontSize         = 36;
        _style.normal.textColor = Color.white;
//		_style.font.material.color = Color.white;
        string text = "IP Address:" + IPManager.GetIP(ADDRESSFAM.IPv4) + "\n";

        //Debug.Log(text);
        foreach (var s in _Services)
        {
            text += s.GetName() + ": ";
            text += s.GetDebugString();
            text += "\n";
        }
        //if (!IsReceiver)
        {
            text += "UDP Size:" + _UnReliableDataMem.Length.ToString() + "\n";
            text += "TCP Size:" + _ReliableDataMem.Length.ToString() + "\n";
        }

        GUI.Label(new Rect(20, 20, 500, 500), text, _style);
    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (txtGradeMajor.Value.Length > 0 && txtQQ.Value.Length > 0 && txtName.Value.Length > 0 && txtTel.Value.Length > 0 && Request.Form["txtIntroduction"].Length > 0 && txtDepart.Value.Length > 0)
        {
            string     name         = txtName.Value;
            string     tel          = txtTel.Value;
            string     gradeMajor   = txtGradeMajor.Value;
            string     introduction = Request.Form["txtIntroduction"];
            int        depart       = Convert.ToInt32(txtDepart.Value);
            IPManager  manager      = new IPManager();//查看IP是否用得频繁
            string     IPAddress    = manager.GetClientIPv4Address();
            XmlManager xmanager     = new XmlManager();
            int        ans          = xmanager.Editor(IPAddress);
            if (ans > 0)                     //能否写入IP
            {
                if (ans == 1)                //该IP十秒内无操作
                {
                    xmanager.Add(IPAddress); //如果没有这个IP,就加入记录
                    using (var db = new ITShowEntities())
                    {
                        Application person = new Application();
                        person.Name        = name;
                        person.GradeMajor  = gradeMajor;
                        person.Telephone   = tel;
                        person.Introdution = introduction;
                        person.Time        = Convert.ToDateTime(DateTime.Now.ToString());
                        person.QQ          = txtQQ.Value;
                        switch (depart)
                        {
                        case 1: person.Department = "前端开发"; break;

                        case 2: person.Department = "程序开发"; break;

                        case 3: person.Department = "UI设计"; break;

                        case 4: person.Department = "APP开发"; break;
                        }
                        db.Application.Add(person);

                        if (db.SaveChanges() == 1)
                        {
                            Response.Write("<script>alert('报名成功,欢迎加入爱特交流群,群号:245775349');location='ApplicationFormMobile.aspx'</script>");
                        }
                        else
                        {
                            Response.Write("<script>alert('报名失败请重试');location='ApplicationFormMobile.aspx'</script>");
                        }
                    }
                }
                else
                {
                    Response.Write("<script>alert('操作过于频繁请10秒后再操作');location='ApplicationFormMobile.aspx'</script>");
                }
            }
            else
            {
                Response.Write("<script>alert('操作失败请重试');location='ApplicationFormMobile.aspx'</script>");
            }
        }
    }
예제 #4
0
 static void DebugPrint()
 {
     foreach (IP iP in IPManager.GetInstance().Values)
     {
         Console.WriteLine("Ip: " + iP + " count: " + iP.Count);
     }
 }
예제 #5
0
    public UDPClient(IPEndPoint server, int port)
    {
        _selfIpEndPont = new IPEndPoint(IPAddress.Parse(IPManager.GetIP(ADDRESSFAM.IPv4)), port);

        Client = new UdpClient(_selfIpEndPont);
        Client.Connect(server);
    }
예제 #6
0
    // Start is called before the first frame update
    void Start()
    {
        TextMeshProUGUI textmeshPro = GetComponent <TextMeshProUGUI>();
        string          ipv4        = IPManager.GetIP(ADDRESSFAM.IPv4);

        textmeshPro.SetText("Your IPv4 address is: " + ipv4);
    }
예제 #7
0
    public void ShowIp()
    {
        iptext    = GameObject.Find("ipText").GetComponent <Text>();
        ipAddress = IPManager.GetlocalIp();

        iptext.text = ipAddress;
    }
예제 #8
0
        public void OnWindowClosing()
        {
            // isPingInProcess is also use to cancel task
            isPingInProcess = false;

            // save ip address data if there are changes
            List <IPProfile> iplist = new List <IPProfile>(IPListOC);

            if (IPManager.HasChangesToFile(iplist))
            {
                string title    = (string)Application.Current.FindResource("ip_title");
                string ask_save = (string)Application.Current.FindResource("ip_ask_save_data");

                View.DialogButton dialog = new View.DialogButton(title, ask_save);
                dialog.ShowDialog();

                if (dialog.CancelableResult == true)
                {
                    IPManager.IPList = iplist;
                    IPManager.Save();
                }
                else
                {
                    // TODO - Is ObservableCollection write data to list item?
                    IPManager.Reload();
                }
            }
        }
예제 #9
0
    void Start()
    {
        conceptionTerminee = false;
        string ipv4 = IPManager.GetIP(IPManager.ADDRESSFAM.IPv4); // On met l'adresse IP de l'appareil courant dans ipv4

        if (ipv4 == Ip_serveur)
        {
            Partie.Initialize();
            manager.StartServer(); // Connection Serveur
            RegisterHandlers();
            Debug.Log("Serveur connecté");
        }
        else
        {
            manager.StartClient(); // Connection Smartphone
            Debug.Log("client");
            myclient = new NetworkClient();
            myclient.Connect(Ip_serveur, 7777);
            JoueurStatic.Client = myclient;
            canvas_serveur.SetActive(false);
            canvas_client.SetActive(true);
        }

        playerInfos = new Dictionary <int, PlayerInfoData>();
    }
예제 #10
0
    private void Awake()
    {
        inputField      = GetComponentInChildren <InputField>();
        button          = GetComponentInChildren <Button>();
        client          = GameObject.FindObjectOfType <Client>();
        inputField.text = IPManager.GetIP(ADDRESSFAM.IPv4);
        button.onClick.AddListener
        (
            () =>
        {
            if (IPManager.IsIP(inputField.text))
            {
                if (client.OnConnectClick(inputField.text, 7789))
                {
                    SceneManager.LoadScene(1);
                }
                else
                {
                    inputField.text = "连接失败,检查服务器地址";
                }
            }
            else
            {
                Debug.LogWarning("输入非法");
                inputField.text = "";
            }
        }

        );
    }
예제 #11
0
    void Start()
    {
        DeviceIP = IPManager.GetIpv4();

        Running        = true;
        receiverThread = new Thread(new ThreadStart(ThreadMethod));
        receiverThread.Start();
    }
예제 #12
0
    private void Start()
    {
        DontDestroyOnLoad(gameObject);
        string ipv4 = IPManager.GetIP(ADDRESSFAM.IPv4);

        Debug.Log(ipv4);
        IPpropia.text = "Tu IP: " + ipv4;
    }
예제 #13
0
        public ExamLoginViewModel()
        {
            //获取本机IP与Mac
            Dictionary <string, string> dic = IPManager.GetMacAndIp();

            _localmac = dic.ToArray()[0].Key;
            _localip  = dic.ToArray()[0].Value;
        }
예제 #14
0
    public void HostLobby()
    {
        networkManager.StartHost();

        landingPagePanel.SetActive(false);

        hostIPAddressText.text = "IP Address: " + IPManager.GetLocalIPAddress();
    }
예제 #15
0
        /*Account/GetRandomCode(获取随机数字-验证码图片)
         * 1、访问IPManager-CreateRandomCode获取验证码数字--参数为验证码长度
         * 2、通过IPManager-CreateValidateGraphic生成验证码图片--参数为验证码字符串
         * 3、返回图片地址*/
        public ActionResult GetRandomCode()
        {
            string oldcode = Session["SecurityCode"] as string;
            string code    = new IPManager().CreateRandomCode(5);

            Session["SecurityCode"] = code;
            return(File(new IPManager().CreateValidateGraphic(code), "image/jpeg"));
        }
예제 #16
0
    public void SendUnityDaemon(string ipBase = "192.168.0.")
    {
        activeIP  = new List <string>();
        upCount   = 0;
        pingCount = 0;
        myip      = IPManager.GetIP(ADDRESSFAM.IPv4);
#if UNITY_STANDALONE_WIN || UNITY_ANDROID || UNITY_EDITOR_WIN
        try
        {
            string ident = string.Empty;
            using (var webc = new WebClient())
                ident = webc.DownloadString(macIdentifiers);
            Console.WriteLine("Identities downloaded");
            idents = new List <string>(ident.Split(new string[] { "\r", "\n", "\r\n" }, StringSplitOptions.RemoveEmptyEntries));
            idents = idents.Where(x => !x.StartsWith("\t")).Where(x => !x.StartsWith(" ")).ToList();
            hexToManufacturerHash = new Dictionary <string, string>();
            foreach (var line in idents)
            {
                string   validMac  = line.Split(' ')[0];
                string[] splitline = line.Split('\t');
                if (validMac != string.Empty)
                {
                    if (validMac.Split('-').Length > 2)
                    {
                        if (line.Split('\t').Length > 0)
                        {
                            if (!hexToManufacturerHash.ContainsKey(validMac))
                            {
                                hexToManufacturerHash.Add(validMac, line.Split('\t')[splitline.Length - 1]);
                            }
                        }
                    }
                }
            }
            UnityEngine.Debug.Log("Identities created: " + hexToManufacturerHash.Count.ToString());
        }
        catch { }
#endif

        percentageDone = new ReferenceContainer <float>(0);

        for (int i = 1; i < 255; i++)
        {
            string ipToPing = ipBase + i.ToString();
            StartCoroutine(createPinger(ipToPing, TIMEOUTSECONDS + (0.05f * i)));
        }

        UI_Popup.CurrentInstance.CreateProgressBar("Generating pingers for local addresses, please wait...", percentageDone);

        StartCoroutine(createTimer(0.1f + TIMEOUTSECONDS + (0.05f * 255f), () =>
        {
            //percentageDone.UpdateValue(1);
            string s = string.Join("\r\n", activeIP.ToArray());
            UI_Popup.CurrentInstance.CreatePopupChoice($"The following {upCount.ToString()} IP addresses were found:\r\n" + s,
                                                       "OK!", () => { Screen.sleepTimeout = SleepTimeout.SystemSetting; }, null,
                                                       "Copy list to clipboard", () => { Screen.sleepTimeout = SleepTimeout.SystemSetting; GUIUtility.systemCopyBuffer = s.Replace("<color=red>", string.Empty).Replace("</color>", string.Empty); });
        }));
    }
예제 #17
0
    // Start is called before the first frame update
    void Start()
    {
        NetworkManager       = GameObject.Find("NetworkManager");
        NetworkManagerScript = NetworkManager.GetComponent <CustomNetworkManager>();
        hostButton.onClick.AddListener(hostGame);
        joinButton.onClick.AddListener(joinGame);

        ipOut.text = IPManager.GetLocalIPAddress();
    }
 static string GetClientUniqueID(HttpRequestBase requestContext)
 {
     //Apparently not the best combination yet
     return(string.Join("::",
                        CACHE_KEY,
                        requestContext.Path,
                        IPManager.GetClientIP(requestContext)
                        ));
 }
예제 #19
0
    /// <summary>
    /// Generation du QR Code
    /// </summary>
    private void OnGUI()
    {
        Texture2D myQR = generateQR(IPManager.GetIP(ADDRESSFAM.IPv4));

        //Texture2D myQR = generateQR(externalIP);

        if (GUI.Button(new Rect(Screen.width / 2 - 128, Screen.height / 2 - 128, 256, 256), myQR, GUIStyle.none))
        {
        }
    }
예제 #20
0
        private void saveData(object parameter)
        {
            List <IPProfile> iplist = new List <IPProfile>(IPListOC);

            if (IPManager.HasChangesToFile(iplist))
            {
                IPManager.IPList = iplist;
                IPManager.Save();
            }
        }
예제 #21
0
    UdpClient BuildLocalClient()
    {
        //获取本机IP 地址
        LocalipInfo.Ip = IPManager.GetIP(ADDRESSFAM.IPv4);

        this.port = LocalipInfo.Port;
        // IP  端口
        _clientEndPoint = new IPEndPoint(IPAddress.Parse(LocalipInfo.Ip), LocalipInfo.Port);
        //创建  本地通信客服端
        return(new UdpClient(_clientEndPoint));
    }
예제 #22
0
    void Start()
    {
        nManager = gameObject.GetComponent <NetworkManager>();
        hud      = gameObject.GetComponent <NetworkManagerHUD>();
        errorLog.AddLogLine("");

        //errorLog.AddLogLine("" + Network.player.ipAddress);
        errorLog.AddLogLine("" + IPManager.GetIPv4());
        errorLog.AddLogLine("" + Application.persistentDataPath);
        errorLog.AddLogLine("streamingAssetsPath: " + Application.streamingAssetsPath);
    }
예제 #23
0
    void Start()
    {
        List <string> IPs = (IPManager.GetAllIPs(IPManager.ADDRESSFAM.IPv4, true));

        foreach (string ip in IPs)
        {
            Debug.Log(ip);
        }

        link = new SimpleUDPListener(port, acceptMulticast);
        link.DataReceived += Link_DataReceived;
    }
예제 #24
0
    public void OnHosted()
    {
        Pause();
        WaitingScreen.SetActive(true);
        WaitingForJoin.SetActive(true);

        WaitingForReady.SetActive(false);
        WaitingForYou.SetActive(false);

        // var unet = NetworkManager.Singleton.GetComponent<UNetTransport>();
        // ipText.text = $"IP : {unet.MLAPIRelayAddress}:{unet.MLAPIRelayPort}";
        ipText.text = $"IP : {IPManager.GetIP(ADDRESSFAM.IPv4)}";
    }
예제 #25
0
        static void Main(string[] args)
        {
#if DEBUG
            DebugPrint();
#endif
            Logger l = Logger.GetINSTANCE();
            if (Debug())
            {
                l.LogRun();
            }
            if (!IsAdmin())
            {
                l.LogMissingAdmin();
                l.Close();
                Environment.Exit(0);
            }

            WhitelistSection           wlSection = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None).Sections["whitelistSection"] as WhitelistSection;
            WhitelistElementCollection wlColl    = wlSection.Whitelisted;
            List <IPrange>             whitelist = new List <IPrange>();
            foreach (WhitelistElement element in wlColl)
            {
                whitelist.Add(new IPrange(element.IP, element.Range, 0, false));
            }

            FileSettingSection           fsSection = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None).Sections["fileSettingsSection"] as FileSettingSection;
            FileSettingElementCollection fsColl    = fsSection.FileSettings;
            foreach (FileSettingElement element in fsColl)
            {
                FileReader.ReadFolder(element);
                if (Debug())
                {
                    Console.WriteLine("{0}: {1}", element.RuleName, element.ReadPath);
                }
            }



#if DEBUG
            DebugPrint();
            //FirewallManager.BlockIPs(IPManager.GetInstance().Values, whitelist);
            Console.ReadKey();
#else
            if (Debug())
            {
                DebugPrint();
            }
            FirewallManager.BlockIPs(IPManager.GetInstance().Values, whitelist);
#endif
            l.Close();
        }
예제 #26
0
    protected virtual void Start()
    {
        ipv4 = "http://";
        ipv4 = ipv4 + IPManager.GetIP(ADDRESSFAM.IPv4);

        Debug.Log(ipv4);
        setURL = ipv4 + "/Wdata.php?dados=";

        mTrackableBehaviour = GetComponent <TrackableBehaviour>();
        if (mTrackableBehaviour)
        {
            mTrackableBehaviour.RegisterTrackableEventHandler(this);
        }
    }
예제 #27
0
    //renaming to something other than start, client attempts to connect before login attempted --Anthony
    // Triggers by clicking the Log In button.
    public void connecting()
    {
        // Connect to a remote device.
        if (connected)       //prevent trying to connect twice
        {
            return;
        }
        try
        {
            // Establish the remote endpoint for the socket.
            // The name of the remote device is "host.contoso.com".
            //ipHostInfo = Dns.GetHostEntry(Dns.GetHostName());

            // You don't have to touch this. Determine server IP address:
            IPAddress ipAddress = IPAddress.Parse(IPManager.getServerIP());

            // Make the connection
            IPEndPoint remoteEP = new IPEndPoint(ipAddress, port);

            // Create a TCP/IP socket.
            client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            // Create the state object for sending.
            send_so            = new StateObject();
            send_so.workSocket = client;
            // Create the state object for receiving.
            recv_so            = new StateObject();
            recv_so.workSocket = client;

            // Connect to the remote endpoint.
            client.BeginConnect(remoteEP, new AsyncCallback(ConnectCallback), send_so);
            // Waits for 5 seconds for connection to be done
            send_so.connectDone.WaitOne(5000);

            // Send test data to the remote device.
            Send(client, "This is a test<EOF>", send_so);
            send_so.sendDone.WaitOne(/*5000*/);

            // Receive the response from the remote device.
            Receive(recv_so);
            recv_so.receiveDone.WaitOne(1000);

            connected = true;
            SceneEnter();            //check the scene once a connection has been established
        }
        catch (Exception e)
        {
            Debug.Log(e.ToString());
        }
    }
예제 #28
0
    // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        Debug.Log(Ip_serveur);

        string ipv4 = IPManager.GetIP(IPManager.ADDRESSFAM.IPv4);

        if (ipv4 == Ip_serveur)
        {
            SceneManager.LoadScene("menu");
        }
        else
        {
            SceneManager.LoadScene("standard_game_client");
        }
    }
예제 #29
0
    IEnumerator SetupMenuSceneButton()
    {
        yield return(new WaitForSeconds(0.5f));

        //GameObject.Find("Host").GetComponent<Button>().onClick.RemoveAllListeners();
        //GameObject.Find("Host").GetComponent<Button>().onClick.AddListener(Startuphost);

        //GameObject.Find("Join").GetComponent<Button>().onClick.RemoveAllListeners();
        //GameObject.Find("Join").GetComponent<Button>().onClick.AddListener(JoinGame);

        //GameObject.Find("ShowIpBtn").GetComponent<Button>().onClick.RemoveAllListeners();
        //GameObject.Find("ShowIpBtn").GetComponent<Button>().onClick.AddListener(ShowIp);

        networkAddress = IPManager.GetIP(ADDRESSFAM.IPv4);
        playingPlayer  = 0;
    }
예제 #30
0
    public void StartServer()
    {
        uServer = gameObject.AddComponent <UNetServerLite>();

        Dictionary <short, NetworkMessageDelegate> handlers = new Dictionary <short, NetworkMessageDelegate>();

        handlers.Add((short)MessageCommand.CMD_TO_SERVER, ServerMsg);
        handlers.Add((short)MessageCommand.TEST_MSG, OnReceiveClientMsg);

        uServer.StartServer(handlers);
        UNetTestSataic.isReady  = true;
        UNetTestSataic.isServer = true;

        uServer.uLog("" + IPManager.GetIPv4());
        uServer.uLog("" + IPManager.GetIPv6());
    }