private static Match[] MatchSubstring(string i_source, string i_matchPattern, bool i_uniqueMatch) { //<note> use RegexOptions.Multiline, otherwise it will treat the whole thing as 1 string Regex regex = new Regex(i_matchPattern, RegexOptions.Multiline); MatchCollection matchCollection = regex.Matches(i_source); Match[] result; if (!i_uniqueMatch) { result = new Match[matchCollection.Count]; matchCollection.CopyTo(result, 0); } else { //<note> cannot use HashSet<Match> because each Match object is unique, even though they may have same value (string). Can use HashSet<string> //SortedList is more like sorted Dictionary<key, value> SortedList uniqueMatchCollection = new SortedList(); foreach(Match match in matchCollection) { if (!uniqueMatchCollection.ContainsKey(match.Value)) { uniqueMatchCollection.Add(match.Value, match); } } result = new Match[uniqueMatchCollection.Count]; uniqueMatchCollection.Values.CopyTo(result, 0); //<note> cannot use uniqueMatchCollection.CopyTo(...) since SortedList member is not type-match with destination array member } Console.WriteLine("Found {0} matches", result.Length); return result; }
public TrajectoryData() { comparer = new TpointCompare(); tpoints = new SortedList(comparer); interceptComparer = new InterceptComparer(); }
private Image GetAny() { Image oPic; string sname; System.Collections.SortedList filelist = new System.Collections.SortedList(); foreach (string newname in oExt.ArchiveFileNames) { if (IsImage(newname)) { filelist.Add(newname, newname); } } sname = Convert.ToString(filelist.GetByIndex(0)); Random anyimageindex = new Random(); sname = Convert.ToString(filelist.GetByIndex(anyimageindex.Next(filelist.Count))); Stream iStream = new System.IO.MemoryStream(); try { oExt.ExtractFile(sname, iStream); } catch (Exception ex) { ComicError("Connot extract " + sname + " from " + currentFile); ComicError(ex.Message); return(null); } oPic = System.Drawing.Bitmap.FromStream(iStream); return(oPic); }
private void Init() { drawables_ = new ArrayList(); xAxisPositions_ = new ArrayList(); yAxisPositions_ = new ArrayList(); zPositions_ = new ArrayList(); ordering_ = new SortedList(); TitleFont = new Font(FontFamily.GenericSerif, 10, FontStyle.Regular); padding_ = 10; title_ = ""; autoScaleTitle_ = false; autoScaleAutoGeneratedAxes_ = false; xAxis1_ = null; xAxis2_ = null; yAxis1_ = null; yAxis2_ = null; pXAxis1Cache_ = null; pYAxis1Cache_ = null; pXAxis2Cache_ = null; pYAxis2Cache_ = null; titleBrush_ = new SolidBrush(Color.Black); plotBackColor_ = Color.White; this.legend_ = null; axesConstraints_ = new ArrayList(); }
public override string this[string name] { get { if (localQueryString == null) { if (HttpContext.Current != null) return HttpContext.Current.Request.QueryString[name]; else return null; } else return localQueryString[name].ToString(); } set { if (localQueryString == null) localQueryString = new SortedList(); // add if it is new, or replace the old value if ((localQueryString[name]) == null) localQueryString.Add(name, value); else localQueryString[name] = value; } }
public partdata() { // // TODO: Add constructor logic here // mOfferData = new System.Collections.SortedList(); mSelect = false; mTaxValue = 0.00M; mDiscRequired = 0.00M; mHeadDiscRequired = 0.00M; mDiscount = 0.00M; // mHeadDiscount = 0.00M; mSaleType = 0; mSaleTypeDesc = "S"; mSerialTracking = false; mSerialNumber = new System.Collections.SortedList(); mLineMessage = new System.Collections.SortedList(); mComponentData = new System.Collections.SortedList(); mAlternativeParts = new System.Collections.SortedList(); mObsoleteCode = 0; mConsolidateGroup = false; mGiftPart = false; mPartType = -1; }
private void Init() { drawables_ = new ArrayList(); xAxisPositions_ = new ArrayList(); yAxisPositions_ = new ArrayList(); zPositions_ = new ArrayList(); ordering_ = new SortedList(); FontFamily fontFamily = new FontFamily("Arial"); TitleFont = new Font(fontFamily, 14, FontStyle.Regular, GraphicsUnit.Pixel); padding_ = 10; title_ = ""; autoScaleTitle_ = false; autoScaleAutoGeneratedAxes_ = false; xAxis1_ = null; xAxis2_ = null; yAxis1_ = null; yAxis2_ = null; pXAxis1Cache_ = null; pYAxis1Cache_ = null; pXAxis2Cache_ = null; pYAxis2Cache_ = null; titleBrush_ = new SolidBrush(Color.Black); plotBackColor_ = Color.White; legend_ = null; smoothingMode_ = System.Drawing.Drawing2D.SmoothingMode.None; axesConstraints_ = new ArrayList(); }
private static ArrayList m_fileList = new ArrayList(); // temp list to hold photo files names #endregion Fields #region Methods // knows about .gpx files and Project.photoAnalyzeOnLoad: public static void enlistPhotoFolder(string filename, SortedList foldersToProcess, ProcessFile imageFileProcessor) { string folderName = null; // stays null for .loc files if (AllFormats.isZipFile(filename)) { folderName = filename; } else if (AllFormats.isGpxFile(filename)) { if (Project.photoAnalyzeOnLoad) { FileInfo fi = new FileInfo(filename); folderName = fi.DirectoryName; } } else { DirectoryInfo di = new DirectoryInfo(filename); if (di.Exists) { folderName = di.FullName; } } // gpx and zip files are candidates for processing (containing) folder for photos: if (folderName != null && !foldersToProcess.ContainsKey(folderName)) { // delayed processing of photo images in folder(s), as we need to have all trackpoints in memory first to relate to them: PhotoFolderToProcess pf = new PhotoFolderToProcess(); pf.name = folderName; pf.imageFileProcessor = imageFileProcessor; foldersToProcess.Add(folderName, pf); } }
static void Main(string[] args) { //ArrayList ArrayList arrayList = new ArrayList(); arrayList.Add("First item"); arrayList.Add(5); arrayList.Add('c'); foreach (var item in arrayList) { Console.WriteLine("Element of arrayList: {0}", item); } //HashTable Hashtable hashtable = new Hashtable(); hashtable.Add(0, "Zero item"); hashtable[1] = "First item"; hashtable["2"] = "Second item"; hashtable[Guid.NewGuid()] = "Third item"; ICollection keys = hashtable.Keys; foreach (var key in keys) { Console.WriteLine("Key: {0}, Value: {1}", key, hashtable[key]); } //SortedList SortedList sl = new SortedList(); sl.Add("007", "Ritesh Saikia"); sl.Add("001", "Zara Ali"); sl.Add("002", "Abida Rehman"); sl.Add("003", "Joe Holzner"); sl.Add("004", "Mausam Benazir Nur"); sl.Add("006", "M. Amlan"); sl.Add("005", "M. Arif"); ICollection slValues = sl.Values; foreach (var s in slValues) { Console.WriteLine("SortedList value: {0}", s); } //Queue is FIFO: First in First out Queue que = new Queue(); que.Enqueue("Student_1"); que.Enqueue(5); que.Enqueue("Student_2"); que.Enqueue("Student_3"); Console.WriteLine(que.Dequeue().ToString()); Console.WriteLine(que.Dequeue().ToString()); // Stack is FILO: First in Last out Stack StackPop = new Stack(); StackPop.Push("Student_1"); StackPop.Push("Student_2"); StackPop.Push("Student_3"); Console.WriteLine(StackPop.Pop().ToString()); Console.WriteLine(StackPop.Pop().ToString()); Console.ReadLine(); }
public void ComputeTrendTest(SortedList<int, double> years, int currentYear) { var map = new ExtractValuesForIndicatorsMapper(); var data = new SortedList<int, double>(); double[] inflationVal ={100.764370305146,104.476042578907, 164.776810573524,343.810676313218,626.718592068498,672.180651051974, 90.0966050749321,131.327020980362,342.955110191569,3079.8097030531, 2313.96466339751,171.671696468307,24.8999485988254,10.6114940961306, 4.17734724367,3.37611684980121,0.155695900742245,0.527258257063252 ,0.920336467095566,-1.16689546970002,-0.935939411978723,-1.06663550777849, 25.8684978656633,13.4428492915644,4.41571792341912,9.63939954620811, 10.901124534884, 8.83141298885049}; int length = inflationVal.Count(); int year = 2007; for (int i = length - 1; i >= 0; i--) { data.Add(year, inflationVal[i]); year--; } Assert.IsTrue( map.ComputeTrend(data, 1998)<1); Assert.IsTrue( map.ComputeTrend(data, 1999)<1); Assert.IsTrue( map.ComputeTrend(data, 2000)<1); Assert.IsTrue( map.ComputeTrend(data, 2001)<1); Assert.IsTrue(map.ComputeTrend(data, 2002)>1); Assert.IsTrue(map.ComputeTrend(data, 2003)>1); }
/// <summary> /// Returns a portion of the list whose keys are greater that the lowerLimit parameter less than the upperLimit parameter. /// </summary> /// <param name="l">The list where the portion will be extracted.</param> /// <param name="limit">The start element of the portion to extract.</param> /// <param name="limit">The end element of the portion to extract.</param> /// <returns>The portion of the collection.</returns> public static System.Collections.SortedList SubMap(System.Collections.SortedList list, System.Object lowerLimit, System.Object upperLimit) { System.Collections.Comparer comparer = System.Collections.Comparer.Default; System.Collections.SortedList newList = new System.Collections.SortedList(); if (list != null) { if ((list.Count > 0) && (!(lowerLimit.Equals(upperLimit)))) { int index = 0; while (comparer.Compare(list.GetKey(index), lowerLimit) < 0) { index++; } for (; index < list.Count; index++) { if (comparer.Compare(list.GetKey(index), upperLimit) >= 0) { break; } newList.Add(list.GetKey(index), list[list.GetKey(index)]); } } } return(newList); }
private EventStreamSlice() { m_streamPosition = EventStreamPosition.Start; m_events = new SortedList<StreamVersion, JournaledEvent>(0); m_endOfStream = true; m_currentSlicePosition = EventStreamPosition.Start; }
public FamiliaCompetencias(ModeloCompetencias mod) { competencias = new SortedList<int, Competencia>(); creationDate = DateTime.Now; familiaID = -1; modelo = mod; }
private void AddInfo(SortedList<double, ArrayList> timingInfos, TimingInfo newInfo) { if (!timingInfos.ContainsKey(newInfo.Fps)) { timingInfos.Add(newInfo.Fps, new ArrayList()); } bool found = false; foreach (TimingInfo info in timingInfos[newInfo.Fps]) { if (info.T1Value == newInfo.T1Value && info.T2Value == newInfo.T2Value) { found = true; } if (info.T2Value == newInfo.T1Value && info.T1Value == newInfo.T2Value) { //found = true; } } if (!found) { timingInfos[newInfo.Fps].Add(newInfo); } }
private RowRecordsAggregate(SharedValueManager svm) { _rowRecords = new SortedList(); _valuesAgg = new ValueRecordsAggregate(); _unknownRecords = new ArrayList(); _sharedValueManager = svm; }
public void debugLocations() { int activeAttr, maxLength; GL.GetProgram(m_programID, GetProgramParameterName.ActiveAttributes, out activeAttr); GL.GetProgram(m_programID, GetProgramParameterName.ActiveAttributeMaxLength, out maxLength); System.Collections.SortedList info = new System.Collections.SortedList(); for (int i = 0; i < activeAttr; i++) { int size, length; ActiveAttribType type; System.Text.StringBuilder name = new System.Text.StringBuilder(maxLength); GL.GetActiveAttrib(m_programID, i, maxLength, out length, out size, out type, name); int location = GL.GetAttribLocation(m_programID, name.ToString()); info.Add((location >= 0) ? location : (location * i), String.Format("{0} {1} is at location {2}, size {3}", type.ToString(), name, location, size) ); } foreach (int key in info.Keys) { Console.WriteLine(info [key]); } }
void btnSave_Click(object sender, EventArgs e) { SortedList sl = new SortedList(); Qry = "delete from Unit_master where UnitGroupName='" + cboUnitType.Text + "'"; sl.Add(sl.Count + 1, Qry); for (int i = 0; i < dgvInfo.Rows.Count - 1; i++) { Qry = "INSERT INTO [dbo].[Unit_Master] " + " ([UnitGroupName]" + " ,[UnitID]" + " ,[UnitName]" + " ,[RelativeFactor]" + " ,[IsBaseUOM]" + " ,[AddedBy]" + " ,[DateAdded])" + " VALUES " + " ('" + cboUnitType.Text + "'," + "'" + dgvInfo.Rows[i].Cells[0].Value.ToString() + "'," + "'" + dgvInfo.Rows[i].Cells[1].Value.ToString() + "'," + "" + dgvInfo.Rows[i].Cells[2].Value.ToString() + "," + "'" + Convert.ToBoolean(dgvInfo.Rows[i].Cells[3].Value) + "'," + "'" + LoginSession.UserID + "',getdate())"; sl.Add(sl.Count + 1, Qry); } DbUtility.ExecuteQuery(sl, ""); MessageBox.Show("Saved"); }
private void CopyProject(Project project) { AssemblyFileNames = new ArrayList(); XmlDocFileNames = new ArrayList(); ReferencePaths = new ReferencePathCollection(); foreach(AssemblySlashDoc assemblySlashDoc in project.AssemblySlashDocs) { if (assemblySlashDoc.Assembly.Path.Length>0) { string assemblyFileName = assemblySlashDoc.Assembly.Path; AssemblyFileNames.Add(assemblyFileName); string assyDir = System.IO.Path.GetDirectoryName(assemblyFileName); ReferencePaths.Add(new ReferencePath(assyDir)); } if (assemblySlashDoc.SlashDoc.Path.Length>0) { XmlDocFileNames.Add(assemblySlashDoc.SlashDoc.Path); } } ReferencePaths.AddRange(project.ReferencePaths); if (project.Namespaces==null) { NamespaceSummaries = new SortedList(); } else { NamespaceSummaries = project.Namespaces; } }
//SpriteFont debugfont; public Scene(Game game) : base(game) { World = new World(new Vector2(0, 18)); PhysicsDebug = new DebugViewXNA(World); InputManager = new InputManager(Game); Transitioner = new Transitioner(Game, this); #if !FINAL_RELEASE SelectionManager = new SelectionManager(Game, this); #endif SceneLoader = new SceneLoader(Game); Camera = new Camera(Game, this); GarbageElements = new SortedList<Element>(); RespawnElements = new SortedList<Element>(); Elements = new SortedList<Element>(); PhysicsDebug.Enabled = false; SelectionManager.ShowEmblems = false; Kinect.ColorStream.Enable(); Kinect.DepthStream.Enable(); Kinect.SkeletonStream.Enable(); Kinect.Start(); //SelectionManager.ShowForm = false; }
/// <summary> /// Gets all User data source names for the local machine. /// </summary> public SortedList GetUserDataSourceNames() { System.Collections.SortedList dsnList = new System.Collections.SortedList(); // get user dsn's Microsoft.Win32.RegistryKey reg = (Microsoft.Win32.Registry.CurrentUser).OpenSubKey("Software"); if (reg != null) { reg = reg.OpenSubKey("ODBC"); if (reg != null) { reg = reg.OpenSubKey("ODBC.INI"); if (reg != null) { reg = reg.OpenSubKey("ODBC Data Sources"); if (reg != null) { // Get all DSN entries defined in DSN_LOC_IN_REGISTRY. foreach (string sName in reg.GetValueNames()) { dsnList.Add(sName, DataSourceType.User); } } try { reg.Close(); } catch { /* ignore this exception if we couldn't close */ } } } } return(dsnList); }
private void RefreshRelatoriosNormal() { System.Windows.Forms.ListViewItem lviItem; System.Collections.SortedList sortLstRelatorios = new System.Collections.SortedList(); m_lvCriados.Columns[0].Width = m_lvCriados.Width - 20; m_lvCriados.Items.Clear(); // Ordenando e Dividindo os Relatorios mdlDataBaseAccess.Tabelas.XsdTbRelatorios.tbRelatoriosRow dtrwRelatorio; for (int nCont = 0; nCont < m_typDatSetTbRelatorios.tbRelatorios.Rows.Count; nCont++) { dtrwRelatorio = (mdlDataBaseAccess.Tabelas.XsdTbRelatorios.tbRelatoriosRow)m_typDatSetTbRelatorios.tbRelatorios.Rows[nCont]; if (dtrwRelatorio.nIdRelatorio > 0 && dtrwRelatorio.nIdExportador == m_nIdExportador) { // Normal if (!sortLstRelatorios.Contains(dtrwRelatorio.strNomeRelatorio)) { sortLstRelatorios.Add(dtrwRelatorio.strNomeRelatorio, dtrwRelatorio); } } } // Inserindo os Relatorios na Lista View for (int nCont = 0; nCont < sortLstRelatorios.Count; nCont++) { dtrwRelatorio = (mdlDataBaseAccess.Tabelas.XsdTbRelatorios.tbRelatoriosRow)sortLstRelatorios.GetByIndex(nCont); lviItem = m_lvCriados.Items.Add(dtrwRelatorio.strNomeRelatorio); lviItem.Tag = dtrwRelatorio.nIdRelatorio; } }
private static void ConvertXmlToJsonNode(StringBuilder jsonBuilder, XmlElement node, bool showNodeName) { var childAdded = false; if (showNodeName) { jsonBuilder.Append("\"" + SafeJsonString(node.Name) + "\": "); } jsonBuilder.Append("{"); var childNodeNames = new SortedList(); if (node.Attributes != null) { foreach (XmlAttribute attr in node.Attributes) { StoreChildNode(childNodeNames, attr.Name, attr.InnerText); } } foreach (XmlNode childNode in node.ChildNodes) { childAdded = true; if (childNode is XmlText) { StoreChildNode(childNodeNames, "value", childNode.InnerText); } else if (childNode is XmlElement) { StoreChildNode(childNodeNames, childNode.Name, childNode); } } foreach (string childName in childNodeNames.Keys) { childAdded = true; var childNodeNamesList = (ArrayList)childNodeNames[childName]; if (childNodeNamesList.Count == 1 && (childNodeNamesList[0] is string)) { OutputNode(childName, childNodeNamesList[0], jsonBuilder, true); } else { jsonBuilder.Append(" \"" + SafeJsonString(childName) + "\": [ "); foreach (object child in childNodeNamesList) { OutputNode(childName, child, jsonBuilder, false); } jsonBuilder.Remove(jsonBuilder.Length - 2, 2); jsonBuilder.Append(" ], "); } } jsonBuilder.Remove(jsonBuilder.Length - 2, 2); jsonBuilder.Append(" }"); jsonBuilder.Append(childAdded ? " }" : " null"); }
private void RefreshRelatoriosPadrao() { System.Windows.Forms.ListViewItem lviItem; System.Collections.SortedList sortLstRelatoriosPadrao = new System.Collections.SortedList(); m_lvPadrao.Columns[0].Width = m_lvPadrao.Width - 20; m_lvPadrao.Items.Clear(); // Ordenando e Dividindo os Relatorios mdlDataBaseAccess.Tabelas.XsdTbRelatorios.tbRelatoriosRow dtrwRelatorio; for (int nCont = 0; nCont < m_typDatSetTbRelatoriosPadrao.tbRelatorios.Rows.Count; nCont++) { dtrwRelatorio = (mdlDataBaseAccess.Tabelas.XsdTbRelatorios.tbRelatoriosRow)m_typDatSetTbRelatoriosPadrao.tbRelatorios.Rows[nCont]; if (dtrwRelatorio.nIdRelatorio < 1) { // Padrao if (!sortLstRelatoriosPadrao.Contains(dtrwRelatorio.strNomeRelatorio)) { sortLstRelatoriosPadrao.Add(dtrwRelatorio.strNomeRelatorio, dtrwRelatorio); } } } // Inserindo os Relatorios na Lista View for (int nCont = 0; nCont < sortLstRelatoriosPadrao.Count; nCont++) { dtrwRelatorio = (mdlDataBaseAccess.Tabelas.XsdTbRelatorios.tbRelatoriosRow)sortLstRelatoriosPadrao.GetByIndex(nCont); lviItem = m_lvPadrao.Items.Add(dtrwRelatorio.strNomeRelatorio); lviItem.Tag = dtrwRelatorio.nIdRelatorio; lviItem.Font = new System.Drawing.Font(lviItem.Font, System.Drawing.FontStyle.Bold); } }
public static Shop.shop_sold_item sort_sold_items(Shop.shop_sold_item sold_items) { Shop.shop_sold_item sold_items_sorted = new Shop.shop_sold_item(); System.Collections.SortedList used = new System.Collections.SortedList(); for (int i = 0; i < sold_items._shop_sold_item.Rows.Count; ++i) { Shop.shop_sold_item.shop_sold_itemRow row = sold_items._shop_sold_item[i]; if (used.ContainsKey(row.idx)) { continue; } if (row.type == 1) { sold_items_sorted._shop_sold_item.ImportRow(row); foreach (Shop.shop_sold_item.shop_sold_itemRow r in sold_items._shop_sold_item.Rows) { if (r.parent == row.idx) { sold_items_sorted._shop_sold_item.ImportRow(r); used[r.idx] = 1; } } } else { sold_items_sorted._shop_sold_item.ImportRow(row); } } return(sold_items_sorted); }
/// <summary> /// Returns a list of data source names from the local machine. /// </summary> public SortedList GetAllDataSourceNames() { // Get the list of user DSN's first. System.Collections.SortedList dsnList = GetUserDataSourceNames(); // Get list of System DSN's and add them to the first list. System.Collections.SortedList systemDsnList = GetSystemDataSourceNames(); for (int i = 0; i < systemDsnList.Count; i++) { string sName = systemDsnList.GetKey(i) as string; DataSourceType type = (DataSourceType)systemDsnList.GetByIndex(i); try { // This dsn to the master list dsnList.Add(sName, type); } catch { // An exception can be thrown if the key being added is a duplicate so // we just catch it here and have to ignore it. } } return(dsnList); }
public void TestConstructor3 () { Hashtable d = new Hashtable (); d.Add ("one", "Mircosoft"); d.Add ("two", "will"); d.Add ("three", "rule"); d.Add ("four", "the world"); SortedList temp1 = new SortedList (d); Assert.IsNotNull (temp1, "#A1"); Assert.AreEqual (4, temp1.Capacity, "#A2"); Assert.AreEqual (4, temp1.Count, "#A3"); try { new SortedList ((Hashtable) null); Assert.Fail ("#B"); } catch (ArgumentNullException) { } try { d = new Hashtable (); d.Add ("one", "Mircosoft"); d.Add ("two", "will"); d.Add ("three", "rule"); d.Add ("four", "the world"); d.Add (7987, "lkj"); new SortedList (d); Assert.Fail ("#C"); } catch (InvalidOperationException) { } }
public DataSet ServerDBQuery(string strProcName, DataSet dsIN) { try { SortedList SDList = new SortedList(); if (dsIN.Tables.Count > 0 && dsIN.Tables[0].Rows.Count > 0) { DataRow dR = dsIN.Tables[0].Rows[0]; for (int i = 0; i < dsIN.Tables[0].Columns.Count; i++) { SDList[dsIN.Tables[0].Columns[i].ColumnName] = dR[i]; } } return WSBDB.proGetDS(SDList, strProcName); } catch (Exception Ex) { #region 错误日志 string strSDList = ""; if (dsIN.Tables.Count > 0 && dsIN.Tables[0].Rows.Count > 0) { DataRow dR = dsIN.Tables[0].Rows[0]; for (int i = 0; i < dsIN.Tables[0].Columns.Count; i++) { strSDList += dsIN.Tables[0].Columns[i].ColumnName + ":" + dR[i] + "$"; } } string strErrEx = "出现未知错误,请联系系统管理员查询日志,方法" + strProcName + "参数:" + strSDList + "错误ID:" + Guid.NewGuid().ToString(); WSBDB.txtSaveErro(strErrEx + ":" + Ex.ToString()); #endregion return null; } }
public TemplateCollection() { eX4XcIhHpDXt70u2x3N.k8isAcYzkUOGF(); // ISSUE: explicit constructor call base.\u002Ector(); this.aJ8duHpkdC = new SortedList(); }
public string ExecuteSclrBySP(string sp, SortedList sl) { string err = string.Empty; string returnSclr = "-1"; SqlConnection con = new SqlConnection(DbConnStr); SqlCommand cmd = new SqlCommand(sp, con); cmd.CommandType = CommandType.StoredProcedure; foreach (DictionaryEntry entry in sl) { cmd.Parameters.Add(new SqlParameter(entry.Key.ToString(), entry.Value)); } try { con.Open(); returnSclr = Convert.ToString(cmd.ExecuteScalar()); } catch (Exception ex) { err = ex.Message; } finally { con.Close(); } return returnSclr; }
private void m_btIComparerNumeroTexto_Click(object sender, System.EventArgs e) { System.Collections.SortedList sortListTest = new System.Collections.SortedList(new mdlComponentesColecoes.clsComparerNumbersTexts()); // Inserindo os Items sortListTest.Add("1", "1"); sortListTest.Add("2", "2"); sortListTest.Add("5", "5"); sortListTest.Add("10", "10"); sortListTest.Add("11", "11"); sortListTest.Add("Thiago", "Thiago"); sortListTest.Add("22", "22"); sortListTest.Add("", ""); sortListTest.Add("Silvio", "Silvio"); sortListTest.Add("Paulo", "Paulo"); sortListTest.Add("32", "32"); sortListTest.Add("Robson", "Robson"); sortListTest.Add("27", "27"); for (int nCont = 300; nCont < 400; nCont++) { sortListTest.Add(nCont.ToString(), nCont.ToString()); } m_lvOutput.Items.Clear(); for (int nCont = 0; nCont < sortListTest.Count; nCont++) { m_lvOutput.Items.Add((string)sortListTest.GetByIndex(nCont)); } }
/// <summary> /// Class constructor. /// </summary> /// <param name="properties"></param> public Type2CIDFont(FontProperties properties) { this.properties = properties; this.baseFontName = properties.FaceName.Replace(" ", "-"); this.usedGlyphs = new SortedList(); ObtainFontMetrics(); }
public Button() { this.m_bNoScalingOnSetRect = true; Name = "Button"; this.MouseActive = true; m_plStateSprites = new SortedList(); Frame spFrame = new Frame(); spFrame.Parent = this; spFrame.Member = new MemberSpriteBitmap("Button2Up"); spFrame.Ink = RasterOps.ROPs.BgTransparent; spFrame.Member.ColorKey = Color.FromArgb(0,0,0); spFrame.Rect = new ERectangleF(0,0,50,50); m_plStateSprites.Add(Sprite.MouseEventType.Leave, (Sprite)spFrame); spFrame = new Frame(); spFrame.Parent = this; spFrame.Member = new MemberSpriteBitmap("Button2Down"); spFrame.Ink = RasterOps.ROPs.BgTransparent; spFrame.Member.ColorKey = Color.FromArgb(0,0,0); spFrame.Rect = new ERectangleF(0,0,50,50); m_plStateSprites.Add(Sprite.MouseEventType.Enter, (Sprite)spFrame); for (int i = 0; i < m_plStateSprites.Count; i++) { ((Sprite)m_plStateSprites.GetByIndex(i)).Visible = false; } ((Sprite)m_plStateSprites[MouseEventType.Leave]).Visible = true; }
public override void Dispose() { _rowRecords = null; _unknownRecords = null; _valuesAgg.Dispose(); _sharedValueManager.Dispose(); }
protected void TargetSelectorCallback(Address start, SortedList score_table, Address current) { Assert.IsTrue(score_table.Count > 0); if (current == null) { Address min_target = (Address) score_table.GetByIndex(0); Assert.AreEqual(_addr_list[_idx++], min_target); } }
public DataEditor(IData Data, SortedList Prevalues) { _data = (cms.businesslogic.datatype.DefaultData)Data; if (Prevalues["group"] != null) _group = Prevalues["group"].ToString(); }
static void Main(string[] args) { // Here we define the Hashtable obect and initialize it Hashtable countryCodes = new Hashtable(); countryCodes.Add("358", "Finland"); countryCodes.Add("1", "Canada"); countryCodes.Add("254", "Kenya"); // Here we print the full content of the Hashtable foreach (string code in countryCodes.Keys) Console.WriteLine(code + " --> " + countryCodes[code]); // Here we print all values in the Hastable Console.WriteLine("Values in the hash table: "); foreach (string value in countryCodes.Values) Console.WriteLine(value); SortedList countryAbbr = new SortedList(); countryAbbr.Add("FI", "Finland"); countryAbbr.Add("NL", "Netherlands"); countryAbbr.Add("IR", "Iran"); countryAbbr.Add("CA", "Canada"); Console.WriteLine("Country with abbreviation NL in sorted list: " + countryAbbr["NL"]); Console.WriteLine("Third value in the sorted list: " + countryAbbr.GetByIndex(2)); // Here we print the full content of the SortedList Console.WriteLine("The contnet of the sorted list: "); foreach (string abbr in countryAbbr.Keys) Console.WriteLine(abbr + " --> " + countryAbbr[abbr]); // Here we print all values in the Hastable Console.WriteLine("Values in the SortedList: "); foreach (string abbr in countryAbbr.Values) Console.WriteLine(abbr); }
public void JavascriptAsGenericSortedListTestOptionsTest() { IDictionary<string, string> options = new SortedList<string, string>(); options.Add("key1","option1"); options.Add("key2","option2"); Assert.AreEqual("{key1:option1, key2:option2}",AbstractHelper.JavascriptOptions(options)); }
public void SortTest() { var rnd = new Random(); var list = new int[1000]; int i; for (i = 0; i < list.Length; ++i) { list[i] = rnd.Next(); } // create sorted list #if (SILVERLIGHT) var sortedList = new TreeDictionary<int, object>(); #else var sortedList = new SortedList(); #endif foreach (int key in list) { sortedList.Add(key, null); } // sort table this.Sorter.Sort(list); Assert.AreEqual(sortedList.Keys, list); }
// StoreChildNode: Store data associated with each nodeName // so that we know whether the nodeName is an array or not. private static void StoreChildNode(SortedList childNodeNames, string nodeName, object nodeValue) { // Pre-process contraction of XmlElement-s if (nodeValue is XmlElement) { // Convert <aa></aa> into "aa":null // <aa>xx</aa> into "aa":"xx" XmlNode cnode = (XmlNode)nodeValue; if (cnode.Attributes.Count == 0) { XmlNodeList children = cnode.ChildNodes; if (children.Count == 0) nodeValue = null; else if (children.Count == 1 && (children[0] is XmlText)) nodeValue = ((XmlText)(children[0])).InnerText; } } // Add nodeValue to ArrayList associated with each nodeName // If nodeName doesn't exist then add it object oValuesAL = childNodeNames[nodeName]; ArrayList ValuesAL; if (oValuesAL == null) { ValuesAL = new ArrayList(); childNodeNames[nodeName] = ValuesAL; } else ValuesAL = (ArrayList)oValuesAL; ValuesAL.Add(nodeValue); }
public GetUnicodeCategory_char() { m_CharData = new SortedList(); m_uCharsRead = 0; m_uTestCaseCount = 0; m_uFailureCount = 0; }
private void markAllDeleted(TreeMap bookSide) { foreach (MamdaOrderBookPriceLevel level in bookSide.Values) { level.markAllDeleted(); } }
public ThemeProvider(IDesignerHost host, string name, string themeDefinition, string[] cssFiles, string themePath) { this._themeName = name; this._themePath = themePath; this._cssFiles = cssFiles; this._host = host; ControlBuilder builder = DesignTimeTemplateParser.ParseTheme(host, themeDefinition, themePath); this._contentHashCode = themeDefinition.GetHashCode(); ArrayList subBuilders = builder.SubBuilders; this._skinBuilders = new Hashtable(); for (int i = 0; i < subBuilders.Count; i++) { ControlBuilder builder2 = subBuilders[i] as ControlBuilder; if (builder2 != null) { IDictionary dictionary = this._skinBuilders[builder2.ControlType] as IDictionary; if (dictionary == null) { dictionary = new SortedList(StringComparer.OrdinalIgnoreCase); this._skinBuilders[builder2.ControlType] = dictionary; } Control control = builder2.BuildObject() as Control; if (control != null) { dictionary[control.SkinID] = builder2; } } } }
public GetNumericValue_str_i() { m_CharData = new SortedList(); m_uCharsRead = 0; m_uTestCaseCount = 0; m_uFailureCount = 0; }
public static Match[] FindSubstrings(string source, string matchPattern, bool findAllUnique) { SortedList uniqueMatches = new SortedList(); Match[] retArray = null; Regex RE = new Regex(matchPattern, RegexOptions.Multiline); MatchCollection theMatches = RE.Matches(source); if (findAllUnique) { for (int counter = 0; counter < theMatches.Count; counter++) { if (!uniqueMatches.ContainsKey(theMatches[counter].Value)) { uniqueMatches.Add(theMatches[counter].Value, theMatches[counter]); } } retArray = new Match[uniqueMatches.Count]; uniqueMatches.Values.CopyTo(retArray, 0); } else { retArray = new Match[theMatches.Count]; theMatches.CopyTo(retArray, 0); } return (retArray); }
//--------------------------------------------------------------------- public bool Startup() { this.Sockets = System.Collections.SortedList.Synchronized(new System.Collections.SortedList()); this.Callback_Accept_ = new AsyncCallback(this.Callback_Accept); this.Callback_Receive_ = new AsyncCallback(this.Callback_Receive); this.Callback_Send_ = new AsyncCallback(this.Callback_Send); return(true); }
public StrProcess() { this._StoreChars = null; _StoreChars = new LocalStore(); _Sortlst = new SortedList(); #region Initial SortList foreach (int _key in _StoreChars.aChar) { _Sortlst.Add(_key, 'a'); } foreach (int _key in _StoreChars.AChar) { _Sortlst.Add(_key, 'A'); } foreach (int _key in _StoreChars.eChar) { _Sortlst.Add(_key, 'e'); } foreach (int _key in _StoreChars.EChar) { _Sortlst.Add(_key, 'E'); } foreach (int _key in _StoreChars.oChar) { _Sortlst.Add(_key, 'o'); } foreach (int _key in _StoreChars.OChar) { _Sortlst.Add(_key, 'O'); } foreach (int _key in _StoreChars.uChar) { _Sortlst.Add(_key, 'u'); } foreach (int _key in _StoreChars.UChar) { _Sortlst.Add(_key, 'U'); } foreach (int _key in _StoreChars.iChar) { _Sortlst.Add(_key, 'i'); } foreach (int _key in _StoreChars.IChar) { _Sortlst.Add(_key, 'I'); } foreach (int _key in _StoreChars.yChar) { _Sortlst.Add(_key, 'y'); } foreach (int _key in _StoreChars.YChar) { _Sortlst.Add(_key, 'Y'); } _Sortlst.Add(_StoreChars.dChar, 'd'); _Sortlst.Add(_StoreChars.DChar, 'D'); #endregion }
//--------------------------------------------------------------------- void IDisposable.Dispose() { this.Shutdown(); this.Sockets = null; this.Callback_Accept_ = null; this.Callback_Receive_ = null; this.Callback_Send_ = null; return; }
/// <summary> /// If a plot is removed, then the ordering_ list needs to be /// recalculated. /// </summary> private void RefreshZOrdering() { uniqueCounter_ = 0; ordering_ = new SortedList(); for (int i = 0; i < zPositions_.Count; ++i) { double zpos = Convert.ToDouble(zPositions_[i]); double fraction = (double)(++uniqueCounter_) / 10000000.0f; double d = zpos + fraction; ordering_.Add(d, i); } }
static public int get_SyncRoot(IntPtr l) { try { System.Collections.SortedList self = (System.Collections.SortedList)checkSelf(l); pushValue(l, true); pushValue(l, self.SyncRoot); return(2); } catch (Exception e) { return(error(l, e)); } }
static public int Clear(IntPtr l) { try { System.Collections.SortedList self = (System.Collections.SortedList)checkSelf(l); self.Clear(); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
/// <summary> /// 导出Excel /// </summary> /// <param name="dgv"></param> /// <param name="filePath"></param> public static void ExportExcel(DataTable dtSource, Stream excelStream) { _listColumnsName = new SortedList(new NoSort()); for (int i = 0; i < dtSource.Columns.Count; i++) { _listColumnsName.Add(dtSource.Columns[i].ColumnName, dtSource.Columns[i].ColumnName); } HSSFWorkbook excelWorkbook = CreateExcelFile(); InsertRow(dtSource, excelWorkbook); SaveExcelFile(excelWorkbook, excelStream); }
static public int GetValueList(IntPtr l) { try { System.Collections.SortedList self = (System.Collections.SortedList)checkSelf(l); var ret = self.GetValueList(); pushValue(l, true); pushValue(l, ret); return(2); } catch (Exception e) { return(error(l, e)); } }
static public int ctor_s(IntPtr l) { try { System.Collections.SortedList o; o = new System.Collections.SortedList(); pushValue(l, true); pushValue(l, o); return(2); } catch (Exception e) { return(error(l, e)); } }
/// <summary> /// 导出Excel /// </summary> /// <param name="dsSource"></param> /// <param name="excelStream"></param> /// <param name="SheetName"></param> /// <remarks>齐鹏飞 2011.05.24</remarks> public static void ExportExcel(DataSet ds, Stream excelStream, List <string> SheetName) { if (ds == null || SheetName == null) { return; } if (ds.Tables.Count != SheetName.Count) { return; } int rowCount = 0; int cellIndex = 0; HSSFWorkbook excelWorkbook = CreateExcelFile(); HSSFSheet newsheet = null; for (int i = 0; i < ds.Tables.Count; i++) { //循环数据源导出数据集 newsheet = excelWorkbook.CreateSheet(SheetName[i]); //创建标题 cellIndex = 0; StarTech.NPOI.NPOIHelper.ListColumnsName = new SortedList(new StarTech.NPOI.NoSort()); //设置标题样式 HSSFCellStyle cellStyle = excelWorkbook.CreateCellStyle(); cellStyle.Alignment = HSSFCellStyle.ALIGN_CENTER; HSSFFont mHSSFFont = excelWorkbook.CreateFont(); mHSSFFont.FontHeightInPoints = 12;//字号 mHSSFFont.Boldweight = HSSFFont.BOLDWEIGHT_BOLD; cellStyle.SetFont(mHSSFFont); //循环导出列 foreach (DataColumn dc in ds.Tables[i].Columns) { HSSFRow newRow = newsheet.CreateRow(0); HSSFCell newCell = newRow.CreateCell(cellIndex); newCell.SetCellValue(dc.ColumnName); newCell.CellStyle = cellStyle; StarTech.NPOI.NPOIHelper.ListColumnsName.Add(dc.ColumnName, dc.ColumnName); cellIndex++; } rowCount = 0; foreach (DataRow dr in ds.Tables[i].Rows) { ++rowCount; HSSFRow newRow = newsheet.CreateRow(rowCount); InsertCell(ds.Tables[i], dr, newRow, newsheet, excelWorkbook); } } SaveExcelFile(excelWorkbook, excelStream); }
public void DisplayEmployeesNameAge() { System.Collections.SortedList nameAge = new System.Collections.SortedList(); nameAge.Add("Alicia", 30); nameAge.Add("Mike", 29); nameAge.Add("Adam", 22); nameAge.Add("Andrew", 39); for (int i = 0; i < nameAge.Count; i++) { Console.WriteLine("{0}: {1}", nameAge.GetKey(i), nameAge.GetByIndex(i)); } }
static public int Remove(IntPtr l) { try { System.Collections.SortedList self = (System.Collections.SortedList)checkSelf(l); System.Object a1; checkType(l, 2, out a1); self.Remove(a1); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int set_Capacity(IntPtr l) { try { System.Collections.SortedList self = (System.Collections.SortedList)checkSelf(l); int v; checkType(l, 2, out v); self.Capacity = v; pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
private void deleteLevelSide( MamdaOrderBookPriceLevel level, TreeMap bookSide) { MamaPrice price = level.getPrice(); if (bookSide.ContainsKey(price)) { /* We actually need to process this properly because the * update may not contain all entries, just updated * ones. */ bookSide.Remove(price); } }
/// <summary> /// 读取AD用户信息 /// </summary> /// <param name= "ADUsername "> 用户 </param> /// <param name= "ADPassword "> 密码 </param> /// <param name= "domain "> 域名 </param> /// <returns> </returns> public DataTable AdUserInfo(string ADUsername, string ADPassword, string domain)//System.Collections.SortedList { ClsDataBase clsSQLCommond = new ClsDataBase(); DataTable dt = new DataTable(); dt.Columns.Add("Name"); System.DirectoryServices.DirectorySearcher src; string ADPath = "LDAP:// " + domain; System.Collections.SortedList sl = new System.Collections.SortedList(); System.DirectoryServices.DirectoryEntry de = new System.DirectoryServices.DirectoryEntry(ADPath, ADUsername, ADPassword); src = new System.DirectoryServices.DirectorySearcher(de); src.PageSize = 10000;// 此参数可以任意设置,但不能不设置,如不设置读取AD数据为0~999条数据,设置后可以读取大于1000条数据。 src.SearchScope = System.DirectoryServices.SearchScope.Subtree; src.Filter = "(&(&(objectCategory=person)))"; DataTable dtadlist = clsSQLCommond.ExecQuery("select * from _LookUpDate where iType=6"); foreach (System.DirectoryServices.SearchResult res in src.FindAll()) { DirectoryEntry users = res.GetDirectoryEntry(); string str = ""; string str3 = ""; string str4 = ""; str = res.GetDirectoryEntry().Properties["distinguishedName"].Value.ToString().Trim(); string[] str2 = System.Text.RegularExpressions.Regex.Split(str, ",OU=", System.Text.RegularExpressions.RegexOptions.IgnoreCase); if (str2.Length > 1) { str3 = str2[1]; } if (str3 != "") { str4 = str3.Split(',')[0].Trim(); } if (res.GetDirectoryEntry().Properties["CN"].Value.ToString().Trim() == "yx") { string s = "s"; } DataRow[] dwadlist = dtadlist.Select("iText='" + str4 + "'"); if (dwadlist.Length > 0) { DataRow dw = dt.NewRow(); dw["Name"] = res.GetDirectoryEntry().Properties["Name"].Value.ToString().Trim(); dt.Rows.Add(dw); } } return(dt); }
private void addLevelSide( MamdaOrderBookPriceLevel level, TreeMap bookSide) { MamaPrice price = level.getPrice(); if (!bookSide.ContainsKey(price)) { bookSide.Add(price, level); } else { bookSide[price] = level; // Overwrite it anyway } }