public void setup_generate_random1(object setup_low_rand, object setup_high_rand) { setup_rand_finished = false; while (!setup_rand_finished) { VBMath.Randomize(); setup_random1 = IntegerType.FromObject(Conversion.Int(ObjectType.AddObj(ObjectType.MulObj(ObjectType.AddObj(setup_high_rand, 1), VBMath.Rnd()), 0))); if (!BooleanType.FromObject(ObjectType.BitAndObj(ObjectType.ObjTst(setup_random1, setup_low_rand, false) >= 0, ObjectType.ObjTst(setup_random1, setup_high_rand, false) <= 0))) { continue; } setup_rand_finished = true; } }
static void EntradaDeDados() { string valor = ""; while (!valor.ToUpper().Contains('S')) { Console.WriteLine("Digite o valor e pressione enter ou S para ir ao menu:"); valor = Console.ReadLine(); if (!valor.ToUpper().Contains('S')) { valores.Add(IntegerType.FromString(valor)); } } }
public void ShouldCreateStringlyTyped() { var iType = new IntegerType(123); var sType = new StringType("Hello"); var sType2 = new OtherStringType("World"); Assert.That(iType.Value, Is.EqualTo(123)); Assert.That(sType.Value, Is.EqualTo("Hello")); Assert.That(sType2.Value, Is.EqualTo("World")); Assert.That(iType, Is.Not.EqualTo(123)); Assert.That(sType, Is.Not.EqualTo("Hello")); Assert.That(sType2, Is.Not.EqualTo("World")); }
private static void BuildIntegerTypeSymbol( SymbolTreeBuilder tree, IntegerType integerType, DataType stringType) { var type = new PrimitiveTypeSymbol(integerType); tree.Add(type); var remainderMethod = new MethodSymbol(type, "remainder", integerType, Params(integerType), integerType); var displayStringMethod = new MethodSymbol(type, "to_display_string", integerType, Params(), stringType); tree.Add(remainderMethod); tree.Add(displayStringMethod); }
public void RegistrarAbonos(int Año, int AlmacenGas, int MovimientoAlmacen, DateTime FVenta, string Usuario) { int num1 = 0; int num2 = checked (this._Registros - 1); int index = num1; while (index <= num2) { Decimal num3 = DecimalType.FromObject(this.dgDatos[index, 2]); int num4 = IntegerType.FromObject(this.dgDatos[index, 0]); int num5 = IntegerType.FromObject(this.dgDatos[index, 1]); new Consulta.cCobroComisionista().Actualizar((short)1, 0, Año, this._Cliente, num3, AlmacenGas, MovimientoAlmacen, FVenta, Usuario, 0, "", num4, num5, (short)0, DateAndTime.Now); checked { ++index; } } }
private static void convertFile(string[] args) { int i = 1; Boolean stop = false; if (args.Length < 5) { Console.WriteLine("Arguments illegaux pour --convert, pour convertir utiliser '-c [-v <verboselevel>] <sourceformat> <sourcepath> <destformat> <destpath>'"); stop = true; } else if (args[i].Equals("-v") || args[i].Equals("--verbose")) { if (args.Length < 7) { Console.WriteLine("Arguments illegaux pour --convert, pour convertir utiliser '-c [-v <verboselevel>] <sourceformat> <sourcepath> <destformat> <destpath>'"); stop = true; } else { switch (args[i + 1]) { case "1": verbose = IntegerType.FromString(args[i + 1]); i += 2; break; case "2": verbose = IntegerType.FromString(args[i + 1]); i += 2; break; case "3": verbose = IntegerType.FromString(args[i + 1]); i += 2; break; default: Console.WriteLine("Niveau de verbose invalide pour --verbose, les niveaux disponibles sont 1, 2 ou 3"); stop = true; break; } } } if (!stop) { Conversion.convertFile(args[i], args[i + 1], args[i + 2], args[i + 3], verbose); } }
private void RegistrarInformacion() { ClienteFactor.cClientePrestacion clientePrestacion = new ClienteFactor.cClientePrestacion(0); clientePrestacion.Borra(this._Cliente); int num1 = 0; int num2 = checked (this.dtDatos.Rows.Count - 1); int index = num1; while (index <= num2) { clientePrestacion.Registra(this._Cliente, IntegerType.FromObject(this.dgDatos[index, 2]), DecimalType.FromObject(this.dgDatos[index, 1]), this.dtpFInicio.Value, this.dtpFInicio.Value, this.cboStatus.Text, Globals.GetInstance._Usuario); checked { ++index; } } this.DatosSalvados = true; this.Close(); }
private void Populate() { IntegerType c1 = new IntegerType("id", "id"); Border b1 = c1.Border; stackPanel.Children.Add(b1); StringType c2 = new StringType("First Name", "First Name"); Border b2 = c2.Border; stackPanel.Children.Add(b2); StringType c3 = new StringType("Last Name", "Last Name"); Border b3 = c3.Border; stackPanel.Children.Add(b3); RadioType c4 = new RadioType("Gender", "Male", "Female"); Border b4 = c4.Border; stackPanel.Children.Add(b4); LongType c5 = new LongType("Phone No.", "Phone No"); Border b5 = c5.Border; stackPanel.Children.Add(b5); DateType c9 = new DateType("Date", System.DateTime.Now); Border b9 = c9.Border; stackPanel.Children.Add(b9); FloatType c6 = new FloatType("Salary", "Salary"); Border b6 = c6.Border; stackPanel.Children.Add(b6); IntegerType c7 = new IntegerType("Roll no", "Roll No"); Border b7 = c7.Border; stackPanel.Children.Add(b7); StringType c8 = new StringType("Address", "Address"); Border b8 = c8.Border; stackPanel.Children.Add(b8); }
protected static int GetInteger(BinaryReader input, IntegerType type) { const byte ByteLengthCutoff = 0xF0; var t = (byte)type; if (t < ByteLengthCutoff) { return(t - 1); } switch (type) { case IntegerType.Byte: return(input.ReadByte()); case IntegerType.ByteTimes256: return(input.ReadByte() * 256); case IntegerType.Int16: { int v = 0; v |= input.ReadByte() << 8; v |= input.ReadByte(); return(v); } case IntegerType.Int24: { int v = 0; v |= input.ReadByte() << 16; v |= input.ReadByte() << 8; v |= input.ReadByte(); return(v); } case IntegerType.Int32: { int v = 0; v |= input.ReadByte() << 24; v |= input.ReadByte() << 16; v |= input.ReadByte() << 8; v |= input.ReadByte(); return(v); } default: throw new NotSupportedException(); } }
private static void RetorneApenasNumeroInformado() { Console.Clear(); var valorInformado = Console.ReadLine(); var valorRetornado = valores.Find(valor => valor == IntegerType.FromString(valorInformado)); if (valorRetornado != 0) { Console.WriteLine($"Valor encontrado: {valorRetornado}"); } else { Console.WriteLine("Valor não encontrado"); } Console.WriteLine("Pressione enter pra voltar ao menu"); Console.ReadLine(); }
private bool ExistePrestacion(int Identificador) { bool flag = false; int num1 = 0; int num2 = checked (this.dtDatos.Rows.Count - 1); int index = num1; while (index <= num2) { if (IntegerType.FromObject(this.dgDatos[index, 2]) == Identificador) { flag = true; } checked { ++index; } } return(flag); }
private void LoadConfig(string cwd) { _config.Load(cwd); _processSleepSeconds = IntegerType.FromString(_config.SelectSingleNode(_configBase + "processSleepSeconds").InnerText); _ipAddress = _config.SelectSingleNode(_configBase + "ipAddress").InnerText; _port = IntegerType.FromString(_config.SelectSingleNode(_configBase + "port").InnerText); _username = _config.SelectSingleNode(_configBase + "username").InnerText; _password = _config.SelectSingleNode(_configBase + "password").InnerText; _dbConnectionString = _config.SelectSingleNode(_configBase + "dbConnectionString").InnerText; _outputLocationPath = _config.SelectSingleNode(_configBase + "outputLocationPath").InnerText; _deleteVideos = _config.SelectSingleNode(_configBase + "deleteVideos").InnerText == "true"; _audioSilenceRemove = _config.SelectSingleNode(_configBase + "audioSilenceRemove").InnerText == "true"; _audiodBThreshold = _config.SelectSingleNode(_configBase + "audiodBThreshold").InnerText; _audioExportPath = _config.SelectSingleNode(_configBase + "audioExportPath").InnerText; _cameraName = _config.SelectSingleNode(_configBase + "cameraName").InnerText; }
public void TestEnumerable() { const string test = "SomeEnum ::= INTEGER {first(1), second(2)}"; Lexer lexer = new Lexer(); StringReader reader = new StringReader(test); lexer.Parse(reader); string name = lexer.NextSymbol.ToString(); lexer.NextSymbol.Expect(Symbol.Assign); lexer.NextSymbol.Expect(Symbol.Integer); IntegerType i = new IntegerType("module", "name", lexer); Assert.IsTrue(i.IsEnumeration); Assert.AreEqual("first(1)", i[1]); }
private Studies GetStudies(string name, SqlCommand command) { command.CommandText = "select * from Studies WHERE Name like @name"; command.Parameters.AddWithValue("name", name); var dataRow = command.ExecuteReader(); if (dataRow.Read()) { Studies studies = new Studies(); studies.IdStudy = IntegerType.FromString(dataRow["IdStudy"].ToString()); studies.Name = dataRow["Name"].ToString(); dataRow.Close(); return(studies); } dataRow.Close(); throw new NotFoundException(); }
public static void FormatArgs(List <string> args) { for (var i = 0; i < args.Count; i++) { if (args[i].StartsWith("$")) { try { var index = IntegerType.FromString(args[i].Substring(1)); args[i] = Console.PreviousList[index - 1]; // Starts at 1 rather than 0 } catch (Exception e) { } } } }
private void cmbAceptar_Click(object sender, EventArgs e) { if (StringType.StrCmp(this.editCantMeses.Text, Strings.Space(0), false) == 0) { Interaction.MsgBox("Debe indicar cantidad de meses", 0x10, "Operador"); this.editCantMeses.Focus(); } else { this.editCantMeses.Enabled = false; this.cmbAceptar.Enabled = false; this.cmbSalir.Enabled = false; Variables.gCantMeses = IntegerType.FromString(this.editCantMeses.Text); frmConsInv1_1 inv_ = new frmConsInv1_1(); this.Hide(); inv_.Show(); } }
public override TypeValidationResult CheckType() { Type = new IntegerType(); var result = Right.CheckType(); if (result.HasError) { return(result); } if (Type.Equals(result.Type) == false) { return(TypeValidationResult.Invalid(Position, $"Negate operator called with expression which is not integer")); } return(TypeValidationResult.Valid(Type)); }
private void toolStripButton9_Click(object sender, EventArgs e) { ToolStripButton button = sender as ToolStripButton; if (button == null) { return; } ClsTerrain clsTerrain = (ClsTerrain)this.GroupSelect.SelectedItem; if (clsTerrain == null) { return; } this.iTransition.SetHashKey(IntegerType.FromObject(button.Tag), checked ((byte)clsTerrain.GroupID)); this.PictureBox1.Refresh(); }
private static void Translate(Module module, MethodBase method) { var function = EmitFunction(module, method); if (method.IsStatic == false) { throw new CudaSharpException("Cannot translate instance methods to GPU code"); } var metadataArgs = new[] { function, PInvoke.LLVMMDStringInContext(module.Context, "kernel"), IntegerType.GetInt32(module.Context).Constant(1, true) }; var metadata = module.Context.MetadataNodeInContext(metadataArgs); module.AddNamedMetadataOperand("nvvm.annotations", metadata); }
public Models_Zadanie10.Enrollment EnrollStudent(EnrollStudentReq req) { using (var db = new s18734Context()) { using (var transaction = db.Database.BeginTransaction()) { var study = DoStudiesExist(req.Studies); if (study == null) { transaction.Rollback(); throw new Exception("Studia nie istnieja"); } Models_Zadanie10.Enrollment enrollment = GetEnrollment(study.IdStudy); if (enrollment == null) { enrollment = new Models_Zadanie10.Enrollment() { Semester = 1, IdStudy = study.IdStudy, StartDate = DateType.FromString(DateTime.Now.ToString("MM.dd.yyyy")) }; db.Enrollment.Add(enrollment); db.SaveChanges(); } if (checkIfStudentExist(req.IndexNumber)) { transaction.Rollback(); throw new Exception(); } var stud = new Models_Zadanie10.Student { IndexNumber = req.IndexNumber, FirstName = req.FirstName, LastName = req.LastName, BirthDate = DateType.FromString(req.BirthDate), IdEnrollment = IntegerType.FromObject(enrollment.IdEnrollment) }; db.Student.Add(stud); db.SaveChanges(); transaction.Commit(); return(enrollment); } } }
private void BuscarCliente() { this.Cursor = Cursors.WaitCursor; Consulta.cCliente cCliente = new Consulta.cCliente(0, IntegerType.FromString(((TextBox)this.txtCliente).Text)); cCliente.CargaDatos(); if (StringType.StrCmp(((Consulta.ConsultaBase3)cCliente).Cliente, "", false) != 0) { this.lblCliente.Text = ((Consulta.ConsultaBase3)cCliente).Cliente; this.lblRuta.Text = ((Consulta.ConsultaBase3)cCliente).Ruta; } else { this.LimpiarCliente(); int num = (int)MessageBox.Show(new Mensaje(3).Mensaje, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Hand); this.ActiveControl = (Control)this.txtCliente; ((TextBoxBase)this.txtCliente).Clear(); } this.Cursor = Cursors.Default; }
protected override void Edit(CurrencyManager source, int rowNum, Rectangle bounds, bool readOnly, string instantText, bool cellIsVisible) { Debug.WriteLine("ComboBox Edit"); Point point = this.DataGridTableStyle.DataGrid.PointToClient(Cursor.Position); Rectangle controlBounds = this.GetControlBounds(bounds); Rectangle rectangle2 = new Rectangle(point.X, point.Y, 1, 1); this.m_comboBox.SelectedIndex = IntegerType.FromObject(this.GetColumnValueAtRow(source, rowNum)); Debug.WriteLine(DoubleType.FromString("SelectedItem: ") + this.m_comboBox.SelectedIndex); Point point2 = new Point(controlBounds.X, controlBounds.Y); this.m_comboBox.Location = point2; this.m_comboBox.Visible = true; if (rectangle2.IntersectsWith(controlBounds)) { this.m_comboBox.DroppedDown = true; } this.m_previouslyEditedCellRow = rowNum; }
public static int GetIntMax(IntegerType type) { switch (type) { case IntegerType.U8: return(byte.MaxValue); case IntegerType.S8: return(sbyte.MaxValue); case IntegerType.U16: return(ushort.MaxValue); case IntegerType.S16: return(short.MaxValue); case IntegerType.U32: return(unchecked ((int)uint.MaxValue)); case IntegerType.S32: return(int.MaxValue); } throw new ArgumentException($"The type \"{type}\" is not a supported int type."); }
protected override void Paint(Graphics g, Rectangle bounds, CurrencyManager source, int rowNum, Brush backBrush, Brush foreBrush, bool alignToRight) { g.FillRectangle(new SolidBrush(Color.White), bounds); StringFormat format = new StringFormat(); format.Alignment = StringAlignment.Near; format.LineAlignment = StringAlignment.Center; Rectangle controlBounds = this.GetControlBounds(bounds); int num = IntegerType.FromObject(this.GetColumnValueAtRow(source, rowNum)); string text = this.m_comboBox.Items[num].ToString(); RectangleF layoutRectangle = new RectangleF((float)(controlBounds.X + 1), (float)(controlBounds.Y + 4), (float)(controlBounds.Width - 3), (float)((int)Math.Round((double)g.MeasureString(text, this.m_comboBox.Font).Height))); g.DrawString(text, this.m_comboBox.Font, foreBrush, layoutRectangle); ControlPaint.DrawBorder3D(g, controlBounds, Border3DStyle.Sunken); Rectangle rectangle = controlBounds; rectangle.Inflate(-2, -2); ControlPaint.DrawComboButton(g, rectangle.X + (controlBounds.Width - 20), rectangle.Y, 0x10, 0x11, ButtonState.Normal); }
public static long GetIntMin(IntegerType type) { switch (type) { case IntegerType.U8: return(byte.MinValue); case IntegerType.S8: return(sbyte.MinValue); case IntegerType.U16: return(ushort.MinValue); case IntegerType.S16: return(short.MinValue); case IntegerType.U32: return(uint.MinValue); case IntegerType.S32: return(int.MinValue); } throw new ArgumentException($"The type \"{type}\" is not a supported int type."); }
private int GetIntFrom(string val, IntegerType type) { switch (type) { case IntegerType.Binary: val = val.Replace("0b", ""); return(Convert.ToInt32(val, 2)); case IntegerType.Decimal: return(Convert.ToInt32(val, 10)); case IntegerType.Hexadecimal: val = val.Replace("0x", ""); return(Convert.ToInt32(val, 16)); default: throw new ArgumentOutOfRangeException(nameof(type), type, null); } }
public override bool check(CodeContext context) { if (is_checked) { return(!error); } is_checked = true; if (get_char() < 128) { value_type = new IntegerType((Struct)context.analyzer.root_symbol.scope.lookup("char")); } else { value_type = new IntegerType((Struct)context.analyzer.root_symbol.scope.lookup("unichar")); } return(!error); }
/// <summary> /// Tipos básicos não possuem transformações especiais. /// </summary> /// <param name="valueTypes"></param> /// <returns></returns> private static TypeBase GetTypeFromValue(TypeRef valueTypes) { if (valueTypes == null) { return(null); } switch (valueTypes.AsString().ToLower()) { case "byte[]": case "string": return(StringType.Create()); case "int": return(IntegerType.Create()); case "int?": return(IntegerType.CreateNullable()); case "datetime": return(DateType.Create()); case "datetime?": return(DateType.CreateNullable()); case "long": return(LongType.Create()); case "long?": return(LongType.CreateNullable()); case "bool": return(BoolType.Create()); case "bool?": return(BoolType.CreateNullable()); default: throw new ArgumentOutOfRangeException("valueTypes", "Não foi possível determinar o tipo da propriedade!"); } }
static BuiltinType() { i8 = new IntegerType { Name = "i8", FullyQualifiedName = "i8", SymbolName = "int8_t", Size = 1, Alignment = 1, Signed = true/*, Context = BindingContext.EmptyContext */}; i16 = new IntegerType { Name = "i16", FullyQualifiedName = "i16", SymbolName = "int16_t", Size = 2, Alignment = 2, Signed = true/*, Context = BindingContext.EmptyContext */}; i32 = new IntegerType { Name = "i32", FullyQualifiedName = "i32", SymbolName = "int32_t", Size = 4, Alignment = 4, Signed = true/*, Context = BindingContext.EmptyContext */}; i64 = new IntegerType { Name = "i64", FullyQualifiedName = "i64", SymbolName = "int64_t", Size = 8, Alignment = 8, Signed = true/*, Context = BindingContext.EmptyContext */}; u8 = new IntegerType { Name = "u8", FullyQualifiedName = "u8", SymbolName = "uint8_t", Size = 1, Alignment = 1, Signed = false/*, Context = BindingContext.EmptyContext */}; u16 = new IntegerType { Name = "u16", FullyQualifiedName = "u16", SymbolName = "uint16_t", Size = 2, Alignment = 2, Signed = false/*, Context = BindingContext.EmptyContext */}; u32 = new IntegerType { Name = "u32", FullyQualifiedName = "u32", SymbolName = "uint32_t", Size = 4, Alignment = 4, Signed = false/*, Context = BindingContext.EmptyContext */}; u64 = new IntegerType { Name = "u64", FullyQualifiedName = "u64", SymbolName = "uint64_t", Size = 8, Alignment = 8, Signed = false/*, Context = BindingContext.EmptyContext */}; f32 = new FloatType { Name = "f32", FullyQualifiedName = "f32", SymbolName = "float", Size = 4, Alignment = 4 /*, Context = BindingContext.EmptyContext */}; f64 = new FloatType { Name = "f64", FullyQualifiedName = "f64", SymbolName = "double", Size = 8, Alignment = 8 /*, Context = BindingContext.EmptyContext */}; Void = new VoidType { Name = "void", FullyQualifiedName = "void", SymbolName = "void" /*, Context = BindingContext.EmptyContext */}; Auto = new AutoType(); VoidPtr = new PointerType { PointsTo = Void }; CharPtr = new PointerType { PointsTo = i8 }; }
public Studies GetStudies(string studiesName) { using var connection = SqlConnection; using var command = new SqlCommand { Connection = connection, CommandText = "SELECT * FROM Studies WHERE Name = @studiesName" }; command.Parameters.AddWithValue("studiesName", studiesName); connection.Open(); using var dataReader = command.ExecuteReader(); if (dataReader.Read()) { Studies studies = new Studies { IdStudy = IntegerType.FromObject(dataReader["IdStudy"]), Name = dataReader["Name"].ToString() }; return(studies); } return(null); }
private void Imprimir() { if (this.Grid.VisibleRowCount <= 0) { return; } if (StringType.StrCmp(StringType.FromObject(this.Grid[this.Grid.CurrentRowIndex, 9]), "1", false) == 0) { if (StringType.StrCmp(StringType.FromObject(this.Grid[this.Grid.CurrentRowIndex, 7]), "AUTORIZADO", false) == 0) { this.ImprimirReporte((int)Globals.GetInstance._Sucursal, IntegerType.FromObject(this.Grid[this.Grid.CurrentRowIndex, 0]), IntegerType.FromObject(this.Grid[this.Grid.CurrentRowIndex, 1])); } else { int num1 = (int)MessageBox.Show("Para imprimir un vale, el anticipo debe ser autorizado.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } } else { int num2 = (int)MessageBox.Show("Los vales solo se generan de los anticipos de comisión.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } }
protected static int GetInteger(BinaryReader input, IntegerType type) { const byte ByteLengthCutoff = 0xF0; var t = (byte)type; if (t < ByteLengthCutoff) return t - 1; switch (type) { case IntegerType.Byte: return (input.ReadByte()); case IntegerType.ByteTimes256: return (input.ReadByte() * 256); case IntegerType.Int16: { int v = 0; v |= input.ReadByte() << 8; v |= input.ReadByte(); return (v); } case IntegerType.Int24: { int v = 0; v |= input.ReadByte() << 16; v |= input.ReadByte() << 8; v |= input.ReadByte(); return (v); } case IntegerType.Int32: { int v = 0; v |= input.ReadByte() << 24; v |= input.ReadByte() << 16; v |= input.ReadByte() << 8; v |= input.ReadByte(); return (v); } default: throw new NotSupportedException(); } }
public override object Visit(IntegerType that, object value) { var result = (System.Text.StringBuilder) value; // Output type specifier. result.Append('s'); // 's' for signed as 'i' is used for 'interface' // Output width specifier. #if FEATURE_SCALAR_WIDTH char width; switch (that.Width) { case 0: width = '0'; break; case 8: width = '1'; break; case 16: width = '2'; break; case 32: width = '3'; break; case 64: width = '4'; break; case 128: width = '5'; break; case 256: width = '6'; break; default : throw new System.Exception("Invalid scalar width encountered: " + that.Width.ToString()); } result.Append(width); #else result.Append('0'); #endif return null; }
public override object Visit(IntegerType that, object value = null) { return null; }
public override object Visit(IntegerType that, object value = null) { PrintPrologue(that); _writer.WriteLine("TypeKind = {0}", that.TypeKind.ToString()); #if FEATURE_SCALAR_WIDTH _writer.WriteLine("Width = {0}", that.Width.ToString()); #endif PrintEpilogue(that); return null; }
public override AstNode VisitIntegerType(IntegerType ast) { ast.ResolvedType = PrimaryType.Int; return ast; }
public override object Visit(IntegerType that, object value = null) { _writer.Write("integer"); return null; }
public static void AddInteger(this CompositeType type, IntegerType value) { type.Add(value); }
public virtual object Visit(IntegerType that, object value) { throw new System.NotImplementedException(); }
void IntegerRangeAsType(Scope scope, out IntegerType type) { IntegerRange range; IntegerRange(scope, out range); type = new IntegerType(range.min, range.max); }