C# (CSharp) Класс System.Collections. ArrayList Code Examples

C# (CSharp) System.Collections.ArrayList - 30 примеров найдено. Это лучшие примеры C# (CSharp) кода для класса System.Collections.ArrayList, полученные из open source проектов. Вы можете ставить оценку каждому примеру, чтобы помочь нам улучшить качество примеров.
Наследование: System.Collections.IEnumerable, System.Collections.IList, System.ICloneable
Пример #1
0
		public void OverviewFor(string t, string p, ref bool b, ref SearchSet obj, ArrayList list)
		{
			PartOfSpeech pos = PartOfSpeech.of(p);
			SearchSet ss = WNDB.is_defined(t, pos);
			MorphStr ms = new MorphStr(t, pos);
			bool checkmorphs = false;

			checkmorphs = AddSearchFor(t, pos, list); // do a search

		    if (checkmorphs)
				HasMatch = true;

			if (!HasMatch)
			{
			    // loop through morphs (if there are any)
			    string m;
			    while ((m = ms.next()) != null)
					if (m != t)
					{
						ss = ss + WNDB.is_defined(m, pos);
						AddSearchFor(m, pos, list);
					}
			}
		    b = ss.NonEmpty;
			obj = ss;
		}
 internal ApplicationPartitionCollection(ArrayList values)
 {
     if (values != null)
     {
         InnerList.AddRange(values);
     }
 }
Пример #3
0
        public static void WriteException(System.Exception e)
        {
            ArrayList messages = new ArrayList();
            while (e != null)
            {
                messages.Add(e);
                e = e.InnerException;
            }
            Console.WriteLine(" ");
            Console.WriteLine("------- System.Exception ----------------------------- ");
            messages.Reverse();

            foreach (System.Exception ex in messages)
            {
                Console.WriteLine(ex.Message);
            }

            Console.WriteLine(" ");
            Console.WriteLine("----- Details -----");
            foreach (System.Exception ex in messages)
            {
                Console.WriteLine("Message..........: " + ex.Message);
                Console.WriteLine("Stact trace......: " + ex.StackTrace);
                Console.WriteLine("TargetSite.......: " + ex.TargetSite.Name);
                Console.WriteLine("Source...........: " + ex.Source);
                Console.WriteLine(" ");
            }
        }
Пример #4
0
 public IList aListOfPoint()
 {
     IList list = new ArrayList();
     list.Add(new System.Drawing.Point(0,0));
     list.Add(new System.Drawing.Point(5,5));
     return list;
 }
Пример #5
0
        /// <summary>
        /// Initializes an instance of the RdfParser class
        /// </summary>
        public OwlXmlParser()
        {
            _owlGraph = null;
            _warnings = new ArrayList();
            _errors = new ArrayList();
            _messages = new ArrayList();
            _newID = 10000;
            _dummyID = 10000;

            string[] rdfXmlAttrs = {"rdf:about", "rdf:resource", "rdf:parseType", "rdf:ID", "rdf:nodeID", "rdf:type", "rdf:datatype", "rdf:value", "xml:lang", "xml:base"};
            _rdfXmlProperties = new Hashtable();
            int len = rdfXmlAttrs.Length;
            for(int i=0;i<len;i++)
                _rdfXmlProperties.Add(rdfXmlAttrs[i],rdfXmlAttrs[i]);

            string[] syntacticElements = {"rdf:RDF", "rdf:ID", "rdf:about", "rdf:resource", "rdf:parseType", "rdf:nodeID"};
            _syntacticElements = new Hashtable();
            len = syntacticElements.Length;
            for(int i=0;i<len;i++)
                _syntacticElements.Add(syntacticElements[i], syntacticElements[i]);

            string[] nonSyntacticElements = {"rdf:type", "rdf:value", "rdf:datatype", "rdf:List", "rdf:first", "rdf:rest", "rdf:nil", "rdfs:comment", "rdfs:subPropertyOf", "rdfs:domain", "rdfs:range", "rdfs:subClassOf", "owl:allValuesFrom", "owl:backwardCompatibleWith", "owl:cardinality", "owl:complementOf", "owl:differentFrom", "owl:disjointWith", "owl:distinctMembers", "owl:equivalentClass", "owl:equivalentProperty", "owl:hasValue", "owl:imports", "owl:incompatibleWith", "owl:intersectionOf", "owl:inverseOf", "owl:maxCardinality", "owl:minCardinality", "owl:oneOf", "owl:onProperty", "owl:priorVersion", "owl:sameAs", "owl:someValuesFrom", "owl:unionOf", "owl:versionInfo"};
            _nonSyntacticElements = new Hashtable();
            len = nonSyntacticElements.Length;
            for(int i=0;i<len;i++)
                _nonSyntacticElements.Add(nonSyntacticElements[i],nonSyntacticElements[i]);

            _declID = new Hashtable();

            StopOnErrors = false;
            StopOnWarnings = false;
        }
Пример #6
0
        public DataSet PRC_PersonasListasDePrecios()
        {
            ArrayList Parameters=new ArrayList(0);

            SqlParameter MODOParameter=new SqlParameter("@MODO",SqlDbType.Int);
            MODOParameter.Size=0;
            MODOParameter.Value=MODO;
            Parameters.Add(MODOParameter);

            SqlParameter PersonasListasDePrecios_IDParameter=new SqlParameter("@PersonasListasDePrecios_ID",SqlDbType.Int);
            PersonasListasDePrecios_IDParameter.Size=0;
            PersonasListasDePrecios_IDParameter.Value=PersonasListasDePrecios_ID;
            Parameters.Add(PersonasListasDePrecios_IDParameter);

            SqlParameter Personas_IDParameter=new SqlParameter("@Personas_ID",SqlDbType.Int);
            Personas_IDParameter.Size=0;
            Personas_IDParameter.Value=Personas_ID;
            Parameters.Add(Personas_IDParameter);

            SqlParameter ListasDePrecios_IDParameter=new SqlParameter("@ListasDePrecios_ID",SqlDbType.Int);
            ListasDePrecios_IDParameter.Size=0;
            ListasDePrecios_IDParameter.Value=ListasDePrecios_ID;
            Parameters.Add(ListasDePrecios_IDParameter);

            SqlParameter PersonasDirecciones_IDParameter=new SqlParameter("@PersonasDirecciones_ID",SqlDbType.Int);
            PersonasDirecciones_IDParameter.Size=0;
            PersonasDirecciones_IDParameter.Value=PersonasDirecciones_ID;
            Parameters.Add(PersonasDirecciones_IDParameter);

             DataSet dsResult=ExecuteStoredProcedure("[Grifo].[PRC_PersonasListasDePrecios]",ref Parameters);

            return dsResult;
        }
        /// <summary>
        /// Action
        /// </summary>
        /// <param name="living"></param>
        public override void Execute(GameLiving living)
        {
            if (CheckPreconditions(living, DEAD | SITTING | MEZZED | STUNNED)) return;

            GamePlayer player = living as GamePlayer;
            if (player != null)
            {
                ArrayList targets = new ArrayList();
                if (player.Group == null)
                    targets.Add(player);
                else
                {
                    foreach (GamePlayer grpplayer in player.Group.GetPlayersInTheGroup())
                    {
                        if (player.IsWithinRadius(grpplayer, SpellRadius) && grpplayer.IsAlive)
                            targets.Add(grpplayer);
                    }
                }
                foreach (GamePlayer target in targets)
                {
                    //send spelleffect
                    if (!target.IsAlive) continue;
                    ValhallasBlessingEffect ValhallasBlessing = target.EffectList.GetOfType<ValhallasBlessingEffect>();
                    if (ValhallasBlessing != null)
                        ValhallasBlessing.Cancel(false);
                    new ValhallasBlessingEffect().Start(target);
                }
            }
            DisableSkill(living);
        }
 /// <summary>
 /// Inspects the members of the data Table, focusing on the named field.  It calculates
 /// the median of the values in the named field.
 /// </summary>
 /// <param name="self"></param>
 /// <param name="fieldName"></param>
 /// <returns></returns>
 public static BoxStatistics GetBoxStatistics(this DataTable self, string fieldName)
 {
     DataColumn dc = self.Columns[fieldName];
     ArrayList lst = new ArrayList();
     foreach (DataRow row in self.Rows)
     {
         lst.Add(row[fieldName]);
     }
     lst.Sort();
     BoxStatistics result = new BoxStatistics();
     if (lst.Count % 2 == 0)
     {
         if (dc.DataType == typeof(string))
         {
         }
         // For an even number of items, the mean is the average of the middle two values (after sorting)
         double high = Convert.ToDouble(lst.Count / 2);
         double low = Convert.ToDouble(lst.Count / 2 - 1);
         result.Median = (high + low) / 2;
     }
     else
     {
         result.Median = lst[(int)Math.Floor(lst.Count / (double)2)];
     }
     return result;
 }
Пример #9
0
 public virtual void CollectScintillaNodes(ArrayList list)
 {
     if (_parent == this)
     {
         if (list != null) return;
         list = new ArrayList();
         if (ChildScintilla != null) ChildScintilla.CollectScintillaNodes(list);
     }
     else if (list == null) return;
     ConfigFile cf;
     if (includedFiles != null)
     {
         for (int i = 0 ; i<includedFiles.Length; i++)
         {
             cf = includedFiles[i];
             if (cf == null) continue;
             if (cf.ChildScintilla != null) list.Add(cf.ChildScintilla);
             if( cf.ChildScintilla != null ) cf.ChildScintilla.CollectScintillaNodes(list);
             if( cf.includedFiles != null && cf.includedFiles.Length > 0) cf.CollectScintillaNodes(list);
         }
     }
     if (_parent == this)
     {
         ChildScintilla.includedFiles = new ConfigFile[list.Count];
         list.CopyTo(ChildScintilla.includedFiles);
     }
 }
Пример #10
0
        public void load()
        {
            IEnumerable lines = File.ReadLines(this.filename, Encoding.Default);

            this.words = new ArrayList();

            foreach (string line in lines)
            {
                if (line == null)
                    continue;
                if (line.Trim().Equals(""))
                    continue;

                this.words.Add(line);
            }

            string genRegex = "^";
            for (int i = 0; i < (this.words.Count - 1); i++)
            {
                genRegex += this.words[i] + "|";
            }
            genRegex += this.words[this.words.Count - 1] + "$";

            this.cueWordsRegex = new Regex(genRegex, RegexOptions.Compiled);
        }
Пример #11
0
        public BaseGame(int id, int roomId, Map map, eRoomType roomType, eGameType gameType, int timeType)
            : base(id, roomType, gameType, timeType)
        {
            m_roomId = roomId;
            m_players = new Dictionary<int, Player>();
            m_turnQueue = new List<TurnedLiving>();
            m_livings = new List<Living>();

            m_random = new Random();

            m_map = map;
            m_actions = new ArrayList();
            PhysicalId = 0;
            BossWarField = "";

            m_tempBox = new List<Box>();
            m_tempPoints = new List<Point>();

            if (roomType == eRoomType.Dungeon)
            {
                Cards = new int[21];
            }
            else
            {
                Cards = new int[8];
            }

            m_gameState = eGameState.Inited;
        }
Пример #12
0
        public Data(Mobile m)
        {
            c_Mobile = m;

            c_Friends = new ArrayList();
            c_Ignores = new ArrayList();
            c_Messages = new ArrayList();
            c_GIgnores = new ArrayList();
            c_GListens = new ArrayList();
            c_IrcIgnores = new ArrayList();
            c_Sounds = new Hashtable();
            c_PerPage = 10;
            c_SystemC = 0x161;
            c_GlobalMC = 0x26;
            c_GlobalCC = 0x47E;
            c_GlobalGC = 0x44;
            c_GlobalFC = 0x17;
            c_GlobalWC = 0x3;
            c_StaffC = 0x3B4;
            c_MsgC = 0x480;
            c_AwayMsg = "";
            c_Signature = "";
            c_BannedUntil = DateTime.Now;

            if (m.AccessLevel >= AccessLevel.Administrator)
                c_GlobalAccess = true;

            s_Datas[m] = this;

            foreach (Channel c in Channel.Channels)
                if (c.NewChars)
                    c.Join(m);
        }
Пример #13
0
 public JsonObject GetDiskInfo()
 {
   try
   {
     var diskinfo = new JsonObject();
     var volumes = new ArrayList();
     foreach (var vi in VolumeInfo.GetVolumes())
     {
       var v = new Hashtable();
       v.Add("root", vi.RootDirectory);
       v.Add("size", vi.TotalSize);
       v.Add("free", vi.TotalFreeSpace);
       v.Add("formatted", vi.IsFormatted);
       v.Add("volumeid", vi.VolumeID);
       v.Add("content", GetRootFolderInfo(vi.RootDirectory));
       volumes.Add(v);
     }
     diskinfo.Add("volumes", volumes);
     return diskinfo;
   }
   catch (Exception ex)
   {
     var error = new JsonObject();
     error.Add("error", ex.ToString());
     error.Add("stacktrace", ex.StackTrace);
     return error;
   }
 }
		/// <summary>
		/// Creates a NDataReader from a <see cref="IDataReader" />
		/// </summary>
		/// <param name="reader">The <see cref="IDataReader" /> to get the records from the Database.</param>
		/// <param name="isMidstream"><see langword="true" /> if we are loading the <see cref="IDataReader" /> in the middle of reading it.</param>
		/// <remarks>
		/// NHibernate attempts to not have to read the contents of an <see cref="IDataReader"/> into memory until it absolutely
		/// has to.  What that means is that it might have processed some records from the <see cref="IDataReader"/> and will
		/// pick up the <see cref="IDataReader"/> midstream so that the underlying <see cref="IDataReader"/> can be closed 
		/// so a new one can be opened.
		/// </remarks>
		public NDataReader(IDataReader reader, bool isMidstream)
		{
			ArrayList resultList = new ArrayList(2);

			try
			{
				// if we are in midstream of processing a DataReader then we are already
				// positioned on the first row (index=0)
				if (isMidstream)
				{
					currentRowIndex = 0;
				}

				// there will be atleast one result 
				resultList.Add(new NResult(reader, isMidstream));

				while (reader.NextResult())
				{
					// the second, third, nth result is not processed midstream
					resultList.Add(new NResult(reader, false));
				}

				results = (NResult[]) resultList.ToArray(typeof(NResult));
			}
			catch (Exception e)
			{
				throw new ADOException("There was a problem converting an IDataReader to NDataReader", e);
			}
			finally
			{
				reader.Close();
			}
		}
Пример #15
0
 public override void Map(Channel q, object map_arg) {
   IList retval = new ArrayList();
   IDictionary my_entry = new ListDictionary();
   my_entry["node"] = _node.Address.ToString();
   retval.Add(my_entry);
   q.Enqueue(retval);
 }
Пример #16
0
        public DataTable QuerySwitch(QueryType QT,
                                     ArrayList ParameterList
                                     )
        {
            DBO.VDM_VCMSLevelDBO dbo = new VDM_VCMSLevelDBO(ref USEDB);
            DataTable Dt;

            try
            {
                switch (QT)
                {
                    case QueryType.ALL:
                        Dt = dbo.doQueryAll();
                        break;
                    case QueryType.CODE:
                        Dt = dbo.doQueryByCode(ParameterList);
                        break;
                    case QueryType.ID:
                        Dt = dbo.doQueryByID(ParameterList);
                        break;
                    case QueryType.Custom:
                        Dt = dbo.doQueryByFind(ParameterList);
                        break;
                    default:
                        Dt = new DataTable();
                        break;
                }

                return Dt;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public IResponse Execute(ICruiseRequest request)
        {
            Hashtable velocityContext = new Hashtable();
            ArrayList links = new ArrayList();
            links.Add(new ServerLink(urlBuilder, request.ServerSpecifier, "Server Log", ActionName));

            ProjectStatusListAndExceptions projects = farmService.GetProjectStatusListAndCaptureExceptions(request.ServerSpecifier,
                request.RetrieveSessionToken());
            foreach (ProjectStatusOnServer projectStatusOnServer in projects.StatusAndServerList)
            {
                DefaultProjectSpecifier projectSpecifier = new DefaultProjectSpecifier(projectStatusOnServer.ServerSpecifier, projectStatusOnServer.ProjectStatus.Name);
                links.Add(new ProjectLink(urlBuilder, projectSpecifier, projectSpecifier.ProjectName, ServerLogProjectPlugin.ActionName));
            }
            velocityContext["projectLinks"] = links;
            if (string.IsNullOrEmpty(request.ProjectName))
            {
                velocityContext["log"] = HttpUtility.HtmlEncode(farmService.GetServerLog(request.ServerSpecifier, request.RetrieveSessionToken()));
            }
            else
            {
                velocityContext["currentProject"] = request.ProjectSpecifier.ProjectName;
                velocityContext["log"] = HttpUtility.HtmlEncode(farmService.GetServerLog(request.ProjectSpecifier, request.RetrieveSessionToken()));
            }

            return viewGenerator.GenerateView(@"ServerLog.vm", velocityContext);
        }
Пример #18
0
        /*
          * source code from blog:
          * https://github.com/yinlinglin/LeetCode/blob/master/SudokuSolver.h
          * convert C++ code to C# code
          *
          */
        public static bool solveSudokuRe(char[][]board, int row, int col)
        {
            if (row == 9) return true;

            KeyValuePair<int, int> next = getNextMissing(board, row, col);

            ArrayList possible = new ArrayList();

            getPossibleValues(board, row, col, possible);

            for (int i = 0; i < possible.Count; ++i)
            {
                object o = possible[i];
                int val = Convert.ToInt16(o);

                board[row][col] = (char)val;

                if (solveSudokuRe(board, (int)next.Key, (int)next.Value))
                    return true;

                // back tracking
                board[row][col] = '.';
            }

            return false;
        }
 public void InsertUpdateDepartment(ArrayList department)
 {
     Database db = null;
     DbCommand dbCmd = null;
     try
     {
         db = DatabaseFactory.CreateDatabase(DALHelper.CRM_CONNECTION_STRING);
         dbCmd = db.GetStoredProcCommand("INSERT_UPDATE_FOR_COMMON_DEPARTMENT_MASTER");
         db.AddInParameter(dbCmd, "@DEPARTMENT_ID", DbType.Int32, department[2]);
         db.AddInParameter(dbCmd, "@DEPARTMENT_NAME", DbType.String, department[0]);
         db.AddInParameter(dbCmd, "@DEPARTMENT_DESC", DbType.String, department[1]);
         db.AddInParameter(dbCmd, "@USER", DbType.Int32, Convert.ToInt32(department[3]));
         db.ExecuteNonQuery(dbCmd);
     }
     catch (Exception ex)
     {
         bool rethrow = ExceptionPolicy.HandleException(ex, DALHelper.DAL_EXP_POLICYNAME);
         if (rethrow)
         {
             throw ex;
         }
     }
     finally
     {
         DALHelper.Destroy(ref dbCmd);
     }
 }
Пример #20
0
 internal Page(AreaTree areaTree, int height, int width)
 {
     this.areaTree = areaTree;
     this.height = height;
     this.width = width;
     markers = new ArrayList();
 }
Пример #21
0
 //合并
 public void combine(PropertyTypesManager srcPropertyTypesManager, ArrayList ids)
 {
     for (int i = 0; i < srcPropertyTypesManager.getElementCount(); i++)
     {
         if (ids == null || !ids.Contains(i))
         {
             continue;
         }
         PropertyTypeElement srcPropertyTypeElement = (PropertyTypeElement)srcPropertyTypesManager.getElement(i);
         //寻找相同的属性类型单元
         PropertyTypeElement localPropertyTypeElement = null;
         for (int j = 0; j < getElementCount(); j++)
         {
             PropertyTypeElement tempPropertyTypeElement = (PropertyTypeElement)getElement(j);
             if (tempPropertyTypeElement.name.Equals(srcPropertyTypeElement.name))
             {
                 localPropertyTypeElement = tempPropertyTypeElement;
                 break;
             }
         }
         //找到相同名称的本地单元
         if (localPropertyTypeElement != null)
         {
             localPropertyTypeElement.combine(srcPropertyTypeElement);
         }
         else//并入本容器
         {
             srcPropertyTypeElement.combineTo(this);
         }
     }
 }
Пример #22
0
		internal static DataObject DragToDataObject (IntPtr dragref) {
			UInt32 items = 0;
			ArrayList flavorlist = new ArrayList ();

			CountDragItems (dragref, ref items);
			
			for (uint item_counter = 1; item_counter <= items; item_counter++) {
				IntPtr itemref = IntPtr.Zero;
				UInt32 flavors = 0;
				
				GetDragItemReferenceNumber (dragref, item_counter, ref itemref);
				CountDragItemFlavors (dragref, itemref, ref flavors);
				for (uint flavor_counter = 1; flavor_counter <= flavors; flavor_counter++) {
					FlavorHandler flavor = new FlavorHandler (dragref, itemref, flavor_counter);
					if (flavor.Supported)
						flavorlist.Add (flavor);
				}
			}

			if (flavorlist.Count > 0) {
				return ((FlavorHandler) flavorlist [0]).Convert (flavorlist);
			} 

			return new DataObject ();
		}
Пример #23
0
        public Form3()
        {
            InitializeComponent();
            //counter =  counter.ReadFromFile();
            //string str ;
            //str = counter.ReadTextFile();
            //counter = counter.ConvertToCounter(str);
            buttonClose.Enabled = false;
            buttonProceed.Enabled = false;
            jlist.LoadXmlFile("Joke.xml");
            arrayList = jlist.JokeList();
            jokeText = ReturnJooke(arrayList);
            Text = "Показ шутки " + jokeText.Name;
            richTextBox1.Text = jokeText.Text;

            //foreach (JokeText jt in jokeText.JokeTextArL)
            //{
            //    richTextBox1.Text = jt.Text;
            //    Thread.Sleep(5000);
            //}   
            //for (int i = 0; i < jokeText.JokeTextArL.Count; i++)
            //{
            //    int k = random.Next(jokeText.JokeTextArL.Count);
            //    JokeText jokeText in jokeText.JokeTextArL[k];
              
            //    jokeText.JokeTextArL.RemoveAt(k);
            //}
        }
Пример #24
0
        /**
         * cria o HTML necessario para a montagem de uma questao
         */
        public static void criaUmaProva(ArrayList lista, ArrayList topicos, StringBuilder output, int[] ultimas_questoes)
        {
            output.Append("<div style=\"page-break-before: always\">");
            output.Append("<img src='cabecalho_prova.png'><br>" );
            //               + TITULO + "</h2>");
            // output.Append("<b>Nome : _______________________________________________________</b><br>");
            output.Append(ALERTA + "<br>");

            int counter = 1;

            for(int n=0; n < topicos.Count; n++){

                ArrayList inner = (ArrayList)lista[n];
                int max = inner.Count;

                for(int i=0; i< QUESTOES_QUANTIDADE[n]; i++){

                    output.Append( "<p><b>Questao " + counter + "</b> (peso " + QUESTOES_PONTOS[n] + ")");
                    output.Append( "<pre>" + inner[ ultimas_questoes[n] ] + "</pre>");
                    output.Append( "</p><br>\n");

                    // avanca para a proxima questao
                    ultimas_questoes[n] = (ultimas_questoes[n]+1) % max;
                    counter ++;
                }

            }

            output.Append("</div>\n");
        }
        /// <summary>
        /// The estimate where violation is using source differce.
        /// </summary>
        /// <param name="sonarLine">
        /// The sonar Line.
        /// </param>
        /// <param name="currentDiffReport">
        /// The current Diff Report.
        /// </param>
        /// <returns>
        /// Returns -1 if violation line is removed or modified locally. &gt; 0 otherwise
        /// </returns>
        public static int EstimateWhereSonarLineIsUsingSourceDifference(int sonarLine, ArrayList currentDiffReport)
        {
            var line = sonarLine;

            try
            {
                var differenceSpan = GetChangeForLine(line, currentDiffReport);
                if (differenceSpan == null)
                {
                    return -1;
                }

                int j = 0;
                for (int i = differenceSpan.SourceIndex; i < differenceSpan.SourceIndex + differenceSpan.Length; i++)
                {
                    if (line - 1 == i)
                    {
                        return differenceSpan.DestIndex + j + 1;
                    }
                    ++j;
                }

                line = -1;
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
                line = -1;
            }

            return line;
        }
Пример #26
0
	protected virtual void Delete(ITestableReplicationProviderInside provider)
	{
		ArrayList toDelete = new ArrayList();
		IEnumerator rr = provider.GetStoredObjects(typeof(R0)).GetEnumerator();
		while (rr.MoveNext())
		{
			object o = rr.Current;
			IReflectClass claxx = ReplicationReflector().ForObject(o);
			SetFieldsToNull(o, claxx);
			toDelete.Add(o);
		}
		object commitObject = null;
		for (IEnumerator iterator = toDelete.GetEnumerator(); iterator.MoveNext(); )
		{
			object o = iterator.Current;
			//System.out.println("o = " + o);
			provider.Delete(o);
			commitObject = o;
		}
		if (commitObject != null)
		{
			provider.Commit();
		}
		else
		{
			provider.Commit();
		}
	}
Пример #27
0
        public string getPaperReferenceHTML(ArrayList paper_ids)
        {
            if (_AuthCookie == null)
            {
                //Auth Cookie is null
                return null;
            }

            string rs = "|";

            foreach( string p in paper_ids)
            {
                rs = rs + p + "|";
            }

            Cookie rs_cookie = new Cookie("rs", rs, _AuthCookie.Path, _AuthCookie.Domain);

            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(URL_2);
            request.CookieContainer = new CookieContainer();

            request.CookieContainer.Add(_AuthCookie);
            request.CookieContainer.Add(rs_cookie);

            HttpWebResponse response = request.GetResponse() as HttpWebResponse;

            if (response.StatusCode == HttpStatusCode.OK)
            {
                StreamReader reader = new StreamReader(response.GetResponseStream());

                return reader.ReadToEnd();
            }

            return null;
        }
Пример #28
0
        ///
        public LogRMC(string[] filenames)
        {
            Hashtable methods = new Hashtable();
            methods["StatusInvalid"] = false;
            methods["NullValues"]    = false;
            methods["InvalidCoords"] = false;
            methods["ValidChecksum"] = false;

            LogRMC[] rmcLogs = new LogRMC[filenames.Length];

            for (int i = 0; i < filenames.Length; i++)
            {
                rmcLogs[i] = new LogRMC();
                rmcLogs[i].ReadFile(filenames[i]);
                rmcLogs[i].Clean(methods);
            }

            Array.Sort(rmcLogs);

            this.logBegin = rmcLogs[0].logBegin;
            this.logEnd   = rmcLogs[0].logEnd;
            this.rmcData  = new ArrayList();

            foreach (LogRMC rmc in rmcLogs)
            {
                if (this.logBegin > rmc.logBegin)
                    this.logBegin = rmc.logBegin;

                if (this.logEnd < rmc.logEnd)
                    this.logEnd = rmc.logEnd;

                foreach (Hashtable fields in rmc.rmcData)
                    this.rmcData.Add(this.GetRMCSentence(fields));
            }
        }
Пример #29
0
        /// <summary>
        /// Gets/Sets the specified value
        /// </summary>
        public dynamic this[string key]
        {
            get
              {
            if (!Values.ContainsKey(key))
              return null;

            object result = Values[key];
            if (result is IDictionary<string, object>)
              result = new JsonDataObject(result as IDictionary<string, object>);
            else if (result is ArrayList)
            {
              ArrayList resultList = result as ArrayList;
              ArrayList dataList = new ArrayList();
              foreach (object current in resultList)
              {
            if (current is IDictionary<string, object>)
              dataList.Add(new JsonDataObject(current as IDictionary<string, object>));
            else
              dataList.Add(current);
              }

              result = dataList;
            }

            return result;
              }
              set
              {
            if (Values.ContainsKey(key))
              Values[key] = value;
            else
              Values.Add(key, value);
              }
        }
Пример #30
0
        static void Main(string[] args)
        {
            ArrayList arrayList = new ArrayList();
            arrayList.Add("agnaldo");
            arrayList.Add(1);
            arrayList.Add(10.1205);

            Console.WriteLine(arrayList.Count);

            foreach (var item in arrayList)
                Console.WriteLine(item);

            Console.WriteLine();

            List<int> list = new List<int>();
            list.Add(1);
            list.Add(11);
            list.Add(11);
            list.Add(11);
            list.Add(11);
            list.Add(111);
            //list.Add(11.11);

            Console.WriteLine(list.Count);

            foreach (var item in list)
                Console.WriteLine(item);

            Console.ReadKey();
        }