public PointField() { name = ""; offset = 0; datatype = 0; count = 0; }
public override int Deserialize(System.Byte[] serialized, int startIndex) { int curIndex = startIndex; data = serialized[curIndex]; curIndex++; return (curIndex - startIndex); }
public override void Serialize(MemoryStream stream) { System.Byte[] type_bytes = new System.Byte[] {type}; stream.Write(type_bytes, 0, type_bytes.Length); System.Byte[] id_bytes = new System.Byte[] {id}; stream.Write(id_bytes, 0, id_bytes.Length); System.Byte[] intensity_bytes = BitConverter.GetBytes(intensity); stream.Write(intensity_bytes, 0, intensity_bytes.Length); }
public TrackerState() { header = new std_msgs.Header(); ActiveTracks = 0; TotalTracks = 0; Tracks = new List<person_tracker.TrackedPerson>(); TrackerType = 0; TrackerName = ""; }
private static void AreEqual(QuantumType expected, QuantumType actual, MagickColor actualColor, float delta, string channel) { #if (Q16HDRI) if (double.IsNaN(actual)) actual = 0; #endif Assert.AreEqual(expected, actual, delta, channel + " is not equal (" + actualColor.ToString() + ")"); }
public Range() { header = new std_msgs.Header(); radiation_type = 0; field_of_view = 0.0f; min_range = 0.0f; max_range = 0.0f; range = 0.0f; }
public Image() { header = new std_msgs.Header(); height = 0; width = 0; encoding = ""; is_bigendian = 0; step = 0; data = new List<System.Byte>(); }
public override void Serialize(MemoryStream stream) { goal_id.Serialize(stream); System.Byte[] status_bytes = new System.Byte[] {status}; stream.Write(status_bytes, 0, status_bytes.Length); System.Byte[] text_bytes = System.Text.Encoding.UTF8.GetBytes(text); System.Byte[] text_len_bytes = BitConverter.GetBytes((System.UInt32)text_bytes.Length); stream.Write(text_len_bytes, 0, text_len_bytes.Length); stream.Write(text_bytes, 0, text_bytes.Length); }
public override int Deserialize(System.Byte[] serialized, int startIndex) { int curIndex = startIndex; type = serialized[curIndex]; curIndex++; id = serialized[curIndex]; curIndex++; intensity = BitConverter.ToSingle(serialized, curIndex); curIndex += BitConverter.GetBytes(intensity).Length; return (curIndex - startIndex); }
public override int Deserialize(System.Byte[] serialized, int startIndex) { int curIndex = startIndex; System.UInt32 CompressedMessageData_len = BitConverter.ToUInt32(serialized, curIndex); curIndex += BitConverter.GetBytes(CompressedMessageData_len).Length; System.Byte[] temp = new System.Byte[CompressedMessageData_len]; Array.Copy(serialized, curIndex, temp, 0, CompressedMessageData_len); CompressedMessageData = temp.ToList(); curIndex += (int)CompressedMessageData_len; return (curIndex - startIndex); }
public override int Deserialize(System.Byte[] serialized, int startIndex) { int curIndex = startIndex; curIndex += layout.Deserialize(serialized, curIndex); System.UInt32 data_len = BitConverter.ToUInt32(serialized, curIndex); curIndex += BitConverter.GetBytes(data_len).Length; System.Byte[] temp = new System.Byte[data_len]; Array.Copy(serialized, curIndex, temp, 0, data_len); data = temp.ToList(); curIndex += (int)data_len; return (curIndex - startIndex); }
public override int Deserialize(System.Byte[] serialized, int startIndex) { int curIndex = startIndex; curIndex += goal_id.Deserialize(serialized, curIndex); status = serialized[curIndex]; curIndex++; System.UInt32 text_len = BitConverter.ToUInt32(serialized, curIndex); curIndex += BitConverter.GetBytes(text_len).Length; text = System.Text.Encoding.UTF8.GetString(serialized, curIndex, (int)text_len); curIndex += (int)text_len; return (curIndex - startIndex); }
public CompressedPointCloud2() { header = new std_msgs.Header(); height = 0; width = 0; fields = new List<sensor_msgs.PointField>(); is_bigendian = false; point_step = 0; row_step = 0; compression_type = 0; compressed_data = new List<System.Byte>(); is_dense = false; }
public TrackedPerson() { header = new std_msgs.Header(); Name = ""; UID = 0; Pose = new geometry_msgs.Pose(); Twist = new geometry_msgs.Twist(); Skeleton = new person_tracker.SkeletonTrack(); Hands = new List<person_tracker.HandTrack>(); Confidence = 0.0f; TrackerType = 0; TrackerName = ""; }
public override void Serialize(MemoryStream stream) { System.Byte[] name_bytes = System.Text.Encoding.UTF8.GetBytes(name); System.Byte[] name_len_bytes = BitConverter.GetBytes((System.UInt32)name_bytes.Length); stream.Write(name_len_bytes, 0, name_len_bytes.Length); stream.Write(name_bytes, 0, name_bytes.Length); System.Byte[] offset_bytes = BitConverter.GetBytes(offset); stream.Write(offset_bytes, 0, offset_bytes.Length); System.Byte[] datatype_bytes = new System.Byte[] {datatype}; stream.Write(datatype_bytes, 0, datatype_bytes.Length); System.Byte[] count_bytes = BitConverter.GetBytes(count); stream.Write(count_bytes, 0, count_bytes.Length); }
public nsFont(string name, uint8_t style, uint8_t systemFont, uint8_t variant, uint8_t decorations, uint16_t weight, int16_t stretch, nscoord size, float sizeAdjust = 0, string languageOverride = null) { this.name = name; this.style = style; this.systemFont = systemFont; this.variant = variant; this.decorations = decorations; this.weight = weight; this.stretch = stretch; this.size = size; this.sizeAdjust = sizeAdjust; this.languageOverride = languageOverride; }
public override void Serialize(MemoryStream stream) { header.Serialize(stream); System.Byte[] radiation_type_bytes = new System.Byte[] {radiation_type}; stream.Write(radiation_type_bytes, 0, radiation_type_bytes.Length); System.Byte[] field_of_view_bytes = BitConverter.GetBytes(field_of_view); stream.Write(field_of_view_bytes, 0, field_of_view_bytes.Length); System.Byte[] min_range_bytes = BitConverter.GetBytes(min_range); stream.Write(min_range_bytes, 0, min_range_bytes.Length); System.Byte[] max_range_bytes = BitConverter.GetBytes(max_range); stream.Write(max_range_bytes, 0, max_range_bytes.Length); System.Byte[] range_bytes = BitConverter.GetBytes(range); stream.Write(range_bytes, 0, range_bytes.Length); }
public override int Deserialize(System.Byte[] serialized, int startIndex) { int curIndex = startIndex; System.UInt32 name_len = BitConverter.ToUInt32(serialized, curIndex); curIndex += BitConverter.GetBytes(name_len).Length; name = System.Text.Encoding.UTF8.GetString(serialized, curIndex, (int)name_len); curIndex += (int)name_len; offset = BitConverter.ToUInt32(serialized, curIndex); curIndex += BitConverter.GetBytes(offset).Length; datatype = serialized[curIndex]; curIndex++; count = BitConverter.ToUInt32(serialized, curIndex); curIndex += BitConverter.GetBytes(count).Length; return (curIndex - startIndex); }
public override int Deserialize(System.Byte[] serialized, int startIndex) { int curIndex = startIndex; curIndex += header.Deserialize(serialized, curIndex); radiation_type = serialized[curIndex]; curIndex++; field_of_view = BitConverter.ToSingle(serialized, curIndex); curIndex += BitConverter.GetBytes(field_of_view).Length; min_range = BitConverter.ToSingle(serialized, curIndex); curIndex += BitConverter.GetBytes(min_range).Length; max_range = BitConverter.ToSingle(serialized, curIndex); curIndex += BitConverter.GetBytes(max_range).Length; range = BitConverter.ToSingle(serialized, curIndex); curIndex += BitConverter.GetBytes(range).Length; return (curIndex - startIndex); }
public override int Deserialize(System.Byte[] serialized, int startIndex) { int curIndex = startIndex; curIndex += header.Deserialize(serialized, curIndex); System.UInt32 format_len = BitConverter.ToUInt32(serialized, curIndex); curIndex += BitConverter.GetBytes(format_len).Length; format = System.Text.Encoding.UTF8.GetString(serialized, curIndex, (int)format_len); curIndex += (int)format_len; System.UInt32 data_len = BitConverter.ToUInt32(serialized, curIndex); curIndex += BitConverter.GetBytes(data_len).Length; System.Byte[] temp = new System.Byte[data_len]; Array.Copy(serialized, curIndex, temp, 0, data_len); data = temp.ToList(); curIndex += (int)data_len; return (curIndex - startIndex); }
/* * translate_from_zscii * * Map a ZSCII character into Unicode. * */ internal static zword translate_from_zscii(zbyte c) { if (c == 0xfc) return CharCodes.ZC_MENU_CLICK; if (c == 0xfd) return CharCodes.ZC_DOUBLE_CLICK; if (c == 0xfe) return CharCodes.ZC_SINGLE_CLICK; if (c >= 0x9b && main.story_id != Story.BEYOND_ZORK) { if (main.hx_unicode_table != 0) { /* game has its own Unicode table */ zbyte N; FastMem.LOW_BYTE(main.hx_unicode_table, out N); if (c - 0x9b < N) { zword addr = (zword)(main.hx_unicode_table + 1 + 2 * (c - 0x9b)); zword unicode; FastMem.LOW_WORD(addr, out unicode); if (unicode < 0x20) return '?'; return unicode; } else return '?'; } else /* game uses standard set */ if (c <= 0xdf) { return zscii_to_latin1[c - 0x9b]; } else return '?'; } return (zword)c; }/* translate_from_zscii */
public override int Deserialize(System.Byte[] serialized, int startIndex) { int curIndex = startIndex; System.UInt32 TopicName_len = BitConverter.ToUInt32(serialized, curIndex); curIndex += BitConverter.GetBytes(TopicName_len).Length; TopicName = System.Text.Encoding.UTF8.GetString(serialized, curIndex, (int)TopicName_len); curIndex += (int)TopicName_len; System.UInt32 TopicType_len = BitConverter.ToUInt32(serialized, curIndex); curIndex += BitConverter.GetBytes(TopicType_len).Length; TopicType = System.Text.Encoding.UTF8.GetString(serialized, curIndex, (int)TopicType_len); curIndex += (int)TopicType_len; System.UInt32 SerializedMessageData_len = BitConverter.ToUInt32(serialized, curIndex); curIndex += BitConverter.GetBytes(SerializedMessageData_len).Length; System.Byte[] temp = new System.Byte[SerializedMessageData_len]; Array.Copy(serialized, curIndex, temp, 0, SerializedMessageData_len); SerializedMessageData = temp.ToList(); curIndex += (int)SerializedMessageData_len; return (curIndex - startIndex); }
public override void Serialize(MemoryStream stream) { header.Serialize(stream); System.Byte[] ActiveTracks_bytes = BitConverter.GetBytes(ActiveTracks); stream.Write(ActiveTracks_bytes, 0, ActiveTracks_bytes.Length); System.Byte[] TotalTracks_bytes = BitConverter.GetBytes(TotalTracks); stream.Write(TotalTracks_bytes, 0, TotalTracks_bytes.Length); System.Byte[] Tracks_len_bytes = BitConverter.GetBytes((System.UInt32)Tracks.Count); stream.Write(Tracks_len_bytes, 0, Tracks_len_bytes.Length); foreach(person_tracker.TrackedPerson element in Tracks) { element.Serialize(stream); } System.Byte[] TrackerType_bytes = new System.Byte[] {TrackerType}; stream.Write(TrackerType_bytes, 0, TrackerType_bytes.Length); System.Byte[] TrackerName_bytes = System.Text.Encoding.UTF8.GetBytes(TrackerName); System.Byte[] TrackerName_len_bytes = BitConverter.GetBytes((System.UInt32)TrackerName_bytes.Length); stream.Write(TrackerName_len_bytes, 0, TrackerName_len_bytes.Length); stream.Write(TrackerName_bytes, 0, TrackerName_bytes.Length); }
public override void Serialize(MemoryStream stream) { header.Serialize(stream); System.Byte[] height_bytes = BitConverter.GetBytes(height); stream.Write(height_bytes, 0, height_bytes.Length); System.Byte[] width_bytes = BitConverter.GetBytes(width); stream.Write(width_bytes, 0, width_bytes.Length); System.Byte[] encoding_bytes = System.Text.Encoding.UTF8.GetBytes(encoding); System.Byte[] encoding_len_bytes = BitConverter.GetBytes((System.UInt32)encoding_bytes.Length); stream.Write(encoding_len_bytes, 0, encoding_len_bytes.Length); stream.Write(encoding_bytes, 0, encoding_bytes.Length); System.Byte[] is_bigendian_bytes = new System.Byte[] {is_bigendian}; stream.Write(is_bigendian_bytes, 0, is_bigendian_bytes.Length); System.Byte[] step_bytes = BitConverter.GetBytes(step); stream.Write(step_bytes, 0, step_bytes.Length); System.Byte[] data_bytes = data.ToArray(); System.Byte[] data_len_bytes = BitConverter.GetBytes((System.UInt32)data_bytes.Length); stream.Write(data_len_bytes, 0, data_len_bytes.Length); stream.Write(data_bytes, 0, data_bytes.Length); }
public void Save(System.String fileName) { System.Int32 bufferLength = 16*(BARanges.Count+1); for (System.Int32 i=0;i<BARanges.Count;i++) bufferLength+= BARanges[i][1]; System.Byte[] outputBuffer = new System.Byte[bufferLength]; System.Array.Copy(System.Text.Encoding.ASCII.GetBytes("BARDMA"), 0, outputBuffer, 0, 6); System.Array.Copy(System.BitConverter.GetBytes(BARanges.Count), 0, outputBuffer, 8, 4); for (System.Int32 i=0;i<BARanges.Count;i++) { System.Array.Copy(System.Text.Encoding.ASCII.GetBytes(rangesNames[i]), 0, outputBuffer, 0x10+i*0x10, 4); System.Int32 currOffset = i==0?0x10+BARanges.Count*0x10: System.BitConverter.ToInt32(new System.Byte[] { outputBuffer[0x4+i*0x10], outputBuffer[0x5+i*0x10], outputBuffer[0x6+i*0x10], outputBuffer[0x7+i*0x10]},0)+ System.BitConverter.ToInt32(new System.Byte[] { outputBuffer[0x8+i*0x10], outputBuffer[0x9+i*0x10], outputBuffer[0xA+i*0x10], outputBuffer[0xB+i*0x10]},0); System.Array.Copy(System.BitConverter.GetBytes(currOffset),0, outputBuffer, 0x14+i*0x10, 4); System.Array.Copy(System.BitConverter.GetBytes(BARanges[i][1]), 0, outputBuffer, 0x18+i*0x10, 4); System.Array.Copy(System.BitConverter.GetBytes(BARanges[i][0]), 0, outputBuffer, 0x1C+i*0x10, 4); System.Byte[] curBuffer = new System.Byte[BARanges[i][1]]; System.Array.Copy(DMAbuffer,BARanges[i][0],curBuffer,0,BARanges[i][1]); System.Array.Copy(curBuffer, 0, outputBuffer, currOffset, curBuffer.Length); } try { System.IO.File.WriteAllBytes(fileName,outputBuffer); } catch (System.UnauthorizedAccessException) { } }
static TriggerStep sqlite3TriggerInsertStep(sqlite3 db, Token pTableName, IdList pColumn, int null_4, Select pSelect, u8 orconf) { return(sqlite3TriggerInsertStep(db, pTableName, pColumn, null, pSelect, orconf)); }
/** è¨å®šã€‚ */ public void Reset(System.Byte a_raw) { this.valuetype = ValueType.SignedNumber; this.raw = (SIGNED_NUMBER_TYPE)a_raw; }
/// <summary> /// Specifies a column alias of a specified value. /// </summary> /// <param name="value">A value.</param> /// <param name="alias">Is an alias. It is recommended that the alias follows the rules for regular SQL identifiers.</param> public static ColumnAsChainer As(this System.Byte value, string alias) { return(new ColumnAsChainer(value, alias)); }
static TriggerStep sqlite3TriggerInsertStep(sqlite3 db, Token pTableName, IdList pColumn, ExprList pEList, int null_5, u8 orconf) { return(sqlite3TriggerInsertStep(db, pTableName, pColumn, pEList, null, orconf)); }
public static bool testbits(lu_byte x, int m) { return((x & (lu_byte)m) != 0); }
/// <summary> /// Get the value of <see cref="System.Math.Min(System.Byte, System.Byte)"/> for this <see cref="System.Byte"/> value. /// </summary> public static System.Byte Min(this System.Byte val1, System.Byte val2) { return(System.Math.Min(val1, val2)); }
// the type has the indicated custom modifiers (which can be optional or required) protected virtual void NotifyCustomMod(sig_elem_type cmod, sig_index token, sig_index_type indexType, sig_index index) { }
public override void Convert(byte[] data) { byte[] l_bytes = new byte[4]; for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 0]; } this.m_File_id_0 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 4]; } this.m_Level_id_4 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 40]; } this.m_TXMP_link_28 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 44]; } this.m_Shadow_height_5__2C = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 48]; } this.m_Shadow_height_4_30 = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 52]; } this.m_Shadow_height_3_34 = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 56]; } this.m_Shadow_height_2_38 = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 60]; } this.m_Shadow_height_1_3C = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 2; i++) { l_bytes[i] = data[i + 64]; } this.m_Shadow_option_1_40 = (System.Int16)BinaryDatReader.l_int16(l_bytes, 2); for (int i = 0; i < 2; i++) { l_bytes[i] = data[i + 66]; } this.m_Shadow_option_2_42 = (System.Int16)BinaryDatReader.l_int16(l_bytes, 2); for (int i = 0; i < 2; i++) { l_bytes[i] = data[i + 100]; } this.m_Regeneration_time_64 = (System.Int16)BinaryDatReader.l_int16(l_bytes, 2); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 152]; } this.m_Hurt_light_sound_98 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 184]; } this.m_Hurt_medium_sound_B8 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 216]; } this.m_Hurt_heavy_sound_D8 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 248]; } this.m_Death_sound_F8 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 300]; } this.m_Rotation_factor_12C = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 1; i++) { l_bytes[i] = data[i + 688]; } this.m_Taunt_sound_query_2B0 = (System.Byte)BinaryDatReader.l_int8(l_bytes, 1); for (int i = 0; i < 1; i++) { l_bytes[i] = data[i + 689]; } this.m_Alert_sound_query_2B1 = (System.Byte)BinaryDatReader.l_int8(l_bytes, 1); for (int i = 0; i < 1; i++) { l_bytes[i] = data[i + 690]; } this.m_Startle_sound_query_2B2 = (System.Byte)BinaryDatReader.l_int8(l_bytes, 1); for (int i = 0; i < 1; i++) { l_bytes[i] = data[i + 691]; } this.m_Check_body_sound_query_2B3 = (System.Byte)BinaryDatReader.l_int8(l_bytes, 1); for (int i = 0; i < 1; i++) { l_bytes[i] = data[i + 692]; } this.m_Pursue_sound_query_2B4 = (System.Byte)BinaryDatReader.l_int8(l_bytes, 1); for (int i = 0; i < 1; i++) { l_bytes[i] = data[i + 693]; } this.m_Cower_sound_query_2B5 = (System.Byte)BinaryDatReader.l_int8(l_bytes, 1); for (int i = 0; i < 1; i++) { l_bytes[i] = data[i + 694]; } this.m_Punch_heavy_sound_query_2B6 = (System.Byte)BinaryDatReader.l_int8(l_bytes, 1); for (int i = 0; i < 1; i++) { l_bytes[i] = data[i + 695]; } this.m_Kich_heavy_sound_query_2B7 = (System.Byte)BinaryDatReader.l_int8(l_bytes, 1); for (int i = 0; i < 1; i++) { l_bytes[i] = data[i + 696]; } this.m_Super3_sound_query_2B8 = (System.Byte)BinaryDatReader.l_int8(l_bytes, 1); for (int i = 0; i < 1; i++) { l_bytes[i] = data[i + 697]; } this.m_Super4_sound_query_2B9 = (System.Byte)BinaryDatReader.l_int8(l_bytes, 1); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 700]; } this.m_Taunt_sound_2BC = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 732]; } this.m_Alert_sound_2DC = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 764]; } this.m_Startle_sound_2FC = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 796]; } this.m_Check_body_sound_31C = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 828]; } this.m_Pursue_sound_33C = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 860]; } this.m_Cower_sound_35C = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 892]; } this.m_Punch_heavy_sound_37C = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 924]; } this.m_Kick_heavy_sound_39C = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 956]; } this.m_Super3_sound_3BC = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 988]; } this.m_Super4_sound_3DC = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 1020]; } this.m_Eyeshot_3FC = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 1024]; } this.m_Earshot_400 = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 1076]; } this.m_ONCV_link_434 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 1080]; } this.m_ONCP_link_438 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 1084]; } this.m_ONIA_link_43C = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 1108]; } this.m_Footstep_walk_impact_454 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 1238]; } this.m_Footstep_run_impact_4D6 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 1368]; } this.m_Footstep_crouch_impact_558 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 1498]; } this.m_Fall_slide_impact_5DA = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 1628]; } this.m_Fall_land_impact_65C = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 1758]; } this.m_Fall_land_hard_impact_6DE = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 1888]; } this.m_Fall_knockdown_impact_760 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 2018]; } this.m_Fall_knockdown_impact_7E2 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 2148]; } this.m_Fall_knockdown_impact_864 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 2278]; } this.m_Footstep_turn_impact_8E6 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 2408]; } this.m_Footstep_run_start_impact_968 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 2538]; } this.m_Footstep_single_step_impact_9EA = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 2668]; } this.m_Footstep_run_stop_impact_A6C = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 2798]; } this.m_Footstep_walk_stop_impact_AEE = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 2928]; } this.m_Footstep_run_sprint_impact_B70 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 3060]; } this.m_Special_death_particles_BF4 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 3132]; } this.m_TRBS_link_C3C = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 3136]; } this.m_TRMA_link_C40 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 3140]; } this.m_CBPM_link_C44 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 3144]; } this.m_CBPI_link_C48 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 3148]; } this.m_Peace_timer_C4C = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 3152]; } this.m_First_idle_timer_C50 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 3156]; } this.m_Second_idle_timer_C54 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 3160]; } this.m_Basic_health_C58 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 3164]; } this.m_Basic_health_C5C = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 3168]; } this.m_Minimal_body_size_factor_C60 = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 3172]; } this.m_Maximal_body_size_factor_C64 = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 3208]; } this.m_TRAC_link_C88 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 3212]; } this.m_TRSC_link_C8C = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); }
public static bool testbit(lu_byte x, int b) { return(testbits(x, bitmask(b))); }
bool ParseMethod(sig_elem_type elem_type) { // MethodDefSig ::= [[HASTHIS] [EXPLICITTHIS]] (DEFAULT|VARARG|GENERIC GenParamCount) // ParamCount RetType Param* [SENTINEL Param+] NotifyBeginMethod(elem_type); sig_count gen_param_count; sig_count param_count; if ((elem_type & SIG_GENERIC) != 0) { if (!ParseNumber(out gen_param_count)) { return(false); } NotifyGenericParamCount(gen_param_count); } if (!ParseNumber(out param_count)) { return(false); } NotifyParamCount(param_count); if (!ParseRetType()) { return(false); } bool fEncounteredSentinal = false; for (sig_count i = 0; i < param_count; i++) { if (pbCur >= pbEnd) { return(false); } if (pb[pbCur] == ELEMENT_TYPE_SENTINEL) { if (fEncounteredSentinal) { return(false); } fEncounteredSentinal = true; NotifySentinal(); pbCur++; } if (!ParseParam()) { return(false); } } NotifyEndMethod(); return(true); }
public static int setbits(ref lu_byte x, int m) { x |= (lu_byte)m; return(x); }
/// <summary>Puts the specified instruction and character argument onto the Microsoft intermediate language (MSIL) stream of instructions.</summary> /// <param name="opcode">The MSIL instruction to be put onto the stream. </param> /// <param name="arg">The character argument pushed onto the stream immediately after the instruction. </param> /// <param name="generator">The <see cref="T:System.Reflection.Emit.XsILGenerator" /> to emit instructions from</param> public static XsILGenerator FluentEmit(this XsILGenerator generator, System.Reflection.Emit.OpCode opcode, System.Byte arg) { generator.Emit(opcode, arg); return(generator); }
public void Download(int id) { // ************************************************** string fileName = string.Format("{0}.zip", id); string rootRelativePathName = string.Format("~/App_Data/Files/{0}", fileName); string pathName = Server.MapPath(path: rootRelativePathName); if (System.IO.File.Exists(pathName) == false) { return; } // ************************************************** System.IO.Stream stream = null; try { // Open the file stream = new System.IO.FileStream (path: pathName, mode: System.IO.FileMode.Open, share: System.IO.FileShare.Read, access: System.IO.FileAccess.Read); // ************************************************** Response.Buffer = false; // Setting the unknown [ContentType] // will display the saving dialog for the user Response.ContentType = "application/octet-stream"; // With setting the file name, // in the saving dialog, user will see // the [fileName] name instead of [download]! Response.AddHeader("Content-Disposition", "attachment; filename=" + fileName); long fileLength = stream.Length; // Notify user (client) the total file length Response.AddHeader("Content-Length", fileLength.ToString()); // ************************************************** // Total bytes that should be read long dataToRead = fileLength; // Read the bytes of file while (dataToRead > 0) { // The below code is just for testing! So we commented it! //System.Threading.Thread.Sleep(1000); // Verify that the client is connected or not? if (Response.IsClientConnected) { // 8KB int bufferSize = 8 * 1024; // Create buffer for reading [intBufferSize] bytes from file byte[] buffers = new System.Byte[bufferSize]; // Read the data and put it in the buffer. int theBytesThatReallyHasBeenReadFromTheStream = stream.Read(buffer: buffers, offset: 0, count: bufferSize); // Write the data from buffer to the current output stream. Response.OutputStream.Write (buffer: buffers, offset: 0, count: theBytesThatReallyHasBeenReadFromTheStream); // Flush (Send) the data to output // (Don't buffer in server's RAM!) Response.Flush(); dataToRead = dataToRead - theBytesThatReallyHasBeenReadFromTheStream; } else { // Prevent infinite loop if user disconnected! dataToRead = -1; } } } catch { } finally { if (stream != null) { //oStream.Close(); stream.Dispose(); stream = null; } Response.Close(); } }
/** rpc serializers*/ public void ReceiveUpdate_OnServer(UnityEngine.Vector3 pos, UnityEngine.Vector3 rot, System.Single estTime, UnityEngine.Vector3 _frameVelocity, System.Byte interpolationMode) { ClientTest.self.rpcBegin(goId, 64, SerializedBuffer.RPCMode_Unreliable); ClientTest.self.rpcAddParam(pos); ClientTest.self.rpcAddParam(rot); ClientTest.self.rpcAddParam(estTime); ClientTest.self.rpcAddParam(_frameVelocity); ClientTest.self.rpcAddParam(interpolationMode); ClientTest.self.rpcEnd(); }
public static bool test2bits(lu_byte x, int b1, int b2) { return(testbits(x, (bit2mask(b1, b2)))); }
/* ** some userful bit tricks */ public static int resetbits(ref lu_byte x, int m) { x &= (lu_byte) ~m; return(x); }
// the type is specified by the given index of the given index type (normally a type index in the type metadata) // this callback is normally qualified by other ones such as NotifyTypeClass or NotifyTypeValueType protected virtual void NotifyTypeDefOrRef(sig_index token, sig_index_type indexType, int index) { }
//# define sqlite3WalClose(w,x,y,z) 0 static int sqlite3WalClose(Wal w, int x, int y, u8 z) { return(0); }
public static int resetbit(ref lu_byte x, int b) { return(resetbits(ref x, bitmask(b))); }
public override void Convert(byte[] data) { byte[] l_bytes = new byte[24]; for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 0]; } this.m_File_id_0 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 4]; } this.m_Level_id_4 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 8]; } this.m_Unknown_8 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 12]; } this.m_Raw_link_C = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 16]; } this.m_Raw_link_10 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 20]; } this.m_Raw_link_14 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 24]; } this.m_Raw_link_18 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 28]; } this.m_Raw_link_1C = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 32]; } this.m_Raw_link_20 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 36]; } this.m_Raw_link_24 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 40]; } this.m_Raw_link_28 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 44]; } this.m_Raw_link_2C = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 48]; } this.m_Raw_link_30 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 52]; } this.m_Raw_link_34 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 56]; } this.m_Raw_link_38 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 60]; } this.m_Flags_1_3C = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 61]; } this.m_Flags_2_3D = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 62]; } this.m_Flags_3_3E = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 1; i++) { l_bytes[i] = data[i + 63]; } this.m_Unknown_3F = (System.Byte)BinaryDatReader.l_int8(l_bytes, 1); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 64]; } this.m_TRAM_link_40 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 68]; } this.m_TRAM_link_44 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 72]; } this.m_Used_parts_48 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 76]; } this.m_Replace_parts_4C = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 80]; } this.m_Final_rotation_50 = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 2; i++) { l_bytes[i] = data[i + 84]; } this.m_Move_direction_54 = (System.Int16)BinaryDatReader.l_int16(l_bytes, 2); for (int i = 0; i < 2; i++) { l_bytes[i] = data[i + 86]; } this.m_Attack_voice_sound_56 = (System.Int16)BinaryDatReader.l_int16(l_bytes, 2); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 88]; } this.m_Unknown_58 = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 92]; } this.m_Unknown_5C = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 96]; } this.m_Unknown_60 = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 100]; } this.m_Unknown_64 = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 104]; } this.m_Unknown_68 = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 108]; } this.m_Unknown_6C = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 112]; } this.m_Unknown_70 = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 116]; } this.m_Unknown_74 = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 120]; } this.m_Unknown_78 = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 124]; } this.m_Unknown_7C = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 128]; } this.m_Unknown_80 = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 132]; } this.m_Unknown_84 = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 136]; } this.m_Unknown_88 = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 140]; } this.m_Unknown_8C = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 144]; } this.m_Unknown_90 = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 148]; } this.m_Unknown_94 = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 152]; } this.m_Unknown_98 = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 156]; } this.m_Unknown_9C = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 160]; } this.m_Unknown_A0 = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 164]; } this.m_Unknown_A4 = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 168]; } this.m_Unknown_A8 = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 172]; } this.m_Unknown_AC = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 176]; } this.m_Unknown_B0 = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 180]; } this.m_Unknown_B4 = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 184]; } this.m_Unknown_B8 = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 188]; } this.m_Unknown_BC = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 192]; } this.m_Unknown_C0 = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 196]; } this.m_Unknown_C4 = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 200]; } this.m_Unknown_C8 = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 204]; } this.m_Unknown_CC = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 208]; } this.m_Unknown_D0 = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 212]; } this.m_Unknown_D4 = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 216]; } this.m_Unknown_D8 = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 220]; } this.m_Unknown_DC = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 224]; } this.m_Unknown_E0 = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 228]; } this.m_Unknown_E4 = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 232]; } this.m_Unknown_E8 = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 236]; } this.m_Unknown_EC = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 240]; } this.m_Unknown_F0 = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 2; i++) { l_bytes[i] = data[i + 244]; } this.m_Unknown_F4 = (System.Int16)BinaryDatReader.l_int16(l_bytes, 2); for (int i = 0; i < 2; i++) { l_bytes[i] = data[i + 246]; } this.m_Unknown_F6 = (System.Int16)BinaryDatReader.l_int16(l_bytes, 2); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 248]; } this.m_Unknown_F8 = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 252]; } this.m_Unknown_FC = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 256]; } this.m_Unknown_100 = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 260]; } this.m_Unknown_104 = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 264]; } this.m_Unknown_108 = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 268]; } this.m_Unknown_10C = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 272]; } this.m_Unknown_110 = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 2; i++) { l_bytes[i] = data[i + 276]; } this.m_Unknown_114 = (System.Int16)BinaryDatReader.l_int16(l_bytes, 2); for (int i = 0; i < 1; i++) { l_bytes[i] = data[i + 278]; } this.m_Unknown_116 = (System.Byte)BinaryDatReader.l_int8(l_bytes, 1); for (int i = 0; i < 1; i++) { l_bytes[i] = data[i + 279]; } this.m_Unknown_117 = (System.Byte)BinaryDatReader.l_int8(l_bytes, 1); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 280]; } this.m_Unknown_118 = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 284]; } this.m_Unknown_11C = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 288]; } this.m_Unknown_120 = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 292]; } this.m_Unknown_124 = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 296]; } this.m_Unknown_128 = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 300]; } this.m_Unknown_12C = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 304]; } this.m_Unknown_130 = (System.Single)BinaryDatReader.l_float(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 308]; } this.m_Unknown_134 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 312]; } this.m_Extent_packages_138 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 316]; } this.m_Raw_link_13C = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 4; i++) { l_bytes[i] = data[i + 320]; } this.m_Attack_sound_140 = (System.Int32)BinaryDatReader.l_int32(l_bytes, 4); for (int i = 0; i < 2; i++) { l_bytes[i] = data[i + 336]; } this.m_Hard_pause_150 = (System.Int16)BinaryDatReader.l_int16(l_bytes, 2); for (int i = 0; i < 2; i++) { l_bytes[i] = data[i + 338]; } this.m_Soft_pause_152 = (System.Int16)BinaryDatReader.l_int16(l_bytes, 2); for (int i = 0; i < 2; i++) { l_bytes[i] = data[i + 340]; } this.m_Unknown_154 = (System.Int16)BinaryDatReader.l_int16(l_bytes, 2); for (int i = 0; i < 2; i++) { l_bytes[i] = data[i + 342]; } this.m_Unknown_156 = (System.Int16)BinaryDatReader.l_int16(l_bytes, 2); for (int i = 0; i < 2; i++) { l_bytes[i] = data[i + 344]; } this.m_Unknown_158 = (System.Int16)BinaryDatReader.l_int16(l_bytes, 2); for (int i = 0; i < 2; i++) { l_bytes[i] = data[i + 346]; } this.m_Unknown_15A = (System.Int16)BinaryDatReader.l_int16(l_bytes, 2); for (int i = 0; i < 2; i++) { l_bytes[i] = data[i + 348]; } this.m_Unknown_15C = (System.Int16)BinaryDatReader.l_int16(l_bytes, 2); for (int i = 0; i < 2; i++) { l_bytes[i] = data[i + 350]; } this.m_Frames_15E = (System.Int16)BinaryDatReader.l_int16(l_bytes, 2); for (int i = 0; i < 2; i++) { l_bytes[i] = data[i + 352]; } this.m_Compression_160 = (System.Int16)BinaryDatReader.l_int16(l_bytes, 2); for (int i = 0; i < 2; i++) { l_bytes[i] = data[i + 354]; } this.m_Type_162 = (System.Int16)BinaryDatReader.l_int16(l_bytes, 2); for (int i = 0; i < 2; i++) { l_bytes[i] = data[i + 356]; } this.m_Animation_Type_164 = (System.Int16)BinaryDatReader.l_int16(l_bytes, 2); for (int i = 0; i < 2; i++) { l_bytes[i] = data[i + 358]; } this.m_From_state_166 = (System.Int16)BinaryDatReader.l_int16(l_bytes, 2); for (int i = 0; i < 2; i++) { l_bytes[i] = data[i + 360]; } this.m_To_state_168 = (System.Int16)BinaryDatReader.l_int16(l_bytes, 2); for (int i = 0; i < 2; i++) { l_bytes[i] = data[i + 362]; } this.m_Bodyparts_16A = (System.Int16)BinaryDatReader.l_int16(l_bytes, 2); for (int i = 0; i < 2; i++) { l_bytes[i] = data[i + 364]; } this.m_Frames_16C = (System.Int16)BinaryDatReader.l_int16(l_bytes, 2); for (int i = 0; i < 2; i++) { l_bytes[i] = data[i + 366]; } this.m_Duration_16E = (System.Int16)BinaryDatReader.l_int16(l_bytes, 2); for (int i = 0; i < 2; i++) { l_bytes[i] = data[i + 368]; } this.m_Varient_170 = (System.Int16)BinaryDatReader.l_int16(l_bytes, 2); for (int i = 0; i < 2; i++) { l_bytes[i] = data[i + 370]; } this.m_Varient_end_172 = (System.Int16)BinaryDatReader.l_int16(l_bytes, 2); for (int i = 0; i < 2; i++) { l_bytes[i] = data[i + 372]; } this.m_Atomic_start_174 = (System.Int16)BinaryDatReader.l_int16(l_bytes, 2); for (int i = 0; i < 2; i++) { l_bytes[i] = data[i + 374]; } this.m_Atomic_end_176 = (System.Int16)BinaryDatReader.l_int16(l_bytes, 2); for (int i = 0; i < 2; i++) { l_bytes[i] = data[i + 376]; } this.m_End_interpolation_178 = (System.Int16)BinaryDatReader.l_int16(l_bytes, 2); for (int i = 0; i < 2; i++) { l_bytes[i] = data[i + 378]; } this.m_Maximal_interpolation_17A = (System.Int16)BinaryDatReader.l_int16(l_bytes, 2); for (int i = 0; i < 2; i++) { l_bytes[i] = data[i + 380]; } this.m_Action_frame_17C = (System.Int16)BinaryDatReader.l_int16(l_bytes, 2); for (int i = 0; i < 2; i++) { l_bytes[i] = data[i + 382]; } this.m_First_level_17E = (System.Int16)BinaryDatReader.l_int16(l_bytes, 2); for (int i = 0; i < 1; i++) { l_bytes[i] = data[i + 384]; } this.m_Unknown_180 = (System.Byte)BinaryDatReader.l_int8(l_bytes, 1); for (int i = 0; i < 1; i++) { l_bytes[i] = data[i + 385]; } this.m_Unknown_181 = (System.Byte)BinaryDatReader.l_int8(l_bytes, 1); for (int i = 0; i < 1; i++) { l_bytes[i] = data[i + 386]; } this.m_Attack_packages_182 = (System.Byte)BinaryDatReader.l_int8(l_bytes, 1); for (int i = 0; i < 1; i++) { l_bytes[i] = data[i + 387]; } this.m_Damage_packages_183 = (System.Byte)BinaryDatReader.l_int8(l_bytes, 1); for (int i = 0; i < 1; i++) { l_bytes[i] = data[i + 388]; } this.m_Motion_blur_packages_184 = (System.Byte)BinaryDatReader.l_int8(l_bytes, 1); for (int i = 0; i < 1; i++) { l_bytes[i] = data[i + 389]; } this.m_Shortcut_packages_185 = (System.Byte)BinaryDatReader.l_int8(l_bytes, 1); for (int i = 0; i < 1; i++) { l_bytes[i] = data[i + 390]; } this.m_Footstep_packages_186 = (System.Byte)BinaryDatReader.l_int8(l_bytes, 1); for (int i = 0; i < 1; i++) { l_bytes[i] = data[i + 391]; } this.m_Particle_packages_187 = (System.Byte)BinaryDatReader.l_int8(l_bytes, 1); for (int i = 0; i < 24; i++) { l_bytes[i] = data[i + 392]; } this.m_Not_used_188 = (System.String)BinaryDatReader.l_str(l_bytes, 24); }
public static int reset2bits(ref lu_byte x, int b1, int b2) { return(resetbits(ref x, (bit2mask(b1, b2)))); }
// a property with given element type protected virtual void NotifyBeginProperty(sig_elem_type elem_type) { }
/* * Restore a saved game using Quetzal format. Return 2 if OK, 0 if an error * occurred before any damage was done, -1 on a fatal error. */ internal static zword restore_quetzal(FileStream svf, System.IO.Stream stf) { zlong ifzslen, currlen, tmpl; zlong pc; zword i, tmpw; zword fatal = 0; /* Set to -1 when errors must be fatal. */ zbyte skip, progress = GOT_NONE; int x, y; /* Check it's really an `IFZS' file. */ if (!read_long(svf, out tmpl) || !read_long(svf, out ifzslen) || !read_long(svf, out currlen)) { return(0); } if (tmpl != ID_FORM || currlen != ID_IFZS) { Text.print_string("This is not a saved game file!\n"); return(0); } if (((ifzslen & 1) > 0) || ifzslen < 4) /* Sanity checks. */ return { (0); } ifzslen -= 4; /* Read each chunk and process it. */ while (ifzslen > 0) { /* Read chunk header. */ if (ifzslen < 8) /* Couldn't contain a chunk. */ return { (0); } if (!read_long(svf, out tmpl) || !read_long(svf, out currlen)) { return(0); } ifzslen -= 8; /* Reduce remaining by size of header. */ /* Handle chunk body. */ if (ifzslen < currlen) /* Chunk goes past EOF?! */ return { (0); } skip = (byte)(currlen & 1); ifzslen -= currlen + (zlong)skip; switch (tmpl) { /* `IFhd' header chunk; must be first in file. */ case 1229351012: // IFhd if ((progress & GOT_HEADER) > 0) { Text.print_string("Save file has two IFZS chunks!\n"); return(fatal); } progress |= GOT_HEADER; if (currlen < 13 || !read_word(svf, out tmpw)) { return(fatal); } if (tmpw != main.h_release) { progress = GOT_ERROR; } for (i = ZMachine.H_SERIAL; i < ZMachine.H_SERIAL + 6; ++i) { if ((x = svf.ReadByte()) == -1) { return(fatal); } if (x != FastMem.ZMData[FastMem.zmp + i]) { progress = GOT_ERROR; } } if (!read_word(svf, out tmpw)) { return(fatal); } if (tmpw != main.h_checksum) { progress = GOT_ERROR; } if ((progress & GOT_ERROR) > 0) { Text.print_string("File was not saved from this story!\n"); return(fatal); } if ((x = svf.ReadByte()) == -1) { return(fatal); } pc = (zlong)x << 16; if ((x = svf.ReadByte()) == -1) { return(fatal); } pc |= (zlong)x << 8; if ((x = svf.ReadByte()) == -1) { return(fatal); } pc |= (zlong)x; fatal = zword.MaxValue; /* Setting PC means errors must be fatal. */ // TODO make sure this works FastMem.SET_PC(pc); for (i = 13; i < currlen; ++i) { svf.ReadByte(); /* Skip rest of chunk. */ } break; /* `Stks' stacks chunk; restoring this is quite complex. ;) */ case 1400138611: // ID_Stks: if ((progress & GOT_STACK) > 0) { Text.print_string("File contains two stack chunks!\n"); break; } progress |= GOT_STACK; fatal = zword.MaxValue;; /* Setting SP means errors must be fatal. */ // sp = stack + General.STACK_SIZE; main.sp = main.stack.Length; /* * All versions other than V6 may use evaluation stack outside * any function context. As a result a faked function context * will be present in the file here. We skip this context, but * load the associated stack onto the stack proper... */ if (main.h_version != ZMachine.V6) { if (currlen < 8) { return(fatal); } for (i = 0; i < 6; ++i) { if (svf.ReadByte() != 0) { return(fatal); } } if (!read_word(svf, out tmpw)) { return(fatal); } if (tmpw > General.STACK_SIZE) { Text.print_string("Save-file has too much stack (and I can't cope).\n"); return(fatal); } currlen -= 8; if (currlen < tmpw * 2) { return(fatal); } for (i = 0; i < tmpw; ++i) { // if (!read_word(svf, --sp)) return fatal; if (!read_word(svf, out main.stack[--main.sp])) { return(fatal); } } currlen -= (zword)(tmpw * 2); } /* We now proceed to load the main block of stack frames. */ for (main.fp = main.stack.Length, main.frame_count = 0; currlen > 0; currlen -= 8, ++main.frame_count) { if (currlen < 8) { return(fatal); } if (main.sp < 4) /* No space for frame. */ { Text.print_string("Save-file has too much stack (and I can't cope).\n"); return(fatal); } /* Read PC, procedure flag and formal param count. */ if (!read_long(svf, out tmpl)) { return(fatal); } y = (int)(tmpl & 0x0F); /* Number of formals. */ tmpw = (zword)(y << 8); /* Read result variable. */ if ((x = svf.ReadByte()) == -1) { return(fatal); } /* Check the procedure flag... */ if ((tmpl & 0x10) > 0) { tmpw |= 0x1000; /* It's a procedure. */ tmpl >>= 8; /* Shift to get PC value. */ } else { /* Functions have type 0, so no need to or anything. */ tmpl >>= 8; /* Shift to get PC value. */ --tmpl; /* Point at result byte. */ /* Sanity check on result variable... */ if (FastMem.ZMData[FastMem.zmp + tmpl] != (zbyte)x) { Text.print_string("Save-file has wrong variable number on stack (possibly wrong game version?)\n"); return(fatal); } } main.stack[--main.sp] = (zword)(tmpl >> 9); /* High part of PC */ main.stack[--main.sp] = (zword)(tmpl & 0x1FF); /* Low part of PC */ main.stack[--main.sp] = (zword)(main.fp - 1); /* FP */ /* Read and process argument mask. */ if ((x = svf.ReadByte()) == -1) { return(fatal); } ++x; /* Should now be a power of 2 */ for (i = 0; i < 8; ++i) { if ((x & (1 << i)) > 0) { break; } } if ((x ^ (1 << i)) > 0) /* Not a power of 2 */ { Text.print_string("Save-file uses incomplete argument lists (which I can't handle)\n"); return(fatal); } // *--sp = tmpw | i; main.stack[--main.sp] = (zword)(tmpw | i); main.fp = main.sp; /* FP for next frame. */ /* Read amount of eval stack used. */ if (!read_word(svf, out tmpw)) { return(fatal); } tmpw += (zword)y; /* Amount of stack + number of locals. */ // if (sp - stack <= tmpw) { if (main.sp <= tmpw) { Text.print_string("Save-file has too much stack (and I can't cope).\n"); return(fatal); } if (currlen < tmpw * 2) { return(fatal); } for (i = 0; i < tmpw; ++i) { if (!read_word(svf, out main.stack[--main.sp])) { return(fatal); } } currlen -= (zword)(tmpw * 2); } /* End of `Stks' processing... */ break; /* Any more special chunk types must go in HERE or ABOVE. */ /* `CMem' compressed memory chunk; uncompress it. */ case 1129145709: // CMem if ((progress & GOT_MEMORY) == 0) /* Don't complain if two. */ { stf.Position = 0; // (void) fseek (stf, 0, SEEK_SET); i = 0; /* Bytes written to data area. */ for (; currlen > 0; --currlen) { if ((x = svf.ReadByte()) == -1) { return(fatal); } if (x == 0) /* Start run. */ { /* Check for bogus run. */ if (currlen < 2) { Text.print_string("File contains bogus `CMem' chunk.\n"); for (; currlen > 0; --currlen) { svf.ReadByte(); /* Skip rest. */ } currlen = 1; i = 0xFFFF; break; /* Keep going; may be a `UMem' too. */ } /* Copy story file to memory during the run. */ --currlen; if ((x = svf.ReadByte()) == -1) { return(fatal); } for (; x >= 0 && i < main.h_dynamic_size; --x, ++i) { if ((y = stf.ReadByte()) == -1) { return(fatal); } else { FastMem.ZMData[FastMem.zmp + i] = (zbyte)y; } } } else /* Not a run. */ { if ((y = stf.ReadByte()) == -1) { return(fatal); } FastMem.ZMData[FastMem.zmp + i] = (zbyte)(x ^ y); ++i; } /* Make sure we don't load too much. */ if (i > main.h_dynamic_size) { Text.print_string("warning: `CMem' chunk too long!\n"); for (; currlen > 1; --currlen) { svf.ReadByte(); /* Skip rest. */ } break; /* Keep going; there may be a `UMem' too. */ } } /* If chunk is short, assume a run. */ for (; i < main.h_dynamic_size; ++i) { if ((y = stf.ReadByte()) == -1) { return(fatal); } else { FastMem.ZMData[FastMem.zmp + i] = (zbyte)y; } } if (currlen == 0) { progress |= GOT_MEMORY; /* Only if succeeded. */ } break; } goto default; /* Fall right thru (to default) if already GOT_MEMORY */ /* `UMem' uncompressed memory chunk; load it. */ case 1431135597: // ID_UMem: if ((progress & GOT_MEMORY) == 0) /* Don't complain if two. */ { /* Must be exactly the right size. */ if (currlen == main.h_dynamic_size) { byte[] buffer = new byte[currlen]; int read = svf.Read(FastMem.ZMData, (int)FastMem.zmp, (int)currlen); if (read == currlen) { progress |= GOT_MEMORY; /* Only on success. */ break; } //if (fread(zmp, currlen, 1, svf) == 1) { //} } else { Text.print_string("`UMem' chunk wrong size!\n"); } /* Fall into default action (skip chunk) on errors. */ } goto default; /* Fall thru (to default) if already GOT_MEMORY */ /* Unrecognised chunk type; skip it. */ default: // (void) fseek (svf, currlen, SEEK_CUR); /* Skip chunk. */ svf.Position += currlen; break; } if (skip > 0) { svf.ReadByte(); /* Skip pad byte. */ } } /* * We've reached the end of the file. For the restoration to have been a * success, we must have had one of each of the required chunks. */ if ((progress & GOT_HEADER) == 0) { Text.print_string("error: no valid header (`IFhd') chunk in file.\n"); } if ((progress & GOT_STACK) == 0) { Text.print_string("error: no valid stack (`Stks') chunk in file.\n"); } if ((progress & GOT_MEMORY) == 0) { Text.print_string("error: no valid memory (`CMem' or `UMem') chunk in file.\n"); } return((ushort)(progress == GOT_ALL ? 2 : fatal)); }
// the only constraint available to locals at the moment is ELEMENT_TYPE_PINNED protected virtual void NotifyConstraint(sig_elem_type elem_type) { }
}/* reset_memory */ /* * storeb * * Write a byte value to the dynamic Z-machine memory. * */ internal static void storeb(zword addr, zbyte value) { if (addr >= main.h_dynamic_size) Err.runtime_error(ErrorCodes.ERR_STORE_RANGE); if (addr == ZMachine.H_FLAGS + 1) { /* flags register is modified */ main.h_flags &= (zword)(~(ZMachine.SCRIPTING_FLAG | ZMachine.FIXED_FONT_FLAG)); main.h_flags |= (zword)(value & (ZMachine.SCRIPTING_FLAG | ZMachine.FIXED_FONT_FLAG)); if ((value & ZMachine.SCRIPTING_FLAG) > 0) { if (!main.ostream_script) Files.script_open(); } else { if (main.ostream_script) Files.script_close(); } Screen.refresh_text_style(); } SET_BYTE(addr, value); DebugState.Output("storeb: {0} -> {1}", addr, value); }/* storeb */
// a block of locals with given elem_type (always just LOCAL_SIG for now) protected virtual void NotifyBeginLocals(sig_elem_type elem_type) { }
}/* mem_diff */ /* * mem_undiff * * Applies a quetzal-like diff to dest * */ static void mem_undiff(zbyte[] diff, long diff_length, zbyte[] dest) { zbyte c; uint diffPtr = 0; uint destPtr = 0; while (diff_length > 0) { c = diff[diffPtr++]; diff_length--; if (c == 0) { uint runlen; if (diff_length == 0) // TODO I'm not sure about this logic return; /* Incomplete run */ runlen = diff[diffPtr++]; diff_length--; if ((runlen & 0x80) > 0) { if (diff_length == 0) return; /* Incomplete extended run */ c = diff[diffPtr++]; diff_length--; runlen = (runlen & 0x7f) | (((uint)c) << 7); } destPtr += runlen + 1; } else { dest[destPtr++] ^= c; } } }/* mem_undiff */
public override void Serialize(MemoryStream stream) { System.Byte[] data_bytes = new System.Byte[] {data}; stream.Write(data_bytes, 0, data_bytes.Length); }
public virtual void Emit(System.Reflection.Emit.OpCode opcode, System.Byte arg) => throw null;
}/* z_restore */ /* * mem_diff * * Set diff to a Quetzal-like difference between a and b, * copying a to b as we go. It is assumed that diff points to a * buffer which is large enough to hold the diff. * mem_size is the number of bytes to compare. * Returns the number of bytes copied to diff. * */ static long mem_diff(zbyte[] a, zbyte[] b, zword mem_size, zbyte[] diff) { zword size = mem_size; int dPtr = 0; uint j; zbyte c = 0; int aPtr = 0; int bPtr = 0; for (; ; ) { for (j = 0; size > 0 && (c = (zbyte)(a[aPtr++] ^ b[bPtr++])) == 0; j++) size--; if (size == 0) break; size--; if (j > 0x8000) { diff[dPtr++] = 0; diff[dPtr++] = 0xff; diff[dPtr++] = 0xff; j -= 0x8000; } if (j > 0) { diff[dPtr++] = 0; j--; if (j <= 0x7f) { diff[dPtr++] = (byte)j; } else { diff[dPtr++] = (byte)((j & 0x7f) | 0x80); diff[dPtr++] = (byte)((j & 0x7f80) >> 7); } } diff[dPtr++] = c; b[bPtr - 1] ^= c; } return dPtr; }/* mem_diff */
/* ** Return TRUE if the given SQL string ends in a semicolon. ** ** Special handling is require for CREATE TRIGGER statements. ** Whenever the CREATE TRIGGER keywords are seen, the statement ** must end with ";END;". ** ** This implementation uses a state machine with 8 states: ** ** (0) INVALID We have not yet seen a non-whitespace character. ** ** (1) START At the beginning or end of an SQL statement. This routine ** returns 1 if it ends in the START state and 0 if it ends ** in any other state. ** ** (2) NORMAL We are in the middle of statement which ends with a single ** semicolon. ** ** (3) EXPLAIN The keyword EXPLAIN has been seen at the beginning of ** a statement. ** ** (4) CREATE The keyword CREATE has been seen at the beginning of a ** statement, possibly preceeded by EXPLAIN and/or followed by ** TEMP or TEMPORARY ** ** (5) TRIGGER We are in the middle of a trigger definition that must be ** ended by a semicolon, the keyword END, and another semicolon. ** ** (6) SEMI We've seen the first semicolon in the ";END;" that occurs at ** the end of a trigger definition. ** ** (7) END We've seen the ";END" of the ";END;" that occurs at the end ** of a trigger difinition. ** ** Transitions between states above are determined by tokens extracted ** from the input. The following tokens are significant: ** ** (0) tkSEMI A semicolon. ** (1) tkWS Whitespace. ** (2) tkOTHER Any other SQL token. ** (3) tkEXPLAIN The "explain" keyword. ** (4) tkCREATE The "create" keyword. ** (5) tkTEMP The "temp" or "temporary" keyword. ** (6) tkTRIGGER The "trigger" keyword. ** (7) tkEND The "end" keyword. ** ** Whitespace never causes a state transition and is always ignored. ** This means that a SQL string of all whitespace is invalid. ** ** If we compile with SQLITE_OMIT_TRIGGER, all of the computation needed ** to recognize the end of a trigger can be omitted. All we have to do ** is look for a semicolon that is not part of an string or comment. */ static public int sqlite3_complete(string zSql) { int state = 0; /* Current state, using numbers defined in header comment */ int token; /* Value of the next token */ #if !SQLITE_OMIT_TRIGGER /* A complex statement machine used to detect the end of a CREATE TRIGGER ** statement. This is the normal case. */ u8[][] trans = new u8[][] { /* Token: */ /* State: ** SEMI WS OTHER EXPLAIN CREATE TEMP TRIGGER END */ /* 0 INVALID: */ new u8[] { 1, 0, 2, 3, 4, 2, 2, 2, }, /* 1 START: */ new u8[] { 1, 1, 2, 3, 4, 2, 2, 2, }, /* 2 NORMAL: */ new u8[] { 1, 2, 2, 2, 2, 2, 2, 2, }, /* 3 EXPLAIN: */ new u8[] { 1, 3, 3, 2, 4, 2, 2, 2, }, /* 4 CREATE: */ new u8[] { 1, 4, 2, 2, 2, 4, 5, 2, }, /* 5 TRIGGER: */ new u8[] { 6, 5, 5, 5, 5, 5, 5, 5, }, /* 6 SEMI: */ new u8[] { 6, 6, 5, 5, 5, 5, 5, 7, }, /* 7 END: */ new u8[] { 1, 7, 5, 5, 5, 5, 5, 5, }, }; #else /* If triggers are not supported by this compile then the statement machine ** used to detect the end of a statement is much simplier */ u8[][] trans = new u8[][] { /* Token: */ /* State: ** SEMI WS OTHER */ /* 0 INVALID: */ new u8[] { 1, 0, 2, }, /* 1 START: */ new u8[] { 1, 1, 2, }, /* 2 NORMAL: */ new u8[] { 1, 2, 2, }, }; #endif // * SQLITE_OMIT_TRIGGER */ int zIdx = 0; while (zIdx < zSql.Length) { switch (zSql[zIdx]) { case ';': { /* A semicolon */ token = tkSEMI; break; } case ' ': case '\r': case '\t': case '\n': case '\f': { /* White space is ignored */ token = tkWS; break; } case '/': { /* C-style comments */ if (zSql[zIdx + 1] != '*') { token = tkOTHER; break; } zIdx += 2; while (zIdx < zSql.Length && zSql[zIdx] != '*' || zIdx < zSql.Length - 1 && zSql[zIdx + 1] != '/') { zIdx++; } if (zIdx == zSql.Length) { return(0); } zIdx++; token = tkWS; break; } case '-': { /* SQL-style comments from "--" to end of line */ if (zSql[zIdx + 1] != '-') { token = tkOTHER; break; } while (zIdx < zSql.Length && zSql[zIdx] != '\n') { zIdx++; } if (zIdx == zSql.Length) { return(state == 1 ? 1 : 0); //if( *zSql==0 ) return state==1; } token = tkWS; break; } case '[': { /* Microsoft-style identifiers in [...] */ zIdx++; while (zIdx < zSql.Length && zSql[zIdx] != ']') { zIdx++; } if (zIdx == zSql.Length) { return(0); } token = tkOTHER; break; } case '`': /* Grave-accent quoted symbols used by MySQL */ case '"': /* single- and double-quoted strings */ case '\'': { int c = zSql[zIdx]; zIdx++; while (zIdx < zSql.Length && zSql[zIdx] != c) { zIdx++; } if (zIdx == zSql.Length) { return(0); } token = tkOTHER; break; } default: { //#if SQLITE_EBCDIC // unsigned char c; //#endif if (IdChar((u8)zSql[zIdx])) { /* Keywords and unquoted identifiers */ int nId; for (nId = 1; (zIdx + nId) < zSql.Length && IdChar((u8)zSql[zIdx + nId]); nId++) { } #if SQLITE_OMIT_TRIGGER token = tkOTHER; #else switch (zSql[zIdx]) { case 'c': case 'C': { if (nId == 6 && sqlite3StrNICmp(zSql, zIdx, "create", 6) == 0) { token = tkCREATE; } else { token = tkOTHER; } break; } case 't': case 'T': { if (nId == 7 && sqlite3StrNICmp(zSql, zIdx, "trigger", 7) == 0) { token = tkTRIGGER; } else if (nId == 4 && sqlite3StrNICmp(zSql, zIdx, "temp", 4) == 0) { token = tkTEMP; } else if (nId == 9 && sqlite3StrNICmp(zSql, zIdx, "temporary", 9) == 0) { token = tkTEMP; } else { token = tkOTHER; } break; } case 'e': case 'E': { if (nId == 3 && sqlite3StrNICmp(zSql, zIdx, "end", 3) == 0) { token = tkEND; } else #if !SQLITE_OMIT_EXPLAIN if (nId == 7 && sqlite3StrNICmp(zSql, zIdx, "explain", 7) == 0) { token = tkEXPLAIN; } else #endif { token = tkOTHER; } break; } default: { token = tkOTHER; break; } } #endif // * SQLITE_OMIT_TRIGGER */ zIdx += nId - 1; } else { /* Operators and special symbols */ token = tkOTHER; } break; } } state = trans[state][token]; zIdx++; } return((state == 1) ? 1 : 0);//return state==1; }
public Char() { data = 0; }
/* ** 2001 September 15 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** An tokenizer for SQL ** ** This file contains C code that implements the sqlite3_complete() API. ** This code used to be part of the tokenizer.c source file. But by ** separating it out, the code will be automatically omitted from ** static links that do not use it. ************************************************************************* ** Included in SQLite3 port to C#-SQLite; 2008 Noah B Hart ** C#-SQLite is an independent reimplementation of the SQLite software library ** ** SQLITE_SOURCE_ID: 2010-08-23 18:52:01 42537b60566f288167f1b5864a5435986838e3a3 ** ************************************************************************* */ //#include "sqliteInt.h" #if !SQLITE_OMIT_COMPLETE /* ** This is defined in tokenize.c. We just have to import the definition. */ #if !SQLITE_AMALGAMATION #if SQLITE_ASCII //#define IdChar(C) ((sqlite3CtypeMap[(unsigned char)C]&0x46)!=0) static bool IdChar(u8 C) { return((sqlite3CtypeMap[(char)C] & 0x46) != 0); }
/// <summary> /// Declares the parameter using the specified value. /// </summary> /// <param name="value">Is the value whose type is used to infer the parameter type.</param> public static Value Param(System.Byte value) { return(new Value(value, Parameterization.Param)); }
// the type is a simple type, the elem_type defines it fully protected virtual void NotifyTypeSimple(sig_elem_type elem_type) { }