CopyTo() public method

public CopyTo ( Array array ) : void
array Array
return void
        /// <summary>
        /// Reads byte[] line from stream.
        /// </summary>
        /// <returns>Return null if end of stream reached.</returns>
        public byte[] ReadLine()
        {
            ArrayList lineBuf  = new ArrayList();
            byte      prevByte = 0;

            int currByteInt = m_StrmSource.ReadByte();
            while(currByteInt > -1){
                lineBuf.Add((byte)currByteInt);

                // Line found
                if((prevByte == (byte)'\r' && (byte)currByteInt == (byte)'\n')){
                    byte[] retVal = new byte[lineBuf.Count-2];    // Remove <CRLF>
                    lineBuf.CopyTo(0,retVal,0,lineBuf.Count-2);

                    return retVal;
                }

                // Store byte
                prevByte = (byte)currByteInt;

                // Read next byte
                currByteInt = m_StrmSource.ReadByte();
            }

            // Line isn't terminated with <CRLF> and has some chars left, return them.
            if(lineBuf.Count > 0){
                byte[] retVal = new byte[lineBuf.Count];
                lineBuf.CopyTo(0,retVal,0,lineBuf.Count);

                return retVal;
            }

            return null;
        }
Example #2
0
 public void Add(string name, string fieldValue, bool readOnly)
 {
     ArrayList list = new ArrayList(this.SharePointListFields);
     list.Add(new SharePointListField(name, fieldValue, readOnly));
     this.sharePointListFields = new SharePointListField[list.Count];
     list.CopyTo(this.SharePointListFields);
 }
        /// <summary>
        /// Returns an array of any MethodInfo's on a Type that are marked as ValidationMethod
        /// </summary>
        /// <param name="objectType">CLR Type to search for validation methods</param>
        /// <returns></returns>
        public static MethodInfo[] GetValidationMethods(Type objectType)
        {
            var methodList = new ArrayList();

            MethodInfo[] methods = objectType.GetMethods();
            foreach (MethodInfo method in methods)
            {
                var att =
                    (ValidationMethodAttribute) GetCustomAttribute(method, typeof (ValidationMethodAttribute));

                if (att != null)
                {
                    if (method.GetParameters().Length > 0)
                    {
                        string msg =
                            string.Format(
                                "Method *{0}* in Class *{1}* cannot be a validation method because it has parameters",
                                method.Name, objectType.AssemblyQualifiedName);
                        throw new ApplicationException(msg);
                    }

                    methodList.Add(method);
                }
            }

            var returnValue = new MethodInfo[methodList.Count];
            methodList.CopyTo(returnValue, 0);

            return returnValue;
        }
Example #4
0
		public void CopyTo(Array array, int index)
		{
			ArrayList arrayList = new ArrayList();
			foreach (BrokerAccountField brokerAccountField in this)
				arrayList.Add((object)brokerAccountField);
			arrayList.CopyTo(array, index);
		}
Example #5
0
        public static UserInfo[] GetAllUsers()
        {
            ArrayList al = new ArrayList();

            int retValue = -1;

            //Generated Code for query : dbo.GetAllVendors
            using (SqlDataReader dr = ProjManagementAdmin.GetAllUsers(out retValue)) //Initialize and retrieve code for Datareader goes here
            {

                while (dr.Read())
                {
                    UserInfo user = new UserInfo();

                    user.UserName = dr["user_name"].ToString();
                    user.UserId = Convert.ToInt32(dr["user_id"]);
                    user.UserEmail = dr["user_email"].ToString();
                    user.RoleId = Convert.ToInt32(dr["role_id"]);
                   // user.Password = Convert.ToChar(dr["password"]);
                    user.CreatedDate = Convert.ToDateTime(dr["created_date"]);
                    user.ChangedDate = Convert.ToDateTime(dr["changed_date"]);
                    user.ChangedBy = dr["changed_by"].ToString();

                    al.Add(user);
                }
                //dr.Close();
            }

            UserInfo[] allInfo = new UserInfo[al.Count];
            al.CopyTo(allInfo);
            return allInfo;
        }
Example #6
0
        //EXECUTION
        protected override void InternalExecution()
        {
            int size = 100;
            IList list = new ArrayList();

            IQuantumState newState;
            IQuantumOperator randomizer = QuantumOperatorFactory.generateRandomizeOperator();
            TesterLog("Generating " + size + " QuantumSimpleStates of 3 levels and initializing to random....");
            for (int i = 0; i < size; i++)
            {
                newState = QuantumStateFactory.generateStateSimple(3);
                randomizer.Evaluate(newState);
                list.Add(newState);
            }

            TesterLog("");
            TesterLog("Showing all of them");
            for (int i = 0; i < size; i++)
            {
                newState = (IQuantumState)list[i];
                TesterLog(newState.generateQuantumDebugger().FullDebug);
            }

            TesterLog("");
            TesterLog("Getting a composed state of all of them");
            IQuantumState[] array = new IQuantumState[list.Count];
            list.CopyTo(array,0);
            IQuantumState composed = QuantumStateFactory.generateStateComposed(array);
            TesterLog(composed.generateQuantumDebugger().FullDebug);
        }
Example #7
0
 static void Main(string[] args)
 {
     ArrayList al = new ArrayList();
     al.Add("string");
     al.Add('B');
     al.Add(10);
     al.Add(DateTime.Now);
     ArrayList bl = new ArrayList(5);
     al.Remove('B');
     // 从al中删除第一个匹配的对象,如果al中不包含该对象,数组保持不变,不引发异常。
     al.Remove('B');
     al.RemoveAt(0);
     al.RemoveRange(0, 1);
     bl.Add(1);
     bl.Add(11);
     bl.Add(111);
     bl.Insert(4, 1111);
     int[] inttest = (int[])bl.ToArray(typeof(int));
     foreach(int it in inttest)
         Console.WriteLine(it);
     int[] inttest2 = new int[bl.Count];
     bl.CopyTo(inttest2);
     ArrayList cl = new ArrayList();
     cl.Add(1);
     cl.Add("Hello, World!");
     object[] ol = (object[])cl.ToArray(typeof(object));
     // stringp[] os = (string[])cl.ToArray(typeof(string));
     Console.WriteLine("The Capacity of new ArrayList: {0}", al.Capacity);
 }
 internal OracleDataReader(OracleCommand command, ArrayList refCursorParameterOrdinals, string statementText, CommandBehavior commandBehavior)
 {
     this.ObjectID = Interlocked.Increment(ref _objectTypeCount);
     this._commandBehavior = commandBehavior;
     this._statementText = statementText;
     this._closeConnectionToo = this.IsCommandBehavior(CommandBehavior.CloseConnection);
     if (CommandType.Text == command.CommandType)
     {
         this._keyInfoRequested = this.IsCommandBehavior(CommandBehavior.KeyInfo);
     }
     ArrayList list = new ArrayList();
     int num2 = 0;
     OracleDataReader reader = null;
     for (int i = 0; i < refCursorParameterOrdinals.Count; i++)
     {
         int num3 = (int) refCursorParameterOrdinals[i];
         OracleParameter parameter = command.Parameters[num3];
         if (OracleType.Cursor == parameter.OracleType)
         {
             reader = (OracleDataReader) parameter.Value;
             reader._recordsAffected = num2;
             list.Add(reader);
             parameter.Value = DBNull.Value;
         }
         else
         {
             num2 += (int) parameter.Value;
         }
     }
     this._refCursorDataReaders = new OracleDataReader[list.Count];
     list.CopyTo(this._refCursorDataReaders);
     this._nextRefCursor = 0;
     this.NextResultInternal();
 }
        /// <summary>
        /// Diese Funktion gibt alle EtbEintraege zurueck, die nicht Systemereignisse sind.
        /// </summary>
        /// <returns>Menge aller EtbZusatzeintraege</returns>
        public Cdv_EtbEintrag[] LadeEtbEintraege()
        {
            // hole alle EtbEintraege
            pELS.DV.Server.Interfaces.IPelsObject[] ipoa = _ObjektManager.EtbEintraege.HolenAlle();
            if(!(ipoa == null) || (ipoa.Length == 0))
            {
                Cdv_EtbEintrag[] tmpEtbEintraege = new Cdv_EtbEintrag[ipoa.Length];
                ipoa.CopyTo(tmpEtbEintraege,0);

                //Schmeiße alle Systemereignisse raus
                ArrayList _tmpAL = new ArrayList();
                for (int pos = 0; pos < tmpEtbEintraege.Length; pos++)
                {
                    if (tmpEtbEintraege[pos].GetType().ToString() != "pELS.DV.Cdv_Systemereignis") _tmpAL.Add(tmpEtbEintraege[pos]);
                }

                // kopiere Einträge aus ArrayList nach Array
                Cdv_EtbEintrag[] pout_EtbEintraege = new Cdv_EtbEintrag[_tmpAL.Count];
                _tmpAL.CopyTo(pout_EtbEintraege);

                //nach Datum sortieren
                pout_EtbEintraege = this.SortiereNachDatum(pout_EtbEintraege);
                return pout_EtbEintraege;
            }
            else
                return null;
        }
        /// <summary>
        /// Initializes this force-directed layout. Assumes that graph has some
        /// reasonable initial node positions.
        /// </summary>
        /// <param name="graph">The graph to layout.</param>
        /// <param name="start_node">The node to start layout from.</param>
        public ForceDirectedLayout(IReadOnlyGraph<FDLNode, FDLEdge> graph, FDLNode start_node)
        {
            if (graph == null)
                throw new ArgumentNullException("graph");
            if (start_node == null)
                throw new ArgumentNullException("start_node");
            if (!graph.ContainsNode(start_node))
                throw new ArgumentException("start_node must be in this graph");

            //initialize nodes array to only the reachable nodes
            ArrayList n = new ArrayList(graph.NodeCount);
            Algorithms.Algorithms.BreadthFirstSearch(graph, start_node, null, delegate(FDLNode node){
                n.Add(node);
            });
            nodes = new FDLNode[n.Count];
            n.CopyTo(nodes);

            new_positions = new MutablePoint[nodes.Length];
            accels = new double[nodes.Length];

            //summarize constraints
            HashSet<FDLEdge> h = new HashSet<FDLEdge>();
            for (int i = 0; i < nodes.Length; i++)
            {
                foreach (FDLEdge edge in nodes[i].OutEdges)
                {
                    DefaultEdge reverse = edge.Target.GetEdgeTo(edge.Source);
                    if(h.Contains(edge) || (reverse != null && h.Contains(reverse)))
                        continue;
                    h.Add(edge);
                }
            }
            constraints = new FDLEdge[h.Count];
            h.CopyTo(constraints);
        }
        public static BeneficiaryProjLocInfo[] GetAllBeneficiaries()
        {
            ArrayList al = new ArrayList();
            int retValue = -1;
            //Generated Code for query : dbo.GetAllVendors
            using (SqlDataReader dr = ProjManagementAdmin.GetAllBeneficiaries(out retValue)) //Initialize and retrieve code for Datareader goes here
            {

                while (dr.Read())
                {
                    BeneficiaryProjLocInfo b = new BeneficiaryProjLocInfo();
                    b.BeneficiaryId = Convert.ToInt32(dr["beneficiary_id"]);
                    b.BeneficiaryName = dr["beneficiary_name"].ToString();
                    b.BeneficiaryAddress = dr["beneficiary_address"].ToString();
                    b.ProjectLocationId = Convert.ToInt32(dr["project_location_id"]);
                    b.ProjectId = Convert.ToInt32(dr["project_id"]);
                   b.ProjectName = dr["project_name"].ToString();
                    // b.ProjectCode = dr["project_code"].ToString();

                    b.LocationId = Convert.ToInt32(dr["location_id"]);
                    b.LocationName = dr["location_name"].ToString();

                    b.IsActive = Convert.ToBoolean(dr["is_active"]);
                    b.CreatedDate = Convert.ToDateTime(dr["created_date"]);
                    b.ChangedDate = Convert.ToDateTime(dr["changed_date"]);
                    b.ChangedBy = dr["changed_by"].ToString();
                    al.Add(b);
                }
                //dr.Close();
            }

            BeneficiaryProjLocInfo[] allInfo = new BeneficiaryProjLocInfo[al.Count];
            al.CopyTo(allInfo);
            return allInfo;
        }
Example #12
0
        public static LocationInfo[] GetAllLocations()
        {
            ArrayList al = new ArrayList();

            int retValue = -1;

            //Generated Code for query : dbo.GetAllVendors
            using (SqlDataReader dr = ProjManagementAdmin.GetAllLocations(out retValue)) //Initialize and retrieve code for Datareader goes here
            {

                while (dr.Read())
                {
                    LocationInfo location = new LocationInfo();
                    location.LocationId = Convert.ToInt32(dr["location_id"]);
                    location.LocationName = dr["location_name"].ToString();
                    location.CreatedDate = Convert.ToDateTime(dr["created_date"]);
                    location.ChangedDate = Convert.ToDateTime(dr["changed_date"]);
                    location.ChangedByName = dr["changed_by"].ToString();
                    al.Add(location);
                }
                //dr.Close();
            }

            LocationInfo[] allInfo = new LocationInfo[al.Count];
            al.CopyTo(allInfo);
            return allInfo;
        }
Example #13
0
        public bool TryConvert(ConvertArgs args)
        {
            if (!args.DestinationType.IsArray)
            {
                return false;
            }
            if (args.Reader.Value == null)
            {
                args.ConvertedObject = null;
                return true;
            }

            ArrayList arrayList = new ArrayList();
            var elementType = args.DestinationType.GetElementType();
            var enumerableItems = args.Reader.Value as IEnumerable;
            if (enumerableItems == null)
            {
                return true;
            }
            foreach (var obj in enumerableItems)
            {
                Type toElementType = args.Converter.GetDestinationType(obj, elementType);
                var dstObject = args.Converter.MapObject(obj, toElementType);
                arrayList.Add(dstObject);
            }
            var array = (Array)Activator.CreateInstance(args.DestinationType, new object[] { arrayList.Count });
            arrayList.CopyTo(array);
            args.ConvertedObject = array;
            return true;
        }
Example #14
0
 private void SaveButton_Click(object sender, EventArgs e)
 {
     if (SubjectBox.Text.Length == 0)
     {
         MessageBox.Show("Cannot proceed with empty name");
         return;
     }
     ArrayList list = new ArrayList((string[])Host.SubjectList.DataSource);
     list.Sort();
     int id = list.BinarySearch(SubjectBox.Text);
     if (id >= 0)
     {
         MessageBox.Show("Subject with that name already exists!");
         return;
     }
     id = ~id;
     list.Insert(id, SubjectBox.Text);
     string[] n = new string[list.Count];
     list.CopyTo(n);
     Host.SubjectBox2.AutoCompleteCustomSource.Add(SubjectBox.Text);
     Host.SubjectList.DataSource = n;
     Host.RenewSubjectList();
     Host.SubjectList.SelectedItem = SubjectBox.Text;
     this.Close();
 }
        /// <summary>
        /// Split Function that Supports Text Qualifiers
        /// Source: http://www.codeproject.com/KB/dotnet/TextQualifyingSplit.aspx
        /// </summary>
        private static string[] Split(string expression, string delimiter, string qualifier, bool ignoreCase)
        {
            bool qualifierState = false;
            int startIndex = 0;
            ArrayList values = new ArrayList();

            for (int charIndex = 0; charIndex < expression.Length - 1; charIndex++)
            {
                if ((qualifier != null)
                 & (string.Compare(expression.Substring(charIndex, qualifier.Length), qualifier, ignoreCase) == 0))
                {
                    qualifierState = !(qualifierState);
                }
                else if (!(qualifierState) & (delimiter != null)
                      & (string.Compare(expression.Substring(charIndex, delimiter.Length), delimiter, ignoreCase) == 0))
                {
                    values.Add(expression.Substring(startIndex, charIndex - startIndex));
                    startIndex = charIndex + 1;
                }
            }

            if (startIndex < expression.Length)
                values.Add(expression.Substring(startIndex, expression.Length - startIndex));

            string[] returnValues = new string[values.Count];
            values.CopyTo(returnValues);
            return returnValues;
        }
        public void init()
        {
            IList temp = new ArrayList();
            temp.Add(new ListItem("Interpret", "0"));
            temp.Add(new ListItem("Titel","1"));
            temp.Add(new ListItem("Autor","2"));
            temp.Add(new ListItem("Bpm","3"));
            temp.Add(new ListItem("Code","4"));
            temp.Add(new ListItem("Ending","5"));
            temp.Add(new ListItem("Label","6"));
            temp.Add(new ListItem("Laenge","7"));
            temp.Add(new ListItem("Verlag","8"));
            temp.Add(new ListItem("Year","9"));

            ListItem[] categories = new ListItem[temp.Count];
            temp.CopyTo(categories, 0);

            temp = new ArrayList();
            temp.Add(new ListItem("IS","0"));
            temp.Add(new ListItem("NOT", "1"));
            ListItem[] relators = new ListItem[temp.Count];
            temp.CopyTo(relators, 0);

            using(mocks.Record()) {
                this.view.SearchCategories = categories;
                this.view.UnaryRelators = relators;
            }
            using(mocks.Playback()) {
                presenter.initialise();
            }
        }
Example #17
0
		public void CopyTo(Array array, int index)
		{
			ArrayList arrayList = new ArrayList();
			foreach (BrokerPosition brokerPosition in this)
				arrayList.Add((object)brokerPosition);
			arrayList.CopyTo(array, index);
		}
Example #18
0
        /// <summary>
        /// Gets iSC's available _AMMediaTypes, without freeing pbFormat
        /// Caller should call MediaType.Free(_AMMediaType[]) when done
        /// </summary>
        public static _AMMediaType[] GetMediaTypes(IPin pin)
        {
            IEnumMediaTypes iEnum;
            pin.EnumMediaTypes(out iEnum);

            ArrayList alMTs = new ArrayList();

            IntPtr[] ptrs = new IntPtr[1];
            uint fetched;

            iEnum.Next(1, ptrs, out fetched);

            while(fetched == 1)
            {
                _AMMediaType mt = (_AMMediaType)Marshal.PtrToStructure(ptrs[0], typeof(_AMMediaType));
                alMTs.Add(mt);
                
                Marshal.FreeCoTaskMem(ptrs[0]);
                ptrs[0] = IntPtr.Zero;

                iEnum.Next(1, ptrs, out fetched);
            }

            _AMMediaType[] mts = new _AMMediaType[alMTs.Count];
            alMTs.CopyTo(mts);
            
            return mts;
        }
 public void CopyTo(Array array, int index)
 {
     if (this.isDisposed)
     {
         throw new ObjectDisposedException(name);
     }
     if (array == null)
     {
         throw new ArgumentNullException("array");
     }
     if ((index < array.GetLowerBound(0)) || (index > array.GetUpperBound(0)))
     {
         throw new ArgumentOutOfRangeException("index");
     }
     int num = array.Length - index;
     int num2 = 0;
     ArrayList list = new ArrayList();
     ManagementObjectEnumerator enumerator = this.GetEnumerator();
     while (enumerator.MoveNext())
     {
         ManagementBaseObject current = enumerator.Current;
         list.Add(current);
         num2++;
         if (num2 > num)
         {
             throw new ArgumentException(null, "index");
         }
     }
     list.CopyTo(array, index);
 }
Example #20
0
    public static TreeNode[] ToPlainArray( TreeNodeCollection nodes )
    {
      TreeNode[] arrayOut;

      if( nodes.Count > 0 )
      {
        ArrayList array = new ArrayList();

        TreeNode  next = null, start = nodes[0];
        array.Add( start );

        while( null != ( next = FindNextNode( nodes, start ) ) )
        {
          if( next == start ) break;
          array.Add( start = next );
        }

        arrayOut = new TreeNode[ array.Count ];
        array.CopyTo( arrayOut, 0 );

        return arrayOut;
      }

      return null;
    }
 internal void AddClassesExcluding(ClassScope excludedClass, string name, ArrayList result)
 {
     ArrayList list = new ArrayList();
     foreach (MemberInfo info in this.GetMembers(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static))
     {
         if ((info is JSVariableField) && ((JSVariableField) info).IsLiteral)
         {
             object obj2 = ((JSVariableField) info).value;
             if (obj2 is ClassScope)
             {
                 ClassScope other = (ClassScope) obj2;
                 if (((other.name == info.Name) && ((excludedClass == null) || !excludedClass.IsSameOrDerivedFrom(other))) && (other.GetMember(name, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly).Length > 0))
                 {
                     list.Add(other);
                 }
             }
         }
     }
     if (list.Count != 0)
     {
         ClassScope[] array = new ClassScope[list.Count];
         list.CopyTo(array);
         Array.Sort<ClassScope>(array);
         result.AddRange(array);
     }
 }
        /// <summary>
        /// Gets MX records from answer collection and ORDERS them by preference.
        /// NOTE: Duplicate preference records are appended to end. 
        /// </summary>
        /// <returns></returns>
        internal MX_Record[] GetMxRecordsFromAnswers()
        {
            MX_Record[] retVal = null;

            try
            {
                SortedList mx            = new SortedList();
                ArrayList  duplicateList = new ArrayList();
                foreach(Dns_Answer answer in m_Answers){
                    if(answer.QTYPE == QTYPE.MX){
                        MX_Record mxRec = (MX_Record)answer.RecordObj;

                        if(!mx.Contains(mxRec.Preference)){
                            mx.Add(mxRec.Preference,mxRec);
                        }
                        else{
                            duplicateList.Add(mxRec);
                        }
                    }
                }

                MX_Record[] mxBuff = new MX_Record[mx.Count + duplicateList.Count];
                mx.Values.CopyTo(mxBuff,0);
                duplicateList.CopyTo(mxBuff,mx.Count);
                retVal = mxBuff;
            }
            catch{
            }

            return retVal;
        }
		/// <summary>
		/// Construct the palette quantizer
		/// </summary>
		/// <param name="palette">The color palette to quantize to</param>
		/// <remarks>
		/// Palette quantization only requires a single quantization step
		/// </remarks>
		public PaletteQuantizer ( ArrayList palette ) : base ( true )
		{
			_colorMap = new Hashtable ( ) ;

			_colors = new Color[palette.Count] ;
			palette.CopyTo ( _colors ) ;
		}
Example #24
0
        /* BytePPToArray
           * Converts a C-style string array into a .NET managed string array
           * Parameters
           *    C-style string array pointer returned from PhysFS
           * Returns
           *    .NET managed string array
           * Exceptions
           *    none
           */
        public static unsafe string[] BytePPToArray(byte **bytearray)
        {
            byte** ptr;
             byte* c;
             string tempstr;
             ArrayList MyArrayList = new ArrayList();
             string[] RetArray;

             for(ptr = bytearray; *ptr != null; ptr++)
             {
            tempstr = "";
            for(c = *ptr; *c != 0; c++)
            {
               tempstr += (char)*c;
            }

            // Add string to our list
            MyArrayList.Add(tempstr);
             }

             // Return a normal array of the list
             RetArray = new string[MyArrayList.Count];
             MyArrayList.CopyTo(RetArray, 0);
             return RetArray;
        }
Example #25
0
        public Block[] getProxyBlocks( int limit )
        {
            string cmdText = "SELECT * FROM ipblocks i WHERE ipb_reason LIKE \"%proxy%\" AND ipb_user = 0";
            if( limit != 0 )
                cmdText += " LIMIT " + limit.ToString( );

            cmdText += ";";

            MySqlCommand cmd = new MySqlCommand( cmdText );

            cmd.Connection = db_connection;
            MySqlDataReader dr = cmd.ExecuteReader( );

            ArrayList blocks = new ArrayList( );

            while( dr.Read() )
            {
                object[ ] vals = new object[ dr.FieldCount ];
                dr.GetValues( vals );

                blocks.Add(Block.newFromDataRow( vals ));
            }

            dr.Close( );

            Block[ ] bA = new Block[ blocks.Count ];
            blocks.CopyTo( bA );
            return bA;
        }
Example #26
0
        public static AvailablePlugin[] FindPlugins(string strPath, string strInterface)
        {
            ArrayList Plugins = new ArrayList();
            string[] strDLLs = null;
            int intIndex = default(int);
            Assembly objDLL = default(Assembly);

            //Go through all DLLs in the directory, attempting to load them
            strDLLs = Directory.GetFileSystemEntries(strPath, "*.dll");
            for (intIndex = 0; intIndex <= strDLLs.Length - 1; intIndex++)
            {
                try
                {
                    objDLL = Assembly.LoadFrom(strDLLs[intIndex]);
                    ExamineAssembly(objDLL, strInterface, Plugins);
                }
                catch (Exception)
                {
                    //Error loading DLL, we don't need to do anything special
                }
            }

            //Return all plugins found
            AvailablePlugin[] Results = new AvailablePlugin[Plugins.Count - 1 + 1];

            if (Plugins.Count != 0)
            {
                Plugins.CopyTo(Results);
                return Results;
            }
            else
            {
                return null;
            }
        }
Example #27
0
        /// <summary>
        /// Parses name-value params.
        /// </summary>
        /// <param name="source">Parse source.</param>
        /// <param name="expressions">Expressions importance order. NOTE: must contain param and value groups.</param>
        public static _Parameter[] Paramparser_NameValue(string source,string[] expressions)
        {
            string tmp = source.Trim();
            ArrayList param = new ArrayList();
            foreach(string exp in expressions){
                Regex r = new Regex(exp,RegexOptions.IgnoreCase);
                Match m = r.Match(tmp);
                if(m.Success){
                    param.Add(new _Parameter(m.Result("${param}").Trim(),m.Result("${value}")));

                    // remove matched string part form tmp
                    tmp = tmp.Replace(m.ToString(),"").Trim();
                }
            }

            // There are some unparsed params, add them as UnParsed
            if(tmp.Trim().Length > 0){
                param.Add(new _Parameter("UNPARSED",tmp));
            }

            _Parameter[] retVal = new _Parameter[param.Count];
            param.CopyTo(retVal);

            return retVal;
        }
        /// <summary>
        /// Copy property value of object stored in source into destination array.
        /// </summary>
        /// <param name="source">List of object which property must be read</param>
        /// <param name="array">Destination array</param>
        /// <param name="property">Source Object Property Name</param>
        /// <param name="startIndx">Start index of source object</param>
        public static void CopyTo( IList source, Array array, string property, int index )
        {
            ArrayList list = new ArrayList( source.Count );
              PropertyInfo keyProp = null;

              int iCount = 0;
              foreach( object obj in source )
              {
            if( keyProp == null )
            {
              keyProp =  obj.GetType().GetProperty( property );
              if( keyProp == null )
            throw new ArgumentException( "Property Name of object is wrong", "property" );
            }

            if( iCount >= index )
            {
              list.Add( keyProp.GetValue( obj, null ) );
            }

            iCount++;
              }

              list.CopyTo( array );
              list.Clear();
        }
Example #29
0
        /// <summary>
        /// Gets all thread status.
        /// </summary>
        /// <returns></returns>
        public string[] getAllThreadStatus()
        {
            ArrayList responses = new ArrayList();
            foreach (IThreadedSystem item in this._threadedObjects)
            {
                string status = item.GetType() + ": ";
                try
                {
                    foreach (string i in item.getThreadStatus())
                    {
                        responses.Add(status + i);
                    }
                }
                catch (NotImplementedException)
                {
                    status += "Not available.";
                    responses.Add(status);
                }
            }

            string[] responseArray = new string[responses.Count];

            responses.CopyTo(responseArray);

            return responseArray;
        }
Example #30
0
		public void CopyTo(Array array, int index)
		{
			ArrayList arrayList = new ArrayList();
			foreach (BrokerOrder brokerOrder in this)
				arrayList.Add((object)brokerOrder);
			arrayList.CopyTo(array, index);
		}