本文整理汇总了C#中StreamInfo类的典型用法代码示例。如果您正苦于以下问题:C# StreamInfo类的具体用法?C# StreamInfo怎么用?C# StreamInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StreamInfo类属于命名空间,在下文中一共展示了StreamInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateObjectFromStreamInfo
private static GameObject CreateObjectFromStreamInfo(StreamInfo stream, bool visible)
{
GameObject streamObj = new GameObject("Stream #" + streamID++);
//Need a mesh filter and a mesh renderer for the stream's mesh rendering
MeshFilter filter = streamObj.AddComponent("MeshFilter") as MeshFilter;
filter.mesh = Object.Instantiate(stream.mesh) as Mesh;
MeshRenderer renderer = streamObj.AddComponent("MeshRenderer") as MeshRenderer;
renderer.material = Object.Instantiate(stream.material) as Material;
renderer.enabled = visible;
//Add a box collider
MeshCollider hitBox = streamObj.AddComponent("MeshCollider") as MeshCollider;
hitBox.transform.parent = streamObj.transform;
//Add proper stream script
string streamScript = "FluidStream";
if(stream.type == Source.SourceType.Electricity)
streamScript = "ElectricityStream";
else if (stream.type == Source.SourceType.Wind)
streamScript = "WindStream";
streamObj.AddComponent(streamScript);
return streamObj;
}
示例2: AudioStreamWrapper
internal AudioStreamWrapper(StreamInfo adaptiveAudioStream)
{
AdaptiveAudioStream = adaptiveAudioStream;
base.Name = adaptiveAudioStream.GetName();
base.Language = adaptiveAudioStream.GetLanguage();
//base.Language = new CultureInfo(adaptiveAudioStream.GetLanguage()).DisplayName;
}
示例3: SerializeObject
public override CustomObjectInfo SerializeObject()
{
StreamInfo x = new StreamInfo();
x.BasicSerialization(this);
x.direction=direction;
x.power=power;
return x;
}
示例4: GetVideoMedatada
public StreamInfo GetVideoMedatada()
{
StreamInfo sinfo = new StreamInfo();
sinfo.Author = currentUrl;
sinfo.Title = currentUrl;
return sinfo;
}
示例5: AddBytes
private static void AddBytes(IBinaryStorage storage, string key, byte[] data)
{
var streamInfo = new StreamInfo();
using (var md5 = MD5.Create()) {
streamInfo.Hash = md5.ComputeHash(data);
}
streamInfo.Length = data.Length;
streamInfo.IsCompressed = false;
using (var ms = new MemoryStream(data)) {
storage.Add(key, ms, streamInfo);
}
}
示例6: Clone
internal StreamInfo Clone()
{
StreamInfo clone = new StreamInfo
{
SectionName = SectionName,
ConfigSource = ConfigSource,
StreamName = StreamName,
IsMonitored = IsMonitored,
Version = Version
};
return clone;
}
示例7: GetVideoMedatada
public StreamInfo GetVideoMedatada()
{
StreamInfo sinfo = new StreamInfo();
sinfo.Author = GetCanonicalUrl();
sinfo.Title = GetCanonicalUrl();
if (localInitData.Config.GetBoolean(ConfigurationConstants.ApiInternetAccess,
true, false))
{
try
{
// pobieramy informacje o video
string yt_url = GetCanonicalUrl();
string oembed = "http://www.youtube.com/oembed";
{
var qstr = HttpUtility.ParseQueryString(string.Empty);
qstr["url"] = yt_url;
qstr["format"] = "xml";
oembed += "?" + qstr.ToString();
}
WebRequest wr = WebRequest.Create(oembed);
WebResponse wre = wr.GetResponse();
Stream data = wre.GetResponseStream();
System.Xml.XmlDocument xmldoc = new System.Xml.XmlDocument();
xmldoc.Load(data);
data.Close();
sinfo.Author = xmldoc.GetElementsByTagName("author_name")[0].InnerText;
sinfo.Title = xmldoc.GetElementsByTagName("title")[0].InnerText;
sinfo.CanonicalUrl = GetCanonicalUrl();
}
catch (Exception)
{
sinfo.Author = "Unknown author";
sinfo.Title = "Unknown title";
sinfo.CanonicalUrl = GetCanonicalUrl();
}
}
return sinfo;
}
示例8: GetADSes
public static IList<string> GetADSes(this FileInfo info)
{
List<string> result = new List<string>();
using (FileStream stream = new StreamInfo(info.FullName).Open(FileMode.Open,
FileAccess.Read, FileShare.ReadWrite))
using (SafeFileHandle streamHandle = stream.SafeFileHandle)
{
NativeMethods.FILE_STREAM_INFORMATION[] streams = GetADSes(streamHandle);
foreach (NativeMethods.FILE_STREAM_INFORMATION streamInfo in streams)
{
string streamName = streamInfo.StreamName.Substring(1,
streamInfo.StreamName.LastIndexOf(':') - 1);
if (streamName.Length != 0)
result.Add(streamName);
}
}
return result.AsReadOnly();
}
示例9: StreamInlet
public StreamInlet(StreamInfo info, int max_buflen, int max_chunklen)
{
obj = dll.lsl_create_inlet(info.handle(), max_buflen, max_chunklen, 1);
}
示例10: results
/**
* Obtain the set of currently present streams on the network (i.e. resolve result).
* @return An array of matching stream info objects (excluding their meta-data), any of
* which can subsequently be used to open an inlet.
*/
public StreamInfo[] results()
{
IntPtr[] buf = new IntPtr[1024];
int num = dll.lsl_resolver_results(obj,buf,(uint)buf.Length);
StreamInfo[] res = new StreamInfo[num];
for (int k = 0; k < num; k++)
res[k] = new StreamInfo(buf[k]);
return res;
}
示例11: resolve_stream
public static StreamInfo[] resolve_stream(string pred, int minimum, double timeout)
{
IntPtr[] buf = new IntPtr[1024]; int num = dll.lsl_resolve_bypred(buf, (uint)buf.Length, pred, minimum, timeout);
StreamInfo[] res = new StreamInfo[num];
for (int k = 0; k < num; k++)
res[k] = new StreamInfo(buf[k]);
return res;
}
示例12: StreamOutlet
public StreamOutlet(StreamInfo info, int chunk_size)
{
obj = dll.lsl_create_outlet(info.handle(), chunk_size, 360);
}
示例13: PutFileInternal
private void PutFileInternal(string s3Filename, string filename, StreamInfo file) {
var tmpfile = Path.Combine(_tempDirectory, Guid.NewGuid() + ".cache");
try {
using(file) {
Tuplet<string, TaskTimer, DateTime?> entry = null;
// create tmp file
try {
// copy stream to tmp file
using(Stream stream = File.Create(tmpfile)) {
file.Stream.CopyTo(stream, file.Length, new Result<long>(TimeSpan.MaxValue)).Wait();
}
// create cached entry
if(_cacheTtl != TimeSpan.Zero) {
lock(_cache) {
if(_cache.TryGetValue(s3Filename, out entry)) {
entry.Item2.Change(_cacheTtl, TaskEnv.None);
entry.Item3 = file.Modified;
} else {
var timer = _timerFactory.New(_cacheTtl, OnTimer, s3Filename, TaskEnv.None);
_cache[s3Filename] = entry = new Tuplet<string, TaskTimer, DateTime?>(tmpfile, timer, file.Modified);
}
}
}
} catch(Exception e) {
try {
// delete tmp file and clear out timer and cache, if any exist
SafeFileDelete(tmpfile);
if(entry != null) {
lock(_cache) {
entry.Item2.Cancel();
_cache.Remove(s3Filename);
}
}
} catch(Exception e2) {
_log.WarnFormat("Failed cleaned-up post tmp file creation failure for attachment {0}: {1}", s3Filename, e2.Message);
}
throw new DreamInternalErrorException(string.Format("Unable to cache file attachment to '{0}' ({1})", s3Filename, e.Message));
}
}
// forward cached file to S3
Stream filestream = File.Open(tmpfile, FileMode.Open, FileAccess.Read, FileShare.Read);
file = new StreamInfo(filestream, file.Length, file.Type);
var s3Msg = DreamMessage.Ok(file.Type, file.Length, file.Stream);
s3Msg.Headers.ContentDisposition = new ContentDisposition(true, DateTime.UtcNow, null, null, filename, file.Length);
// Note (arnec): The timeout is just a workaround Plug not having some kind of heartbeat on progress. Ideally 30 seconds of inactivity
// should be perfectly fine, as long as we track uploads that are proceeding as active
_s3.AtPath(s3Filename).WithTimeout(TimeSpan.FromMinutes(30)).Put(s3Msg);
} finally {
if(_cacheTtl == TimeSpan.Zero) {
SafeFileDelete(tmpfile);
}
}
}
示例14: PutFile
public void PutFile(ResourceBE attachment, SizeType size, StreamInfo file) {
CheckDisposed();
PutFileInternal(BuildS3Filename(attachment, size), attachment.Name, file);
}
示例15: ParseStreams
private void ParseStreams(IAMStreamSelect pStrm)
{
int cStreams = 0;
pStrm.Count(out cStreams);
_audioStreams.Clear();
_subtitleStreams.Clear();
for (int istream = 0; istream < cStreams; istream++)
{
AMMediaType sType;
AMStreamSelectInfoFlags sFlag;
int sPDWGroup;
int sPLCid;
string sName;
object pppunk;
object ppobject;
pStrm.Info(istream, out sType, out sFlag, out sPLCid, out sPDWGroup, out sName, out pppunk, out ppobject);
if (sPDWGroup == 1)
{
StreamInfo info = new StreamInfo(istream, sName);
_audioStreams.Add(info);
}
if (sPDWGroup == 2)
{
StreamInfo info = new StreamInfo(istream, sName);
_subtitleStreams.Add(info);
}
}
}