public static void CheckHits_(Query query, System.String defaultFieldName, Searcher searcher, int[] results, TestCase testCase) { Hits hits = searcher.Search(query); System.Collections.Hashtable correct = new System.Collections.Hashtable(); for (int i = 0; i < results.Length; i++) { correct.Add((System.Int32)results[i], null); } System.Collections.Hashtable actual = new System.Collections.Hashtable(); for (int i = 0; i < hits.Length(); i++) { actual.Add((System.Int32)hits.Id(i), null); } //Assert.AreEqual(correct, actual, query.ToString(defaultFieldName)); if (correct.Count != 0) { System.Collections.IDictionaryEnumerator iter = correct.GetEnumerator(); bool status = false; while (iter.MoveNext()) { status = actual.ContainsKey(iter.Key); if (status == false) { break; } } Assert.IsTrue(status, query.ToString(defaultFieldName)); } }
protected void btnLimpaCache_Click(object sender, EventArgs e) { try { rptTipos.Visible = false; int keys = 0; System.Collections.IDictionaryEnumerator myCache = Cache.GetEnumerator(); myCache.Reset(); while (myCache.MoveNext()) { keys++; Cache.Remove(myCache.Key.ToString()); } keys += CacheManager.Factory.GetAllKey().Count; CacheManager.Factory.Clear(); ViewState["Chaves"] = null; lblInformacao.Text = UtilBO.GetErroMessage("Quantidade de caches removidos: " + keys, UtilBO.TipoMensagem.Sucesso); } catch (Exception ex) { lblMessage.Text = UtilBO.GetErroMessage("Erro ao tentar excluir o cache: " + ex.Message, UtilBO.TipoMensagem.Erro); } }
/// <summary> /// Gets all the simple members from the property table. /// </summary> /// <returns>An array of property info items.</returns> public PropertyInfo[] GetSimpleMembers() { // if we have already done this...then there is no need to do it again. if (_simplemembers != null) { return(_simplemembers as PropertyInfo[]); } System.Collections.ArrayList templist = new System.Collections.ArrayList(); System.Collections.IDictionaryEnumerator en = this.GetEnumerator() as System.Collections.IDictionaryEnumerator; PropertyInfo currprop = null; if (en != null) { while (en.MoveNext()) { currprop = en.Value as PropertyInfo; if (currprop != null) { if (OrcaLogic.TypeHelper.IsSimpleType(currprop.PropertyType)) { templist.Add(currprop); } } } } // store it for future usage _simplemembers = templist.ToArray(typeof(System.Reflection.PropertyInfo)) as object[]; return(_simplemembers as PropertyInfo[]); }
// Dump the scope to an xml file public void Dump(XmlWriter o, bool fRecursive) { o.WriteStartElement("scope"); o.WriteAttributeString("name", m_szDebugName); ILookupController p = this.m_pController; o.WriteAttributeString("controller", (p == null) ? "none" : ((object)p).GetType().Name); /* * if (m_SuperScope != null) * { * o.WriteAttributeString("super", m_SuperScope.m_szDebugName); * } */ System.Collections.IDictionaryEnumerator e = m_table.GetEnumerator(); while (e.MoveNext()) { string str = (string)e.Key; SymEntry sym = (SymEntry)e.Value; sym.Dump(o, fRecursive); } o.WriteEndElement(); // scope }
/// <summary> /// 判断某用户是否已经登录,并强迫登录用户下线。可以放到页面基类里面实时监测。 /// </summary> /// <param name="id">为用户ID或用户名这个必须是用户的唯一标识</param> /// <returns>flase为没有登陆 true为被迫下线</returns> public bool ValidateForceLogin() { bool flag = false; System.Collections.Hashtable ht = (System.Collections.Hashtable)HttpContext.Current.Application[appKey]; if (ht != null) { System.Collections.IDictionaryEnumerator IDE = ht.GetEnumerator(); while (IDE.MoveNext()) { //找到自己的登陆ID if (IDE.Key.ToString().Equals(HttpContext.Current.Session.SessionID)) { //判断用户是否被注销 if (IDE.Value.ToString().Equals(logout)) { ht.Remove(HttpContext.Current.Session.SessionID); HttpContext.Current.Application.Lock(); HttpContext.Current.Application[appKey] = ht; HttpContext.Current.Application.UnLock(); HttpContext.Current.Session.RemoveAll(); //HttpContext.Current.Response.Write("<script type='text/javascript'>alert('你的帐号已在别处登陆,你被强迫下线!')</script>"); flag = true; } break; } } } return(flag); }
public static void DestroyCacheOfCategory(CacheCategory cc) { string key = cc.ToString() + "-"; System.Collections.IDictionaryEnumerator enumerator = HttpRuntime.Cache.GetEnumerator(); while (enumerator.MoveNext()) { var name = (string)enumerator.Key; switch (cc) { case CacheCategory.STD: if (name.StartsWith(CacheCategory.OPC.ToString()) || name.StartsWith(CacheCategory.OSC.ToString())) { continue; } break; case CacheCategory.OPC: case CacheCategory.OSC: if (!name.StartsWith(key)) { continue; } break; default: break; } HttpRuntime.Cache.Remove((string)enumerator.Key); } }
/// <summary> Given the 2 maps fills a document for 1 word.</summary> private static int Index(System.Collections.IDictionary word2Nums, System.Collections.IDictionary num2Words, System.String g, Document doc) { System.Collections.IList keys = (System.Collections.IList)word2Nums[g]; // get list of key#'s System.Collections.IEnumerator i2 = keys.GetEnumerator(); System.Collections.SortedList already = new System.Collections.SortedList(); // keep them sorted // pass 1: fill up 'already' with all words while (i2.MoveNext()) // for each key# { foreach (object item in (System.Collections.IList)num2Words[i2.Current]) // get list of words { if (already.Contains(item) == false) { already.Add(item, item); } } } int num = 0; already.Remove(g); // of course a word is it's own syn System.Collections.IDictionaryEnumerator it = already.GetEnumerator(); while (it.MoveNext()) { System.String cur = (System.String)it.Key; // don't store things like 'pit bull' -> 'american pit bull' if (!IsDecent(cur)) { continue; } num++; doc.Add(new Field(F_SYN, cur, Field.Store.YES, Field.Index.NO)); } return(num); }
void ReadLocalized() { if (!File.Exists(LocalizedFileName)) { return; } ResXResourceReader reader = new ResXResourceReader(LocalizedFileName); reader.UseResXDataNodes = true; System.Collections.IDictionaryEnumerator enumerator = reader.GetEnumerator(); // Run through the file looking for only true text related // properties and only those with values set. Others are saved in the nonStringNodes // so they can be written back later. foreach (System.Collections.DictionaryEntry dic in reader) { // Only consider this entry if the value is something. if (null != dic.Value) { ResXDataNode dataNode = (ResXDataNode)dic.Value; if (InterestingString(dataNode) && strings.ContainsKey(dataNode.Name)) { strings[dataNode.Name].Localized = (string)(dataNode.GetValue(noAssemblies)); } else { nonStringNodes.Add(dataNode); } } } }
//修改快捷键 private void 修改快捷键ToolStripMenuItem_Click(object sender, EventArgs e) { try { System.Collections.IDictionaryEnumerator ef_form_enumerator = EF.EF_Args.ht_ef_form.GetEnumerator(); while (ef_form_enumerator.MoveNext()) { var form_ename_ht = ef_form_enumerator.Key.ToString().Split(':')[0]; if (form_ename_ht == "FromFMJ603") { MessageBox.Show("请先关闭正在修改的快捷键"); Logger.Info("重复打开修改快捷键页面" + DateTime.Now.ToString()); break; } else { this.EFCallForm("FMJ603", new object[] { this.ServerNames.Text }); Logger.Info("修改启动快捷键" + DateTime.Now.ToString()); return; } } } catch (Exception ex) { Logger.Error(ex.Message); } }
/// <summary> /// Gets all the simple members from the field table. /// </summary> /// <returns>An array of field info items.</returns> public FieldInfo[] GetSimpleMembers() { // if we have already done this...then there is no need to do it again. if (_simplemembers != null) { return(_simplemembers as FieldInfo[]); } System.Collections.ArrayList templist = new System.Collections.ArrayList(); System.Collections.IDictionaryEnumerator en = this.GetEnumerator() as System.Collections.IDictionaryEnumerator; FieldInfo currfield = null; if (en != null) { while (en.MoveNext()) { currfield = en.Value as FieldInfo; if (currfield != null && OrcaLogic.TypeHelper.IsSimpleType(currfield.FieldType)) { templist.Add(currfield); } } } // store it for future usage _simplemembers = templist.ToArray(typeof(System.Reflection.FieldInfo)) as object[]; // return it as a specific type array return(_simplemembers as FieldInfo[]); }
public LinguaLinksImportDlg() { InitializeComponent(); // Copied from the LexImportWizard dlg Init (LexImportWizard.cs) // Ensure that we have the default encoding converter (to/from MS Windows Code Page // for Western European languages) SilEncConverters31.EncConverters encConv = new SilEncConverters31.EncConverters(); System.Collections.IDictionaryEnumerator de = encConv.GetEnumerator(); string sEncConvName = "Windows1252<>Unicode"; // REVIEW: SHOULD THIS NAME BE LOCALIZED? bool fMustCreateEncCnv = true; while (de.MoveNext()) { if ((string)de.Key != null && (string)de.Key == sEncConvName) { fMustCreateEncCnv = false; break; } } if (fMustCreateEncCnv) { try { encConv.AddConversionMap(sEncConvName, "1252", ECInterfaces.ConvType.Legacy_to_from_Unicode, "cp", "", "", ECInterfaces.ProcessTypeFlags.CodePageConversion); } catch (SilEncConverters31.ECException exception) { MessageBox.Show(exception.Message, ITextStrings.ksConvMapError, MessageBoxButtons.OK); } } }
// Unlock all resources for the passed in transaction public void UnlockAll(TP.Transaction context) { // Loop over the resources lock (this.ResourceTable) { // Get resource enumerator System.Collections.IDictionaryEnumerator resenum = ResourceTable.GetEnumerator(); // Loop over resources while (resenum.MoveNext()) { ResourceEntry lockTarget = (ResourceEntry)resenum.Value; lock (lockTarget) { // Unregister all unlock modes for current resource for (int lockMode = (int)LockMode.Read; lockMode < (int)LockMode._Length; lockMode++) { lockTarget.Unregister(context, (LockMode)lockMode); } } } } System.Console.WriteLine("----Unlocked all for Tx: {0}--------", context.Id); }
public System.Collections.IDictionaryEnumerator[] GetEnumerators() { if (!didopen) { throw new Exception("Attempted to GetEnumerators before Open"); } System.Collections.IDictionaryEnumerator[] results; lock (dslaves) { byte enumid = nextenumid; if (nextenumid >= 32) nextenumid = 0; else nextenumid++; int i; results = new System.Collections.IDictionaryEnumerator[dslaves.Count]; i = 0; foreach (SlaveInfo slave in dslaves) { results[i++] = new HashtablePartEnumerator(slave, enumid); } } return results; }
public ActionResult DangXuat() { //xoa session Session["DangNhap"] = null; Session["Url"] = null; Session["MailDown"] = null; //xoa quyen FormsAuthentication.SignOut(); System.Collections.IDictionaryEnumerator enumerator = HttpRuntime.Cache.GetEnumerator(); while (enumerator.MoveNext()) { HttpRuntime.Cache.Remove(enumerator.Key.ToString()); } //xoa cookie HttpCookie aCookie; string cookieName; int limit = Request.Cookies.Count; for (int i = 0; i < limit; i++) { cookieName = Request.Cookies[i].Name; aCookie = new HttpCookie(cookieName); aCookie.Expires = DateTime.Now.AddDays(-1); Response.Cookies.Add(aCookie); } return(RedirectToAction("DangNhap")); }
//fieldname MUST be interned prior to this call private static void GetTerms(Query query, System.Collections.Hashtable terms, bool prohibited, System.String fieldName) { try { if (query is BooleanQuery) { GetTermsFromBooleanQuery((BooleanQuery)query, terms, prohibited, fieldName); } else if (query is FilteredQuery) { GetTermsFromFilteredQuery((FilteredQuery)query, terms, prohibited, fieldName); } else { System.Collections.Hashtable nonWeightedTerms = new System.Collections.Hashtable(); query.ExtractTerms(nonWeightedTerms); System.Collections.IDictionaryEnumerator iter = nonWeightedTerms.GetEnumerator(); while (iter.MoveNext()) { Term term = (Term)iter.Value; if ((fieldName == null) || (term.Field() == fieldName)) { WeightedTerm temp = new WeightedTerm(query.GetBoost(), term.Text()); terms.Add(temp, temp); } } } } catch (System.NotSupportedException ignore) { //this is non-fatal for our purposes } }
public override unsafe void SetPixels(System.Collections.Hashtable coordsAndColors) { SurfaceDescription sd = this.m_tx.GetLevelDescription(0); int nPitch; //uint* pData = (uint*)this.m_tx.LockRectangle(0, // LockFlags.None, out nPitch).InternalData.ToPointer(); uint[,] data = (uint[, ]) this.m_tx.LockRectangle(typeof(uint), 0, LockFlags.None, sd.Width, sd.Height); System.Collections.IDictionaryEnumerator en = coordsAndColors.GetEnumerator(); while (en.MoveNext()) { Point pnt = (Point)en.Key; data[pnt.X, pnt.Y] = (uint)((Color)en.Value).ToArgb(); } // for (int x = 0; x < sd.Width; x++) // { // for (int y = 0; y < sd.Height; y++) // data[x,y] = (uint)Color.FromArgb(100,200,233).ToArgb(); // } this.m_tx.UnlockRectangle(0); }
public System.Collections.IDictionaryEnumerator[] GetEnumerators() { if (!didopen) { throw new Exception("Attempted to GetEnumerators before Open"); } System.Collections.IDictionaryEnumerator[] results; lock (dslaves) { byte enumid = nextenumid; if (nextenumid >= 32) { nextenumid = 0; } else { nextenumid++; } int i; results = new System.Collections.IDictionaryEnumerator[dslaves.Count]; i = 0; foreach (SlaveInfo slave in dslaves) { results[i++] = new HashtablePartEnumerator(slave, enumid); } } return(results); }
public static IEnumerable <SecondCacheItemProperty> GetSecondCache(CacheCategory cc) { string CacheKey = string.Empty; IList <SecondCacheItemProperty> cache = new List <SecondCacheItemProperty>(); System.Collections.IDictionaryEnumerator enumerator = HttpRuntime.Cache.GetEnumerator(); while (enumerator.MoveNext()) { CacheKey = (string)enumerator.Key; switch (cc) { case CacheCategory.STD: if (CacheKey.StartsWith(CacheCategory.OPC.ToString()) || CacheKey.StartsWith(CacheCategory.OSC.ToString())) { continue; } cache.Add(GetCacheObjectProperty(CacheKey)); break; default: if (CacheKey.StartsWith(cc.ToString())) { cache.Add(GetCacheObjectProperty(CacheKey)); } break; } } return(cache); }
private void initInvariantCulture() { if (invariant == null) { ParseInvariant(Application["sharpwebmail/general/default_lang"].ToString()); } if (invariant == null) { ParseInvariant("en"); } if (invariant == null) { invariant = System.Globalization.CultureInfo.InvariantCulture; // Set the first available culture as the default one if (availablecultures.Count > 0) { System.Collections.IDictionaryEnumerator enumerator = availablecultures.GetEnumerator(); if (enumerator.MoveNext()) { invariant = ParseCultureSpecific((string)enumerator.Key); } enumerator = null; } } }
/// <summary> /// 清除所有缓存 /// </summary> public override void Clear() { try { if (theCache.Count > 0) { System.Collections.IDictionaryEnumerator e = theCache.GetEnumerator(); while (e.MoveNext()) { theCache.Remove(Convert.ToString(e.Key)); } } lock (lockObj) { try { theState.Clear(); theState = null; theState = new MDictionary <string, CacheDependencyInfo>(500, StringComparer.OrdinalIgnoreCase); } catch { } } } catch { errorCount++; } }
/// <summary> /// 根据指定字段列表获取对象 /// </summary> /// <param name="dir"></param> /// <returns></returns> public static T findByField(bool isOr, bool isLike, System.Collections.Hashtable ht) { try { StringBuilder where; if (isOr) { where = new StringBuilder("1=0"); } else { where = new StringBuilder("1=1"); } System.Collections.IDictionaryEnumerator ienum = ht.GetEnumerator(); while (ienum.MoveNext()) { if (isOr) { where.AppendFormat(" or {0}='{1}'", ienum.Key, ienum.Value); } else { where.AppendFormat(" and {0}='{1}'", ienum.Key, ienum.Value); } } return(db.find <T>(where.ToString()).first()); } catch { return(null); } }
public static PropertyType MakeNew(DataTypeDefinition dt, ContentType ct, string Name, string Alias) { PropertyType pt; try { pt = new PropertyType(int.Parse(Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteScalar(_connstring, CommandType.Text, "insert into cmsPropertyType (DataTypeId, ContentTypeId, alias, Name) values (" + dt.Id + "," + ct.Id + ",'" + Alias + "','" + Name + "') Select @@Identity").ToString())); } finally { // Clear cached items System.Web.Caching.Cache c = System.Web.HttpRuntime.Cache; if (c != null) { System.Collections.IDictionaryEnumerator cacheEnumerator = c.GetEnumerator(); while (cacheEnumerator.MoveNext()) { if (cacheEnumerator.Key is string && ((string)cacheEnumerator.Key).StartsWith(UmbracoPropertyTypeCacheKey)) { Cache.ClearCacheItem((string)cacheEnumerator.Key); } } } } return(pt); }
private static void ClearServerCache() { System.Collections.IDictionaryEnumerator enumerator = HttpContext.Current.Cache.GetEnumerator(); while (enumerator.MoveNext()) { HttpContext.Current.Cache.Remove((string)enumerator.Key); } }
/// <summary> /// 清空 /// </summary> public void Clear() { System.Collections.IDictionaryEnumerator enumerator = HttpRuntime.Cache.GetEnumerator(); while (enumerator.MoveNext()) { HttpRuntime.Cache.Remove(enumerator.Key.ToString()); } }
/// <summary> /// 清除所有的缓存数据 /// </summary> public static void Clear() { System.Collections.IDictionaryEnumerator idenum = _cache.GetEnumerator(); while (idenum.MoveNext()) { _cache.Remove(idenum.Key.ToString()); } }
public override void LimparCache() { System.Collections.IDictionaryEnumerator enumerator = System.Web.HttpRuntime.Cache.GetEnumerator(); while (enumerator.MoveNext()) { System.Web.HttpRuntime.Cache.Remove(enumerator.Key.ToString()); } }
/// <summary> /// 移除所有缓存 /// </summary> /// <returns></returns> public static void RemoveAllCache() { System.Collections.IDictionaryEnumerator enume = HttpContext.Current.Cache.GetEnumerator(); while (enume.MoveNext()) { HttpContext.Current.Cache.Remove(enume.Key.ToStr()); } }
public static void RemoveAll() { System.Collections.IDictionaryEnumerator CacheKeys = System.Web.HttpContext.Current.Cache.GetEnumerator(); while (CacheKeys.MoveNext()) { var currentKey = CacheKeys.Key.ToString(); System.Web.HttpContext.Current.Cache.Remove(currentKey); } }
/// <summary> /// 执行存储过程返回得到的数据库表 /// </summary> /// <param name="sp_cmd">存储过程名称</param> /// <param name="sp_Input_Params">哈希数据集</param> /// <returns>成功返回查询到的数据表, 失败返回null</returns> static public DataTable QueryInfoPro(string sp_cmd, System.Collections.Hashtable sp_Input_Params, out string error) { error = null; try { DataTable tempTable = new DataTable(); using (SqlConnection sqlconn = new SqlConnection(GlobalObject.GlobalParameter.StorehouseConnectionString)) { using (SqlDataAdapter da = new SqlDataAdapter(sp_cmd, sqlconn)) { DataSet ds = new DataSet(); da.SelectCommand = new SqlCommand(); da.SelectCommand.CommandType = CommandType.StoredProcedure; da.SelectCommand.CommandText = sp_cmd; da.SelectCommand.Connection = sqlconn; da.SelectCommand.CommandTimeout = 40000; if (sp_Input_Params != null) { System.Collections.IDictionaryEnumerator InputEnume = sp_Input_Params.GetEnumerator(); while (InputEnume.MoveNext()) { SqlParameter param = new SqlParameter(); param.Direction = ParameterDirection.Input; param.ParameterName = InputEnume.Key.ToString(); param.Value = InputEnume.Value; da.SelectCommand.Parameters.Add(param); } } int rowcount = da.Fill(ds); if (rowcount == 0 && ds != null && ds.Tables.Count == 0) { error = "没有找到任何数据"; } else { tempTable = ds.Tables[ds.Tables.Count - 1]; } } } return(tempTable); } catch (Exception) { throw; } }
// Constructor. public DictionaryEnumeratorWrapper (System.Collections.IDictionaryEnumerator e) { if (e == null) { throw new ArgumentNullException("e"); } this.e = e; }
private void ClearCache() { System.Web.Caching.Cache _cache = HttpRuntime.Cache; System.Collections.IDictionaryEnumerator CacheEnum = _cache.GetEnumerator(); while (CacheEnum.MoveNext()) { string _key = CacheEnum.Key.ToString(); _cache.Remove(_key); } }
public BackGroundFileWorker(System.Collections.IDictionaryEnumerator fileListEnumerator) : this() { FileListEnumerator = fileListEnumerator; }