public static int ReadInt(this byte[] bytes, ref int offset) { var value = Little.ToInt32(bytes, offset); offset += 4; return(value); }
public int Update(int GameState, GameTime pGameTime, ContentManager Content) { GAMESTATE = GameState; keyboard = Keyboard.GetState(); mstate = Mouse.GetState(); Little.Update(pGameTime); switch (GAMESTATE) { case 1: Start_Update(GAMESTATE, pGameTime, Content); break; case 2: Gameplay_Update(GAMESTATE, pGameTime, Content); break; case 3: End_Update(GAMESTATE, pGameTime, Content); break; } previousKeyboard = keyboard; previousMstate = mstate; return(GAMESTATE); }
public double GetCx_nos(AeroGraphs ag, double mach, double lmb_nos) { double lmb_shtr = GetLmbdShtr(lmb_nos); double type = 0; double cosTetta = Math.Cos(Math.Atan(0.5 / lmb_shtr)); double main_expr = Rshtrih * Rshtrih; if (Little is RocketNos_SpherePlusCyl) { type = (Little as RocketNos_SpherePlusCyl).Type; } if (Main is RocketNos_ConePlusCyl) { cosTetta = Math.Cos(Math.Atan(0.5 / lmb_shtr)); main_expr = Rshtrih * Rshtrih * (type * (cosTetta - 1) + 1); } if (Main is RocketNos_OzjPlusCyl) { cosTetta = Math.Cos(Math.Atan(Math.Sqrt(1 - Rshtrih) / lmb_shtr)); double cosTettaExpr = type * (cosTetta - 1) + 1; double r_strSqr = Rshtrih * Rshtrih; main_expr = r_strSqr * cosTettaExpr * cosTettaExpr * (3.1 - 1.4 * cosTettaExpr * Rshtrih - 0.7 * cosTettaExpr * cosTettaExpr * r_strSqr); } return(Main.GetCx_nos(ag, mach, lmb_shtr) * (1 - main_expr) + Little.GetCx_nos(ag, mach, lmb_nos) * Rshtrih * Rshtrih); }
public double GetCy1a_nos(AeroGraphs ag, double mach, double lmb_nos, double lmb_cyl) { double lmb_shtr = GetLmbdShtr(lmb_nos); return(Main.GetCy1a_nos(ag, mach, lmb_shtr, lmb_cyl) * (1 - Rshtrih * Rshtrih) + Little.GetCy1a_nos(ag, mach, lmb_nos, lmb_cyl) * Rshtrih * Rshtrih); }
public static void Write(int value, byte[] bytes, ref int offset) { var valueBytes = Little.GetBytes(value); Array.Copy(valueBytes, 0, bytes, offset, 4); offset += 4; }
/// <summary> /// Convert the given number of bytes from the given array, from the given start /// position, into a long, using the bytes as the least significant part of the long. /// By the time this is called, the arguments have been checked for validity. /// </summary> /// <param name="value">The bytes to convert</param> /// <param name="startIndex">The index of the first byte to convert</param> /// <param name="bytesToConvert">The number of bytes to use in the conversion</param> /// <returns>The converted number</returns> protected internal override long FromBytes(byte[] value, int startIndex, int bytesToConvert) { if (this.IsLittleEndian()) { return(Little.FromBytes(value, startIndex, bytesToConvert)); } return(Big.FromBytes(value, startIndex, bytesToConvert)); }
public double GetW_nos(double d, double l) { var lmbShtr = GetLmbdShtr(l / d); var l_dop = (Little is RocketNos_SpherePlusCyl) ? (Little as RocketNos_SpherePlusCyl).Type * d * 0.5 * Rshtrih : 0.0; return(Little.GetW_nos(d * Rshtrih, l) + Main.GetW_nos(d, d * lmbShtr) - Main.GetW_nos(d * Rshtrih, d * lmbShtr - l + l_dop)); }
/// <summary> /// Copies the given number of bytes from the least-specific /// end of the specified value into the specified byte array, beginning /// at the specified index. /// This must be implemented in concrete derived classes, but the implementation /// may assume that the value will fit into the buffer. /// </summary> /// <param name="value">The value to copy bytes for</param> /// <param name="bytes">The number of significant bytes to copy</param> /// <param name="buffer">The byte array to copy the bytes into</param> /// <param name="index">The first index into the array to copy the bytes into</param> protected internal override void CopyBytesImpl(long value, int bytes, byte[] buffer, int index) { if (this.IsLittleEndian()) { Little.CopyBytesImpl(value, bytes, buffer, index); } else { Big.CopyBytesImpl(value, bytes, buffer, index); } }
private void little_Click(object sender, EventArgs e) { string Name = Convert.ToString(name.Text); int Age = Convert.ToInt32(age.Text); double Chinese = Convert.ToDouble(chinese.Text); double Math = Convert.ToDouble(math.Text); Little stu = new Little(Name, Age, Chinese, Math); result.Text += "总人数:" + Student.number + "姓名:" + stu.Name + ",小学生,平均成绩为:" + stu.Average() + "\r\n"; }
public static void Write(this Color[] colors, byte[] bytes, ref int offset) { var lengthBytes = Little.GetBytes(colors.Length); Array.Copy(lengthBytes, 0, bytes, offset, 4); offset += 4; for (var i = 0; i < colors.Length; i++) { var colorBytes = ColorToBytes(colors[i]); Array.Copy(colorBytes, 0, bytes, offset, 4); offset += 4; } }
public static void Write(int[] ints, byte[] bytes, ref int offset) { var lengthBytes = Little.GetBytes(ints.Length); Array.Copy(lengthBytes, 0, bytes, offset, 4); offset += 4; for (var i = 0; i < ints.Length; i++) { var intBytes = Little.GetBytes(ints[i]); Array.Copy(intBytes, 0, bytes, offset, 4); offset += 4; } }
public double GetF_nos(double d, double l) { double l_shtr = GetLmbdShtr(l / d) * d; double type = 0.0; if (Little is RocketNos_SpherePlusCyl) { type = (Little as RocketNos_SpherePlusCyl).Type; } var tetta = GetTetta(l / d); var expr1 = Main.GetF_nos(d, l_shtr); var expr2 = Main.GetF_nos(d * Rshtrih * Math.Cos(tetta), l_shtr - l + Rshtrih * d * 0.5 * type - Rshtrih * d * 0.5 * Math.Sin(tetta)); var expr3 = Little.GetF_nos(d * Rshtrih, Rshtrih * d * 0.5 * type); return(expr1 - expr2 + expr3); }
public static int[] ReadInts(this byte[] bytes, ref int offset) { var length = Little.ToInt32(bytes, offset); offset += 4; var ints = new int[length]; for (var i = 0; i < ints.Length; i++) { ints[i] = Little.ToInt32(bytes, offset); offset += 4; } return(ints); }
public static Color[] ReadColors(this byte[] bytes, ref int offset) { var length = Little.ToInt32(bytes, offset); offset += 4; var colors = new Color[length]; for (var i = 0; i < colors.Length; i++) { colors[i] = BytesToColor(bytes, offset); offset += 4; } return(colors); }
public static void Write(this Vector2[] vectors, byte[] bytes, ref int offset) { var lengthBytes = Little.GetBytes(vectors.Length); Array.Copy(lengthBytes, 0, bytes, offset, 4); offset += 4; for (var i = 0; i < vectors.Length; i++) { var vector = vectors[i]; var x = Little.GetBytes(vector.x); var y = Little.GetBytes(vector.y); Array.Copy(x, 0, bytes, offset, 4); offset += 4; Array.Copy(y, 0, bytes, offset, 4); offset += 4; } }
public static Vector2[] ReadVector2s(this byte[] bytes, ref int offset) { var length = Little.ToInt32(bytes, offset); offset += 4; var vector2s = new Vector2[length]; for (var i = 0; i < vector2s.Length; i++) { var x = Little.ToSingle(bytes, offset); offset += 4; var y = Little.ToSingle(bytes, offset); offset += 4; vector2s[i] = new Vector2(x, y); } return(vector2s); }
public void Draw(SpriteBatch pSpriteBatch) { this.SpriteBatch = pSpriteBatch; switch (GAMESTATE) { case 1: Start_Draw(pSpriteBatch); break; case 2: Gameplay_Draw(pSpriteBatch); break; case 3: End_Draw(pSpriteBatch); break; } Little.Draw(pSpriteBatch); }