本文整理汇总了C#中FrameType类的典型用法代码示例。如果您正苦于以下问题:C# FrameType类的具体用法?C# FrameType怎么用?C# FrameType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FrameType类属于命名空间,在下文中一共展示了FrameType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Encode
public static ByteBuffer Encode(FrameType type, ushort channel, Transfer transfer,
ByteBuffer payload, int maxFrameSize, out int payloadSize)
{
int bufferSize = cmdBufferSize + payload.Length;
if (bufferSize > maxFrameSize)
{
bufferSize = maxFrameSize;
}
bool more = false; // estimate it first
if (payload.Length > bufferSize - 32)
{
transfer.More = more = true;
}
ByteBuffer buffer = new ByteBuffer(bufferSize, false);
EncodeFrame(buffer, type, channel, transfer);
if (more && payload.Length <= buffer.Size)
{
// guessed it wrong. correct it
transfer.More = false;
buffer.Reset();
EncodeFrame(buffer, type, channel, transfer);
}
payloadSize = Math.Min(payload.Length, buffer.Size);
AmqpBitConverter.WriteBytes(buffer, payload.Buffer, payload.Offset, payloadSize);
payload.Complete(payloadSize);
AmqpBitConverter.WriteInt(buffer.Buffer, 0, buffer.Length);
return buffer;
}
示例2: Frame
internal Frame(FrameType frameType)
{
Shiny = false;
EncounterMod = EncounterMod.None;
Offset = 0;
FrameType = frameType;
}
示例3: Create
public static Frame Create (FrameType frameType)
{
switch (frameType) {
case FrameType.Data:
return new DataFrame ();
case FrameType.Headers:
return new HeadersFrame ();
case FrameType.Priority:
return new PriorityFrame ();
case FrameType.RstStream:
return new RstStreamFrame ();
case FrameType.Settings:
return new SettingsFrame ();
case FrameType.PushPromise:
return new PushPromiseFrame ();
case FrameType.Ping:
return new PingFrame ();
case FrameType.GoAway:
return new GoAwayFrame ();
case FrameType.WindowUpdate:
return new WindowUpdateFrame ();
case FrameType.Continuation:
return new ContinuationFrame ();
}
return null;
}
示例4: FrameData
private static byte[] FrameData(byte[] payload, FrameType frameType)
{
using (var memoryStream = new MemoryStream())
{
var op = (byte) ((byte) frameType + 128);
memoryStream.WriteByte(op);
if (payload.Length > UInt16.MaxValue)
{
memoryStream.WriteByte(127);
var lengthBytes = payload.Length.ToBigEndianBytes<ulong>();
memoryStream.Write(lengthBytes, 0, lengthBytes.Length);
}
else if (payload.Length > 125)
{
memoryStream.WriteByte(126);
var lengthBytes = payload.Length.ToBigEndianBytes<ushort>();
memoryStream.Write(lengthBytes, 0, lengthBytes.Length);
}
else
{
memoryStream.WriteByte((byte) payload.Length);
}
memoryStream.Write(payload, 0, payload.Length);
return memoryStream.ToArray();
}
}
示例5: Frame
public Frame(FrameType frameType)
{
VerifyConstructorCall (this);
#pragma warning disable 618
Type = frameType;
#pragma warning restore 618
}
示例6: CombSpare
//Correct spares from GUI input (slashes input as -1)
public void CombSpare()
{
if(scores[1] == -1) {
scores[1] = 10 - scores[0];
type = FrameType.spare;
}
}
示例7: CreateTextFrame
public GuideFrame CreateTextFrame(Mode mode, FrameType type )
{
Bounds newBounds = contentBounds.Clone();
newBounds.top = GetNextTop();
newBounds.height = 10;
TextFrame textFrame = page.TextFrames.Add(miss, idLocationOptions.idAtEnd, miss);
textFrame.GeometricBounds = newBounds.raw;
textFrame.TextFramePreferences.FirstBaselineOffset = idFirstBaseline.idLeadingOffset;
if (mode==Mode.TwoColumns)
{
textFrame.TextFramePreferences.TextColumnCount = 2;
}
//$.global.textFrames.push( myTextFrame );
GuideFrame frame = new GuideFrame(textFrame, this.guide, this, mode, type);
frame.bounds = newBounds;
//currentFrame = frame;
frames.Add(frame);
//currentMode = mode;
return frame;
}
示例8: Name
public static String Name(FrameType type, CelestialBody selected) {
switch (type) {
case FrameType.BODY_CENTRED_NON_ROTATING:
return selected.name + "-Centred Inertial";
case FrameType.BARYCENTRIC_ROTATING:
if (selected.is_root()) {
throw Log.Fatal("Naming barycentric rotating frame of root body");
} else {
return selected.referenceBody.name + "-" + selected.name +
" Barycentric";
}
case FrameType.BODY_CENTRED_PARENT_DIRECTION:
if (selected.is_root()) {
throw Log.Fatal(
"Naming parent-direction rotating frame of root body");
} else {
// TODO(egg): find a proper name...
return selected.name + "-Centred " + selected.referenceBody.name +
"-Fixed";
}
case FrameType.BODY_SURFACE:
return selected.name + "-Centred " + selected.name + "-Fixed";
default:
throw Log.Fatal("Unexpected type " + type.ToString());
}
}
示例9: ProcessFrame
public static void ProcessFrame(FrameType frameType, byte[] data, Action<string> onMessage, Fleck2Extensions.Action onClose, Action<byte[]> onBinary)
{
switch (frameType)
{
case FrameType.Close:
if (data.Length == 1 || data.Length>125)
throw new WebSocketException(WebSocketStatusCodes.ProtocolError);
if (data.Length >= 2)
{
var closeCode = (ushort) (data.Take(2).ToArray().ToLittleEndianInt());
if (!WebSocketStatusCodes.Contains(closeCode) && (closeCode < 3000 || closeCode > 4999))
throw new WebSocketException(WebSocketStatusCodes.ProtocolError);
}
if (data.Length > 2)
ReadUtf8PayloadData(data.Skip(2));
onClose();
break;
case FrameType.Binary:
onBinary(data);
break;
case FrameType.Text:
onMessage(ReadUtf8PayloadData(data));
break;
default:
FleckLog.Debug("Received unhandled " + frameType);
break;
}
}
示例10: _drawFrame
private static void _drawFrame(int x, int y, int width, int height, FrameType frameType, bool isFilled, string caption, Color captionColor = Color.White, Color captionBackColor = Color.Black)
{
var charSet = frameCharSets[(int) _validate(frameType)];
ZOutput.Print(x, y, charSet[0].ToString().PadRight(width-1, charSet[1]) + charSet[2]);
var fill = charSet[3].ToString().PadRight(width - 1, ' ') + charSet[4];
for (var i = 1; i < height-1; i++)
{
if (isFilled)
{
ZOutput.Print(x, y+i, fill);
}
else
{
ZOutput.Print(x, y+i, charSet[3]);
ZOutput.Print(x+width-1, y+i, charSet[4]);
}
}
ZOutput.Print(x, y+height-1, charSet[5].ToString().PadRight(width-1, charSet[6]) + charSet[7]);
if (!string.IsNullOrEmpty(caption))
{
ZOutput.Print(x + 2, y, " " + caption + " ", captionColor, captionBackColor);
}
}
示例11: packetBase
public packetBase(int frameNumber, FrameType type, int length, byte checksum, DateTime recTime)
{
this.frameNumber = frameNumber;
this.length = length;
this.checksum = checksum;
this.recTime = recTime;
this.type = type;
}
示例12: Encode
public static void Encode(ByteBuffer buffer, FrameType type, ushort channel, DescribedList command)
{
buffer.Append(FixedWidth.UInt);
AmqpBitConverter.WriteUByte(buffer, DOF);
AmqpBitConverter.WriteUByte(buffer, (byte)type);
AmqpBitConverter.WriteUShort(buffer, channel);
Codec.Encode(command, buffer);
AmqpBitConverter.WriteInt(buffer.Buffer, buffer.Offset, buffer.Length);
}
示例13: Frame
public Frame(FrameDirection direction, FrameType type, byte id, byte seq, byte[] data)
{
this.Direction = direction;
this.Type = type;
this.Id = id;
this.Seq = seq;
this.Data = data;
}
示例14: EggParents
public EggParents(FrameType frameType, EncounterType encounterType, uint seed)
{
InitializeComponent();
this.seed = seed;
this.encounterType = encounterType;
this.frameType = frameType;
if (frameType == FrameType.BWBred || frameType == FrameType.BWBredInternational)
{
Text = "Display Parent IVs";
buttonRetrieveIVs.Text = "Get IVs from IVRNG (Frame 8)";
}
else if (frameType == FrameType.DPPtBred ||
frameType == FrameType.HGSSBred ||
frameType == FrameType.Bred ||
frameType == FrameType.BredSplit ||
frameType == FrameType.BredAlternate)
{
labelParentA.Text = "Parent A";
labelParentB.Text = "Parent B";
labelParentA.Location = new Point(39, 40);
labelParentB.Location = new Point(39, 66);
labelIVRNG.Visible = false;
maskedTextBoxHP_IVRNG.Visible = false;
maskedTextBoxAtk_IVRNG.Visible = false;
maskedTextBoxDef_IVRNG.Visible = false;
maskedTextBoxSpA_IVRNG.Visible = false;
maskedTextBoxSpD_IVRNG.Visible = false;
maskedTextBoxSpe_IVRNG.Visible = false;
}
else
{
maskedTextBoxHP_ParentA.Enabled = false;
maskedTextBoxAtk_ParentA.Enabled = false;
maskedTextBoxDef_ParentA.Enabled = false;
maskedTextBoxSpA_ParentA.Enabled = false;
maskedTextBoxSpD_ParentA.Enabled = false;
maskedTextBoxSpe_ParentA.Enabled = false;
maskedTextBoxHP_ParentB.Enabled = false;
maskedTextBoxAtk_ParentB.Enabled = false;
maskedTextBoxDef_ParentB.Enabled = false;
maskedTextBoxSpA_ParentB.Enabled = false;
maskedTextBoxSpD_ParentB.Enabled = false;
maskedTextBoxSpe_ParentB.Enabled = false;
Text = "Display Characteristics in List";
buttonRetrieveIVs.Text = encounterType == EncounterType.LarvestaEgg
? "Get IVs from IVRNG (Frame 2)"
: "Get IVs from IVRNG (Frame 1)";
}
}
示例15: Reset
public void Reset(NavigationFrameParameters parameters) {
frame_type = (FrameType)parameters.extension;
switch (frame_type) {
case FrameType.BODY_CENTRED_NON_ROTATING:
selected_celestial_ = FlightGlobals.Bodies[parameters.centre_index];
break;
case FrameType.BARYCENTRIC_ROTATING:
selected_celestial_ = FlightGlobals.Bodies[parameters.secondary_index];
break;
}
}