本文整理汇总了C#中StreamInfo类的典型用法代码示例。如果您正苦于以下问题:C# StreamInfo类的具体用法?C# StreamInfo怎么用?C# StreamInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StreamInfo类属于命名空间,在下文中一共展示了StreamInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:Gatlink,项目名称:elementum-dare,代码行数:27,代码来源:StreamFactory.cs
示例2: AudioStreamWrapper
internal AudioStreamWrapper(StreamInfo adaptiveAudioStream)
{
AdaptiveAudioStream = adaptiveAudioStream;
base.Name = adaptiveAudioStream.GetName();
base.Language = adaptiveAudioStream.GetLanguage();
//base.Language = new CultureInfo(adaptiveAudioStream.GetLanguage()).DisplayName;
}
开发者ID:bondarenkod,项目名称:pf-arm-deploy-error,代码行数:7,代码来源:AudioStreamWrapper.cs
示例3: SerializeObject
public override CustomObjectInfo SerializeObject()
{
StreamInfo x = new StreamInfo();
x.BasicSerialization(this);
x.direction=direction;
x.power=power;
return x;
}
开发者ID:crassus0,项目名称:Edge-drivers,代码行数:8,代码来源:Stream.cs
示例4: GetVideoMedatada
public StreamInfo GetVideoMedatada()
{
StreamInfo sinfo = new StreamInfo();
sinfo.Author = currentUrl;
sinfo.Title = currentUrl;
return sinfo;
}
开发者ID:psychob,项目名称:livestreamer-gui,代码行数:9,代码来源:GenericPage.cs
示例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);
}
}
开发者ID:saktanorovich,项目名称:interview,代码行数:13,代码来源:Program.cs
示例6: Clone
internal StreamInfo Clone()
{
StreamInfo clone = new StreamInfo
{
SectionName = SectionName,
ConfigSource = ConfigSource,
StreamName = StreamName,
IsMonitored = IsMonitored,
Version = Version
};
return clone;
}
开发者ID:chcosta,项目名称:corefx,代码行数:14,代码来源:StreamInfo.cs
示例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;
}
开发者ID:psychob,项目名称:livestreamer-gui,代码行数:46,代码来源:YouTubeCom.cs
示例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();
}
开发者ID:RoDaniel,项目名称:featurehouse,代码行数:18,代码来源:IO.cs
示例9: StreamInlet
public StreamInlet(StreamInfo info, int max_buflen, int max_chunklen)
{
obj = dll.lsl_create_inlet(info.handle(), max_buflen, max_chunklen, 1);
}
开发者ID:conphyture,项目名称:beta,代码行数:4,代码来源:LSL.cs
示例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;
}
开发者ID:conphyture,项目名称:beta,代码行数:14,代码来源:LSL.cs
示例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;
}
开发者ID:conphyture,项目名称:beta,代码行数:8,代码来源:LSL.cs
示例12: StreamOutlet
public StreamOutlet(StreamInfo info, int chunk_size)
{
obj = dll.lsl_create_outlet(info.handle(), chunk_size, 360);
}
开发者ID:conphyture,项目名称:beta,代码行数:4,代码来源:LSL.cs
示例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);
}
}
}
开发者ID:heran,项目名称:DekiWiki,代码行数:59,代码来源:S3Storage.cs
示例14: PutFile
public void PutFile(ResourceBE attachment, SizeType size, StreamInfo file) {
CheckDisposed();
PutFileInternal(BuildS3Filename(attachment, size), attachment.Name, file);
}
开发者ID:heran,项目名称:DekiWiki,代码行数:4,代码来源:S3Storage.cs
示例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);
}
}
}
开发者ID:MediaPortal,项目名称:MediaPortal-1,代码行数:33,代码来源:BDPlayer.cs
示例16: ProcessGuidStream
/// ------------------------------------------------------------------------------------
/// <summary>
/// Processes the GUID stream.
/// </summary>
/// <param name="streamInfo">The stream info.</param>
/// ------------------------------------------------------------------------------------
private void ProcessGuidStream(StreamInfo streamInfo)
{
// blank out the GUIDs
int nGuidSize = Marshal.SizeOf(typeof(Guid));
int nGuids = streamInfo.Size / nGuidSize;
byte[] buffer = new byte[nGuidSize];
for (int i = 0; i < nGuids; i++)
m_writer.Write(buffer);
}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:15,代码来源:CliFileProcessor.cs
示例17: ProcessTildeStream
/// ------------------------------------------------------------------------------------
/// <summary>
/// Processes the #~ stream.
/// </summary>
/// <param name="streamInfo">The stream info.</param>
/// ------------------------------------------------------------------------------------
private void ProcessTildeStream(StreamInfo streamInfo)
{
long nStreamBase = m_stream.Position;
m_stream.Position += 8;
ulong vValid = m_reader.ReadUInt64();
int cValid = CountSetBits(vValid);
ulong vSorted = m_reader.ReadUInt64();
uint[] rows = new uint[cValid];
for (int i = 0; i < cValid; i++)
{
rows[i] = m_reader.ReadUInt32();
}
// Handle tables
for (int i = 0; i < cValid; i++)
{
if (((vValid >> i) & 0x01) == 0)
continue;
for (int j = 0; j < rows[i]; j++)
{
//Debug.WriteLine(string.Format("Reading row {1} of table {0} at position 0x{2:x}",
// m_MetaDataTable[i], j, m_stream.Position));
switch (i)
{
case 0:
ProcessModule();
break;
case 1:
ProcessTypeRef();
break;
case 6:
ProcessMethodDef();
break;
default:
break;
}
}
}
}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:47,代码来源:CliFileProcessor.cs
示例18: Read
public void Read (TProtocol iprot)
{
bool isset_inputs = false;
bool isset_streams = false;
TField field;
iprot.ReadStructBegin();
while (true)
{
field = iprot.ReadFieldBegin();
if (field.Type == TType.Stop) {
break;
}
switch (field.ID)
{
case 1:
if (field.Type == TType.Map) {
{
Inputs = new Dictionary<GlobalStreamId, Grouping>();
TMap _map12 = iprot.ReadMapBegin();
for( int _i13 = 0; _i13 < _map12.Count; ++_i13)
{
GlobalStreamId _key14;
Grouping _val15;
_key14 = new GlobalStreamId();
_key14.Read(iprot);
_val15 = new Grouping();
_val15.Read(iprot);
Inputs[_key14] = _val15;
}
iprot.ReadMapEnd();
}
isset_inputs = true;
} else {
TProtocolUtil.Skip(iprot, field.Type);
}
break;
case 2:
if (field.Type == TType.Map) {
{
Streams = new Dictionary<string, StreamInfo>();
TMap _map16 = iprot.ReadMapBegin();
for( int _i17 = 0; _i17 < _map16.Count; ++_i17)
{
string _key18;
StreamInfo _val19;
_key18 = iprot.ReadString();
_val19 = new StreamInfo();
_val19.Read(iprot);
Streams[_key18] = _val19;
}
iprot.ReadMapEnd();
}
isset_streams = true;
} else {
TProtocolUtil.Skip(iprot, field.Type);
}
break;
case 3:
if (field.Type == TType.I32) {
Parallelism_hint = iprot.ReadI32();
} else {
TProtocolUtil.Skip(iprot, field.Type);
}
break;
case 4:
if (field.Type == TType.String) {
Json_conf = iprot.ReadString();
} else {
TProtocolUtil.Skip(iprot, field.Type);
}
break;
default:
TProtocolUtil.Skip(iprot, field.Type);
break;
}
iprot.ReadFieldEnd();
}
iprot.ReadStructEnd();
if (!isset_inputs)
throw new TProtocolException(TProtocolException.INVALID_DATA);
if (!isset_streams)
throw new TProtocolException(TProtocolException.INVALID_DATA);
}
开发者ID:bcardi,项目名称:storm-net-adapter,代码行数:83,代码来源:ComponentCommon.cs
示例19: PutSiteFile
public void PutSiteFile(string label, StreamInfo file) {
CheckDisposed();
PutFileInternal(BuildS3SiteFilename(label), string.Empty, file);
}
开发者ID:heran,项目名称:DekiWiki,代码行数:4,代码来源:S3Storage.cs
示例20: Mesh
//.........这里部分代码省略.........
a_Stream.Position += m_Tangents_size * 16; //Vector4f
int m_Normals_size = a_Stream.ReadInt32();
m_Normals = new float[m_Normals_size * 3];
for (int v = 0; v < m_Normals_size * 3; v++) { m_Normals[v] = a_Stream.ReadSingle(); }
}
}
#endregion
#region Vertex Buffer for 3.5.0 and later
else
{
#region read vertex stream
int m_Skin_size = a_Stream.ReadInt32();
a_Stream.Position += m_Skin_size * 32; //4x float weights & 4x int boneIndices
if (version[0] <= 3 || (version[0] == 4 && version[1] <= 2))
{
int m_BindPose_size = a_Stream.ReadInt32();
a_Stream.Position += m_BindPose_size * 16 * 4; //matrix 4x4
}
int m_CurrentChannels = a_Stream.ReadInt32();//defined as uint in Unity
m_VertexCount = a_Stream.ReadUInt32();
#region 3.5.0 - 3.5.7
if (version[0] < 4)
{
if (m_MeshCompression != 0 && version[2] == 0) //special case not just on platform 9
{
a_Stream.Position += 12;
}
else
{
m_Streams = new StreamInfo[4];
for (int s = 0; s < 4; s++)
{
m_Streams[s] = new StreamInfo();
m_Streams[s].channelMask = new BitArray(new int[1] { a_Stream.ReadInt32() });
m_Streams[s].offset = a_Stream.ReadInt32();
m_Streams[s].stride = a_Stream.ReadInt32();
m_Streams[s].align = a_Stream.ReadUInt32();
}
}
}
#endregion
#region 4.0.0 and later
else
{
int singleStreamStride = 0;//used tor unity 5
m_Channels = new ChannelInfo[a_Stream.ReadInt32()];
for (int c = 0; c < m_Channels.Length; c++)
{
m_Channels[c] = new ChannelInfo();
m_Channels[c].stream = a_Stream.ReadByte();
m_Channels[c].offset = a_Stream.ReadByte();
m_Channels[c].format = a_Stream.ReadByte();
m_Channels[c].dimension = a_Stream.ReadByte();
//calculate stride for Unity 5
singleStreamStride += m_Channels[c].dimension * (m_Channels[c].format % 2 == 0 ? 4 : 2);//fingers crossed!
}
if (version[0] < 5)
{
m_Streams = new StreamInfo[a_Stream.ReadInt32()];
开发者ID:DimoPeed,项目名称:UnityStudio,代码行数:67,代码来源:Mesh.cs
注:本文中的StreamInfo类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论