private void button5_Click(object sender, EventArgs e)
        {
            timer3.Enabled = false;
            deviceFromFile = null;
            if (mimicWs != null)
            {
                mimicWs.Stop();
            }
            mimicWs = null;
            savedDeviceTree.Nodes.Clear();
            mimicDeviceLog.Text = "";
            savedDeviceName.Text = "No Device Loaded";

            allSystemsOnline();
            if (status == true)
            {
                button1_Click(null, null);
            }
        }
        private void button3_Click(object sender, EventArgs e)
        {
            try
            {
                openFileDialog2.ShowDialog();

            }
            catch
            {

            }


            try
            {
                if (openFileDialog2.FileName != "")
                {
                    savedDeviceTree.Nodes.Clear();

                    Learn.device device = getDeviceFromFile(openFileDialog2.FileName);
                    deviceFromFile = device;

                    learnedUDN = device.UDN;

                    savedDeviceName.Text = device.deviceName;
                    webServerResponse.Text = device.deviceDescription;
                    foreach (string serviceType in device.serviceTypes)
                    {
                        upnpTypes.Clear();
                        upnpTypes.Add(serviceType);
                    }

                    TreeNode savedActions = savedDeviceTree.Nodes.Add("Actions");
                    TreeNode savedResources = savedDeviceTree.Nodes.Add("Resources");

                    foreach (string action in device.actions.Keys)
                    {
                        savedActions.Nodes.Add(action);
                    }

                    foreach (string resource in device.mimeTypes.Keys)
                    {
                        TreeNode rNode = savedResources.Nodes.Add("/resource/?localResourceID=" + resource);
                        rNode.ToolTipText = "/resource/?localResourceID=" + resource + " - " + device.mimeTypes[resource] + ", " + device.downloadedURLs[resource].Count() + "bytes";
                    }


                    if (mimicWs != null)
                    {
                        mimicWs.Stop();
                    }


                    if (!IsAdministrator())
                    {
                        string current_username = System.Security.Principal.WindowsIdentity.GetCurrent().Name;

                        AddAddress("http://*:" + webserverPort.Text + "/Resource/", current_username);
                        removeFromNetSh.Add("http://*:" + webserverPort.Text + "/Resource/");
                    }

                    mimicWs = new WebServer(ResourceSendResponse, "http://*:" + webserverPort.Text + "/Resource/");
                    mimicWs.device = device;
                    mimicWs.Run();


                    if (mimicWs.ErrorMessage != "")
                    {
                        MessageBox.Show(mimicWs.ErrorMessage);
                    }
                    else
                    {
                        hitCounter.Text = "Web Server Started";
                    }

                    timer3.Enabled = true;

                }
            }
            catch
            {
                MessageBox.Show("Error loading device");
            }
        }