/// <summary> /// Constructor with fileName, path and dayInterval. The file is created in the specified directory, if the directory /// does not exist, the file is created in the same directory than the program. /// An archivage is set with the specified number of days. /// </summary> /// <param name="fileName">Name of the log file</param> /// <param name="path">The path of the directory where the log file will be saved</param> /// <param name="dayInterval">Number of days etween each archivage</param> public LogManager(String fileName, String path, Int32 dayInterval) { this.FileName = fileName; setPath(path); // this.fileManager = new FileManager(this.fileName, this.path); setArchiveManager(dayInterval); }
public String CommonNames(Int32 cutOff) { StringBuilder builder = new StringBuilder(); builder.AppendLine("Total number: " + NumberOfEntities.ToString()); List<KeyValuePair<String, Int32>> sorted = new List<KeyValuePair<String, Int32>>(); foreach ( var keyValuePair in _namesCount ) { String name = keyValuePair.Key; sorted.Add(keyValuePair); } sorted.Sort(delegate(KeyValuePair<String, Int32> x, KeyValuePair<String, Int32> y) { return y.Value.CompareTo(x.Value); }); Int32 count = 0; foreach ( var keyValuePair in sorted ) { builder.AppendLine(keyValuePair.Key + " (" + keyValuePair.Value.ToString() + ") "); count++; if ( count > cutOff ) { break; } } String result = builder.ToString(); return result; }
/// <summary> /// Récupère une Genre à partir d'un identifiant de client /// </summary> /// <param name="Identifiant">Identifant de Genre</param> /// <returns>Un Genre </returns> public static Genre Get(Int32 identifiant) { //Connection ConnectionStringSettings connectionStringSettings = ConfigurationManager.ConnectionStrings["EntretienSPPPConnectionString"]; SqlConnection connection = new SqlConnection(connectionStringSettings.ToString()); //Commande String requete = @"SELECT Identifiant, Libelle FROM Genre WHERE Identifiant = @Identifiant ;"; SqlCommand commande = new SqlCommand(requete, connection); //Paramètres commande.Parameters.AddWithValue("Identifiant", identifiant); //Execution connection.Open(); SqlDataReader dataReader = commande.ExecuteReader(); dataReader.Read(); //1 - Création du Genre Genre genre = new Genre(); genre.Identifiant = dataReader.GetInt32(0); genre.libelle = dataReader.GetString(1); dataReader.Close(); connection.Close(); return genre; }
public void DajPonudu(DataTable ponuda, Int32 ponuda_ID) { SqlConnection _konekcijaSqlConnection = new SqlConnection(); using (_konekcijaSqlConnection = Konekcija.DajKonekciju()) { SqlDataAdapter _dajPonuduSQLDataAdapter = new SqlDataAdapter(); SqlCommand _dajPoslednjuPonuduSqlCommand = new SqlCommand("SELECT * FROM vwPonudaZaglavlje where Ponuda_ID = " + ponuda_ID, _konekcijaSqlConnection); _dajPonuduSQLDataAdapter.SelectCommand = _dajPoslednjuPonuduSqlCommand; //isprazni tabelu ponuda.Clear(); try { //napuni tabelu _dajPonuduSQLDataAdapter.Fill(ponuda); } catch (Exception) { throw; } } }
public DbScriptControl(Event_dataset_script Data, Int32 ID, uint id) { InitializeComponent(); this.Name = ID.ToString(); eventid = ID; script_id = id; this.eventCheckbox.Text = "Event: " + ID.ToString(); this.eventCheckbox.Checked = true; for (int n = 0; n < Info.ScriptCommands.GetLength(0); n++) this.comboBoxAction.Items.Add(Info.ScriptCommands[n, 0]); // set width comboBoxAction.DropDownWidth = DropDownWidth(comboBoxAction); comboBoxAction.DropDownStyle = ComboBoxStyle.DropDownList; this.comboBoxAction.SelectedIndex = Data.command; this.textBoxDelay.Text = Data.delay.ToString(); this.textBox_datalong.Text = Data.datalong.ToString(); this.textBox_datalong2.Text = Data.datalong2.ToString(); this.textBox_buddy.Text = Data.buddy.ToString(); this.textBox_radius.Text = Data.radius.ToString(); this.textBox_flags.Text = Data.dataflags.ToString(); this.textBox_dataint1.Text = Data.dataint.ToString(); this.textBox_dataint2.Text = Data.dataint2.ToString(); this.textBox_dataint3.Text = Data.dataint3.ToString(); this.textBox_dataint4.Text = Data.dataint4.ToString(); this.textBox_posX.Text = Data.position_x.ToString(); this.textBox_posY.Text = Data.position_y.ToString(); this.textBox_posZ.Text = Data.position_z.ToString(); this.textBox_orientation.Text = Data.orientation.ToString(); this.commentTextbox.Text = Data.comment; //switch (comboBoxAction.SelectedIndex) //{ // case 0: // talk // textBox_dataint1.ReadOnly = false; // textBox_dataint2.ReadOnly = false; // textBox_dataint3.ReadOnly = false; // textBox_dataint4.ReadOnly = false; // break; // case 3: // move // case 6: // teleport // case 10: // summon // textBox_posX.ReadOnly = false; // textBox_posY.ReadOnly = false; // textBox_posZ.ReadOnly = false; // textBox_orientation.ReadOnly = false; // break; //} locked = false; }
public Client(String host, Int32 port) { try { clientName = Dns.GetHostName(); } catch (SocketException se) { MessageBox.Show("ERROR: Could not retrieve client's DNS hostname. Please try again." + se.Message + ".", "Client Socket Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } serverName = host; gamePort = port; client = new TcpClient(host, port); netStream = client.GetStream(); reader = new StreamReader(netStream); writer = new StreamWriter(netStream); ssl = new SslStream(netStream, false, new RemoteCertificateValidationCallback(ValidateCert)); cert = new X509Certificate2("server.crt"); ssl.AuthenticateAsClient(serverName); writer.AutoFlush = true; }
//public: public Bullet(Double x_, Double y_, Int32 width_, Int32 height_, Int32 damage_, BulletKind kind_) { PosX = x_; PosY = y_; Width = width_; Height = height_; switch (kind_) { case BulletKind.Laser: { _type = BulletType.Laser; break; } case BulletKind.Exploded: { _type = BulletType.Exploded; break; } case BulletKind.Rocket: { _type = BulletType.Rocket; break; } } Damage = damage_+_type._bonusdamage; _active = true; _vx = 1; _vy = 0; _speed = _type.speed; }
public void UpdateFromInput(EditStageViewModel editStageViewModel) { World = Int32.Parse(editStageViewModel.InputWorld); Stage = Int32.Parse(editStageViewModel.InputStage); StageName = editStageViewModel.InputStageName; StageDescription = editStageViewModel.InputStageDescription; }
public GGuess() { _UserNum = (0); _AllJinbi = (0); _ResultUserNum = (0); _Status = (0); }
public PlayerViewModelBase(Player player) { //_player = player; if (player != null) { _playerId = player.PlayerId; _firstName = player.FirstName; _lastName = player.LastName; _tvName = player.TvName; _hometown = player.Hometown; _state = player.State; _position = player.Position; _positionFull = player.PositionFull; _height = player.Height; _weight = player.Weight; _class = player.Class; _headshot = player.Headshot; _kiperRank = player.KiperRank; _mcShayRank = player.McShayRank; _school = player.School; _pick = player.Pick; _tradeTidbit = player.TradeTidbit; _tidbits = player.Tidbits; loadTidbits(); } }
public static INode AddNode(this IGraph myIGraph, Int32 myInt32Id) { if (myIGraph == null) throw new ArgumentNullException("myIGraph must not be null!"); return myIGraph.AddNode(myInt32Id.ToString()); }
public ChatMessage(IDataReader idr, Int32 offsetHours) { SentBy = idr.GetValueByName<String>("SentByUserName").HTMLDecode(); Message = idr.GetValueByName<String>("Message").HTMLDecode(); SentDate = idr.GetValueByName<DateTime>("DateSent").AddHours(offsetHours); DateSent = SentDate.ToShortDateString() + " " + SentDate.ToLongTimeString(); }
// private SQLiteConnection dbConnection; public MainWindow() { InitializeComponent(); rectFaceMarker.Visibility = Visibility.Hidden; //chkShowFaceMarker.IsChecked = true; numFacesDetected = 0; userId = string.Empty; dbState = string.Empty; doRegister = false; doUnregister = false; // Start SenseManage and configure the face module ConfigureRealSense(); // Start the worker thread btnRegisterMode.IsEnabled = false; btnGetLog.Visibility = System.Windows.Visibility.Hidden; processingThread = new Thread(new ThreadStart(ProcessingThread)); processingThread.Start(); _serialPort = new SerialPort(); _serialPort.PortName = "COM3"; _serialPort.BaudRate = 9600; _serialPort.ReadTimeout = 500; _serialPort.WriteTimeout = 500; _serialPort.Open(); }
public BufferManager(Int32 totalBytes, Int32 totalBufferBytesInEachSaeaObject) { totalBytesInBufferBlock = totalBytes; this.currentIndex = 0; this.bufferBytesAllocatedForEachSaea = totalBufferBytesInEachSaeaObject; this.freeIndexPool = new Stack<int>(); }
public static bool IsHooked(Int32 processId) { lock (HookedProcesses) { return HookedProcesses.Contains(processId); } }
// SendBytesToPrinter() // When the function is given a printer name and an unmanaged array // of bytes, the function sends those bytes to the print queue. // Returns true on success, false on failure. public static bool SendBytesToPrinter( string szPrinterName, IntPtr pBytes, Int32 dwCount) { Int32 dwError = 0, dwWritten = 0; IntPtr hPrinter = new IntPtr(0); DOCINFOA di = new DOCINFOA(); bool bSuccess = false; // Assume failure unless you specifically succeed. di.pDocName = "My C#.NET RAW Document"; di.pDataType = "RAW"; // Open the printer. if( OpenPrinter( szPrinterName, out hPrinter, 0 ) ) { // Start a document. if( StartDocPrinter(hPrinter, 1, di) ) { // Start a page. if( StartPagePrinter(hPrinter) ) { // Write your bytes. bSuccess = WritePrinter(hPrinter, pBytes, dwCount, out dwWritten); EndPagePrinter(hPrinter); } EndDocPrinter(hPrinter); } ClosePrinter(hPrinter); } // If you did not succeed, GetLastError may give more information // about why not. if( bSuccess == false ) { dwError = Marshal.GetLastWin32Error(); } return bSuccess; }
public static void AddHookedProcess(Int32 processId) { lock (HookedProcesses) { HookedProcesses.Add(processId); } }
/// <summary> /// This method deletes a manager. /// </summary> /// <param name="id">Unique ID of the manager to delete</param> /// <returns>Success/Failure</returns> public Boolean deleteManager(Int32 id) { dLog.Info("Entering method deleteManager | ID:" + id); Boolean result = false; SqlConnection conn = null; SqlCommand stmt = null; try { String sqlStr = "DELETE FROM Employee WHERE id = @id"; conn = new SqlConnection(connString); conn.Open(); stmt = new SqlCommand(sqlStr, conn); stmt.Parameters.Add(new SqlParameter("@id", id)); if (stmt.ExecuteNonQuery() > 0) result = true; } catch (SqlException e1) { dLog.Error("SqlException in deleteManager: " + e1.Message); } catch (Exception e2) { dLog.Error("Exception in deleteManager: " + e2.Message); } finally { if (conn.State == System.Data.ConnectionState.Open) conn.Close(); } return result; }
// Check touch position on button public bool OnTouch(View v, MotionEvent e) { switch (e.Action) { // Get the x and y position for a touch (always before move) case MotionEventActions.Down: old_x = e.GetX (); old_y = e.GetY (); Console.WriteLine ("x = " + old_x + " y = " + old_y); break; // Get the x and y position difference continously case MotionEventActions.Move: // Get the difference between current position and old position new_x = e.GetX () - old_x; new_y = e.GetY () - old_y; // Convert to int, to remove decimal numbers (apparently can't be send through the tcp listener) int_x = Convert.ToInt32 (new_x); int_y = Convert.ToInt32 (new_y); // Convert to string, so it can be send send_x = Convert.ToString (int_x); send_y = Convert.ToString (int_y); // Send x and y position over two messages Connect (ipAddress, send_x); Connect (ipAddress, send_y); // Set old position to current position old_x = e.GetX (); old_y = e.GetY (); break; } return true; }
public NpgsqlParse(String prepareName, byte[] queryString, Int32[] parameterIDs) { _bPrepareName = BackendEncoding.UTF8Encoding.GetBytes(prepareName); _bQueryString = queryString; _parameterIDs = parameterIDs; }
public Int32 getExtraNights(Int32 id_booking) { SqlResults results = new SqlStoredProcedure("[BOBBY_TABLES].SP_GET_EXTRA_NIGHTS") .WithParam("IdBooking").As(SqlDbType.Int).Value(id_booking) .WithParam("@Extra").As(SqlDbType.Int).AsOutput() .Execute(); return (Int32)results["@Extra"]; }
/// <summary> /// Gets the bytes of an Int32. /// </summary> public static unsafe void GetBytes(Int32 value, byte[] buffer, int startIndex) { fixed(byte* numRef = buffer) { *((int*)(numRef+startIndex)) = value; } }
public float getStayPrice(Int32 id_booking) { SqlResults results = new SqlStoredProcedure("[BOBBY_TABLES].SP_GET_STAY_PRICE") .WithParam("@IdBooking").As(SqlDbType.Int).Value(id_booking) .WithParam("@Price").As(SqlDbType.Float).AsOutput() .Execute(); return (float)results["@Price"]; }
public void ObrisiPonudu(Int32 ponuda_ID) { SqlConnection _konekcijaSqlConnection = new SqlConnection(); using (_konekcijaSqlConnection = Konekcija.DajKonekciju()) { SqlCommand _obrisiRobuSQLCommand = new SqlCommand("uspObrisiPonudu", _konekcijaSqlConnection); _obrisiRobuSQLCommand.CommandType = CommandType.StoredProcedure; #region Definisi parametre _obrisiRobuSQLCommand.Parameters.Add("@Ponuda_ID", SqlDbType.Int).Value = ponuda_ID; #endregion try { _konekcijaSqlConnection.Open(); _obrisiRobuSQLCommand.ExecuteNonQuery(); } catch (Exception) { throw; } finally { _konekcijaSqlConnection.Close(); } } }
public override void Decode() { MemoryStream stream = new MemoryStream(Data); BinaryReader reader = new BinaryReader(stream); this.ShapeId = reader.ReadInt32(); this.Flags = reader.ReadInt32(); }
public TimesheetBillingCityRateJoinCollection FetchActiveByTimesheetId(Int32 timesheetId) { return new TimesheetBillingCityRateJoinCollection() .Where(TimesheetBillingCityRateJoin.Columns.TimesheetId, timesheetId) .Where(TimesheetBillingCityRateJoin.Columns.IsDeleted, false) .OrderByAsc(TimesheetBillingCityRateJoin.Columns.City).Load(); }
public InsurancePrem GetById(Int32? id) { using (var session = GetSession()) { return session.Get<InsurancePrem>(id); } }
/// <summary> /// ��ȡ���νṹ���� /// </summary> public IList<ModelCategory> CategoryAllThree(out string resultMsg, Int32 ParentCateg = 0) { resultMsg = string.Empty; IList<ModelCategory> list = new List<ModelCategory>(); try { //�洢�������� string sql = "usp_category_select_all_by_three"; //������� IList<DBParameter> parm = new List<DBParameter>(); parm.Add(new DBParameter() { ParameterName = "@ParentCateg", ParameterValue = ParentCateg, ParameterInOut = BaseDict.ParmIn, ParameterType = DbType.Int32 }); //��ѯִ�� using (IDataReader dr = DBHelper.ExecuteReader(sql, true, parm)) { var listTemp = GetModelThree(dr); list = GetCategoryAllThree(listTemp, ParentCateg); } } catch (Exception ex) { resultMsg = string.Format("{0} {1}", BaseDict.ErrorPrefix, ex.ToString()); } return list; }
public static void SetUp(TestContext context) { _unitOfWork = new UnitOfWork(); var memberFactory = new MemberFactory(); _email = Guid.NewGuid().ToString(); _decorator = new MemberDecorator(memberFactory, _unitOfWork.MemberRepository); _oldCount = _unitOfWork.MemberRepository.Count(); _member = memberFactory.CreateMember(_email); _sameMember = memberFactory.CreateMember(_email); _decorator.Add(_member); _unitOfWork.PersistAll(); using (var uow = new UnitOfWork()) { _newCount = uow.MemberRepository.Count(); try { _loadedMember = uow.MemberRepository.Get(_member.Id); } catch (Exception) { _loadedMember = null; } } }
/// <summary> /// ���� ɾ�� /// </summary> /// <param name="id">Id ���</param> /// <returns>ִ�н��</returns> public int CategoryDelete(out string resultMsg, Int32 id, DbTransaction tran = null) { resultMsg = string.Empty; int res = 0; try { //�洢�������� string sql = "usp_category_delete_by_id"; //������� IList<DBParameter> parm = new List<DBParameter>(); parm.Add(new DBParameter() { ParameterName = "ID", ParameterValue = id, ParameterInOut = BaseDict.ParmIn, ParameterType = DbType.Int32 }); //parm.Add(new DBParameter() { ParameterName = "resultMsg", ParameterInOut = BaseDict.ParmOut, ParameterType = DbType.String }); //����ִ�� res = DBHelper.ExecuteNonQuery(sql, true, parm, tran); //foreach (var item in parm) //{ // //��ȡ�������ֵ // if (item.ParameterName == "resultMsg") // { // resultMsg = item.ParameterValue.ToString(); // break; // } //} } catch (Exception ex) { if (tran != null) tran.Rollback(); resultMsg = string.Format("{0} {1}", BaseDict.ErrorPrefix, ex.ToString()); } return res; }
/// <summary> /// Retrieves a specific <see cref="!:SearchTypeModel" /> instance. /// </summary> /// <param name="id"> /// The unique value which distinctly identifies the <see cref="!:SearchTypeModel" /> instance to be returned. /// </param> /// <returns> /// The <see cref="!:SearchTypeModel" /> instance that matches the specified <paramref name="id" />; or null, if no matching instance can be found. /// </returns> Consensus.Search.ISearchTypeModel ISearchTypeFactory.FetchById(System.Int32 id) { return(this.FetchById(id)); }
public virtual void SetInt32(int ordinal, System.Int32 value) { EnsureSubclassOverride(); ValueUtilsSmi.SetInt32(_eventSink, _recordBuffer, ordinal, GetSmiMetaData(ordinal), value); }
/// <summary> CTor</summary> /// <param name="productPhotoId">PK value for ProductPhoto which data should be fetched into this ProductPhoto object</param> /// <param name="validator">The custom validator object for this ProductPhotoEntity</param> public ProductPhotoEntity(System.Int32 productPhotoId, IValidator validator) { InitClassEmpty(validator, null); this.ProductPhotoId = productPhotoId; }
/// <summary> CTor</summary> /// <param name="territoryId">PK value for SalesTerritory which data should be fetched into this SalesTerritory object</param> /// <param name="validator">The custom validator object for this SalesTerritoryEntity</param> /// <remarks>The entity is not fetched by this constructor. Use a DataAccessAdapter for that.</remarks> public SalesTerritoryEntity(System.Int32 territoryId, IValidator validator) : base("SalesTerritoryEntity") { InitClassEmpty(validator, null); this.TerritoryId = territoryId; }
static StackObject *PopulateUIVertex_3(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 3); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Int32 @i = ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); UnityEngine.UIVertex @vertex = (UnityEngine.UIVertex) typeof(UnityEngine.UIVertex).CheckCLRTypes(__intp.RetriveObject(ptr_of_this_method, __mStack)); ptr_of_this_method = ILIntepreter.Minus(__esp, 3); UnityEngine.UI.VertexHelper instance_of_this_method; instance_of_this_method = (UnityEngine.UI.VertexHelper) typeof(UnityEngine.UI.VertexHelper).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.PopulateUIVertex(ref @vertex, @i); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); switch (ptr_of_this_method->ObjectType) { case ObjectTypes.StackObjectReference: { var ___dst = *(StackObject **)&ptr_of_this_method->Value; object ___obj = vertex; if (___dst->ObjectType >= ObjectTypes.Object) { if (___obj is CrossBindingAdaptorType) { ___obj = ((CrossBindingAdaptorType)___obj).ILInstance; } __mStack[___dst->Value] = ___obj; } else { ILIntepreter.UnboxObject(___dst, ___obj, __mStack, __domain); } } break; case ObjectTypes.FieldReference: { var ___obj = __mStack[ptr_of_this_method->Value]; if (___obj is ILTypeInstance) { ((ILTypeInstance)___obj)[ptr_of_this_method->ValueLow] = vertex; } else { var ___type = __domain.GetType(___obj.GetType()) as CLRType; ___type.SetFieldValue(ptr_of_this_method->ValueLow, ref ___obj, vertex); } } break; case ObjectTypes.StaticFieldReference: { var ___type = __domain.GetType(ptr_of_this_method->Value); if (___type is ILType) { ((ILType)___type).StaticInstance[ptr_of_this_method->ValueLow] = vertex; } else { ((CLRType)___type).SetStaticFieldValue(ptr_of_this_method->ValueLow, vertex); } } break; case ObjectTypes.ArrayReference: { var instance_of_arrayReference = __mStack[ptr_of_this_method->Value] as UnityEngine.UIVertex[]; instance_of_arrayReference[ptr_of_this_method->ValueLow] = vertex; } break; } return(__ret); }
/// <summary> CTor</summary> /// <param name="productId">PK value for SpecialOfferProduct which data should be fetched into this SpecialOfferProduct object</param> /// <param name="specialOfferId">PK value for SpecialOfferProduct which data should be fetched into this SpecialOfferProduct object</param> /// <param name="validator">The custom validator object for this SpecialOfferProductEntity</param> /// <remarks>The entity is not fetched by this constructor. Use a DataAccessAdapter for that.</remarks> public SpecialOfferProductEntity(System.Int32 productId, System.Int32 specialOfferId, IValidator validator) : base("SpecialOfferProductEntity") { InitClassEmpty(validator, null); this.ProductId = productId; this.SpecialOfferId = specialOfferId; }
public override NSDragOperation ValidateDrop(NSTableView tableView, NSDraggingInfo info, nint row, NSTableViewDropOperation dropOperation) { return(NSDragOperation.None); }
/// <summary>从字符串中检索子字符串,在指定头部字符串之后,指定尾部字符串之前</summary> /// <remarks>常用于截取xml某一个元素等操作</remarks> /// <param name="str">目标字符串</param> /// <param name="after">头部字符串,在它之后</param> /// <param name="before">尾部字符串,在它之前</param> /// <param name="startIndex">搜索的开始位置</param> /// <param name="positions">位置数组,两个元素分别记录头尾位置</param> /// <returns></returns> public static String Substring(this String str, String after, String before = null, Int32 startIndex = 0, Int32[] positions = null) { if (String.IsNullOrEmpty(str)) return str; if (String.IsNullOrEmpty(after) && String.IsNullOrEmpty(before)) return str; /* * 1,只有start,从该字符串之后部分 * 2,只有end,从开头到该字符串之前 * 3,同时start和end,取中间部分 */ var p = -1; if (!String.IsNullOrEmpty(after)) { p = str.IndexOf(after, startIndex); if (p < 0) return null; p += after.Length; // 记录位置 if (positions != null && positions.Length > 0) positions[0] = p; } if (String.IsNullOrEmpty(before)) return str.Substring(p); var f = str.IndexOf(before, p >= 0 ? p : startIndex); if (f < 0) return null; // 记录位置 if (positions != null && positions.Length > 1) positions[1] = f; if (p >= 0) return str.Substring(p, f - p); else return str.Substring(0, f); }
/// <summary>在列表项中进行模糊搜索</summary> /// <typeparam name="T"></typeparam> /// <param name="list"></param> /// <param name="keys"></param> /// <param name="keySelector"></param> /// <param name="count"></param> /// <returns></returns> public static IEnumerable<T> LCSSearch<T>(this IEnumerable<T> list, String keys, Func<T, String> keySelector, Int32 count = -1) { var rs = LCS(list, keys, keySelector); if (count >= 0) rs = rs.OrderBy(e => e.Value).Take(count); else rs = rs.OrderBy(e => e.Value); return rs.Select(e => e.Key); }
/// <summary>模糊匹配</summary> /// <typeparam name="T"></typeparam> /// <param name="list">列表项</param> /// <param name="keys">关键字</param> /// <param name="keySelector">匹配字符串选择</param> /// <param name="count">获取个数</param> /// <param name="confidence">权重阀值</param> /// <returns></returns> public static IEnumerable<T> Match<T>(this IEnumerable<T> list, String keys, Func<T, String> keySelector, Int32 count, Double confidence = 0.5) { var rs = Match(list, keys, keySelector).Where(e => e.Value >= confidence); if (count >= 0) rs = rs.OrderByDescending(e => e.Value).Take(count); else rs = rs.OrderByDescending(e => e.Value); return rs.Select(e => e.Key); }
public static extern UInt64 BitBlt(IntPtr hDestDC, int x, int y, int nWidth, int nHeight, IntPtr hSrcDC, int xSrc, int ySrc, System.Int32 dwRop);
private void btnSelect_Click(object sender, EventArgs e) { ESRI.ArcGIS.Framework.IProgressDialogFactory progressDialogFactory = null; ESRI.ArcGIS.esriSystem.IStepProgressor stepProgressor = null; ESRI.ArcGIS.Framework.IProgressDialog2 progressDialog = null; // Create a CancelTracker ESRI.ArcGIS.esriSystem.ITrackCancel trackCancel = null; ISpatialFilter pSpatFilt = null; IFeatureLayer pFL = null; IFeatureCursor pFCurs = null; IFeature pFeat = null; ISimpleJunctionFeature pSimpFeat = null; // Create an edit operation enabling undo/redo try { (_app.Document as IMxDocument).FocusMap.ClearSelection(); trackCancel = new ESRI.ArcGIS.Display.CancelTrackerClass(); // Set the properties of the Step Progressor System.Int32 int32_hWnd = _app.hWnd; progressDialogFactory = new ESRI.ArcGIS.Framework.ProgressDialogFactoryClass(); stepProgressor = progressDialogFactory.Create(trackCancel, int32_hWnd); stepProgressor.MinRange = 0; stepProgressor.MaxRange = lstJunctionLayers.Items.Count; stepProgressor.StepValue = 1; stepProgressor.Message = A4LGSharedFunctions.Localizer.GetString("SltByJctCountProc_1"); // Create the ProgressDialog. This automatically displays the dialog progressDialog = (ESRI.ArcGIS.Framework.IProgressDialog2)stepProgressor; // Explict Cast // Set the properties of the ProgressDialog progressDialog.CancelEnabled = true; progressDialog.Description = A4LGSharedFunctions.Localizer.GetString("SltByJctCountProc_1"); progressDialog.Title = A4LGSharedFunctions.Localizer.GetString("SltByJctCountProc_1"); progressDialog.Animation = ESRI.ArcGIS.Framework.esriProgressAnimationTypes.esriProgressGlobe; progressDialog.ShowDialog(); for (int i = 0; i < lstJunctionLayers.Items.Count; i++) { bool boolean_Continue = trackCancel.Continue(); if (!boolean_Continue) { return; } progressDialog.Description = A4LGSharedFunctions.Localizer.GetString("SltByJctCountProc_2") + lstJunctionLayers.Items[i].ToString(); if (lstJunctionLayers.GetItemCheckState(i) == CheckState.Checked) { bool FCorLayer = true; pFL = (IFeatureLayer)Globals.FindLayer(_app, lstJunctionLayers.Items[i].ToString(), ref FCorLayer); if (pFL != null) { pSpatFilt = new SpatialFilterClass(); pSpatFilt.Geometry = _env as IGeometry; pSpatFilt.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects; pSpatFilt.GeometryField = pFL.FeatureClass.ShapeFieldName; int featCnt = pFL.FeatureClass.FeatureCount(pSpatFilt); if (featCnt > 0) { pFCurs = pFL.Search(pSpatFilt, true); pFeat = pFCurs.NextFeature(); int loopCnt = 1; while (pFeat != null) { boolean_Continue = trackCancel.Continue(); if (!boolean_Continue) { return; } stepProgressor.Message = A4LGSharedFunctions.Localizer.GetString("SltByJctCountProc_3") + loopCnt + A4LGSharedFunctions.Localizer.GetString("Of") + featCnt; if (pFeat is SimpleJunctionFeature) { pSimpFeat = (ISimpleJunctionFeature)pFeat; if (pSimpFeat.EdgeFeatureCount >= numMinEdge.Value && pSimpFeat.EdgeFeatureCount <= numMaxEdge.Value) { (_app.Document as IMxDocument).FocusMap.SelectFeature(pFL as ILayer, pFeat); } } loopCnt++; pFeat = pFCurs.NextFeature(); } } } } stepProgressor.Step(); } } catch (Exception ex) { MessageBox.Show(A4LGSharedFunctions.Localizer.GetString("ErrorInThe") + A4LGSharedFunctions.Localizer.GetString("SltByJctCountLbl_22") + "\r\n" + ex.ToString()); } finally { if (progressDialog != null) { progressDialog.HideDialog(); } progressDialogFactory = null; stepProgressor = null; progressDialog = null; trackCancel = null; pSpatFilt = null; pFL = null; if (pFCurs != null) { System.Runtime.InteropServices.Marshal.ReleaseComObject(pFCurs); } pFCurs = null; pFeat = null; pSimpFeat = null; this.Hide(); (_app.Document as IMxDocument).ActiveView.Refresh(); MessageBox.Show((_app.Document as IMxDocument).FocusMap.SelectionCount + A4LGSharedFunctions.Localizer.GetString("SltByJctCountMess_1")); } }
/// <summary> CTor</summary> /// <param name="supplierId">PK value for Supplier which data should be fetched into this Supplier object</param> /// <param name="validator">The custom validator object for this SupplierEntity</param> /// <remarks>The entity is not fetched by this constructor. Use a DataAccessAdapter for that.</remarks> public SupplierEntity(System.Int32 supplierId, IValidator validator) : base("SupplierEntity") { InitClassEmpty(validator, null); this.SupplierId = supplierId; }
public override NSObject GetObjectValue(NSTableView tableView, NSTableColumn tableColumn, nint row) { return(NSNumber.FromInt32((int)row)); }
/// <summary> /// Gets rows from the datasource based on the PK_Classes index. /// </summary> /// <param name="_id"></param> /// <param name="start">Row number at which to start reading, the first row is 0.</param> /// <param name="pageLength">Number of rows to return.</param> /// <remarks></remarks> /// <returns>Returns an instance of the <see cref="School.Entities.Classes"/> class.</returns> public School.Entities.Classes GetById(System.Int32 _id, int start, int pageLength) { int count = -1; return(GetById(null, _id, start, pageLength, out count)); }
/// <summary> /// Copies the elements of the collection to a <see cref="System.Array">System.Array</see>, starting at a particular index. /// </summary> /// <param name="array">The one-dimensional <see cref="System.Array">System.Array</see> that is the destination of the elements. The array must have zero-based indexing.</param> /// <param name="index">The zero-based index in <i>array</i> at which copying begins.</param> public void CopyTo(System.Array array, System.Int32 index) { this.List.CopyTo(array, index); }
public override void SetObjectValue(NSTableView tableView, NSObject theObject, NSTableColumn tableColumn, nint row) { }
/// <summary> /// Gets rows from the datasource based on the primary key PK_Classes index. /// </summary> /// <param name="_id"></param> /// <returns>Returns an instance of the <see cref="School.Entities.Classes"/> class.</returns> public School.Entities.Classes GetById(System.Int32 _id) { int count = -1; return(GetById(null, _id, 0, int.MaxValue, out count)); }
public override bool AcceptDrop(NSTableView tableView, NSDraggingInfo info, nint row, NSTableViewDropOperation dropOperation) { return(false); }
/// <summary> /// Deletes a row from the DataSource. /// </summary> /// <param name="transactionManager"><see cref="TransactionManager"/> object</param> /// <param name="_id">. Primary Key.</param> /// <remarks>Deletes based on primary key(s).</remarks> /// <returns>Returns true if operation suceeded.</returns> public abstract bool Delete(TransactionManager transactionManager, System.Int32 _id);
/// <summary> CTor</summary> /// <param name="territoryId">PK value for SalesTerritory which data should be fetched into this SalesTerritory object</param> /// <remarks>The entity is not fetched by this constructor. Use a DataAccessAdapter for that.</remarks> public SalesTerritoryEntity(System.Int32 territoryId) : base("SalesTerritoryEntity") { InitClassEmpty(null, null); this.TerritoryId = territoryId; }
/// <summary> /// Deletes a row from the DataSource. /// </summary> /// <param name="_id">. Primary Key.</param> /// <remarks>Deletes based on primary key(s).</remarks> /// <returns>Returns true if operation suceeded.</returns> public bool Delete(System.Int32 _id) { return(Delete(null, _id)); }
public BudgetClientAdjustmentCriteria(System.Int32 budgetClientAdjustmentID) { BudgetClientAdjustmentID = budgetClientAdjustmentID; }
/// <summary> /// Gets rows from the datasource based on the PK_Classes index. /// </summary> /// <param name="transactionManager"><see cref="TransactionManager"/> object</param> /// <param name="_id"></param> /// <param name="start">Row number at which to start reading, the first row is 0.</param> /// <param name="pageLength">Number of rows to return.</param> /// <param name="count">The total number of records.</param> /// <returns>Returns an instance of the <see cref="School.Entities.Classes"/> class.</returns> public abstract School.Entities.Classes GetById(TransactionManager transactionManager, System.Int32 _id, int start, int pageLength, out int count);
/// <summary> CTor</summary> /// <param name="productPhotoId">PK value for ProductPhoto which data should be fetched into this ProductPhoto object</param> public ProductPhotoEntity(System.Int32 productPhotoId) : this(productPhotoId, null) { }
/// <summary> /// Gets rows from the datasource based on the PK_Classes index. /// </summary> /// <param name="transactionManager"><see cref="TransactionManager"/> object</param> /// <param name="_id"></param> /// <param name="start">Row number at which to start reading, the first row is 0.</param> /// <param name="pageLength">Number of rows to return.</param> /// <remarks></remarks> /// <returns>Returns an instance of the <see cref="School.Entities.Classes"/> class.</returns> public School.Entities.Classes GetById(TransactionManager transactionManager, System.Int32 _id, int start, int pageLength) { int count = -1; return(GetById(transactionManager, _id, start, pageLength, out count)); }
/// <summary> /// Gets rows from the datasource based on the PK_Classes index. /// </summary> /// <param name="transactionManager"><see cref="TransactionManager"/> object</param> /// <param name="_id"></param> /// <remarks></remarks> /// <returns>Returns an instance of the <see cref="School.Entities.Classes"/> class.</returns> public School.Entities.Classes GetById(TransactionManager transactionManager, System.Int32 _id) { int count = -1; return(GetById(transactionManager, _id, 0, int.MaxValue, out count)); }
static StackObject *GetDeviceCaps_5(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 3); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method); System.Int32 maxFreq = ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method); System.Int32 minFreq = ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 3); System.String deviceName = (System.String) typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); UnityEngine.Microphone.GetDeviceCaps(deviceName, out minFreq, out maxFreq); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); switch (ptr_of_this_method->ObjectType) { case ObjectTypes.StackObjectReference: { var ___dst = *(StackObject **)&ptr_of_this_method->Value; ___dst->ObjectType = ObjectTypes.Integer; ___dst->Value = maxFreq; } break; case ObjectTypes.FieldReference: { var ___obj = __mStack[ptr_of_this_method->Value]; if (___obj is ILTypeInstance) { ((ILTypeInstance)___obj)[ptr_of_this_method->ValueLow] = maxFreq; } else { var t = __domain.GetType(___obj.GetType()) as CLRType; t.SetFieldValue(ptr_of_this_method->ValueLow, ref ___obj, maxFreq); } } break; case ObjectTypes.StaticFieldReference: { var t = __domain.GetType(ptr_of_this_method->Value); if (t is ILType) { ((ILType)t).StaticInstance[ptr_of_this_method->ValueLow] = maxFreq; } else { ((CLRType)t).SetStaticFieldValue(ptr_of_this_method->ValueLow, maxFreq); } } break; case ObjectTypes.ArrayReference: { var instance_of_arrayReference = __mStack[ptr_of_this_method->Value] as System.Int32[]; instance_of_arrayReference[ptr_of_this_method->ValueLow] = maxFreq; } break; } ptr_of_this_method = ILIntepreter.Minus(__esp, 2); switch (ptr_of_this_method->ObjectType) { case ObjectTypes.StackObjectReference: { var ___dst = *(StackObject **)&ptr_of_this_method->Value; ___dst->ObjectType = ObjectTypes.Integer; ___dst->Value = minFreq; } break; case ObjectTypes.FieldReference: { var ___obj = __mStack[ptr_of_this_method->Value]; if (___obj is ILTypeInstance) { ((ILTypeInstance)___obj)[ptr_of_this_method->ValueLow] = minFreq; } else { var t = __domain.GetType(___obj.GetType()) as CLRType; t.SetFieldValue(ptr_of_this_method->ValueLow, ref ___obj, minFreq); } } break; case ObjectTypes.StaticFieldReference: { var t = __domain.GetType(ptr_of_this_method->Value); if (t is ILType) { ((ILType)t).StaticInstance[ptr_of_this_method->ValueLow] = minFreq; } else { ((CLRType)t).SetStaticFieldValue(ptr_of_this_method->ValueLow, minFreq); } } break; case ObjectTypes.ArrayReference: { var instance_of_arrayReference = __mStack[ptr_of_this_method->Value] as System.Int32[]; instance_of_arrayReference[ptr_of_this_method->ValueLow] = minFreq; } break; } return(__ret); }
/// <summary> CTor</summary> /// <param name="supplierId">PK value for Supplier which data should be fetched into this Supplier object</param> /// <remarks>The entity is not fetched by this constructor. Use a DataAccessAdapter for that.</remarks> public SupplierEntity(System.Int32 supplierId) : base("SupplierEntity") { InitClassEmpty(null, null); this.SupplierId = supplierId; }
static StackObject *TryGetValue_11(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 3); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method); System.Int32 value = ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); System.UInt64 key = *(ulong *)&ptr_of_this_method->Value; ptr_of_this_method = ILIntepreter.Minus(__esp, 3); System.Collections.Generic.Dictionary <System.UInt64, System.Int32> instance_of_this_method; instance_of_this_method = (System.Collections.Generic.Dictionary <System.UInt64, System.Int32>) typeof(System.Collections.Generic.Dictionary <System.UInt64, System.Int32>).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.TryGetValue(key, out value); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); switch (ptr_of_this_method->ObjectType) { case ObjectTypes.StackObjectReference: { var ___dst = *(StackObject **)&ptr_of_this_method->Value; ___dst->ObjectType = ObjectTypes.Integer; ___dst->Value = value; } break; case ObjectTypes.FieldReference: { var ___obj = __mStack[ptr_of_this_method->Value]; if (___obj is ILTypeInstance) { ((ILTypeInstance)___obj)[ptr_of_this_method->ValueLow] = value; } else { var t = __domain.GetType(___obj.GetType()) as CLRType; t.SetFieldValue(ptr_of_this_method->ValueLow, ref ___obj, value); } } break; case ObjectTypes.StaticFieldReference: { var t = __domain.GetType(ptr_of_this_method->Value); if (t is ILType) { ((ILType)t).StaticInstance[ptr_of_this_method->ValueLow] = value; } else { ((CLRType)t).SetStaticFieldValue(ptr_of_this_method->ValueLow, value); } } break; case ObjectTypes.ArrayReference: { var instance_of_arrayReference = __mStack[ptr_of_this_method->Value] as System.Int32[]; instance_of_arrayReference[ptr_of_this_method->ValueLow] = value; } break; } __ret->ObjectType = ObjectTypes.Integer; __ret->Value = result_of_this_method ? 1 : 0; return(__ret + 1); }