private string strCarregaDadosNormaDeOrigem() { System.Collections.ArrayList arlNormasStr, arlNormasStrCopia = new System.Collections.ArrayList(), arlIdOrdem; string strRetorno = ""; vCarregaNormas(m_nIdTipoCO, out arlIdOrdem, out arlNormasStr); foreach (string strNorma in arlNormasStr) { arlNormasStrCopia.Add(strNorma); } int nIdOrdem = 0, nPrimeiroIdIntervalo = 0, nIdAtualIntervalo = 0; for (int nCount = 0; nCount < arlNormasStr.Count; nCount++) { nIdOrdem = nPrimeiroIdIntervalo = nIdAtualIntervalo = 0; if (arlNormasStrCopia.LastIndexOf(arlNormasStr[nCount]) == arlNormasStrCopia.IndexOf(arlNormasStr[nCount])) { strRetorno += arlIdOrdem[nCount].ToString() + this.TextoEspacamento + arlNormasStr[nCount].ToString() + System.Environment.NewLine; } else if (strRetorno.IndexOf(arlNormasStr[nCount].ToString()) == -1) { nIdOrdem = nCount; while (nIdOrdem != -1) { nIdOrdem = arlNormasStr.IndexOf(arlNormasStr[nCount], nIdOrdem); if (nIdOrdem != -1) { if (nPrimeiroIdIntervalo == 0) { nPrimeiroIdIntervalo = nIdAtualIntervalo = (int)arlIdOrdem[nIdOrdem]; strRetorno += nPrimeiroIdIntervalo.ToString() + "-" + nIdAtualIntervalo.ToString(); } else { if ((nIdAtualIntervalo + 1) == (int)arlIdOrdem[nIdOrdem]) { string strAntiga = nPrimeiroIdIntervalo.ToString() + "-" + nIdAtualIntervalo.ToString(); nIdAtualIntervalo++; string strNova = nPrimeiroIdIntervalo.ToString() + "-" + nIdAtualIntervalo.ToString(); strRetorno = strRetorno.Replace(strAntiga, strNova); } else { nPrimeiroIdIntervalo = nIdAtualIntervalo = (int)arlIdOrdem[nIdOrdem]; strRetorno += "; " + nPrimeiroIdIntervalo.ToString() + "-" + nIdAtualIntervalo.ToString(); } } nIdOrdem++; } } strRetorno += this.TextoEspacamento + arlNormasStr[nCount].ToString() + System.Environment.NewLine; } } if (strRetorno.Length > 2) { strRetorno = strRetorno.Substring(0, strRetorno.Length - 2); } return(strRetorno); }
public int LastIndexOf(T obj) { mutex.WaitOne(); try { return(array.LastIndexOf(obj)); } finally { mutex.ReleaseMutex(); } }
///<summary> ///Searches for the specified base_scope and returns the zero-based index of the last occurrence within the entire base_scopeArrayList. ///</summary> ///<param name="value">The base_scope to locate in the base_scopeArrayList. The value can be a null reference.<param> ///<returns>The zero-based index of the last occurrence of value within the entire the ArrayList, if found; otherwise, -1.</returns> public int LastIndexOf(base_scope value) { return(arr.LastIndexOf(value)); }
public void IterateThroughJSON(dynamic myObj, Rhino.Collections.ArchivableDictionary myDict) { if (((IDictionary <String, object>)myObj).ContainsKey("children")) { Rhino.RhinoApp.WriteLine("is Folder"); //myDict.Set(myObj.Key) List <object> myObjChildrenKeys = new List <object>(); for (int i = 0; i < myObj.children.Count; i++) { myObjChildrenKeys.Add(myObj.children[i].Key); dynamic kvp = myObj.children[i]; System.Collections.ArrayList arrayList = new System.Collections.ArrayList(myObjChildrenKeys); int first = arrayList.IndexOf(kvp.Key.ToString()); int last = arrayList.LastIndexOf(kvp.Key.ToString()); //Rhino.RhinoApp.WriteLine(first.ToString(), "thatsmyobj"); if (((IDictionary <String, object>)kvp).ContainsKey("children")) { Rhino.Collections.ArchivableDictionary newDict = new Rhino.Collections.ArchivableDictionary(); if (first != -1 && first != last) { Rhino.RhinoApp.WriteLine("found it!"); myDict.Set(kvp.Key + " (at index " + i + ")", newDict); } else { myDict.Set(kvp.Key, newDict); } IterateThroughJSON(kvp, newDict); } else { if (kvp.Key == "Id") { Rhino.RhinoApp.WriteLine(kvp.Value); Guid myGuid = new Guid(kvp.Value); RhinoObject foundObject = Rhino.RhinoDoc.ActiveDoc.Objects.Find(myGuid); myDict.Set("Geometry", foundObject.Geometry); } else { if (first != -1 && first != last) { Rhino.RhinoApp.WriteLine("found it!"); myDict.Set(kvp.Key + " (at index " + i + ")", kvp.Value); } else { myDict.Set(kvp.Key, kvp.Value); } } } } } else // no children { Rhino.RhinoApp.WriteLine(myObj.Value); myDict.Set(myObj.Key, myObj.Value); } }
///<summary> ///Searches for the specified unit_node and returns the zero-based index of the last occurrence within the entire unit_nodeArrayList. ///</summary> ///<param name="value">The unit_node to locate in the unit_nodeArrayList. The value can be a null reference.<param> ///<returns>The zero-based index of the last occurrence of value within the entire the ArrayList, if found; otherwise, -1.</returns> public int LastIndexOf(unit_node value) { return(arr.LastIndexOf(value)); }
///<summary> ///Searches for the specified using_namespace and returns the zero-based index of the last occurrence within the entire using_namespaceArrayList. ///</summary> ///<param name="value">The using_namespace to locate in the using_namespaceArrayList. The value can be a null reference.<param> ///<returns>The zero-based index of the last occurrence of value within the entire the ArrayList, if found; otherwise, -1.</returns> public int LastIndexOf(using_namespace value) { return(arr.LastIndexOf(value)); }
///<summary> ///Searches for the specified SymbolInfo and returns the zero-based index of the last occurrence within the entire SymbolInfoArrayList. ///</summary> ///<param name="value">The SymbolInfo to locate in the SymbolInfoArrayList. The value can be a null reference.<param> ///<returns>The zero-based index of the last occurrence of value within the entire the ArrayList, if found; otherwise, -1.</returns> public int LastIndexOf(SymbolInfo value) { return(arr.LastIndexOf(value)); }