Exemple #1
0
        public void addLocalServerToolStripMenuItem_Click(object sender, EventArgs e)
        {
            AddLocalServerDialog d = new AddLocalServerDialog();

            d.Opacity = GetOpacity("AddLocalOpacity");

            bool editmode = (sender != null && sender is object[]);

            d.EditMode = editmode;
            CustomEntry en = null;

            if (editmode)
            {
                string request = (string)((object[])sender)[0];
                Socket socket  = (Socket)((object[])sender)[1];

                en = (CustomEntry)ServerList.GetServerById(Utility.ParseUrl(request, "id"));

                if (en == null)
                {
                    MessageBox.Show("The requested server entry was invalid or did not exist");
                    Core.Server.SendToBrowser(String.Format(Utility.META_REDIRECT, "http://localhost.:1980/favorites.html"), ref socket);
                    //Utility.OpenUrl("http://localhost.:1980/favorites");
                    return;
                }

                d.ServerName        = en.Name;
                d.ServerDescription = en.Description;
                d.ServerAddress     = en.HostAddress;
                d.ServerPort        = en.Port.ToString();
                d.ServerUpdateURL   = en.UpdateUrl;
                d.ServerPatchURL    = en.PatchUrl;
                d.RemoveEnc         = en.RemoveEncryption;

                Core.Server.SendToBrowser(String.Format(Utility.META_REDIRECT, "http://localhost.:1980/favorites.html"), ref socket);
            }

            if (d.ShowDialog() == DialogResult.OK)
            {
                if (!editmode)
                {
                    en = new CustomEntry();
                }

                en.Name             = d.ServerName;
                en.Description      = d.ServerDescription;
                en.HostAddress      = d.ServerAddress;
                en.Port             = int.Parse(d.ServerPort);
                en.UpdateUrl        = d.ServerUpdateURL;
                en.PatchUrl         = d.ServerPatchURL;
                en.RemoveEncryption = d.RemoveEnc;

                Favorites.AddCustom(en);
                Utility.OpenUrl("http://localhost.:1980/favorites.html");
            }
        }
Exemple #2
0
        public void addLocalServerToolStripMenuItem_Click(object sender, EventArgs e)
        {
            AddLocalServerDialog d = new AddLocalServerDialog();
            d.Opacity = GetOpacity("AddLocalOpacity");

            bool editmode = (sender != null && sender is object[]);
            d.EditMode = editmode;
            CustomEntry en = null;

            if (editmode)
            {
                string request = (string)((object[])sender)[0];
                Socket socket = (Socket)((object[])sender)[1];

                en = (CustomEntry)ServerList.GetServerById(Utility.ParseUrl(request, "id"));

                if (en == null)
                {
                    MessageBox.Show("The requested server entry was invalid or did not exist");
                    Core.Server.SendToBrowser(String.Format(Utility.META_REDIRECT, "http://localhost.:1980/favorites.html"), ref socket);
                    //Utility.OpenUrl("http://localhost.:1980/favorites");
                    return;
                }

                d.ServerName = en.Name;
                d.ServerDescription = en.Description;
                d.ServerAddress = en.HostAddress;
                d.ServerPort = en.Port.ToString();
                d.ServerUpdateURL = en.UpdateUrl;
                d.ServerPatchURL = en.PatchUrl;
                d.RemoveEnc = en.RemoveEncryption;

                Core.Server.SendToBrowser(String.Format(Utility.META_REDIRECT, "http://localhost.:1980/favorites.html"), ref socket);
            }

            if (d.ShowDialog() == DialogResult.OK)
            {
                if (!editmode)
                    en = new CustomEntry();

                en.Name = d.ServerName;
                en.Description = d.ServerDescription;
                en.HostAddress = d.ServerAddress;
                en.Port = int.Parse(d.ServerPort);
                en.UpdateUrl = d.ServerUpdateURL;
                en.PatchUrl = d.ServerPatchURL;
                en.RemoveEncryption = d.RemoveEnc;

                Favorites.AddCustom(en);
                Utility.OpenUrl("http://localhost.:1980/favorites.html");
            }
        }