public IObservable<String> OutputStorageObjectsAsCustomJsonStream(IObservable<StorageObject> input, StorageSession session, String param, IDictionary<String, String> args) { IDisposable _ = session.SuppressDispose(); return input .Select(o => JObject.FromObject(TriDQL.ParseLambda<StorageObject, Object>(args["code"]).Compile()(o)) .ToString(args.Contains("oneline", "true") ? Formatting.None : Formatting.Indented) + "\r\n" ) .Catch((Exception ex) => Observable.Return(ex.ToString())) .Finally(_.Dispose); }
public IObservable<StorageObject> Download(IObservable<Activity> input, StorageSession session, String param, IDictionary<String, String> args) { IDisposable _ = session.SuppressDispose(); return input .Do(a => a.Act("Body", ((HttpWebResponse) WebRequest.Create(a.GetValue<String>()).GetResponse()).If( r => (Int32) r.StatusCode < 300, r => new Byte[r.ContentLength].Apply(b => r.GetResponseStream().Dispose(s => s.Read(b, 0, b.Length))), r => new Byte[0] ))) .Finally(_.Dispose); }