本文整理汇总了C#中System.Stream类的典型用法代码示例。如果您正苦于以下问题:C# Stream类的具体用法?C# Stream怎么用?C# Stream使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Stream类属于System命名空间,在下文中一共展示了Stream类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Different_names_generate_different_hashes
public void Different_names_generate_different_hashes()
{
var a = new Stream("abc");
var b = new Stream("xyz");
Assert.NotEqual(a, b);
}
示例2: StreamListItem
public StreamListItem(Stream audioStream)
{
// Set Stream
stream = audioStream;
// Create components
InitializeComponent();
}
示例3: When_provisioning_along_with_custom_properties
public async void When_provisioning_along_with_custom_properties()
{
var properties = new Dictionary<string, EntityProperty>
{
{"Created", new EntityProperty(DateTimeOffset.Now)},
{"Active", new EntityProperty(true)}
};
var stream = await Stream.ProvisionAsync(partition, StreamProperties.From(properties));
var entity = partition.RetrieveStreamEntity();
var expectedStream = new Stream
(
partition,
entity.ETag, 0,
StreamProperties.From(properties)
);
stream.ShouldEqual(expectedStream.ToExpectedObject());
var expectedEntity = new
{
RowKey = Api.StreamRowKey,
Properties = StreamProperties.From(properties),
Version = 0
};
entity.ShouldMatch(expectedEntity.ToExpectedObject());
}
示例4: RateTransposer
short prev; // 1音前のデータを一時的に保存しておく。
#endregion
#region 初期化
/// <summary>
/// 初期化。
/// </summary>
/// <param name="stream">内部ストリーム</param>
/// <param name="rate">変換レート</param>
public RateTransposer(Stream stream, double rate)
{
this.stream = stream;
this.rate = rate;
this.inputBuffer = null;
this.prev = 0;
}
示例5: Reify
public Output Reify(
Cell<IMaybe<Size>> size,
Stream<MouseEvent> sMouse, Stream<KeyEvent> sKey,
Cell<long> focus, Supply idSupply)
{
return this.reify(size, sMouse, sKey, focus, idSupply);
}
示例6: Run
public override void Run()
{
// This is a sample worker implementation. Replace with your logic.
Trace.WriteLine("Shadow.UShadow.Cloud.Worker entry point called", "Information");
// Connect to Twitter.
//
Stream.ProcessTweetDelegate produceTweetDelegate = new Stream.ProcessTweetDelegate(processTweet);
// Creating the stream and specifying the delegate
Stream myStream = new Stream(produceTweetDelegate);
Token token = new Token()
{
AccessToken = "14910567-1AnQzrOuwPFsPd9HrcXrCPBmW7Cwf7doxXqd5vdgi",
AccessTokenSecret = "hHzkPdejgaJkt9VKxW7JGDC0AnJ5GzvlRjhNaHzYzW4",
ConsumerKey = "WFYdWcCCTZk4ASituGqhqQ",
ConsumerSecret = "DfOmNZOrhN31vuEDpm10lxkSSB1MfjVA4Y9oPzSK0gc"
};
myStream.StreamUrl = "https://userstream.twitter.com/1.1/user.json?with=user&track=!Shadow";
// Starting the stream by specifying credentials thanks to the Token
myStream.StartStream(token);
while (true)
{
Thread.Sleep(10000);
Trace.WriteLine("Working", "Information");
}
}
示例7: ReadByte
public static byte ReadByte(Stream s)
{
int v = s.ReadByte();
if (v == -1)
throw new Exception("IOException: EOF");
return (byte)v;
}
示例8: Same_name_generates_equal_streams
public void Same_name_generates_equal_streams()
{
var a = new Stream("123");
var b = new Stream("123");
Assert.Equal(a, b);
}
示例9: InternalReadByte
public static int InternalReadByte(Stream s)
{
int v = s.ReadByte();
if (v == -1)
throw new Exception("IOException: EOF");
return v;
}
示例10: Names_must_be_case_insensitive
public void Names_must_be_case_insensitive()
{
var a = new Stream("foobar");
var b = new Stream("FooBAR");
Assert.Equal(a, b);
}
示例11: NavigateToStream
internal void NavigateToStream(Stream streamObject, StreamDeskDatabase db)
{
if (streamObject.StreamEmbed == "url_browser") {
webBrowser1.ScrollBarsEnabled = true;
toolStrip1.Visible = true;
} else {
webBrowser1.ScrollBarsEnabled = false;
toolStrip1.Visible = false;
}
viewToolStripMenuItem.Visible = true;
ActiveStreamObject = streamObject;
ActiveDatabase = db;
if (streamObject.ChatEmbed != "none" || streamObject.ChatEmbed != null)
chatToolStripMenuItem.Visible = true;
else
chatToolStripMenuItem.Visible = false;
Text = streamObject.Name + " > " + streamObject.ProviderObject.Name;
if (streamObject.StreamEmbed == "url_browser" || streamObject.StreamEmbed == "url_custom")
webBrowser1.Navigate(streamObject.GetStreamEmbedData("URL"));
else {
ClientSize = new Size(streamObject.Size.Width, streamObject.Size.Height);
webBrowser1.DocumentText = db.GetStream(streamObject);
}
}
示例12: OnStreamCreated
public void OnStreamCreated(PublisherKit publisher, Stream stream)
{
mStreams.Add(stream);
if (mSubscriber == null) {
SubscribeToStream(stream);
}
}
示例13: Conference
public Conference(string json_str)
{
dynamic json = JObject.Parse(json_str);
var conference = json["conference"];
cid = (int)conference["cid"];
string desc = (string)conference["desc"];
this.desc = Encoding.GetEncoding("gbk").GetString(Convert.FromBase64String(desc));
mode = (string)conference["mode"];
uptime = (double)conference["uptime"];
Streams = new List<Stream>();
foreach (var stream in conference["streams"]) {
Stream s = new Stream();
s.streamid = stream["streamid"];
string d = stream["desc"];
if (d == "audio(iLBC)")
s.desc = d;
else {
byte[] raw = Convert.FromBase64String(d);
s.desc = Encoding.GetEncoding("gbk").GetString(raw);
}
s.stat = new Stream.Stat();
s.stat.bytes_recv = stream["stat"]["bytes_recv"];
s.stat.bytes_sent = stream["stat"]["bytes_sent"];
s.stat.jitter = stream["stat"]["jitter"];
s.stat.packet_lost_recv = stream["stat"]["packet_lost_recv"];
s.stat.packet_lost_sent = stream["stat"]["packet_lost_sent"];
s.stat.packet_recv = stream["stat"]["packet_recv"];
s.stat.packet_sent = stream["stat"]["packet_sent"];
Streams.Add(s);
}
// TODO:
Sources = new List<Source>();
Sinks = new List<Sink>();
foreach (var sink in conference["sinks"]) {
Sink s = new Sink();
s.sinkid = sink["sinkid"];
string d = sink["desc"];
if (d == "audio(iLBC)")
s.desc = d;
else {
byte[] raw = Convert.FromBase64String(d);
s.desc = Encoding.GetEncoding("gbk").GetString(raw);
}
d = sink["who"];
byte[] who_raw = Convert.FromBase64String(d);
s.who = Encoding.GetEncoding("gbk").GetString(who_raw);
s.stat = new Sink.Stat();
s.stat.jitter = sink["stat"]["jitter"];
s.stat.packets_lost = sink["stat"]["packets_lost"];
s.stat.packets = sink["stat"]["packets"];
s.stat.sent = sink["stat"]["sent"];
Sinks.Add(s);
}
}
示例14: doSerialize
protected override void doSerialize(Stream stream)
{
centerOfMass.serialize(stream);
stream.write(mass);
torque.serialize(stream);
momentumOfInertia.serialize(stream);
angularMomentum.serialize(stream);
}
示例15: doDeserialize
protected override void doDeserialize(Stream stream)
{
centerOfMass.deserialize(stream);
mass = stream.readDouble();
torque.deserialize(stream);
momentumOfInertia.deserialize(stream);
angularMomentum.deserialize(stream);
}