Пример #1
0
 public void Execute(string[] args, User user)
 {
     if (args.Length != 2)
     {
         Output.WriteError("Invalid arguments!");
         return;
     }
     FSManager.AddFile(new Structs.FilePerms {
         ar = true, aw = false, ax = false, flag = Structs.FileFlag.None, or = true, os = false, ow = true, ox = false, owner = user.userID
     }, path: FSManager.DirListToString(FSManager.currentDirectory), name: args[1], data: "", id: user.userID);
 }
Пример #2
0
        static void Main(string[] args)
        {
            User.Initialize();
            CommandManager.SetupCommands();

            FSManager.AddFile(new FilePerms
            {
                ar    = false,
                aw    = false,
                ax    = false,
                flag  = FileFlag.Directory,
                or    = true,
                os    = false,
                ow    = true,
                ox    = false,
                owner = 0
            }, path: $"~/", name: "folder.sys", data: "0");
            FSManager.AddFolder("test", User.FetchUserID(0));
            FSManager.AddFolder("home", User.FetchUserID(0));
            User.AddUser(new User()
            {
                perms =
                {
                    isDisplayedAsAdmin      = true,
                    canChangeSystemSettings = true,
                    canDoSudo      = true,
                    isRoot         = false,
                    canSeeAllUsers = true
                },
                executeUserID = User.GetNextUserID(),
                groups        =
                {
                    (int)SystemGroups.Admin,
                    (int)SystemGroups.NormalUser,
                },
                name   = "admin",
                userID = User.GetNextUserID(),
                passwd = "admin"
            });
            //FSManager.ChangeDirectory("test");
            //FSManager.GetChildren();
            while (true)
            {
                Output.Write($"SHELL({User.FetchUserID(User.currentUser).name}) {FSManager.PresentWorkingDirectory()} $ ");
                string cmd = Console.ReadLine();
                CommandManager.FetchCommand(cmd, User.FetchUserID(User.currentUser));
            }
        }