public void Execute(object[] parameters) { RequestClass requestMethod = new RequestClass(); string response = requestMethod.CreateFolder(parameters[1].ToString()); JObject obj = JObject.Parse(response); bool b = (bool)obj["ok"]; if (b) { //Console.WriteLine(string.Format("Folder named {0} was created successfully"), folderName); Console.WriteLine("folder was created successfully"); } else { Console.WriteLine(string.Format("An occured the error while creating named {0}"), parameters[1].ToString()); //parametre gelecek } }
public IList <Profiles> profiles() { List <Profiles> profile = new List <Profiles>(); RequestClass req = new RequestClass(); string data = req.GetProfiles(); JObject obj = JObject.Parse(data); JToken tok = obj["Profiles"]; for (int i = 0; i < tok.Count(); i++) { profile.Add(new Profiles { Id = (int)tok[i]["Id"], Name = (string)tok[i]["Name"] }); } return(profile); }
public IList <Dir> Folders() { List <Dir> folders = new List <Dir>(); RequestClass requestMethod = new RequestClass(); string data = requestMethod.GetIndex(); JObject jObject = JObject.Parse(data); JToken jDir = jObject["Folders"]; for (int i = 0; i < jDir.Count(); i++) { string name = (string)jDir[i]["Name"]; string createDate = (string)jDir[i]["CreateDate"]; string parentFolder = (string)jDir[i]["ParentFolder"]; Dir dir = new Dir { Name = name, CreateDate = createDate, ParentFolder = parentFolder }; folders.Add(dir); } return(folders); }
public void Execute(object[] parameters) { if (parameters.Length < 2) { Profiles profiles = new Profiles(); foreach (var item in profiles.profiles()) { Console.Write(item.Id + "\t"); Console.Write(item.Name + "\t"); Console.WriteLine(); } } else { RequestClass req = new RequestClass(); string result = req.CreateFile(int.Parse(parameters[1].ToString()), parameters[2].ToString()); JObject obj = JObject.Parse(result); bool b = (bool)obj["ok"]; if (b) { Console.WriteLine("file was uploaded successfully"); } } }
public void Execute(object[] parameters) { RequestClass request = new RequestClass(); request.Login(parameters[1].ToString(), parameters[2].ToString()); }
public void Execute(object[] parameters) { RequestClass request = new RequestClass(); request.ChangeDirectory(parameters[1].ToString()); }