本文整理汇总了C#中System.Stream.setElement方法的典型用法代码示例。如果您正苦于以下问题:C# Stream.setElement方法的具体用法?C# Stream.setElement怎么用?C# Stream.setElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Stream
的用法示例。
在下文中一共展示了Stream.setElement方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: doIt
//.........这里部分代码省略.........
}
handle.asInt32Array = data;
break;
}
case Member.eDataType.kInt64:
{
long[] data = new long[handle.dataLength];
for (d = 0; d < handle.dataLength; ++d)
{
// rnd.Next() gives a number between [0,Int32
data[d] = (long)rnd.Next(Int32.MinValue, Int32.MaxValue);
if( data[d] >= 0 )
data[d] *= Int64.MaxValue / Int32.MaxValue;
else
data[d] *= Int64.MinValue / Int32.MinValue;
}
handle.asInt64Array = data;
break;
}
case Member.eDataType.kUInt8:
{
byte[] data = new byte[handle.dataLength];
for (d = 0; d < handle.dataLength; ++d)
{
data[d] = (byte)rnd.Next(0, Byte.MaxValue + 1);
}
handle.asUInt8Array = data;
break;
}
case Member.eDataType.kUInt16:
{
ushort[] data = new ushort[handle.dataLength];
for (d = 0; d < handle.dataLength; ++d)
{
data[d] = (ushort)rnd.Next(0, UInt16.MaxValue + 1);
}
handle.asUInt16Array = data;
break;
}
case Member.eDataType.kUInt32:
{
uint[] data = new uint[handle.dataLength];
for (d = 0; d < handle.dataLength; ++d)
{
data[d] = (uint)rnd.Next();
}
handle.asUInt32Array = data;
break;
}
case Member.eDataType.kUInt64:
{
ulong[] data = new ulong[handle.dataLength];
for (d = 0; d < handle.dataLength; ++d)
{
data[d] = ((ulong)rnd.Next()) * UInt64.MaxValue / UInt32.MaxValue;
}
handle.asUInt64Array = data;
break;
}
case Member.eDataType.kString:
{
string[] randomStrings = new string[] { "banana", "tomatoe", "apple", "pineapple", "apricot", "pepper", "olive", "grapefruit" };
string[] data = new string[handle.dataLength];
for (d = 0; d < handle.dataLength; ++d)
{
int index = rnd.Next( randomStrings.Length );
data[d] = randomStrings[index];
}
handle.asStringArray = data;
break;
}
default:
{
Debug.Assert(false, "This should never happen");
break;
}
}
}
newStream.setElement(new Index(m), handle);
}
newChannel.setDataStream(newStream);
newMetadata.setChannel(newChannel);
// Note: the following will not work if "obj" is a shape constructed by a source object
// You need to delete the history of the shape before calling this...
fDGModifier.setMetadata(obj, newMetadata);
fDGModifier.doIt();
// Set the result to the number of actual metadata values set as a
// triple value:
// (# nodes, # metadata elements, # members per element)
//
MIntArray theResult = new MIntArray();
theResult.append( (int) fNodes.length );
theResult.append( (int) indexCount );
theResult.append( (int) structureMemberCount );
setResult( theResult );
}
}