Exemplo n.º 1
0
        public static void MigrateWOSBIni()
        {
            Data.W.Add("Default", new Dictionary <string, string>());
            Data.W["Default"]["Mo1"]      = "";
            Data.W["Default"]["Mo2"]      = "";
            Data.W["Default"]["Mo3"]      = "";
            Data.W["Default"]["Mo4"]      = "";
            Data.W["Default"]["Tu1"]      = "";
            Data.W["Default"]["Tu2"]      = "";
            Data.W["Default"]["Tu3"]      = "";
            Data.W["Default"]["Tu4"]      = "";
            Data.W["Default"]["We1"]      = "";
            Data.W["Default"]["We2"]      = "";
            Data.W["Default"]["We3"]      = "";
            Data.W["Default"]["We4"]      = "";
            Data.W["Default"]["Th1"]      = "";
            Data.W["Default"]["Th2"]      = "";
            Data.W["Default"]["Th3"]      = "";
            Data.W["Default"]["Th4"]      = "";
            Data.W["Default"]["Fr1"]      = "";
            Data.W["Default"]["Fr2"]      = "";
            Data.W["Default"]["Fr3"]      = "";
            Data.W["Default"]["Fr4"]      = "";
            Data.W["Default"]["Sa1"]      = "";
            Data.W["Default"]["Sa2"]      = "";
            Data.W["Default"]["Sa3"]      = "";
            Data.W["Default"]["Sa4"]      = "";
            Data.W["Default"]["Su1"]      = "";
            Data.W["Default"]["Su2"]      = "";
            Data.W["Default"]["Su3"]      = "";
            Data.W["Default"]["Su4"]      = "";
            Data.W["Default"]["File"]     = "";
            Data.W["Default"]["Params"]   = "";
            Data.W["Default"]["AwFile"]   = "";
            Data.W["Default"]["AwParams"] = "";
            Data.W["Default"]["Extra"]    = "";
            Data.curProfile = "Default";

            Ini.ReadWOSB();
            Xml.WriteWOSB();
            System.IO.File.Delete(Ini.WOSBPath);
        }
Exemplo n.º 2
0
        private void buttonNext_Click(object sender, RoutedEventArgs e)
        {
            if (update)
            {
                Close();
            }

            switch (curscreen)
            {
            case 2:
                Data.S["Autostart"] = (bool)checkAutostart.IsChecked;
                break;

            case 3:
                //Data.S["Ask"] = (bool)checkAsk.IsChecked;
                Data.S["Force"]             = (bool)checkForce.IsChecked;
                Data.S["StayAfterShutdown"] = (bool)checkStayAfterShutdown.IsChecked;
                Data.S["SysIcon"]           = (bool)checkSysicon.IsChecked;
                break;

            case 4:
                Data.S["Jumplist"] = (bool)checkJumplist.IsChecked;
                Data.S["Overlay"]  = (bool)checkOverlay.IsChecked;
                //Data.S["Glass"] = (bool)checkGlass.IsChecked;

                if ((bool)checkPinTaskbar.IsChecked)
                {
                    new Thread(Win7.PinToTaskbar).Start();
                }
                break;

            case 5:
                Data.S["RemoteClient"] = (bool)checkRemoteClient.IsChecked;
                Data.S["RemoteServer"] = (bool)checkRemoteServer.IsChecked;
                if (!(bool)checkRemoteServer.IsChecked)
                {
                    curscreen++;
                }
                break;

            case 6:
                if (!Int32.TryParse(textRemotePort.Text, out Data.RemotePort) | (Data.RemotePort < 1024 | Data.RemotePort > 65535))
                {
                    MessageBox.Show(Data.L["RemotePortMissing"], "Shutdown7", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                    return;
                }

                if (textRemotePassword.Password.Length == 0)
                {
                    MessageBox.Show(Data.L["RemotePasswordMissing"], "Shutdown7", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                    return;
                }

                Data.RemotePassword = Remote.md5(textRemotePassword.Password);
                break;

            case 7:
                Data.S["WOSB"] = (bool)checkWOSB.IsChecked;
                if (!(bool)checkWOSB.IsChecked)
                {
                    curscreen++;
                }
                else
                {
                    Data.W.Add("Default", new Dictionary <string, string>());
                    Data.curProfile = "Default";
                }
                break;

            case 8:
                Data.W["Default"]["Mo1"]      = textWOSBTime1.Text;
                Data.W["Default"]["Mo2"]      = textWOSBTime2.Text;
                Data.W["Default"]["Th1"]      = textWOSBTime3.Text;
                Data.W["Default"]["Th2"]      = textWOSBTime4.Text;
                Data.W["Default"]["We1"]      = textWOSBTime5.Text;
                Data.W["Default"]["We2"]      = textWOSBTime6.Text;
                Data.W["Default"]["Th1"]      = textWOSBTime7.Text;
                Data.W["Default"]["Th2"]      = textWOSBTime8.Text;
                Data.W["Default"]["Fr1"]      = textWOSBTime9.Text;
                Data.W["Default"]["Fr2"]      = textWOSBTime10.Text;
                Data.W["Default"]["Sa1"]      = textWOSBTime11.Text;
                Data.W["Default"]["Sa2"]      = textWOSBTime12.Text;
                Data.W["Default"]["Su1"]      = textWOSBTime13.Text;
                Data.W["Default"]["Su2"]      = textWOSBTime14.Text;
                Data.W["Default"]["File"]     = "";
                Data.W["Default"]["Params"]   = "";
                Data.W["Default"]["AwFile"]   = "";
                Data.W["Default"]["AwParams"] = "";
                Data.W["Default"]["Extra"]    = "";
                break;

            case 9:
                Data.S["SendFeedback"] = (bool)checkSendFeedback.IsChecked;
                break;

            default:
                break;
            }

            if (curscreen == Titles.Length - 1)
            {
                Data.RemoteServers = new string[] { "127.0.0.1" };

                Data.RemoteMacs = new string[] { };
                foreach (NetworkInterface CurMac in NetworkInterface.GetAllNetworkInterfaces())
                {
                    if (CurMac.OperationalStatus == OperationalStatus.Up)
                    {
                        if (CurMac.GetPhysicalAddress().ToString().Length > 0)
                        {
                            Array.Resize(ref Data.RemoteMacs, Data.RemoteMacs.Length + 1);
                            Data.RemoteMacs[Data.RemoteMacs.Length - 1] = CurMac.GetPhysicalAddress().ToString();
                        }
                    }
                }

                Xml.Write();
                if ((bool)checkWOSB.IsChecked)
                {
                    Xml.WriteWOSB();
                }

                Close();
            }
            else
            {
                curscreen++;
                ChangeScreen(curscreen);
            }
        }