private void ListStores(object sender, EventCmdArgs args) { string printout = "List of Stores:\n"; for (int i = 0; i < FileStores.Count; i++) printout += i + ". " + FileStores[i].Name + "\n"; args.ConsoleCaller.Print(printout); }
private void PollList(object sender, EventCmdArgs args) { if (args.Arguments.Length == 1) PollList(FileStores[Convert.ToInt32(args.Arguments[0])]); else CmdConsole.Print("Usage: poll_list [store]"); }
private void AddStore(object sender, EventCmdArgs args) { if (args.Arguments.Length == 2) { Guid storeID = AddStore(ID, args.Arguments[0]); FileStores.Add(new FileStore(storeID, args.Arguments[0], args.Arguments[1])); } else CmdConsole.Print("Usage: add_store [name] [physical_path]"); }
private void ListStoreEntries(object sender, EventCmdArgs args) { if (args.Arguments.Length == 1) { StringBuilder builder = new StringBuilder(); foreach (FileEntry entry in FileStores[Convert.ToInt32(args.Arguments[0])].EntryTree.Entries) builder.AppendLine(entry.ToString()); CmdConsole.Print(builder.ToString()); } else CmdConsole.Print("Usage: list_store_entries [store]"); }
private void Register(object sender, EventCmdArgs args) { if (args.Arguments.Length == 3) { Host = "http://" + args.Arguments[0] + "/"; Name = args.Arguments[2]; Register(args.Arguments[1], Name); } else { args.ConsoleCaller.Print("Usage: register [host] [access_token] [name]"); } }
private void Exec(object sender, EventCmdArgs args) { if (args.Arguments.Length == 1) Execute(args.Arguments[0]); else Print("Usage: exec [file_path]"); }
protected virtual void LoadState(object sender, EventCmdArgs args) { LoadState(); }
protected virtual void SaveState(object sender, EventCmdArgs args) { SaveState(); }
private void Validate(object sender, EventCmdArgs args) { Validate(); }
static void Quit(object sender, EventCmdArgs args) { Running = false; }
//Console Commands //list all registered nodes private void ListNodes(object sender, EventCmdArgs args) { string printout = "List of Nodes:\n"; for (int i = 0; i < nodeList.Count; i++) printout += i + ". " + nodeList[i].ToString() + "\n"; args.ConsoleCaller.Print(printout); }
//disallow node access to file private void RevokeEntry(object sender, EventCmdArgs args) { if (args.Arguments.Length == 2) { int id = Convert.ToInt32(args.Arguments[0]); RevokeEntry(storeList[id], args.Arguments[1]); } else { CmdConsole.Print("Usage: revoke_entry [store] [virtual_path]"); } }
//allow node access to file private void PermitEntry(object sender, EventCmdArgs args) { if (args.Arguments.Length == 2) { int id = Convert.ToInt32(args.Arguments[0]); if (id < 0 || id >= storeList.Count) { CmdConsole.Print(VerboseTag.Warning, "Node ID doesn't exist", true); return; } PermitEntry(storeList[id], args.Arguments[1]); } else { CmdConsole.Print("Usage: permit_entry [store] [virtual_path]"); } }
//list store file entries private void ListStoreEntries(object sender, EventCmdArgs args) { if (args.Arguments.Length == 1) { int id = Convert.ToInt32(args.Arguments[0]); string printout = "File Entries:\n"; foreach (FileEntry file in storeList[id].EntryTree.Entries) printout += file.ToString() + "\n"; args.ConsoleCaller.Print(printout); } else { CmdConsole.Print("Usage: list_store_entries [id]"); } }
//list all file entries on console private void ListEntries(object sender, EventCmdArgs args) { string printout = "File Entries:\n"; foreach (FileEntry file in Entries.Entries) printout += file.ToString() + "\n"; args.ConsoleCaller.Print(printout); }