internal FileInfo(PPError result, PPFileInfo ppFileInfo) { QueryResult = result; Size = ppFileInfo.size; Type = (FileType)ppFileInfo.type; SystemType = (FileSystemType)ppFileInfo.system_type; /* UTC "wall clock time" according to the browser */ UTCCreationTime = PepperSharpUtils.ConvertFromPepperTimestamp(ppFileInfo.creation_time); UTCLastAccessTime = PepperSharpUtils.ConvertFromPepperTimestamp(ppFileInfo.last_access_time); UTCLastModifiedTime = PepperSharpUtils.ConvertFromPepperTimestamp(ppFileInfo.last_modified_time); }
private async Task <FileInfo> QueryAsyncCore(MessageLoop messageLoop = null) { var tcs = new TaskCompletionSource <FileInfo>(); EventHandler <FileInfo> handler = (s, e) => { tcs.TrySetResult(e); }; try { HandleQuery += handler; if (MessageLoop == null && messageLoop == null) { Query(); } else { Action <PPError> action = new Action <PPError>((e) => { var fileInfo = new PPFileInfo(); var result = (PPError)PPBFileRef.Query(this, out fileInfo, new BlockUntilComplete() ); tcs.TrySetResult(new FileInfo(result, fileInfo)); } ); InvokeHelper(action, messageLoop); } return(await tcs.Task); } catch (Exception exc) { Console.WriteLine(exc.Message); tcs.SetException(exc); return(new FileInfo(PPError.Aborted, new PPFileInfo())); } finally { HandleQuery -= handler; } }
protected virtual void OnQuery(PPError result, PPFileInfo fileInfo) => HandleQuery?.Invoke(this, new FileInfo(result, fileInfo));
/** * Query() queries info about a file or directory. You must have access to * read this file or directory if it exists in the external filesystem. * * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file * reference. * @param[out] info A pointer to a <code>PP_FileInfo</code> which will be * populated with information about the file or directory. * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon * completion of Query(). * * @return An int32_t containing an error code from <code>pp_errors.h</code>. */ public static int Query(PPResource file_ref, out PPFileInfo info, PPCompletionCallback callback) { return(_Query(file_ref, out info, callback)); }
extern static int _Query(PPResource file_ref, out PPFileInfo info, PPCompletionCallback callback);