private async Task <WsItemsReaderEngine> GetItemsOrItem(WsItemPath path, bool onlyOne, bool useCreatedFileResolver) { if (path == null) { throw new ArgumentNullException(nameof(path)); } CheckConnected(); string fileSearch = path is WsFilePath ? path.Name : string.Empty; WsItemsReaderEngine readerEngine = await PostFormDataWithLoginRetry(async() => { FormUrlEncodedContent formContent = CreateFormContent(new[] { new KeyValuePair <string, string>("path", path.Folder.FullPath), new KeyValuePair <string, string>("private", path.Folder.IsPrivate ? "1" : "0"), //new KeyValuePair<string, string>("sort_by", "name"), //new KeyValuePair<string, string>("sort_order", "asc"), //new KeyValuePair<string, string>("sort_order", "asc"), new KeyValuePair <string, string>("limit", onlyOne ? "1" : "99999999"), //new KeyValuePair<string, string>("offset", "0") new KeyValuePair <string, string>("search", fileSearch), }); HttpResponseMessage response = await _httpClient.PostFormData(API_FILES_URI, formContent); return(await WsItemsReaderEngine.Create(this, response, path.Folder, useCreatedFileResolver)); }); CheckResultStatus(readerEngine); return(readerEngine); }
//private static readonly object _syncRoot = new object(); private static void Log(string action, WsItemPath path) { System.Diagnostics.Trace.TraceInformation($"CreatedFileResolver - {action}: {path}"); //lock (_syncRoot) //{ // System.IO.File.AppendAllText(@"c:\temp\trace.txt", $"{DateTime.Now.ToLongTimeString()} - {action}: {path}\r\n"); //} }