public static string FormatContentLocation(string contentLocation, string queryString) { var token = new char[] { '/' }; var locationArray = contentLocation.Split(token); var locationArrayList = new ArrayList(locationArray); // Create CDN Address as array so we can insert it into url array at appropriate point var cdnAddressArray = new List<string> { CdnEndpoint }; // Replace root element with http address for CDN if (CdnEndpoint.StartsWith("http") && ((locationArrayList[0].ToString() == "~") || (locationArrayList[0].ToString() == "."))) { locationArrayList[0] = CdnEndpoint; } else if (locationArrayList[0].ToString() == "~" || locationArrayList[0].ToString() == ".") { locationArrayList.InsertRange(1, cdnAddressArray); } else { locationArrayList.InsertRange(0, cdnAddressArray); } var newUrl = String.Join("/", locationArrayList.ToArray()); newUrl = newUrl + queryString; return newUrl; }
public ArrayList Recombine(ArrayList maleGenes, ArrayList femaleGenes) { double maleConstraint = random.NextDouble(); int maleCount = (int)Math.Ceiling(maleGenes.Count * maleConstraint); int femaleCount = (int)Math.Floor(femaleGenes.Count * (1-maleConstraint)); ArrayList child = new ArrayList(maleCount + femaleCount); child.InsertRange(0, maleGenes.GetRange(0, maleCount)); child.InsertRange(maleCount, femaleGenes.GetRange(femaleGenes.Count - femaleCount, femaleCount)); for (int i = 0; i < child.Count; i++) child[i] = (child[i] as IGene).Clone(); return child; }
public ArrayList Recombine(ArrayList maleGenes, ArrayList femaleGenes) { if (maleGenes.Count != femaleGenes.Count) throw new GenesIncompatibleException(); ArrayList child = new ArrayList(maleGenes.Count); int middle = maleGenes.Count / 2; child.InsertRange(0, maleGenes.GetRange(0, middle).Clone() as ArrayList); child.InsertRange(middle, femaleGenes.GetRange(middle, femaleGenes.Count - middle).Clone() as ArrayList); // Create Deep Copy for (int i = 0; i < child.Count; i++) child[i] = (child[i] as IGene).Clone(); return child; }
public void fun1() { ArrayList a1 = new ArrayList(); a1.Add(1); a1.Add('c'); a1.Add("string1"); ArrayList al2 = new ArrayList(); al2.Add('a'); al2.Add(5); int n = (int)a1[0]; Console.WriteLine(n); a1[0] = 20; Console.WriteLine(a1.Count); Console.WriteLine(a1.Contains(55)); Console.WriteLine(a1.IndexOf(55)); //int[] num = (int[])a1.ToArray(); a1.Add(45); a1.Add(12); a1.Add(67); a1.Insert(1, "new value"); //a1.AddRange(al2); a1.InsertRange(1, al2); a1.Remove("string1"); a1.RemoveAt(2); a1.RemoveRange(0, 2); foreach (object o in a1) { Console.WriteLine(o.ToString()); } }
private char[] Read_char_int_int(SerialPort com) { System.Collections.ArrayList receivedChars = new System.Collections.ArrayList(); char[] buffer = new char[DEFAULT_READ_CHAR_ARRAY_SIZE]; int totalCharsRead = 0; int numChars; while (true) { try { numChars = com.Read(buffer, 0, buffer.Length); } catch (TimeoutException) { break; } receivedChars.InsertRange(totalCharsRead, buffer); totalCharsRead += numChars; } if (totalCharsRead < receivedChars.Count) { receivedChars.RemoveRange(totalCharsRead, receivedChars.Count - totalCharsRead); } return((char[])receivedChars.ToArray(typeof(char))); }
private char[] Read_byte_int_int(SerialPort com) { System.Collections.ArrayList receivedBytes = new System.Collections.ArrayList(); byte[] buffer = new byte[DEFAULT_READ_BYTE_ARRAY_SIZE]; int totalBytesRead = 0; while (true) { int numBytes; try { numBytes = com.Read(buffer, 0, buffer.Length); } catch (TimeoutException) { break; } receivedBytes.InsertRange(totalBytesRead, buffer); totalBytesRead += numBytes; } if (totalBytesRead < receivedBytes.Count) { receivedBytes.RemoveRange(totalBytesRead, receivedBytes.Count - totalBytesRead); } return(com.Encoding.GetChars((byte[])receivedBytes.ToArray(typeof(byte)))); }
public override void InsertRange(int index, ICollection c) { if (c == null) { throw new ArgumentNullException("c", Environment.GetResourceString("ArgumentNull_Collection")); } if (index < 0 || index > this.Count) { throw new ArgumentOutOfRangeException("index", Environment.GetResourceString("ArgumentOutOfRange_Index")); } if (c.Count > 0) { ArrayList al = _list as ArrayList; if (al != null) { // We need to special case ArrayList. // When c is a range of _list, we need to handle this in a special way. // See ArrayList.InsertRange for details. al.InsertRange(index, c); } else { IEnumerator en = c.GetEnumerator(); while (en.MoveNext()) { _list.Insert(index++, en.Current); } } _version++; } }
public void Test(int arg) { ArrayList items = new ArrayList(); items.Add(1); items.AddRange(1, 2, 3); items.Clear(); bool b1 = items.Contains(2); items.Insert(0, 1); items.InsertRange(1, 0, 5); items.RemoveAt(4); items.RemoveRange(4, 3); items.Remove(1); object[] newItems = items.GetRange(5, 2); object[] newItems2 = items.GetRange(5, arg); List<int> numbers = new List<int>(); numbers.Add(1); numbers.AddRange(1, 2, 3); numbers.Clear(); bool b2 = numbers.Contains(4); numbers.Insert(1, 10); numbers.InsertRange(2, 10, 3); numbers.RemoveAt(4); numbers.RemoveRange(4, 2); int[] newNumbers = items.GetRange(5, 2); int[] newNumbers2 = items.GetRange(5, arg); string[] words = new string[5]; words[0] = "hello"; words[1] = "world"; bool b3 = words.Contains("hi"); string[] newWords = words.GetRange(5, 2); string[] newWords2 = words.GetRange(5, arg); }
public void TestInsert() { ArrayList anArrayList = new ArrayList(); anArrayList.Insert( anArrayList.Count, "Moo!" ); Assert.AreEqual (1, anArrayList.Count); Assert.AreSame ("Moo!", anArrayList[0]); anArrayList.InsertRange( 1, new ArrayList(){1,2,3,4,5,6,7,8,9} ); Assert.AreEqual (10, anArrayList.Count); }
static int InsertRange(IntPtr L) { try { ToLua.CheckArgsCount(L, 3); System.Collections.ArrayList obj = (System.Collections.ArrayList)ToLua.CheckObject(L, 1, typeof(System.Collections.ArrayList)); int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); System.Collections.ICollection arg1 = (System.Collections.ICollection)ToLua.CheckObject(L, 3, typeof(System.Collections.ICollection)); obj.InsertRange(arg0, arg1); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static public int InsertRange(IntPtr l) { try { System.Collections.ArrayList self = (System.Collections.ArrayList)checkSelf(l); System.Int32 a1; checkType(l, 2, out a1); System.Collections.ICollection a2; checkType(l, 3, out a2); self.InsertRange(a1, a2); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
void OnAuthenticate(object sender, EventArgs e) { app = (HttpApplication)sender; HttpRequest req = app.Request; HttpResponse res = app.Response; string loginUrl = ConfigurationSettings.AppSettings[LOGINURL_KEY]; if(loginUrl == null || loginUrl.Trim() == String.Empty) { throw new Exception(" CustomAuthentication.LoginUrl entry not found in appSettings section of Web.config"); } string cookieName = ConfigurationSettings.AppSettings[AUTHENTICATION_COOKIE_KEY]; if(cookieName == null || cookieName.Trim() == String.Empty) { throw new Exception(" CustomAuthentication.Cookie.Name entry not found in appSettings section section of Web.config"); } int i = req.Path.LastIndexOf("/"); string page = req.Path.Substring(i+1, (req.Path.Length - (i + 1))); int j = loginUrl.LastIndexOf("/"); string loginPage = loginUrl.Substring(j+1, (loginUrl.Length - (j + 1))); if(page != null && !(page.Trim().ToUpper().Equals(loginPage.ToUpper()))) { if(req.Cookies.Count > 0 && req.Cookies[cookieName.ToUpper()] != null) { HttpCookie cookie = req.Cookies[cookieName.ToUpper()]; if(cookie != null) { string str = cookie.Value; CustomIdentity userIdentity = CustomAuthentication.Decrypt(str); string[] roles = userIdentity.UserRoles.Split(new char[]{'|'}); ArrayList arrRoles = new ArrayList(); arrRoles.InsertRange(0, roles); CustomPrincipal principal = new CustomPrincipal(userIdentity, arrRoles); app.Context.User = principal; Thread.CurrentPrincipal = principal; } } else { res.Redirect(req.ApplicationPath + loginUrl + "?ReturnUrl=" + req.Path, true); } } }
/// <summary> /// Returns an array of absolute file paths of all of the files in the project where the /// BuildAction = Compile. /// </summary> /// <returns>.</returns> private string[] GetAllCompileBuildActionSourceFiles() { StringCollection sourceFiles = new StringCollection(); ArrayList nodesToProcess = new ArrayList(this.Project.RootNode.Children); while (nodesToProcess.Count > 0) { Node node = (Node)nodesToProcess[0]; FolderNode folderNode = node as FolderNode; string sourceFile = node.AbsolutePath; // Remove the node that we are processing. nodesToProcess.RemoveAt(0); // If we have a sub-folder (that's not the library folder), then add all of its children to the process array. if (folderNode != null) { if (!(folderNode is ReferenceFolderNode)) { nodesToProcess.InsertRange(0, folderNode.Children); } } else if (node.BuildAction == BuildAction.Compile) { sourceFiles.Add(sourceFile); } } return ToStringArray(sourceFiles); }
void AddDefaultResponseFile(ref ArrayList arglist) { ArrayList result = new ArrayList(); foreach (string arg in arglist) { if (arg == "-noconfig") { _noConfig = true; } else { result.Add(arg); } } if (!_noConfig) { string file = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "booc.rsp"); if (File.Exists(file)) { result.InsertRange(0, LoadResponseFile(file)); } } arglist = result; }
/* NOT COMPLETE YET (Cell Reference,A1) * THIS NEED TO BE SOLVED BY UI! * The UI team needs to setup a mathod that takes a Cell Reference as a string and return the formula. */ private ArrayList Reformat(ArrayList Parts) { #region SECTION REMOVER () for (int i = 0; i < Parts.Count; i++) { int second = i - 1; if (second == -1) second = 0; if (Parts[i].ToString().Equals("(") && !Fun_Class.IsFunction(Parts[second].ToString()) && !IsNumber(Parts[second].ToString())) { //PrintArrayList(Parts); int found = 1; int start = i; while (found != 0) { start++; if (Parts[start].ToString().Equals("(")) found++; if (Parts[start].ToString().Equals(")")) found--; } ArrayList atemp = new ArrayList(Parts.GetRange(i + 1, start - i + 1 - 2)); Parts.RemoveRange(i, start - i + 1); Parts.InsertRange(i, Reformat(atemp)); } } #endregion #region SHORTCUT REMOVER * and / for (int i = 0; i < Parts.Count; i++) { string function; if (Parts[i].ToString().Equals("*") || Parts[i].ToString().Equals("/")) { //PrintArrayList(Parts); if (Parts[i].ToString().Equals("*")) function = "MUL"; else function = "DIV"; try { int first = i - 1, second = i + 2; if ((i + 2) >= Parts.Count) second--; if (Parts[first].ToString().Equals(")") && !Parts[second].ToString().Equals("(")) { int found = 1; int start = i - 1; while (found != 0) { start--; if (Parts[start].ToString().Equals(")")) found++; if (Parts[start].ToString().Equals("(")) found--; } Parts.Insert(i, ")"); Parts.Insert(i, Parts[i + 2]); Parts.Insert(i, ","); Parts.InsertRange(i, Parts.GetRange(start - 1, i - start + 1)); Parts.Insert(i, "("); Parts.Insert(i, function); Parts.RemoveAt(i + (i - start + 1) + 5); Parts.RemoveAt(i + (i - start + 1) + 5); Parts.RemoveRange(start - 1, i - start + 1); } else { if (!Parts[first].ToString().Equals(")") && Parts[second].ToString().Equals("(")) { int found = 1; int start = i + 2; while (found != 0) { start++; if (Parts[start].ToString().Equals("(")) found++; if (Parts[start].ToString().Equals(")")) found--; } Parts.Insert(start + i, ")"); Parts.Insert(i + 1, ","); Parts.Insert(i + 1, Parts[i - 1]); Parts.Insert(i + 1, "("); Parts.Insert(i + 1, function); Parts.RemoveAt(i - 1); Parts.RemoveAt(i - 1); } else { if (!Parts[first].ToString().Equals(")") && !Parts[second].ToString().Equals("(")) { Parts.Insert(i, ")"); Parts.Insert(i, Parts[i + 2]); Parts.Insert(i, ","); Parts.Insert(i, Parts[i - 1]); Parts.Insert(i, "("); Parts.Insert(i, function); Parts.RemoveAt(i + 6); Parts.RemoveAt(i + 6); Parts.RemoveAt(i - 1); } else { if (Parts[first].ToString().Equals(")") && Parts[second].ToString().Equals("(")) { int found = 1; int start = i + 2; while (found != 0) { start++; if (Parts[start].ToString().Equals("(")) found++; if (Parts[start].ToString().Equals(")")) found--; } Parts.Insert(start + 1, ")"); Parts[i] = ","; found = 1; start = i - 1; while (found != 0) { start--; if (Parts[start].ToString().Equals(")")) found++; if (Parts[start].ToString().Equals("(")) found--; } Parts.Insert(start - 1, "("); Parts.Insert(start - 1, function); } } } } } catch { OutFile.WriteLine("ERROR: INCORRECT INPUT STRING"); //ERROR: INCORRECT INPUT STRING Form1.Step("ERROR: INCORRECT INPUT STRING"); return Tokenize(Base_String); } } } #endregion #region SHORTCUT REMOVER + and - for (int i = 0; i < Parts.Count; i++) { //SHORTCUT REMOVER string function; if (Parts[i].ToString().Equals("+") || Parts[i].ToString().Equals("-")) { //PrintArrayList(Parts); if (Parts[i].ToString().Equals("+")) function = "ADD"; else function = "SUB"; try { int first = i - 1, second = i + 2; if ((i + 2) >= Parts.Count) second--; if (Parts[first].ToString().Equals(")") && !Parts[second].ToString().Equals("(")) { int found = 1; int start = i - 1; while (found != 0) { start--; if (Parts[start].ToString().Equals(")")) found++; if (Parts[start].ToString().Equals("(")) found--; } Parts.Insert(i, ")"); Parts.Insert(i, Parts[i + 2]); Parts.Insert(i, ","); Parts.InsertRange(i, Parts.GetRange(start - 1, i - start + 1)); Parts.Insert(i, "("); Parts.Insert(i, function); Parts.RemoveAt(i + (i - start + 1) + 5); Parts.RemoveAt(i + (i - start + 1) + 5); Parts.RemoveRange(start - 1, i - start + 1); } else { if (!Parts[first].ToString().Equals(")") && Parts[second].ToString().Equals("(")) { int found = 1; int start = i + 2; while (found != 0) { start++; if (Parts[start].ToString().Equals("(")) found++; if (Parts[start].ToString().Equals(")")) found--; } Parts.Insert(start + i, ")"); Parts.Insert(i + 1, ","); Parts.Insert(i + 1, Parts[i - 1]); Parts.Insert(i + 1, "("); Parts.Insert(i + 1, function); Parts.RemoveAt(i - 1); Parts.RemoveAt(i - 1); } else { if (!Parts[first].ToString().Equals(")") && !Parts[second].ToString().Equals("(")) { Parts.Insert(i, ")"); Parts.Insert(i, Parts[i + 2]); Parts.Insert(i, ","); Parts.Insert(i, Parts[i - 1]); Parts.Insert(i, "("); Parts.Insert(i, function); Parts.RemoveAt(i + 6); Parts.RemoveAt(i + 6); Parts.RemoveAt(i - 1); } else { if (Parts[first].ToString().Equals(")") && Parts[second].ToString().Equals("(")) { int found = 1; int start = i + 2; while (found != 0) { start++; if (Parts[start].ToString().Equals("(")) found++; if (Parts[start].ToString().Equals(")")) found--; } Parts.Insert(start + 1, ")"); Parts[i] = ","; found = 1; start = i - 1; while (found != 0) { start--; if (Parts[start].ToString().Equals(")")) found++; if (Parts[start].ToString().Equals("(")) found--; } Parts.Insert(start - 1, "("); Parts.Insert(start - 1, function); } } } } } catch { OutFile.WriteLine("ERROR: INCORRECT INPUT STRING"); //ERROR: INCORRECT INPUT STRING Form1.Step("ERROR: INCORRECT INPUT STRING"); return Tokenize(Base_String); } } } #endregion #region SHORTCUT REMOVER : for (int i = 0; i < Parts.Count; i++) { //SHORTCUT REMOVER 1 if (Parts[i].ToString().Contains(":")) { //PrintArrayList(Parts); char c = Convert.ToChar(Parts[i].ToString().Substring(0, 1)); int t1 = Convert.ToInt32(Parts[i].ToString().Split(':')[0].Substring(1)); int t2 = Convert.ToInt32(Parts[i].ToString().Split(':')[1].Substring(1)); Parts.RemoveAt(i); for (int j = t2; j >= t1; j--) { Parts.Insert(i, c + j.ToString()); if (j != t1) Parts.Insert(i, ","); } } } #endregion for (int i = 0; i < Parts.Count; i++) { //CELL REFERENCE if (Base_Cell.CompareTo(Parts[i].ToString().ToUpper()) == 0) { OutFile.WriteLine("ERROR: CIRCULAR REFERENCE"); Form1.Step("ERROR: CIRCULAR REFERENCE"); //ERROR: CIRCULAR REFERENCE return Parts; } if (IsCellReference(Parts[i].ToString())) { OutFile.WriteLine("Cell Reference"); Form1.Step("Cell Reference"); //Console.WriteLine("BaseCell= " + Base_Cell); //Console.WriteLine("CellReference= " + Parts[i].ToString()); string cell_ref = Parts[i].ToString().ToUpper(); Parts.RemoveAt(i); //string temp = "=1+2";//temp will equal the output of the UI's function string temp = Form1.getCellFormula(cell_ref); OutFile.WriteLine(cell_ref + " -> " + temp); Form1.Step(cell_ref + " -> " + temp); if (temp[0] == '=') { //Cell has a formula Parts.InsertRange(i, Reformat(Tokenize(temp))); OutFile.WriteLine("Cell has a formula"); Form1.Step("Cell has a formula"); } else { try { //Cell has a value Parts.Insert(i, Convert.ToDouble(temp)); OutFile.WriteLine("Cell has a number"); Form1.Step("Cell has a number"); } catch { OutFile.WriteLine("Cell has a string"); Form1.Step("Cell has a string"); //ERROR: Cell has a string return Parts; } } } } return Parts; }
protected virtual void AddNewRecords() { ArrayList newRecordList = new ArrayList(); System.Collections.Generic.List<Hashtable> newUIDataList = new System.Collections.Generic.List<Hashtable>(); // Loop though all the record controls and if the record control // does not have a unique record id set, then create a record // and add to the list. if (!this.ResetData) { System.Web.UI.WebControls.Repeater rep = (System.Web.UI.WebControls.Repeater)(BaseClasses.Utils.MiscUtils.FindControlRecursively(this, "EstLineAdjTableControlRepeater")); if (rep == null){return;} foreach (System.Web.UI.WebControls.RepeaterItem repItem in rep.Items) { // Loop through all rows in the table, set its DataSource and call DataBind(). EstLineAdjTableControlRow recControl = (EstLineAdjTableControlRow)(repItem.FindControl("EstLineAdjTableControlRow")); if (recControl.Visible && recControl.IsNewRecord) { EstLineAdjRecord rec = new EstLineAdjRecord(); if (MiscUtils.IsValueSelected(recControl.CatID)) { rec.Parse(recControl.CatID.SelectedItem.Value, EstLineAdjTable.CatID); } if (recControl.CreatedBy1.Text != "") { rec.Parse(recControl.CreatedBy1.Text, EstLineAdjTable.CreatedBy); } if (recControl.CreatedByID1.Text != "") { rec.Parse(recControl.CreatedByID1.Text, EstLineAdjTable.CreatedByID); } if (recControl.CreatedDate1.Text != "") { rec.Parse(recControl.CreatedDate1.Text, EstLineAdjTable.CreatedDate); } if (MiscUtils.IsValueSelected(recControl.EstimateAdjID)) { rec.Parse(recControl.EstimateAdjID.SelectedItem.Value, EstLineAdjTable.EstimateAdjID); } if (MiscUtils.IsValueSelected(recControl.EstimateID)) { rec.Parse(recControl.EstimateID.SelectedItem.Value, EstLineAdjTable.EstimateID); } if (MiscUtils.IsValueSelected(recControl.EstimateLineID)) { rec.Parse(recControl.EstimateLineID.SelectedItem.Value, EstLineAdjTable.EstimateLineID); } if (recControl.EstLineAdjAmount.Text != "") { rec.Parse(recControl.EstLineAdjAmount.Text, EstLineAdjTable.EstLineAdjAmount); } if (recControl.EstLineAdjID.Text != "") { rec.Parse(recControl.EstLineAdjID.Text, EstLineAdjTable.EstLineAdjID); } if (recControl.EstLineAdjName.Text != "") { rec.Parse(recControl.EstLineAdjName.Text, EstLineAdjTable.EstLineAdjName); } if (recControl.LastEditBy1.Text != "") { rec.Parse(recControl.LastEditBy1.Text, EstLineAdjTable.LastEditBy); } if (recControl.LastEditByID1.Text != "") { rec.Parse(recControl.LastEditByID1.Text, EstLineAdjTable.LastEditByID); } if (recControl.LastEditDate1.Text != "") { rec.Parse(recControl.LastEditDate1.Text, EstLineAdjTable.LastEditDate); } if (MiscUtils.IsValueSelected(recControl.SiteID)) { rec.Parse(recControl.SiteID.SelectedItem.Value, EstLineAdjTable.SiteID); } rec.Status = recControl.Status1.Checked; newUIDataList.Add(recControl.PreservedUIData()); newRecordList.Add(rec); } } } // Add any new record to the list. for (int count = 1; count <= this.AddNewRecord; count++) { newRecordList.Insert(0, new EstLineAdjRecord()); newUIDataList.Insert(0, new Hashtable()); } this.AddNewRecord = 0; // Finally, add any new records to the DataSource. if (newRecordList.Count > 0) { ArrayList finalList = new ArrayList(this.DataSource); finalList.InsertRange(0, newRecordList); Type myrec = typeof(FPCEstimate.Business.EstLineAdjRecord); this.DataSource = (EstLineAdjRecord[])(finalList.ToArray(myrec)); } // Add the existing UI data to this hash table if (newUIDataList.Count > 0) this.UIData.InsertRange(0, newUIDataList); }
public void TestInsertRange_this () { String [] s1 = { "this", "is", "a", "test" }; ArrayList al = new ArrayList (s1); al.InsertRange (2, al); String [] s2 = { "this", "is", "this", "is", "a", "test", "a", "test" }; for (int i = 0; i < al.Count; i++) { Assert.AreEqual (s2 [i], al [i], "at i=" + i); } }
private ArrayList MultiClassCombination(string multiClass) { multiClass = Common.SortMutiClass(multiClass); string[] className = multiClass.Split(' '); ArrayList result = new ArrayList(); ArrayList concate = new ArrayList(); ArrayList resultCssClassOrder = new ArrayList(); int len = className.Length; if (len == 1) { resultCssClassOrder.AddRange(className); return resultCssClassOrder; } result.AddRange(className); int searchFrom; int searchTo = 0; for (int i = 0; i < len - 1; i++) { searchFrom = searchTo + 1; searchTo = result.Count - 1; concate = MultiClassConcate(className, result, len, searchFrom, searchTo); result.AddRange(concate); resultCssClassOrder.InsertRange(0, OrderByCss(concate)); } concate.Clear(); concate.AddRange(className); resultCssClassOrder.AddRange(OrderByCss(concate)); return resultCssClassOrder; }
/// <summary> /// 组合函数 /// </summary> /// <param name="reslut">返回值数组</param> /// <param name="elements">可供选择的元素数组</param> /// <param name="m">目标选定元素个数</param> /// <param name="x">当前返回值数组的列坐标</param> /// <param name="y">当前返回值数组的行坐标</param> private static void Combination(ref int[,] reslut, ArrayList elements, int m, int x, int y) { ArrayList tmpElements = new ArrayList(); //所有本循环使用的元素都将暂时存放在这个数组 int elementsCount = elements.Count; //先记录可选元素个数 int sub; for (int i = elementsCount - 1; i >= m - 1; i--, y += sub) //从elementsCount-1(即n-1)到m-1的循环,每次循环后移动行指针 { sub = CombinationCount(m - 1, i); //求取当前子组合的个数 int val = RemoveAndWrite(elements, 0, ref reslut, x, y, sub); tmpElements.Add(val); //把这个可选元素存放到临时数组,循环结束后一并恢复到elements数组中 if (sub > 1 || (elements.Count + 1 == m && elements.Count > 0)) //递归条件为 子组合数大于1 或 可选元素个数+1等于当前目标选择元素个数且可选元素个数大于1 Combination(ref reslut, elements, m - 1, x + 1, y); } elements.InsertRange(0, tmpElements); //一次性把上述循环删除的可选元素恢复到可选元素数组中 }
private void RemoveNodeAndPromoteChildren(ArrayList nodes, int indexToRemove) { ProgressNode item = (ProgressNode)nodes[indexToRemove]; if (item != null) { if (item.Children == null) { this.RemoveNode(nodes, indexToRemove); return; } else { for (int i = 0; i < item.Children.Count; i++) { ((ProgressNode)item.Children[i]).ParentActivityId = -1; } nodes.RemoveAt(indexToRemove); PendingProgress pendingProgress = this; pendingProgress.nodeCount = pendingProgress.nodeCount - 1; nodes.InsertRange(indexToRemove, item.Children); return; } } else { return; } }
private void ActiveScenesGUI() { int num; int num2; int num3 = 0; int row = this.lv.row; bool shift = Event.current.shift; bool actionKey = EditorGUI.actionKey; Event current = Event.current; Rect position = GUILayoutUtility.GetRect(styles.scenesInBuild, styles.title); ArrayList list = new ArrayList(EditorBuildSettings.scenes); this.lv.totalRows = list.Count; if (this.selectedLVItems.Length != list.Count) { Array.Resize<bool>(ref this.selectedLVItems, list.Count); } int[] numArray = new int[list.Count]; for (num = 0; num < numArray.Length; num++) { EditorBuildSettingsScene scene = (EditorBuildSettingsScene) list[num]; numArray[num] = num3; if (scene.enabled) { num3++; } } IEnumerator enumerator = ListViewGUILayout.ListView(this.lv, ListViewOptions.wantsExternalFiles | ListViewOptions.wantsReordering, styles.box, new GUILayoutOption[0]).GetEnumerator(); try { while (enumerator.MoveNext()) { ListViewElement element = (ListViewElement) enumerator.Current; EditorBuildSettingsScene scene2 = (EditorBuildSettingsScene) list[element.row]; bool flag3 = File.Exists(scene2.path); EditorGUI.BeginDisabledGroup(!flag3); bool on = this.selectedLVItems[element.row]; if (on && (current.type == EventType.Repaint)) { styles.selected.Draw(element.position, false, false, false, false); } if (!flag3) { scene2.enabled = false; } Rect rect2 = new Rect(element.position.x + 4f, element.position.y, styles.toggleSize.x, styles.toggleSize.y); EditorGUI.BeginChangeCheck(); scene2.enabled = GUI.Toggle(rect2, scene2.enabled, string.Empty); if (EditorGUI.EndChangeCheck() && on) { for (int i = 0; i < list.Count; i++) { if (this.selectedLVItems[i]) { ((EditorBuildSettingsScene) list[i]).enabled = scene2.enabled; } } } GUILayout.Space(styles.toggleSize.x); string path = scene2.path; if (path.StartsWith("Assets/")) { path = path.Substring("Assets/".Length); } Rect rect = GUILayoutUtility.GetRect(EditorGUIUtility.TempContent(path), styles.levelString); if (Event.current.type == EventType.Repaint) { styles.levelString.Draw(rect, EditorGUIUtility.TempContent(path), false, false, on, false); } GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.MaxWidth(36f) }; GUILayout.Label(!scene2.enabled ? string.Empty : numArray[element.row].ToString(), styles.levelStringCounter, options); EditorGUI.EndDisabledGroup(); if ((ListViewGUILayout.HasMouseUp(element.position) && !shift) && !actionKey) { if (!shift && !actionKey) { ListViewGUILayout.MultiSelection(row, element.row, ref this.initialSelectedLVItem, ref this.selectedLVItems); } } else if (ListViewGUILayout.HasMouseDown(element.position)) { if ((!this.selectedLVItems[element.row] || shift) || actionKey) { ListViewGUILayout.MultiSelection(row, element.row, ref this.initialSelectedLVItem, ref this.selectedLVItems); } this.lv.row = element.row; this.selectedBeforeDrag = new bool[this.selectedLVItems.Length]; this.selectedLVItems.CopyTo(this.selectedBeforeDrag, 0); this.selectedBeforeDrag[this.lv.row] = true; } } } finally { IDisposable disposable = enumerator as IDisposable; if (disposable == null) { } disposable.Dispose(); } GUI.Label(position, styles.scenesInBuild, styles.title); if (GUIUtility.keyboardControl == this.lv.ID) { if ((Event.current.type == EventType.ValidateCommand) && (Event.current.commandName == "SelectAll")) { Event.current.Use(); } else if ((Event.current.type == EventType.ExecuteCommand) && (Event.current.commandName == "SelectAll")) { for (num = 0; num < this.selectedLVItems.Length; num++) { this.selectedLVItems[num] = true; } this.lv.selectionChanged = true; Event.current.Use(); GUIUtility.ExitGUI(); } } if (this.lv.selectionChanged) { ListViewGUILayout.MultiSelection(row, this.lv.row, ref this.initialSelectedLVItem, ref this.selectedLVItems); } if (this.lv.fileNames != null) { Array.Sort<string>(this.lv.fileNames); int num6 = 0; for (num = 0; num < this.lv.fileNames.Length; num++) { if (this.lv.fileNames[num].EndsWith("unity")) { EditorBuildSettingsScene scene3 = new EditorBuildSettingsScene { path = FileUtil.GetProjectRelativePath(this.lv.fileNames[num]) }; if (scene3.path == string.Empty) { scene3.path = this.lv.fileNames[num]; } scene3.enabled = true; list.Insert(this.lv.draggedTo + num6++, scene3); } } if (num6 != 0) { Array.Resize<bool>(ref this.selectedLVItems, list.Count); for (num = 0; num < this.selectedLVItems.Length; num++) { this.selectedLVItems[num] = (num >= this.lv.draggedTo) && (num < (this.lv.draggedTo + num6)); } } this.lv.draggedTo = -1; } if (this.lv.draggedTo != -1) { ArrayList c = new ArrayList(); num2 = 0; num = 0; while (num < this.selectedLVItems.Length) { if (this.selectedBeforeDrag[num]) { c.Add(list[num2]); list.RemoveAt(num2); num2--; if (this.lv.draggedTo >= num) { this.lv.draggedTo--; } } num++; num2++; } this.lv.draggedTo = ((this.lv.draggedTo <= list.Count) && (this.lv.draggedTo >= 0)) ? this.lv.draggedTo : list.Count; list.InsertRange(this.lv.draggedTo, c); for (num = 0; num < this.selectedLVItems.Length; num++) { this.selectedLVItems[num] = (num >= this.lv.draggedTo) && (num < (this.lv.draggedTo + c.Count)); } } if ((current.type == EventType.KeyDown) && ((current.keyCode == KeyCode.Backspace) || (current.keyCode == KeyCode.Delete))) { num2 = 0; num = 0; while (num < this.selectedLVItems.Length) { if (this.selectedLVItems[num]) { list.RemoveAt(num2); num2--; } this.selectedLVItems[num] = false; num++; num2++; } this.lv.row = 0; current.Use(); } EditorBuildSettings.scenes = list.ToArray(typeof(EditorBuildSettingsScene)) as EditorBuildSettingsScene[]; }
} // 1.0.012 #endregion #region Private Methods // private void InsertRange(bool replace, int index, params System.Windows.Forms.TabPage[] theTabPages) // private void InsertRange(bool replace, int index, params System.Windows.Forms.TabPage[] theTabPages)// 1.0.010 { // 1.0.004 #region Put existing [base.TabPages] into an ArrayList sequenced in the present order System.Collections.ArrayList alTabPages = new System.Collections.ArrayList(this.Count); // 1.0.003 for (int idx = 0; idx < this.Count; idx++) // 1.0.003 { // 1.0.003 alTabPages.Add(base[idx]); // 1.0.010 } // 1.0.003 #endregion #region Add/Insert [theTabPages] at appropriate location in the ArrayList if (replace // Replace TabPage at [index] with [theTabPages]? // 1.0.004 && ((index >= 0) && (index < alTabPages.Count)) ) // 1.0.004 { // 1.0.004 alTabPages.RemoveAt(index); // 1.0.004 } // 1.0.004 if ((index >= 0) && (index < alTabPages.Count)) // 1.0.004 { // 1.0.004 alTabPages.InsertRange(index, theTabPages); // 1.0.004 } // 1.0.004 else // 1.0.004 { // 1.0.004 alTabPages.AddRange(theTabPages); // 1.0.004 } // 1.0.004 #endregion #region Rebuild the [base.TabPages] Collection _owner.SuspendLayout(); // 1.0.003 base.Clear(); // 1.0.003 for (int idxNew = 0; idxNew < alTabPages.Count; idxNew++) // 1.0.003 { // 1.0.003 System.Windows.Forms.TabPage aTabPage = (System.Windows.Forms.TabPage)alTabPages[idxNew]; // 1.0.010 aTabPage.TabIndex = idxNew; // 1.0.003 base.Add(aTabPage); // 1.0.003 } // 1.0.003 alTabPages.Clear(); // 1.0.003 _owner.ResumeLayout(false); // 1.0.003 _owner.Invalidate(); // 1.0.003 #endregion } // 1.0.004
private void CreateLimitedViewOfDataSet(out EMDataSet dataSet, out string friendlyConstraints) { dataSet = null; friendlyConstraints = null; ReportDialog dlg = new ReportDialog(); if (dlg.ShowDialog() != DialogResult.OK) return; ArrayList constraints = dlg.GetPOHeaderConstraints(); friendlyConstraints = dlg.GetFriendlyConstraints(); ArrayList maybeConstraints = dlg.GetMaybePOHeaderConstraints(); // sometimes applies per item //, sometimes for entire PO. string constraintsAsStr = DataInterface.TranslateToConstraint(constraints); string maybeConstraintsAsStr = DataInterface.TranslateToConstraint(maybeConstraints); constraintsAsStr = AddMaybeConstraints(constraintsAsStr, maybeConstraintsAsStr); dataSet = new EMDataSet(); using (new OpenConnection(EM.IsWrite.No, AdapterHelper.Connection)) using (new TurnOffConstraints(dataSet)) { AdapterHelper.FillCurrency(dataSet); AdapterHelper.FillAllPOHeaders(dataSet, constraintsAsStr); foreach (EMDataSet.POHeaderTblRow poRow in dataSet.POHeaderTbl) { ArrayList poItemconstraints = new ArrayList(); string constraint = "POID = " + poRow.POID.ToString(); poItemconstraints.Add(constraint); constraint = "CancelDate IS NULL"; poItemconstraints.Add(constraint); ArrayList orConstraints; ArrayList constraints2 = dlg.GetPOItemConstraints(out orConstraints); poItemconstraints.InsertRange(0, constraints2); if (poRow.MillConfirmationAppliesToEntirePO == 0) { poItemconstraints.InsertRange(0, maybeConstraints); } constraint = DataInterface.TranslateToConstraint(poItemconstraints, orConstraints); AdapterHelper.FillPOItemsWithConstraints(dataSet, constraint); } AdapterHelper.FillOutConstraints(dataSet); } AddAuxiliaryFieldInfo(dataSet); }
/// <summary> /// The initial load of Market logs from cache files. /// ... /// TODO: write the rest... /// ... /// Fills the item ComboBox. /// </summary> private void LoadMarketLogsFromCache() { try { MarketLog ml; Parser p = new Parser(); //reset market logs Values.dtMarketLogsListTable = DataHandler.CreateMarketLogsListTable(); EveCacheParser.Parser.SetCachedFilesFolders("CachedMethodCalls"); EveCacheParser.Parser.SetIncludeMethodsFilter("GetOrders"); FileInfo[] cachedFiles = EveCacheParser.Parser.GetMachoNetCachedFiles(); DirectoryInfo di = new DirectoryInfo(Values.MarketLogPath + "\\Cache"); if (!di.Exists) di.Create(); Hashtable htItems = _htAvailLogItems; //EVEMon's integrated unified uploader deletes cache files so we have to protect them foreach (FileInfo fi in cachedFiles) { fi.CopyTo(Values.MarketLogPath + "\\Cache\\" + fi.Name, true); } foreach (FileInfo fi in di.GetFiles()) { ml = p.parseCachedMarketLog(fi, ref Values.dRegionNames); if (ml != null) { Values.dtMarketLogsListTable.Rows.Add(DataHandler.MarketLogToDataRow(ml, Values.dtMarketLogsListTable)); // make list for item selection combobox, filter by date created from options if (!htItems.Contains(ml.ItemHash)) { // If Date filtering is set and logs created date is less than set date, then skip it. if (Values.IsLogsDateFilterSet && ml.Created < Values.LogsDateFilter) { /* skip */ } else htItems.Add(ml.ItemHash, ml); } } // Step the progress bar toolStripProgressBar1.PerformStep(); //pbGeneralProgressbar.PerformStep(); } // Put the unique item in an arraylist to sort and use as datasource for combobox ArrayList alItems = new ArrayList(); MarketLog mlFirstInlistMessage = new MarketLog { Item = "!!!" }; alItems.Insert(0, mlFirstInlistMessage); alItems.InsertRange(1, htItems.Values); MarketLogComparer compareOn = new MarketLogComparer(MarketLogCompareField.Item); alItems.Sort(compareOn); // Check for any items at all _isMarketlogsLoaded = alItems.Count > 1; mlFirstInlistMessage.Item = _isMarketlogsLoaded ? Values.MSG_SELECT_ITEM : Values.MSG_NO_LOGS; cbItems.DataSource = alItems; cbItems.MaxDropDownItems = 25; } catch (Exception ex) { MessageBox.Show(ex.Message, Values.MSG_ERROR); } // Clear the progressbar toolStripProgressBar1.Value = 0; // Load the market tree view if (!splitContainerMain.Panel1Collapsed && _isMarketlogsLoaded) ItemTreeView.LoadTreeView(ref _htAvailLogItems); LightErrorHandler(); }
public void OutputHeader(UMC.Web.WebMeta header, int index) { if (this.OuterHeaders == null) { this.OuterHeaders = new Hashtable();; } var dic = header.GetDictionary(); var em = dic.GetEnumerator(); while (em.MoveNext()) { var key = em.Key.ToString(); if (key == "DataEvent") { var value = em.Value; if (this.OuterHeaders.ContainsKey(key)) { var ats = new System.Collections.ArrayList(); var ts = this.OuterHeaders[key]; if (ts is Array) { if (index == -1) { ats.AddRange((Array)ts); } else { ats.InsertRange(index, (Array)ts); } } else { if (index == -1) { ats.Add(ts); } else { ats.Insert(index, ts); } } if (value is Array) { if (index == -1) { ats.AddRange((Array)value); } else { ats.InsertRange(index, (Array)value); } } else { if (index == -1) { ats.Add(value); } else { ats.Insert(index, value); } } this.OuterHeaders[key] = ats.ToArray(); } else { this.OuterHeaders[em.Key] = em.Value; } } else { this.OuterHeaders[em.Key] = em.Value; } } }
private MessageInfo[] ListMessages (string opt_filter) { ICollection method_list; if (obj == null) { ArrayList list = new ArrayList (obj_type.GetMethods ()); list.InsertRange (list.Count, typeof (Type).GetMethods ()); method_list = list; } else { method_list = obj_type.GetMethods (); } ArrayList info_list = new ArrayList (); Hashtable methods = new Hashtable (); if (opt_filter != String.Empty) { opt_filter = opt_filter.ToLower (); } foreach (MethodInfo method in method_list) { string method_lower = method.Name.ToLower (); if (opt_filter != String.Empty && method.Name.ToLower () != opt_filter) continue; MessageInfo info = (MessageInfo) methods[method_lower]; if (info == null) { info = new TypedMessageInfo (); info.message = method.Name; info.min_argc = -1; info.default_argc = -1; info.max_argc = 0; methods[method_lower] = info; info_list.Add (info); } ParameterInfo[] parms = method.GetParameters (); int count = (parms != null) ? parms.Length : 0; if (count > 0) { object[] attrs = parms[count - 1].GetCustomAttributes (typeof (System.ParamArrayAttribute), true); if (attrs != null && attrs.Length > 0) info.max_argc = -1; } object[] method_attrs = method.GetCustomAttributes (typeof (PassContextAttribute), true); if (method_attrs != null && method_attrs.Length > 0) { count--; } if (info.min_argc == -1 || count <= info.min_argc) { info.min_argc = count; info.default_argc = count; } method_attrs = method.GetCustomAttributes (typeof (DefaultArgumentCountAttribute), true); if (method_attrs != null && method_attrs.Length > 0) { info.default_argc = ((DefaultArgumentCountAttribute) method_attrs[0]).DefaultCount; } if (info.max_argc != -1 && count > info.max_argc) { info.max_argc = count; } } MessageInfo[] ret = new MessageInfo[info_list.Count]; info_list.CopyTo (ret, 0); return ret; }
RemoveNodeAndPromoteChildren(ArrayList nodes, int indexToRemove) { ProgressNode nodeToRemove = (ProgressNode)nodes[indexToRemove]; Dbg.Assert(nodes != null, "can't remove nodes from a null list"); Dbg.Assert(indexToRemove < nodes.Count, "index is not in list"); Dbg.Assert(nodeToRemove != null, "no node at specified index"); if (nodeToRemove == null) { return; } if (nodeToRemove.Children != null) { // promote the children. for (int i = 0; i < nodeToRemove.Children.Count; ++i) { // unparent the children. If the children are ever updated again, they will be reparented. ((ProgressNode)nodeToRemove.Children[i]).ParentActivityId = -1; } // add the children as siblings nodes.RemoveAt(indexToRemove); --_nodeCount; nodes.InsertRange(indexToRemove, nodeToRemove.Children); #if DEBUG || ASSERTIONS_TRACE Dbg.Assert(_nodeCount == this.CountNodes(), "We've lost track of the number of nodes in the tree"); #endif } else { // nothing to promote RemoveNode(nodes, indexToRemove); return; } }
public static OpmlItem[] DeserializeItem(XPathNavigator nav) { ArrayList items = new ArrayList(); if (nav.HasAttributes) { string title = nav.GetAttribute("title", ""); if (String.IsNullOrEmpty(title)) title = nav.GetAttribute("text", ""); string htmlUrl = nav.GetAttribute("htmlurl", ""); if (String.IsNullOrEmpty(htmlUrl)) htmlUrl = nav.GetAttribute("htmlUrl", ""); string xmlUrl = nav.GetAttribute("xmlurl", ""); if (String.IsNullOrEmpty(xmlUrl)) xmlUrl = nav.GetAttribute("xmlUrl", ""); OpmlItem currentItem = null; string description = nav.GetAttribute("description", ""); if (!String.IsNullOrEmpty(title) && !String.IsNullOrEmpty(htmlUrl)) currentItem = new OpmlItem(title, description, xmlUrl, htmlUrl); if (null != currentItem) items.Add(currentItem); } if (nav.HasChildren) { XPathNodeIterator childItems = nav.SelectChildren("outline", ""); while (childItems.MoveNext()) { OpmlItem[] children = DeserializeItem(childItems.Current); if (null != children) items.InsertRange(items.Count, children); } } OpmlItem[] result = new OpmlItem[items.Count]; items.CopyTo(result); return result; }
public void TestInsertRange () { { bool errorThrown = false; try { ArrayList al1 = ArrayList.FixedSize (new ArrayList ()); string [] s = { "Hi!" }; al1.InsertRange (0, s); } catch (NotSupportedException) { errorThrown = true; } Assert.IsTrue (errorThrown, "insert to fixed size error not thrown"); } { bool errorThrown = false; try { ArrayList al1 = ArrayList.ReadOnly (new ArrayList ()); string [] s = { "Hi!" }; al1.InsertRange (0, s); } catch (NotSupportedException) { errorThrown = true; } Assert.IsTrue (errorThrown, "insert to read only error not thrown"); } { bool errorThrown = false; try { ArrayList al1 = new ArrayList (3); string [] s = { "Hi!" }; al1.InsertRange (-1, s); } catch (ArgumentOutOfRangeException) { errorThrown = true; } Assert.IsTrue (errorThrown, "negative index insert error not thrown"); } { bool errorThrown = false; try { ArrayList al1 = new ArrayList (3); string [] s = { "Hi!" }; al1.InsertRange (4, s); } catch (ArgumentOutOfRangeException) { errorThrown = true; } Assert.IsTrue (errorThrown, "out-of-range insert error not thrown"); } { bool errorThrown = false; try { ArrayList al1 = new ArrayList (3); al1.InsertRange (0, null); } catch (ArgumentNullException) { errorThrown = true; } Assert.IsTrue (errorThrown, "null insert error not thrown"); } { char [] c = { 'a', 'b', 'c' }; ArrayList a = new ArrayList (c); a.InsertRange (1, c); Assert.AreEqual ('a', a [0], "bad insert 1"); Assert.AreEqual ('a', a [1], "bad insert 2"); Assert.AreEqual ('b', a [2], "bad insert 3"); Assert.AreEqual ('c', a [3], "bad insert 4"); Assert.AreEqual ('b', a [4], "bad insert 5"); Assert.AreEqual ('c', a [5], "bad insert 6"); } }
//Code to draw path for the line public override void DrawPath() { if (Container == null) return; if (ControlPoints == null) return; //Get the start and end location depending on start shapes etc PointF startLocation = GetOriginLocation(Start,End); PointF endLocation = GetOriginLocation(End,Start); //Add the points to the solution ArrayList points = new ArrayList(); points.Add(startLocation); //Add the control points //If bezier must be 2,5,8 control points etc PointF[] controlPoints; //Set up control points if (CurveType == CurveType.Bezier) { //Must be 2, 5, 8 etc if (mControlPoints.GetUpperBound(0) < 1) throw new CurveException("Bezier must contain at least 2 control points."); int intMax = (((int) (mControlPoints.GetUpperBound(0) - 1) / 3) * 3) + 2; controlPoints = new PointF[intMax]; for (int i = 0; i < intMax; i++ ) { controlPoints[i] = mControlPoints[i]; } } else { controlPoints = mControlPoints; } points.InsertRange(1,controlPoints); //Add the end points points.Add(endLocation); //Draw the path GraphicsPath path = new GraphicsPath(); if (CurveType == CurveType.Bezier) { path.AddBeziers((PointF[]) points.ToArray(typeof(PointF))); } else { path.AddCurve((PointF[]) points.ToArray(typeof(PointF)),Tension); } SetPoints(points); //Calculate path rectangle RectangleF rect = path.GetBounds(); SetRectangle(rect); //Sets the bounding rectangle SetPath(path); //setpath moves the line to 0,0 }
public void TestEnumerator () { String [] s1 = { "this", "is", "a", "test" }; ArrayList al1 = new ArrayList (s1); IEnumerator en = al1.GetEnumerator (); en.MoveNext (); al1.Add ("something"); try { en.MoveNext (); Assert.Fail ("Add() didn't invalidate the enumerator"); } catch (InvalidOperationException) { // do nothing...this is what we expect } en = al1.GetEnumerator (); en.MoveNext (); al1.AddRange (al1); try { en.MoveNext (); Assert.Fail ("AddRange() didn't invalidate the enumerator"); } catch (InvalidOperationException) { // do nothing...this is what we expect } en = al1.GetEnumerator (); en.MoveNext (); al1.Clear (); try { en.MoveNext (); Assert.Fail ("Clear() didn't invalidate the enumerator"); } catch (InvalidOperationException) { // do nothing...this is what we expect } al1 = new ArrayList (s1); en = al1.GetEnumerator (); en.MoveNext (); al1.Insert (0, "new first"); try { en.MoveNext (); Assert.Fail ("Insert() didn't invalidate the enumerator"); } catch (InvalidOperationException) { // do nothing...this is what we expect } en = al1.GetEnumerator (); en.MoveNext (); al1.InsertRange (0, al1); try { en.MoveNext (); Assert.Fail ("InsertRange() didn't invalidate the enumerator"); } catch (InvalidOperationException) { // do nothing...this is what we expect } en = al1.GetEnumerator (); en.MoveNext (); al1.Remove ("this"); try { en.MoveNext (); Assert.Fail ("Remove() didn't invalidate the enumerator"); } catch (InvalidOperationException) { // do nothing...this is what we expect } en = al1.GetEnumerator (); en.MoveNext (); al1.RemoveAt (2); try { en.MoveNext (); Assert.Fail ("RemoveAt() didn't invalidate the enumerator"); } catch (InvalidOperationException) { // do nothing...this is what we expect } en = al1.GetEnumerator (); en.MoveNext (); al1.RemoveRange (1, 1); try { en.MoveNext (); Assert.Fail ("RemoveRange() didn't invalidate the enumerator"); } catch (InvalidOperationException) { // do nothing...this is what we expect } en = al1.GetEnumerator (); en.MoveNext (); al1.Reverse (); try { en.MoveNext (); Assert.Fail ("Reverse() didn't invalidate the enumerator"); } catch (InvalidOperationException) { // do nothing...this is what we expect } en = al1.GetEnumerator (); en.MoveNext (); al1.Sort (); try { en.MoveNext (); Assert.Fail ("Sort() didn't invalidate the enumerator"); } catch (InvalidOperationException) { // do nothing...this is what we expect } }
private void ActiveScenesGUI() { int num = 0; int row = this.lv.row; bool shift = Event.current.shift; bool actionKey = EditorGUI.actionKey; Event current = Event.current; Rect rect = GUILayoutUtility.GetRect(BuildPlayerWindow.styles.scenesInBuild, BuildPlayerWindow.styles.title); ArrayList arrayList = new ArrayList(EditorBuildSettings.scenes); this.lv.totalRows = arrayList.Count; if (this.selectedLVItems.Length != arrayList.Count) { Array.Resize<bool>(ref this.selectedLVItems, arrayList.Count); } int[] array = new int[arrayList.Count]; for (int i = 0; i < array.Length; i++) { EditorBuildSettingsScene editorBuildSettingsScene = (EditorBuildSettingsScene)arrayList[i]; array[i] = num; if (editorBuildSettingsScene.enabled) { num++; } } foreach (ListViewElement listViewElement in ListViewGUILayout.ListView(this.lv, (ListViewOptions)3, BuildPlayerWindow.styles.box, new GUILayoutOption[0])) { EditorBuildSettingsScene editorBuildSettingsScene2 = (EditorBuildSettingsScene)arrayList[listViewElement.row]; bool flag = File.Exists(editorBuildSettingsScene2.path); EditorGUI.BeginDisabledGroup(!flag); bool flag2 = this.selectedLVItems[listViewElement.row]; if (flag2 && current.type == EventType.Repaint) { BuildPlayerWindow.styles.selected.Draw(listViewElement.position, false, false, false, false); } if (!flag) { editorBuildSettingsScene2.enabled = false; } Rect position = new Rect(listViewElement.position.x + 4f, listViewElement.position.y, BuildPlayerWindow.styles.toggleSize.x, BuildPlayerWindow.styles.toggleSize.y); EditorGUI.BeginChangeCheck(); editorBuildSettingsScene2.enabled = GUI.Toggle(position, editorBuildSettingsScene2.enabled, string.Empty); if (EditorGUI.EndChangeCheck() && flag2) { for (int j = 0; j < arrayList.Count; j++) { if (this.selectedLVItems[j]) { ((EditorBuildSettingsScene)arrayList[j]).enabled = editorBuildSettingsScene2.enabled; } } } GUILayout.Space(BuildPlayerWindow.styles.toggleSize.x); string text = editorBuildSettingsScene2.path; if (text.StartsWith("Assets/")) { text = text.Substring("Assets/".Length); } Rect rect2 = GUILayoutUtility.GetRect(EditorGUIUtility.TempContent(text), BuildPlayerWindow.styles.levelString); if (Event.current.type == EventType.Repaint) { BuildPlayerWindow.styles.levelString.Draw(rect2, EditorGUIUtility.TempContent(text), false, false, flag2, false); } GUILayout.Label((!editorBuildSettingsScene2.enabled) ? string.Empty : array[listViewElement.row].ToString(), BuildPlayerWindow.styles.levelStringCounter, new GUILayoutOption[] { GUILayout.MaxWidth(36f) }); EditorGUI.EndDisabledGroup(); if (ListViewGUILayout.HasMouseUp(listViewElement.position) && !shift && !actionKey) { if (!shift && !actionKey) { ListViewGUILayout.MultiSelection(row, listViewElement.row, ref this.initialSelectedLVItem, ref this.selectedLVItems); } } else { if (ListViewGUILayout.HasMouseDown(listViewElement.position)) { if (!this.selectedLVItems[listViewElement.row] || shift || actionKey) { ListViewGUILayout.MultiSelection(row, listViewElement.row, ref this.initialSelectedLVItem, ref this.selectedLVItems); } this.lv.row = listViewElement.row; this.selectedBeforeDrag = new bool[this.selectedLVItems.Length]; this.selectedLVItems.CopyTo(this.selectedBeforeDrag, 0); this.selectedBeforeDrag[this.lv.row] = true; } } } GUI.Label(rect, BuildPlayerWindow.styles.scenesInBuild, BuildPlayerWindow.styles.title); if (GUIUtility.keyboardControl == this.lv.ID) { if (Event.current.type == EventType.ValidateCommand && Event.current.commandName == "SelectAll") { Event.current.Use(); } else { if (Event.current.type == EventType.ExecuteCommand && Event.current.commandName == "SelectAll") { for (int i = 0; i < this.selectedLVItems.Length; i++) { this.selectedLVItems[i] = true; } this.lv.selectionChanged = true; Event.current.Use(); GUIUtility.ExitGUI(); } } } if (this.lv.selectionChanged) { ListViewGUILayout.MultiSelection(row, this.lv.row, ref this.initialSelectedLVItem, ref this.selectedLVItems); } if (this.lv.fileNames != null) { Array.Sort<string>(this.lv.fileNames); int num2 = 0; for (int i = 0; i < this.lv.fileNames.Length; i++) { if (this.lv.fileNames[i].EndsWith("unity")) { EditorBuildSettingsScene editorBuildSettingsScene3 = new EditorBuildSettingsScene(); editorBuildSettingsScene3.path = FileUtil.GetProjectRelativePath(this.lv.fileNames[i]); if (editorBuildSettingsScene3.path == string.Empty) { editorBuildSettingsScene3.path = this.lv.fileNames[i]; } editorBuildSettingsScene3.enabled = true; arrayList.Insert(this.lv.draggedTo + num2++, editorBuildSettingsScene3); } } if (num2 != 0) { Array.Resize<bool>(ref this.selectedLVItems, arrayList.Count); for (int i = 0; i < this.selectedLVItems.Length; i++) { this.selectedLVItems[i] = (i >= this.lv.draggedTo && i < this.lv.draggedTo + num2); } } this.lv.draggedTo = -1; } if (this.lv.draggedTo != -1) { ArrayList arrayList2 = new ArrayList(); int num3 = 0; int i = 0; while (i < this.selectedLVItems.Length) { if (this.selectedBeforeDrag[i]) { arrayList2.Add(arrayList[num3]); arrayList.RemoveAt(num3); num3--; if (this.lv.draggedTo >= i) { this.lv.draggedTo--; } } i++; num3++; } this.lv.draggedTo = ((this.lv.draggedTo <= arrayList.Count && this.lv.draggedTo >= 0) ? this.lv.draggedTo : arrayList.Count); arrayList.InsertRange(this.lv.draggedTo, arrayList2); for (i = 0; i < this.selectedLVItems.Length; i++) { this.selectedLVItems[i] = (i >= this.lv.draggedTo && i < this.lv.draggedTo + arrayList2.Count); } } if (current.type == EventType.KeyDown && (current.keyCode == KeyCode.Backspace || current.keyCode == KeyCode.Delete)) { int num3 = 0; int i = 0; while (i < this.selectedLVItems.Length) { if (this.selectedLVItems[i]) { arrayList.RemoveAt(num3); num3--; } this.selectedLVItems[i] = false; i++; num3++; } this.lv.row = 0; current.Use(); } EditorBuildSettings.scenes = (arrayList.ToArray(typeof(EditorBuildSettingsScene)) as EditorBuildSettingsScene[]); }
protected virtual void AddNewRecords() { ArrayList newRecordList = new ArrayList(); System.Collections.Generic.List<Hashtable> newUIDataList = new System.Collections.Generic.List<Hashtable>(); // Loop though all the record controls and if the record control // does not have a unique record id set, then create a record // and add to the list. if (!this.ResetData) { System.Web.UI.WebControls.Repeater rep = (System.Web.UI.WebControls.Repeater)(BaseClasses.Utils.MiscUtils.FindControlRecursively(this, "UOMTableControlRepeater")); if (rep == null){return;} foreach (System.Web.UI.WebControls.RepeaterItem repItem in rep.Items) { // Loop through all rows in the table, set its DataSource and call DataBind(). UOMTableControlRow recControl = (UOMTableControlRow)(repItem.FindControl("UOMTableControlRow")); if (recControl.Visible && recControl.IsNewRecord) { UOMRecord rec = new UOMRecord(); if (recControl.Status.Text != "") { rec.Parse(recControl.Status.Text, UOMTable.Status); } if (recControl.UOMDescription.Text != "") { rec.Parse(recControl.UOMDescription.Text, UOMTable.UOMDescription); } if (recControl.UOMName.Text != "") { rec.Parse(recControl.UOMName.Text, UOMTable.UOMName); } newUIDataList.Add(recControl.PreservedUIData()); newRecordList.Add(rec); } } } // Add any new record to the list. for (int count = 1; count <= this.AddNewRecord; count++) { newRecordList.Insert(0, new UOMRecord()); newUIDataList.Insert(0, new Hashtable()); } this.AddNewRecord = 0; // Finally, add any new records to the DataSource. if (newRecordList.Count > 0) { ArrayList finalList = new ArrayList(this.DataSource); finalList.InsertRange(0, newRecordList); Type myrec = typeof(FPCEstimate.Business.UOMRecord); this.DataSource = (UOMRecord[])(finalList.ToArray(myrec)); } // Add the existing UI data to this hash table if (newUIDataList.Count > 0) this.UIData.InsertRange(0, newUIDataList); }
private ArrayList Reformat(ArrayList Parts) { #region SECTION REMOVER () for (int i = 0; i < Parts.Count; i++) { int second = i - 1; if (second == -1) second = 0; if (Parts[i].ToString().Equals("(") && !Fun_Class.IsFunction(Parts[second].ToString()) && !IsNumber(Parts[second].ToString())) { //PrintArrayList(Parts); int found = 1; int end = i; while (found != 0) {//Find the end of this priority block end++; if (Parts[end].ToString().Equals("(")) found++; if (Parts[end].ToString().Equals(")")) found--; } //Make a copy of the internal info ArrayList atemp = new ArrayList(Parts.GetRange(i + 1, end - i + 1 - 2)); //Remove containers,(), and internal info Parts.RemoveRange(i, end - i + 1); //Insert the reformated internal info Parts.InsertRange(i, Reformat(atemp)); } } #endregion #region SHORTCUT REMOVER * and / for (int i = 0; i < Parts.Count; i++) { string function; if (Parts[i].ToString().Equals("*") || Parts[i].ToString().Equals("/")) { //PrintArrayList(Parts); //Select the appropriate function if (Parts[i].ToString().Equals("*")) function = "MUL"; else function = "DIV"; try { int first = i - 1, second = i + 2; if ((i + 2) >= Parts.Count) second--; if (Parts[first].ToString().Equals(")") && !Parts[second].ToString().Equals("(")) { int found = 1; int start = i - 1; while (found != 0) { start--; if (Parts[start].ToString().Equals(")")) found++; if (Parts[start].ToString().Equals("(")) found--; } Parts.Insert(i, ")"); Parts.Insert(i, Parts[i + 2]); Parts.Insert(i, ","); Parts.InsertRange(i, Parts.GetRange(start - 1, i - start + 1)); Parts.Insert(i, "("); Parts.Insert(i, function); Parts.RemoveAt(i + (i - start + 1) + 5); Parts.RemoveAt(i + (i - start + 1) + 5); Parts.RemoveRange(start - 1, i - start + 1); } else { if (!Parts[first].ToString().Equals(")") && Parts[second].ToString().Equals("(")) { int found = 1; int start = i + 2; while (found != 0) { start++; if (Parts[start].ToString().Equals("(")) found++; if (Parts[start].ToString().Equals(")")) found--; } Parts.Insert(start + 1, ")"); Parts.Insert(i + 1, ","); Parts.Insert(i + 1, Parts[i - 1]); Parts.Insert(i + 1, "("); Parts.Insert(i + 1, function); Parts.RemoveAt(i - 1); Parts.RemoveAt(i - 1); } else { if (!Parts[first].ToString().Equals(")") && !Parts[second].ToString().Equals("(")) { Parts.Insert(i, ")"); Parts.Insert(i, Parts[i + 2]); Parts.Insert(i, ","); Parts.Insert(i, Parts[i - 1]); Parts.Insert(i, "("); Parts.Insert(i, function); Parts.RemoveAt(i + 6); Parts.RemoveAt(i + 6); Parts.RemoveAt(i - 1); } else { if (Parts[first].ToString().Equals(")") && Parts[second].ToString().Equals("(")) { int found = 1; int start = i + 2; while (found != 0) { start++; if (Parts[start].ToString().Equals("(")) found++; if (Parts[start].ToString().Equals(")")) found--; } Parts.Insert(start + 1, ")"); Parts[i] = ","; found = 1; start = i - 1; while (found != 0) { start--; if (Parts[start].ToString().Equals(")")) found++; if (Parts[start].ToString().Equals("(")) found--; } Parts.Insert(start - 1, "("); Parts.Insert(start - 1, function); } } } } } catch { //OutFile.WriteLine("=ERROR - INCORRECT INPUT STRING (/,*)"); //ERROR: INCORRECT INPUT STRING ArrayList atemp = BreakReference(Base_Cell); int r = (int)atemp[0]; int c = (int)atemp[1]; if (activeWS.Spreadsheet.SpreadsheetModel.Cells[r, c] != null) { activeWS.Spreadsheet.SpreadsheetModel.Cells[r, c].Error = true; activeWS.Spreadsheet.SpreadsheetModel.Cells[r, c].ErrorString = "ERROR - INCORRECT INPUT STRING (/,*)"; } return Tokenize("=ERROR - INCORRECT INPUT STRING (/,*)");//return Tokenize(Base_String); } } } #endregion #region SHORTCUT REMOVER + and - for (int i = 0; i < Parts.Count; i++) { //SHORTCUT REMOVER string function; if (Parts[i].ToString().Equals("+") || Parts[i].ToString().Equals("-")) { //PrintArrayList(Parts); //Select the appropriate function if (Parts[i].ToString().Equals("+")) function = "ADD"; else function = "SUB"; try { int first = i - 1, second = i + 2; if ((i + 2) >= Parts.Count) second--; if (Parts[first].ToString().Equals(")") && !Parts[second].ToString().Equals("(")) { int found = 1; int start = i - 1; while (found != 0) { start--; if (Parts[start].ToString().Equals(")")) found++; if (Parts[start].ToString().Equals("(")) found--; } Parts.Insert(i, ")"); Parts.Insert(i, Parts[i + 2]); Parts.Insert(i, ","); Parts.InsertRange(i, Parts.GetRange(start - 1, i - start + 1)); Parts.Insert(i, "("); Parts.Insert(i, function); Parts.RemoveAt(i + (i - start + 1) + 5); Parts.RemoveAt(i + (i - start + 1) + 5); Parts.RemoveRange(start - 1, i - start + 1); } else { if (!Parts[first].ToString().Equals(")") && Parts[second].ToString().Equals("(")) { int found = 1; int start = i + 2; while (found != 0) { start++; if (Parts[start].ToString().Equals("(")) found++; if (Parts[start].ToString().Equals(")")) found--; } Parts.Insert(start + 1, ")"); //Parts.Insert(start + i, ")"); Parts.Insert(i + 1, ","); Parts.Insert(i + 1, Parts[i - 1]); Parts.Insert(i + 1, "("); Parts.Insert(i + 1, function); Parts.RemoveAt(i - 1); Parts.RemoveAt(i - 1); } else { if (!Parts[first].ToString().Equals(")") && !Parts[second].ToString().Equals("(")) { Parts.Insert(i, ")"); Parts.Insert(i, Parts[i + 2]); Parts.Insert(i, ","); Parts.Insert(i, Parts[i - 1]); Parts.Insert(i, "("); Parts.Insert(i, function); Parts.RemoveAt(i + 6); Parts.RemoveAt(i + 6); Parts.RemoveAt(i - 1); } else { if (Parts[first].ToString().Equals(")") && Parts[second].ToString().Equals("(")) { int found = 1; int start = i + 2; while (found != 0) { start++; if (Parts[start].ToString().Equals("(")) found++; if (Parts[start].ToString().Equals(")")) found--; } Parts.Insert(start + 1, ")"); Parts[i] = ","; found = 1; start = i - 1; while (found != 0) { start--; if (Parts[start].ToString().Equals(")")) found++; if (Parts[start].ToString().Equals("(")) found--; } Parts.Insert(start - 1, "("); Parts.Insert(start - 1, function); } } } } } catch { //OutFile.WriteLine("=ERROR - INCORRECT INPUT STRING (+,-)"); //ERROR: INCORRECT INPUT STRING ArrayList atemp = BreakReference(Base_Cell); int r = (int)atemp[0]; int c = (int)atemp[1]; if (activeWS.Spreadsheet.SpreadsheetModel.Cells[r, c] != null) { activeWS.Spreadsheet.SpreadsheetModel.Cells[r, c].Error = true; activeWS.Spreadsheet.SpreadsheetModel.Cells[r, c].ErrorString = "ERROR - INCORRECT INPUT STRING (+,-)"; } return Tokenize("=ERROR - INCORRECT INPUT STRING (+,-)");//return Tokenize(Base_String); } } } #endregion #region SHORTCUT REMOVER : for (int i = 0; i < Parts.Count; i++) { //SHORTCUT REMOVER 1 if (Parts[i].ToString().Contains(":")) { //PrintArrayList(Parts); char c = Convert.ToChar(Parts[i].ToString().Substring(0, 1)); int t1 = Convert.ToInt32(Parts[i].ToString().Split(':')[0].Substring(1)); int t2 = Convert.ToInt32(Parts[i].ToString().Split(':')[1].Substring(1)); Parts.RemoveAt(i); for (int j = t2; j >= t1; j--) { Parts.Insert(i, c + j.ToString()); if (j != t1) Parts.Insert(i, ","); } } } #endregion #region DECREMENT ALL CELL REFERENCES for (int i = 0; i < Parts.Count; i++) { if (IsCellReference(Parts[i].ToString())) Parts[i] = DecrementCellReference(Parts[i].ToString()); } #endregion #region EXPAND OUT ALL CELL REFERENCES for (int i = 0; i < Parts.Count; i++) { //CELL REFERENCE for (int j = 0; j < Parts.Count; j++) if ((Base_Cell.CompareTo(Parts[j].ToString().ToUpper()) == 0) || (Parts[j].ToString().ToUpper().Contains("ERROR"))) {//If it references itself or an error occured already set the error state ArrayList atemp = BreakReference(Base_Cell); int r = (int)atemp[0]; int c = (int)atemp[1]; if (activeWS.Spreadsheet.SpreadsheetModel.Cells[r, c] != null) { activeWS.Spreadsheet.SpreadsheetModel.Cells[r, c].Error = true; activeWS.Spreadsheet.SpreadsheetModel.Cells[r, c].ErrorString = "ERROR - CIRCULAR REFERENCE"; } return Tokenize("=ERROR - CIRCULAR REFERENCE"); } for (int j = 0; j < Parts.Count; j++) if (IsCellReference(Parts[j].ToString())) { ArrayList atemp = BreakReference(Parts[j].ToString()); int r = (int)atemp[0]; int c = (int)atemp[1]; if (activeWS.Spreadsheet.SpreadsheetModel.Cells[r, c] != null) if (activeWS.Spreadsheet.SpreadsheetModel.Cells[r, c].Error) {//If a referenced cell has an error set the error state atemp = BreakReference(Base_Cell); r = (int)atemp[0]; c = (int)atemp[1]; activeWS.Spreadsheet.SpreadsheetModel.Cells[r, c].Error = true; activeWS.Spreadsheet.SpreadsheetModel.Cells[r, c].ErrorString = "ERROR - POSSIBLE CIRCULAR REFERENCE"; return Tokenize("=ERROR - POSSIBLE CIRCULAR REFERENCE"); } } if (IsCellReference(Parts[i].ToString())) { //OutFile.WriteLine("Cell Reference"); //Console.WriteLine("BaseCell= " + Base_Cell); //Console.WriteLine("CellReference= " + Parts[i].ToString()); string cell_ref = Parts[i].ToString().ToUpper(); Parts.RemoveAt(i); //string temp = "=1+2";//temp will equal the output of the UI's function //FIXME ArrayList atemp = BreakReference(cell_ref); int r = (int)atemp[0]; int c = (int)atemp[1]; string temp = "NULL"; if (activeWS.Spreadsheet.SpreadsheetModel.Cells[r, c] != null) if(activeWS.Spreadsheet.SpreadsheetModel.Cells[r, c].Formula != null) temp = activeWS.Spreadsheet.SpreadsheetModel.Cells[r, c].Formula.ToUpper();// Form1.getCellFormula(cell_ref); if (temp.Length <= 0) temp = "NULL"; //OutFile.WriteLine(cell_ref + " -> " + temp); if (temp[0] == '=') { //Cell has a formula Parts.InsertRange(i, Reformat(Tokenize(temp))); //OutFile.WriteLine("Cell has a formula"); } else { try { //Cell has a value Parts.Insert(i, Convert.ToDouble(temp)); //OutFile.WriteLine("Cell has a number"); } catch { Parts.Insert(i, "NULL"); //OutFile.WriteLine("Cell has a string"); } } } } #endregion return Parts; }
/// <summary> /// Determines the advisors for the given object, including the specific interceptors /// as well as the common interceptor, all adapted to the Advisor interface. /// </summary> /// <param name="targetName">The name of the object.</param> /// <param name="specificInterceptors">The set of interceptors that is specific to this /// object (may be empty, but not null)</param> /// <returns>The list of Advisors for the given object</returns> protected virtual IAdvisor[] BuildAdvisors(string targetName, object[] specificInterceptors) { // handle prototypes correctly IAdvisor[] commonInterceptors = ResolveInterceptorNames(); ArrayList allInterceptors = new ArrayList(); if (specificInterceptors != null) { allInterceptors.AddRange(specificInterceptors); if (commonInterceptors != null) { if (applyCommonInterceptorsFirst) { allInterceptors.InsertRange(0, commonInterceptors); } else { allInterceptors.AddRange(commonInterceptors); } } } if (logger.IsInfoEnabled) { int nrOfCommonInterceptors = commonInterceptors != null ? commonInterceptors.Length : 0; int nrOfSpecificInterceptors = specificInterceptors != null ? specificInterceptors.Length : 0; logger.Info(string.Format("Creating implicit proxy for object '{0}' with {1} common interceptors and {2} specific interceptors", targetName, nrOfCommonInterceptors, nrOfSpecificInterceptors)); } IAdvisor[] advisors = new IAdvisor[allInterceptors.Count]; for (int i = 0; i < allInterceptors.Count; i++) { advisors[i] = advisorAdapterRegistry.Wrap(allInterceptors[i]); } return advisors; }
private ArrayList GetDetailCommandUp(IDbCommand sc, ArrayList salDetailCommand, bool isReplaceCmd) { ArrayList myDC = new ArrayList(); try { Type myType = GetType(); object oVal = null; FieldInfo[] Fields = myType.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.DeclaredOnly); ArrayList myList = GetIntfObjects(typeof(IInfoDataSource)); for (int j = 0; j < myList.Count; j++) { if (((IInfoDataSource)(myList[j])).GetMaster() == sc) { if (isReplaceCmd && ((IInfoDataSource)(myList[j])).DynamicTableName) { //myDC.Add(((IInfoDataSource)(myList[j])).GetDetail()); } else if (!isReplaceCmd && !((IInfoDataSource)(myList[j])).DynamicTableName) { //myDC.Add(((IInfoDataSource)(myList[j])).GetDetail()); } else { continue; } for (int i = 0; i < Fields.Length; i++) { oVal = Fields[i].GetValue(this); if (null != oVal) { if (oVal.Equals(((IInfoDataSource)myList[j]).GetDetail())) { //salDetailCommand.Add(Fields[i].Name); salDetailCommand.Insert(0, Fields[i].Name); IDbCommand aCommand = ((IInfoDataSource)(myList[j])).GetDetail(); myDC.Insert(0, aCommand); ArrayList temp = GetDetailCommandUp(aCommand, salDetailCommand); myDC.InsertRange(0, temp); //foreach (IDbCommand B in temp) // myDC.Insert(0, B); break; } } } } } } catch (Exception e) { string sMess = SysMsg.GetSystemMessage((SYS_LANGUAGE)(((object[])(ClientInfo[0]))[0]), ThisModuleName, ThisComponentName, "msg_RethrowException"); throw new Exception(string.Format(sMess, ThisModuleName, "GetDetailCommand", e.Message)); } return myDC; }