public void TestObjectGetRange() { var host = "localhost:8080"; var key = "KxDgvEKzgSBPPfuVfw67oPQBSjidEiqTHURKSDL1R7yGaGYAeYnr".LoadWif(); var cid = ContainerID.FromBase58String("Bun3sfMBpnjKc3Tx7SdwrMxyNi8ha8JT3dhuFGvYBRTz"); var oid = ObjectID.FromBase58String("vWt34r4ddnq61jcPec4rVaXHg7Y7GiEYFmcTB2Qwhtx"); var address = new Address(cid, oid); var client = new Client.Client(key, host); var source1 = new CancellationTokenSource(); source1.CancelAfter(TimeSpan.FromMinutes(1)); var session = client.CreateSession(source1.Token, ulong.MaxValue); source1.Cancel(); var source2 = new CancellationTokenSource(); source2.CancelAfter(TimeSpan.FromMinutes(1)); var o = client.GetObjectPayloadRangeData(source2.Token, new RangeDataParams { Address = address, Range = new Object.Range { Offset = 0, Length = 3 } }, new CallOptions { Ttl = 2, Session = session }).Result; Assert.AreEqual("hel", Encoding.ASCII.GetString(o)); }
public void TestObjectGetRange() { using var client = new Client.Client(key, host); using var source = new CancellationTokenSource(); source.CancelAfter(TimeSpan.FromMinutes(1)); var o = client.GetObjectPayloadRangeData(Address, new Object.Range { Offset = 0, Length = 100 }, false, new CallOptions { Ttl = 1 }, source.Token).Result; Console.WriteLine(o.Length); Console.WriteLine(o.ToHexString()); }