Esempio n. 1
0
        public static void c_Passwd(string username)
        {
            Char separator = ' ';

            string[] cmdargs = username.Split(separator);

            if (cmdargs.Length == 2)
            {
                username = cmdargs[1];
            }

            Text.Display("passwd:newpass");
            string newpassword = Console.ReadLine();

            Text.Display("passwd:retype");
            string retypepass = Console.ReadLine();

            if (newpassword == retypepass)
            {
                System.Users.Users User = new System.Users.Users();

                User.ChangePassword(username, newpassword);

                Text.Display("passwd:updated");
            }
            else
            {
                return;
            }
        }
Esempio n. 2
0
        public static void c_Settings(string settings)
        {
            Char separator = ' ';

            string[] cmdargs = settings.Split(separator);

            if (cmdargs.Length == 2) //No arg
            {
                if (cmdargs[1].Equals("setcomputername"))
                {
                    //method computername
                    Info.AskComputerName();
                }

                else if (cmdargs[1].Equals("setlang"))
                {
                    L.Text.Display("availablelanguage");
                }

                else if (cmdargs[1].Equals("remuser"))
                {
                    L.Text.Display("remuser");
                }

                else if (cmdargs[1].Equals("adduser"))
                {
                    L.Text.Display("adduser");
                }

                else if (cmdargs[1].Equals("passuser"))
                {
                    L.Text.Display("_passuser");
                }
            }
            else if (cmdargs.Length == 3)  //One arg
            {
                if (cmdargs[1].Equals("remuser"))
                {
                    System.Users.Users users = new System.Users.Users();

                    users.Remove(cmdargs[2]);
                }

                else if (cmdargs[1].Equals("setlang"))
                {
                    Utils.Settings config = new Utils.Settings(@"0:\System\settings.conf");

                    if ((cmdargs[2].Equals("en_US")) || cmdargs[2].Equals("en-US"))
                    {
                        Kernel.langSelected = "en_US";
                        L.Keyboard.Init();
                        config.EditValue("language", "en_US");
                        config.PushValues();
                    }
                    else if ((cmdargs[2].Equals("fr_FR")) || cmdargs[2].Equals("fr-FR"))
                    {
                        Kernel.langSelected = "fr_FR";
                        L.Keyboard.Init();
                        config.EditValue("language", "fr_FR");
                        config.PushValues();
                    }
                    else if ((cmdargs[2].Equals("nl_NL")) || cmdargs[2].Equals("nl-NL"))
                    {
                        Kernel.langSelected = "nl_NL";
                        L.Keyboard.Init();
                        config.EditValue("language", "nl_NL");
                        config.PushValues();
                    }
                    else
                    {
                        L.Text.Display("unknownlanguage");
                        L.Text.Display("availablelanguage");
                    }
                }

                else if (cmdargs[1].Equals("adduser"))
                {
                    L.Text.Display("adduser");
                }

                else if (cmdargs[1].Equals("passuser"))
                {
                    L.Text.Display("_passuser");
                }
            }
            else if (cmdargs.Length == 4) //Two args
            {
                if (cmdargs[1].Equals("adduser"))
                {
                    System.Users.Users users = new System.Users.Users();

                    users.Create(cmdargs[2], cmdargs[3]);
                }

                else if (cmdargs[1].Equals("passuser"))
                {
                    System.Users.Users users = new System.Users.Users();

                    users.ChangePassword(cmdargs[2], cmdargs[3]);
                }

                else if (cmdargs[1].Equals("setlang"))
                {
                    L.Text.Display("availablelanguage");
                }

                else if (cmdargs[1].Equals("remuser"))
                {
                    L.Text.Display("remuser");
                }
            }

            //else if (cmdargs[1].Equals("textcolor"))
            //{
            //    bool save = c_Console.TextColor.c_TextColor(cmdargs[2]);
            //    if (save)
            //    {
            //        config.LoadValues();
            //        config.EditValue("foregroundcolor", cmdargs[2]);
            //        config.PushValues();
            //    }
            //}
            //else if (cmdargs[1].Equals("backgroundcolor"))
            //{
            //    bool save = c_Console.BackGroundColor.c_BackGroundColor(cmdargs[2]);
            //    if (save)
            //    {
            //        config.LoadValues();
            //        config.EditValue("backgroundcolor", cmdargs[2]);
            //        config.PushValues();
            //    }
            //}

            else
            {
                Console.ForegroundColor = ConsoleColor.DarkRed;
                L.Text.Display("UnknownCommand");
                Console.ForegroundColor = ConsoleColor.White;
            }
        }
Esempio n. 3
0
        public static void c_Settings(string settings)
        {
            Char separator = ' ';

            string[] cmdargs = settings.Split(separator);

            if (cmdargs.Length == 2) //No arg
            {
                if (cmdargs[1].Equals("setcomputername"))
                {
                    //method computername
                    Info.AskComputerName();
                }

                else if (cmdargs[1].Equals("setlang"))
                {
                    L.Text.Display("availablelanguage");
                }

                else if (cmdargs[1].Equals("consolemode"))
                {
                    L.Text.Display("consolemode");
                }

                else if (cmdargs[1].Equals("remuser"))
                {
                    L.Text.Display("remuser");
                }

                else if (cmdargs[1].Equals("adduser"))
                {
                    L.Text.Display("adduser");
                }

                else if (cmdargs[1].Equals("passuser"))
                {
                    L.Text.Display("_passuser");
                }
            }
            else if (cmdargs.Length == 3)  //One arg
            {
                if (cmdargs[1].Equals("remuser"))
                {
                    System.Users.Users users = new System.Users.Users();

                    users.Remove(cmdargs[2]);
                }

                else if (cmdargs[1].Equals("setlang"))
                {
                    if ((cmdargs[2].Equals("en_US")) || cmdargs[2].Equals("en-US"))
                    {
                        Kernel.langSelected = "en_US";
                        L.Keyboard.Init();
                        System.Utils.Settings.LoadValues();
                        System.Utils.Settings.EditValue("language", "en_US");
                        System.Utils.Settings.PushValues();
                    }
                    else if ((cmdargs[2].Equals("fr_FR")) || cmdargs[2].Equals("fr-FR"))
                    {
                        Kernel.langSelected = "fr_FR";
                        L.Keyboard.Init();
                        System.Utils.Settings.LoadValues();
                        System.Utils.Settings.EditValue("language", "fr_FR");
                        System.Utils.Settings.PushValues();
                    }
                    else if ((cmdargs[2].Equals("nl_NL")) || cmdargs[2].Equals("nl-NL"))
                    {
                        Kernel.langSelected = "nl_NL";
                        L.Keyboard.Init();
                        System.Utils.Settings.LoadValues();
                        System.Utils.Settings.EditValue("language", "nl_NL");
                        System.Utils.Settings.PushValues();
                    }
                    else
                    {
                        L.Text.Display("unknownlanguage");
                        L.Text.Display("availablelanguage");
                    }
                }

                else if (cmdargs[1].Equals("consolemode"))
                {
                    if ((cmdargs[2].Equals("textmode")))
                    {
                        Kernel.AConsole.DisableGraphicMode();
                        Kernel.Consolemode = "VGATextmode";
                        System.Utils.Settings.LoadValues();
                        System.Utils.Settings.EditValue("consolemode", "VGATextmode");
                        System.Utils.Settings.PushValues();
                    }
                    else if ((cmdargs[2].Equals("graphicmode")))
                    {
                        switch (System.Video.GetVideo())
                        {
                        case "SVGAII":
                            Kernel.AConsole.Clear();
                            Kernel.AConsole    = new System.Shell.SVGAII.VMWareSVGAConsole();
                            Kernel.Consolemode = "SVGAII";
                            System.Utils.Settings.LoadValues();
                            System.Utils.Settings.EditValue("consolemode", "SVGAII");
                            System.Utils.Settings.PushValues();
                            break;

                        case "VBE":
                            Kernel.AConsole.Clear();
                            Kernel.AConsole    = new System.Shell.VBE.VBEConsole();
                            Kernel.Consolemode = "VBE";
                            System.Utils.Settings.LoadValues();
                            System.Utils.Settings.EditValue("consolemode", "VBE");
                            System.Utils.Settings.PushValues();
                            break;

                        default:
                            L.Text.Display("nographicmode");
                            break;
                        }
                    }
                    else
                    {
                        L.Text.Display("unknownmode");
                        L.Text.Display("consolemode");
                    }
                }

                else if (cmdargs[1].Equals("adduser"))
                {
                    L.Text.Display("adduser");
                }

                else if (cmdargs[1].Equals("passuser"))
                {
                    L.Text.Display("_passuser");
                }
            }
            else if (cmdargs.Length == 4) //Two args
            {
                if (cmdargs[1].Equals("adduser"))
                {
                    System.Users.Users users = new System.Users.Users();

                    users.Create(cmdargs[2], cmdargs[3]);
                }

                else if (cmdargs[1].Equals("passuser"))
                {
                    System.Users.Users users = new System.Users.Users();

                    users.ChangePassword(cmdargs[2], cmdargs[3]);
                }

                else if (cmdargs[1].Equals("setlang"))
                {
                    L.Text.Display("availablelanguage");
                }

                else if (cmdargs[1].Equals("consolemode"))
                {
                    L.Text.Display("consolemode");
                }

                else if (cmdargs[1].Equals("remuser"))
                {
                    L.Text.Display("remuser");
                }
            }

            //else if (cmdargs[1].Equals("textcolor"))
            //{
            //    bool save = c_Console.TextColor.c_TextColor(cmdargs[2]);
            //    if (save)
            //    {
            //        System.Utils.Settings.LoadValues();
            //        System.Utils.Settings.EditValue("foregroundcolor", cmdargs[2]);
            //        System.Utils.Settings.PushValues();
            //    }
            //}
            //else if (cmdargs[1].Equals("backgroundcolor"))
            //{
            //    bool save = c_Console.BackGroundColor.c_BackGroundColor(cmdargs[2]);
            //    if (save)
            //    {
            //        System.Utils.Settings.LoadValues();
            //        System.Utils.Settings.EditValue("backgroundcolor", cmdargs[2]);
            //        System.Utils.Settings.PushValues();
            //    }
            //}

            else
            {
                Console.ForegroundColor = ConsoleColor.DarkRed;
                L.Text.Display("UnknownCommand");
                Console.ForegroundColor = ConsoleColor.White;
            }
        }