示例#1
0
        public IAsyncOperation <StorageResult> fileInfo(string parameters)
        {
            return(AsyncInfo.Run((token) =>
                                 Task.Run <StorageResult>(() =>
            {
                try
                {
                    // deserialize the parameters passed in as an array of strings
                    string[] paramStrings = JsonConvert.DeserializeObject <string[]>(parameters);

                    //get the file info
                    var fileInfo = JSONStore.fileInfo();
                    fileInfo.Wait();
                    return new StorageResult(Status.OK, fileInfo.Result);
                }
                catch (JSONStoreException jsonException)
                {
                    //JSONStoreLoggerException(exception);

                    // catch a JSONStore specific exception and return the error code
                    return new StorageResult(Status.ERROR, jsonException.errorCode);
                }
                catch (Exception)
                {
                    return new StorageResult(Status.ERROR, JSONStoreConstants.JSON_STORE_PERSISTENT_STORE_FAILURE);
                }
            }, token)));
        }