Пример #1
0
        /// <summary>
        /// Saves profiles to the default profile library file
        /// </summary>
        public static void saveProfiles()
        {
            FileStream fsProfiles = File.Create("profilelibrary");

            IPV4Settings.writeLibrary(fsProfiles, dicProfiles);
            fsProfiles.Close();
        }
Пример #2
0
        private void btnSaveIPV4Profile_Click(object sender, EventArgs e)
        {
            ProfileNaming formProfileName = new ProfileNaming();

            formProfileName.ShowDialog();

            if (formProfileName.result == "PROFILE CREATION CANCELED")
            {
                return;
            }

            IPV4Settings ipv4settingNew = new IPV4Settings(
                rbtnDHCP.Checked ? null : tbxIPAddr.Text,
                rbtnDHCP.Checked ? null : tbxSubnetMask.Text,
                rbtnAutoDNS.Checked ? null : tbxDNS1.Text,
                rbtnAutoDNS.Checked ? null : tbxDNS2.Text,
                tbxDefaultGateway.Text,
                formProfileName.result,
                rbtnDHCP.Checked,
                rbtnAutoDNS.Checked
                );

            Program.dicProfiles.Add(formProfileName.result, ipv4settingNew);

            Program.saveProfiles();

            cbxProfiles.Items.Clear();
            cbxProfiles.Items.AddRange(Program.dicProfiles.Keys.ToArray());
            cbxProfiles.Items.Add("");
        }
Пример #3
0
 /// <summary>
 /// Loads profiles from the default profile library file
 /// </summary>
 public static void loadProfiles()
 {
     if (File.Exists("profilelibrary"))
     {
         FileStream fsProfiles = File.OpenRead("profilelibrary");
         dicProfiles = IPV4Settings.readLibrary(fsProfiles);
         fsProfiles.Close();
     }
     else
     {
         dicProfiles = new Dictionary <string, IPV4Settings>();
         dicProfiles.Add("Dynamic", new IPV4Settings(null, null, null, null, null, "Dynamic", true, true));
         FileStream fsProfiles = File.Create("profilelibrary");
         IPV4Settings.writeLibrary(fsProfiles, dicProfiles);
         fsProfiles.Close();
     }
 }