GetEnumerator() public method

public GetEnumerator ( ) : IDictionaryEnumerator
return IDictionaryEnumerator
Exemplo n.º 1
0
 IDictionaryEnumerator IDictionary.GetEnumerator(){
     var stub = new Hashtable();
     foreach (string o in Session.Keys){
         stub[o] = Session[o];
     }
     return stub.GetEnumerator();
 }
Exemplo n.º 2
0
        public void WriteVariables()
        {
            IDictionaryEnumerator e = strings.GetEnumerator();

            e.Reset();
            while (e.MoveNext())
            {
                Indent();
                stream.WriteLine(((string)e.Key) + " : Unbounded_String;");
            }
            e = variables.GetEnumerator();
            e.Reset();
            while (e.MoveNext())
            {
                Indent();
                stream.WriteLine(((string)e.Key) + " : ??_Variable;");
            }
            e = arrays.GetEnumerator();
            e.Reset();
            while (e.MoveNext())
            {
                Indent();
                stream.WriteLine(((string)e.Key) + " : ??_1D_Array(1..??);");
            }
            e = arrays_2d.GetEnumerator();
            e.Reset();
            while (e.MoveNext())
            {
                Indent();
                stream.WriteLine(((string)e.Key) + " : ??_2D_Array(1..??,1..??);");
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// 根据指定字段列表获取对象
 /// </summary>
 /// <param name="dir"></param>
 /// <returns></returns>
 public static T GetBy(bool isOr, bool isLike, System.Collections.Hashtable ht)
 {
     try
     {
         StringBuilder where;
         if (isOr)
         {
             where = new StringBuilder("1=0");
         }
         else
         {
             where = new StringBuilder("1=1");
         }
         IDictionaryEnumerator ienum = ht.GetEnumerator();
         while (ienum.MoveNext())
         {
             if (isOr)
             {
                 where.AppendFormat(" or {0}='{1}'", ienum.Key, ienum.Value);
             }
             else
             {
                 where.AppendFormat(" and {0}='{1}'", ienum.Key, ienum.Value);
             }
         }
         return(db.find <T>(where.ToString()).first());
     }
     catch { return(default(T)); }
 }
Exemplo n.º 4
0
        public static bool checkResults( string procedure, Hashtable param )
        {
            SqlConnection conn = new SqlConnection(OrionGlobals.getConnectionString("connectionString"));
            SqlCommand cmd = new SqlCommand(procedure, conn);
            cmd.CommandType=CommandType.StoredProcedure;
            cmd.CommandTimeout = 0;

            if( param != null ) {
                IDictionaryEnumerator iter = param.GetEnumerator();
                while( iter.MoveNext() )
                    cmd.Parameters.Add( (string)iter.Key, iter.Value );
            }

            try {

                conn.Open();
                SqlDataReader dr = cmd.ExecuteReader();
                return dr.HasRows;

            } catch( SqlException e ) {
                throw new AlnitakException(String.Format("Excepcao a correr o SP '{0}' @ SqlServerUtility::checkResults - {1}",procedure,e.Message),e);
            } finally {
                conn.Close();
            }
        }
Exemplo n.º 5
0
        public virtual void Serialize(CompactWriter writer)
        {
            writer.WriteObject(_className);
            writer.WriteObject(_perfInst);
            writer.Write(_upTime.Ticks);
            writer.Write(_count);
            writer.Write(_hiCount);
            writer.Write(_maxSize);
            writer.Write(_maxCount);
            writer.Write(_hitCount);
            writer.Write(_missCount);
            writer.WriteObject(_clientsList);
            //muds:
            int count = _localBuckets != null ? _localBuckets.Count : 0;

            writer.Write(count);
            if (_localBuckets != null)
            {
                IDictionaryEnumerator ide = _localBuckets.GetEnumerator();
                while (ide.MoveNext())
                {
                    writer.Write((int)ide.Key);
                    ((BucketStatistics)ide.Value).SerializeLocal(writer);
                }
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Populate dropdownlist
        /// </summary>
        /// <returns></returns>
        public static void FillUpDropDown(DropDownList ddl, Hashtable ht, string defaultselectedvalue)
        {
            string strText, strValue;

            IDictionaryEnumerator ie = ht.GetEnumerator();

            while (ie.MoveNext())
            {
                ddl.Items.Add(new ListItem(ie.Value.ToString(), ie.Key.ToString()));
            }

            if (!string.IsNullOrEmpty(defaultselectedvalue))
                ddl.Items.Insert(0, new ListItem(defaultselectedvalue, "0"));

            //Loop through the items, asign text and value, and sort by text ascending.
            for (int i = ddl.Items.Count - 1; i > 0; i--)
                for (int j = 1; j < i; j++)
                {
                    if (ddl.Items[j].Text.CompareTo(ddl.Items[j + 1].Text) > 0)
                    {
                        strText = ddl.Items[j].Text;
                        strValue = ddl.Items[j].Value;
                        ddl.Items[j].Text = ddl.Items[j + 1].Text;
                        ddl.Items[j].Value = ddl.Items[j + 1].Value;
                        ddl.Items[j + 1].Text = strText;
                        ddl.Items[j + 1].Value = strValue;
                    }
                }
        }
Exemplo n.º 7
0
        //公用类中判断用户是否在线的函数(供用户调用)
        /// <summary> 
        /// 判断用户strUserID是否包含在Hashtable h中 
        /// </summary> 
        /// <param name="strUserID"></param> 
        /// <param name="h"></param> 
        /// <returns></returns> 
        public static bool AmIOnline(string strUserID, Hashtable h)
        {
            if (strUserID == null)
            {
                return false;
            }

            //继续判断是否该用户已经登陆
            if (h == null)
            {
                return false;
            }

            //判断哈希表中是否有该用户
            IDictionaryEnumerator e1 = h.GetEnumerator();
            bool flag = false;
            while (e1.MoveNext())
            {
                if (e1.Value.ToString().CompareTo(strUserID) == 0)
                {
                    flag = true;
                    break;
                }
            }
            return flag;
        }
        public static void Run()
        {
            // ExStart:CustomPropertiesUsingMeta
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_TechnicalArticles();

            // Create instance of PdfFileInfo object
            Aspose.Pdf.Facades.PdfFileInfo fInfo = new Aspose.Pdf.Facades.PdfFileInfo(dataDir + "inFile1.pdf");

            // Retrieve all existing custom attributes
            System.Collections.Hashtable hTable =  new Hashtable(fInfo.Header);

            IDictionaryEnumerator enumerator = hTable.GetEnumerator();
            while (enumerator.MoveNext())
            {
            string output = enumerator.Key.ToString() + " " + enumerator.Value;
            }

            // Set new customer attribute as meta info
            fInfo.SetMetaInfo("CustomAttribute", "test value");

            // Get custom attribute from meta info by specifying attribute/property name
            string value = fInfo.GetMetaInfo("CustomAttribute");
            // ExEnd:CustomPropertiesUsingMeta                      
        }
Exemplo n.º 9
0
 public int DoUpdate(string Tbl, Hashtable HS, string strcondition)
 {
     IDictionaryEnumerator myEnumerator = HS.GetEnumerator();
     System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand();
     cmd.Connection = objCon;
     string qry = null;
     int Rcnt = 0;
     string strLst = "";
     while (myEnumerator.MoveNext())
     {
         strLst += myEnumerator.Key + "=@" + myEnumerator.Key + ",";
         //cmd.Parameters.Add("@" & myEnumerator.Key, CStr(myEnumerator.Value))
         cmd.Parameters.AddWithValue("@" + myEnumerator.Key, Convert.ToString(myEnumerator.Value));
     }
     char quto = ',';
     strLst = strLst.Trim().TrimEnd(quto);
     //strLst = strLst.Trim().TrimEnd(",");
     qry = "Update " + Tbl + " set  " + strLst + " where " + strcondition;
     cmd.CommandText = qry;
     if (objCon.State == ConnectionState.Closed)
         objCon.Open();
     Rcnt = cmd.ExecuteNonQuery();
     if (objCon.State == ConnectionState.Open)
         objCon.Close();
     return Rcnt;
 }
Exemplo n.º 10
0
        public IDictionaryEnumerator GetEnumerator(string typeName)
        {
            if (_cache == null)
                return null;

            //if (typeName == null)
            if (typeName == "*")
                return GetEnumerator();
            else
            {
                IDictionaryEnumerator en = _cache.GetEnumerator() as IDictionaryEnumerator;
                Hashtable tbl = new Hashtable();

                while (en.MoveNext())
                {
                    object obj = ((CacheEntry)en.Value).DeflattedValue(_cache.Context.CacheImpl.Name);

                    if (obj.GetType().FullName == typeName)
                    {
                        tbl[en.Key] = en.Value;
                    }
                }

                return tbl.GetEnumerator();
            }
        }
Exemplo n.º 11
0
 /// <summary>
 /// 合并数组
 /// </summary>
 /// <param name="ids">数组</param>
 /// <returns>数组</returns>
 public static string[] Concat(params string[][] ids)
 {
     // 进行合并
     Hashtable hashValues = new Hashtable();
     if (ids != null)
     {
         for (int i = 0; i < ids.Length; i++)
         {
             if (ids[i] != null)
             {
                 for (int j = 0; j < ids[i].Length; j++)
                 {
                     if (ids[i][j] != null)
                     {
                         if (!hashValues.ContainsKey(ids[i][j]))
                         {
                             hashValues.Add(ids[i][j], ids[i][j]);
                         }
                     }
                 }
             }
         }
     }
     // 返回合并结果
     string[] returnValues = new string[hashValues.Count];
     IDictionaryEnumerator enumerator = hashValues.GetEnumerator();
     int key = 0;
     while (enumerator.MoveNext())
     {
         returnValues[key] = (string)(enumerator.Key.ToString());
         key++;
     }
     return returnValues;
 }
 internal static void DumpHash(string tag, Hashtable hashTable)
 {
     IDictionaryEnumerator enumerator = hashTable.GetEnumerator();
     while (enumerator.MoveNext())
     {
     }
 }
Exemplo n.º 13
0
		public static void Parse(
			XmlDocument		xmlMetadata_in, 
			string			xsltTemplateURL_in, 
			Hashtable		xsltParameters_in, 

			StringWriter	parsedOutput_in
		) {
			#region XsltArgumentList _xsltparameters = new XsltArgumentList().AddParam(...);
			XsltArgumentList _xsltparameters = new XsltArgumentList();
			IDictionaryEnumerator _denum = xsltParameters_in.GetEnumerator();
			_denum.Reset();
			while (_denum.MoveNext()) {
				_xsltparameters.AddParam(
					_denum.Key.ToString(), 
					"", 
					System.Web.HttpUtility.UrlEncode(
						_denum.Value.ToString()
					)
				);
			}
			#endregion

			XPathNavigator _xpathnav = xmlMetadata_in.CreateNavigator();
			XslTransform _xslttransform = new XslTransform();
			_xslttransform.Load(
				xsltTemplateURL_in
			);
			_xslttransform.Transform(
				_xpathnav, 
				_xsltparameters, 
				parsedOutput_in, 
				null
			);
		}
Exemplo n.º 14
0
        public void WriteVariables()
        {
            IDictionaryEnumerator e = strings.GetEnumerator();

            e.Reset();
            while (e.MoveNext())
            {
                Indent();
                stream.WriteLine("string " + ((string)e.Key) + ";");
            }
            e = variables.GetEnumerator();
            e.Reset();
            while (e.MoveNext())
            {
                Indent();
                stream.WriteLine("?? " + ((string)e.Key) + ";");
            }
            e = arrays.GetEnumerator();
            e.Reset();
            while (e.MoveNext())
            {
                Indent();
                stream.WriteLine("??[] " + ((string)e.Key) + " = new ??[??+1];");
            }
            e = arrays_2d.GetEnumerator();
            e.Reset();
            while (e.MoveNext())
            {
                Indent();
                stream.WriteLine("??[,] " + ((string)e.Key) + " = new ??[??+1,??+1];");
            }
        }
Exemplo n.º 15
0
        /// <summary>
        /// 判断某用户是否已经登陆
        /// </summary>
        /// <param name="id">为用户ID或用户名这个必须是用户的唯一标识</param>
        /// <returns>true为没有登陆 flase为被迫下线</returns>
        public bool IsLogin(object id)
        {
            bool   flag = true;
            string uid  = id.ToString();

            System.Collections.Hashtable ht = (System.Collections.Hashtable)HttpContext.Current.Application[appKey];
            if (ht != null)
            {
                System.Collections.IDictionaryEnumerator IDE = ht.GetEnumerator();
                while (IDE.MoveNext())
                {
                    //找到自己的登陆ID
                    if (IDE.Key.ToString().Equals(HttpContext.Current.Session.SessionID))
                    {
                        //判断用户是否被注销
                        if (IDE.Value.ToString().Equals(logout))
                        {
                            ht.Remove(HttpContext.Current.Session.SessionID);
                            HttpContext.Current.Application.Lock();
                            HttpContext.Current.Application[appKey] = ht;
                            HttpContext.Current.Application.UnLock();
                            HttpContext.Current.Session.RemoveAll();
                            //HttpContext.Current.Response.Write("<script type='text/javascript'>alert('你的帐号已在别处登陆,你被强迫下线!')</script>");
                            flag = false;
                        }
                        break;
                    }
                }
            }
            return(flag);
        }
Exemplo n.º 16
0
 // We write variables below, but these should be local variables for each method.
 public void WriteVariables()
 {
     IDictionaryEnumerator e = strings.GetEnumerator();
     e.Reset();
     while (e.MoveNext())
     {
         Indent();
         String var = (String)e.Key;
         stream.WriteLine("String " + var + " = null;");
     }
     e = variables.GetEnumerator();
     e.Reset();
     while (e.MoveNext())
     {
         Indent();
         String var = (String)e.Key;
         stream.WriteLine("?? " + var + " = ??;");
     }
     e = arrays.GetEnumerator();
     e.Reset();
     while (e.MoveNext())
     {
         Indent();
         String var = (String)e.Key;
         stream.WriteLine("??[] " + var + " = new ??[??];");
     }
     e = arrays_2d.GetEnumerator();
     e.Reset();
     while (e.MoveNext())
     {
         Indent();
         String var = (String)e.Key;
         stream.WriteLine("??[][] " + var + " = new ??[??][??];");
     }
 }
Exemplo n.º 17
0
        private string GenerateMacroTag(string macroContent)
        {
            string macroAttr = macroContent.Substring(5, macroContent.IndexOf(">") - 5);
            string macroTag  = "<?UMBRACO_MACRO ";

            System.Collections.Hashtable             attributes = ReturnAttributes(macroAttr);
            System.Collections.IDictionaryEnumerator ide        = attributes.GetEnumerator();
            while (ide.MoveNext())
            {
                if (ide.Key.ToString().IndexOf("umb_") != -1)
                {
                    // Hack to compensate for Firefox adding all attributes as lowercase
                    string orgKey = ide.Key.ToString();
                    if (orgKey == "umb_macroalias")
                    {
                        orgKey = "umb_macroAlias";
                    }

                    macroTag += orgKey.Substring(4, orgKey.Length - 4) + "=\"" +
                                ide.Value.ToString().Replace("\\r\\n", Environment.NewLine) + "\" ";
                }
            }
            macroTag += "/>";
            return(macroTag);
        }
Exemplo n.º 18
0
 internal static void ApplyPropertyValues(MobileControl mobileControl, Hashtable overrides)
 {
     if ((mobileControl != null) && (overrides != null))
     {
         IDictionaryEnumerator enumerator = overrides.GetEnumerator();
         while (enumerator.MoveNext())
         {
             int num;
             string str2;
             object obj2 = mobileControl;
             string key = (string) enumerator.Key;
             object obj3 = enumerator.Value;
             if (!(key.ToLower() == "id"))
             {
                 goto Label_006A;
             }
             continue;
         Label_0039:
             str2 = key.Substring(0, num);
             obj2 = obj2.GetType().GetProperty(str2, BindingFlags.Public | BindingFlags.Instance | BindingFlags.IgnoreCase).GetValue(obj2, null);
             key = key.Substring(num + 1);
         Label_006A:
             if ((num = key.IndexOf("-")) != -1)
             {
                 goto Label_0039;
             }
             FindAndApplyPropertyValue(obj2, key, obj3);
         }
     }
 }
Exemplo n.º 19
0
        public int DoInsert(string Tbl, Hashtable HS)
        {
            IDictionaryEnumerator myEnumerator = HS.GetEnumerator();
            System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand();
            cmd.Connection = objCon;
            string qry = null;
            int Rcnt = 0;
            string colLst = "";
            string valLst = "";
            while (myEnumerator.MoveNext())
            {
                colLst += myEnumerator.Key + ",";
                valLst += "@" + myEnumerator.Key + ",";
                cmd.Parameters.AddWithValue("@" + myEnumerator.Key, Convert.ToString(myEnumerator.Value));

            }
            char qut = ',';

            colLst = colLst.Trim().TrimEnd(qut);
            valLst = valLst.Trim().TrimEnd(qut);
             qry = "insert into " + Tbl + " ( " + colLst + " ) values ( " + valLst + " ) ";
            cmd.CommandText = qry;
            if (objCon.State == ConnectionState.Closed)
                objCon.Open();
            Rcnt = cmd.ExecuteNonQuery();
            if (objCon.State == ConnectionState.Open)
                objCon.Close();
            return Rcnt;
        }
Exemplo n.º 20
0
		private void UT_Connectionstring_ParseParameter_auxiliar(Hashtable hash_in) {
			string _constring;
			IDictionaryEnumerator _enumerator;

			for (int i = 0; ; i++) {
				if (((eDBServerTypes_supportedForGeneration)i).ToString() == "invalid") {
					break;
				} else if (((eDBServerTypes_supportedForGeneration)i).ToString() == i.ToString()) {
					continue;
				} else {
					_constring = utils.Connectionstring.Buildwith.Parameters(
						(string)hash_in[utils.Connectionstring.eParameter.Server],
						(string)hash_in[utils.Connectionstring.eParameter.User], 
						"somepassword",
						(string)hash_in[utils.Connectionstring.eParameter.Database], 
						(eDBServerTypes)i
					);

					_enumerator = hash_in.GetEnumerator();
					while (_enumerator.MoveNext()) {
						Assert.AreEqual(
//						Console.WriteLine(
//"'{0}'\n'{1}'\n{2}\n",
							(string)_enumerator.Value, 
							utils.Connectionstring.ParseParameter(
								_constring,
								(eDBServerTypes)i,
								(utils.Connectionstring.eParameter)_enumerator.Key
							)
//, _constring
						);
					}
				}
			}
		}
Exemplo n.º 21
0
 private void PrintIndexAndKeysAndValues( Hashtable myList )
 {
     IDictionaryEnumerator myEnumerator = myList.GetEnumerator();
     int i = 0;
     RosterLib.Utility.Announce( "\t-INDEX-\t-KEY-\t-VALUE-" );
     while ( myEnumerator.MoveNext() )
         RosterLib.Utility.Announce( string.Format( "\t[{0}]:\t{1}\t{2}", i++, myEnumerator.Key, myEnumerator.Value ) );
 }
Exemplo n.º 22
0
        /// <summary>
        /// Main method, which developer-user will call to get a list of
        ///  all of the files loaded into a sent in hashtable list
        /// </summary>
        /// <param name="p_TargetDir">The top-level directory you want to search</param>
        /// <param name="p_FilePattern">The file pattern you want to search, ex. *.*, frs*.old, msen.old</param>
        /// <param name="p_htDirs">Hashtable ref which will hold all of the directories searched</param>
        /// <param name="p_htFiles">Hashtable ref which will be a list of all the files found, which match
        /// the filepattern entered</param>
        /// <param name="p_SearchSubdirs">bool whether or not you want to search the subdirs</param>
        public static void CreateFileList(string p_TargetDir, string p_FilePattern,
            ref Hashtable p_htDirs, ref Hashtable p_htFiles, bool p_SearchSubdirs)
        {
            //CREATE A LIST OF FILES Which will be searched
            //basically get all of the files which match the file pattern
            //from the path the user entered p_TargetDir
            // if the user enters an empty string for the targetdir,
            // the application will get the currentdirectory (app.path) and continue
            string strCurrDir = string.Empty;
            if (p_TargetDir.Length != 0)
            {
                strCurrDir = p_TargetDir;
            }
            else
            {
                strCurrDir = Directory.GetCurrentDirectory();
            }

            try
            {
                // you could get an error when the user enters a bad path
                string[] files = Directory.GetFiles(strCurrDir, p_FilePattern);
                string[] Dirs = Directory.GetDirectories(strCurrDir);
                int DirCount;
                int FileCount;
                // add all subdirectories
                for (DirCount = 0; DirCount < Dirs.Length; DirCount++)
                {
                    p_htDirs.Add(Dirs[DirCount], Dirs[DirCount]);
                }
                // add all files
                for (FileCount = 0; FileCount < files.Length; FileCount++)
                {
                    p_htFiles.Add(files[FileCount], files[FileCount]);
                }

                if (p_SearchSubdirs)
                {
                    // iterate through all of the directories in the current directory
                  System.Collections.IDictionaryEnumerator DirectoryEnum;
                    while (p_htDirs.Count > 0)
                    {
                        DirectoryEnum = p_htDirs.GetEnumerator();
                        DirectoryEnum.MoveNext();
                        // Get all the subdirs of this directory and add them to the directory hashtable
                        IterateDirectories(
                            DirectoryEnum.Key.ToString(), 
                            p_FilePattern,
                            ref p_htDirs, 
                            ref p_htFiles);
                    }
                }
            }
            catch(Exception OpenDirEx)
            {
            }
        }
Exemplo n.º 23
0
 //Key��Value�����ւ����}�b�v��Ԃ��BValue�����Ԃ��Ă��Ȃ��O��
 public static Hashtable ReverseHashtable(Hashtable src)
 {
     Hashtable r = new Hashtable();
     IDictionaryEnumerator ie = src.GetEnumerator();
     while(ie.MoveNext()) {
         r.Add(ie.Value, ie.Key);
     }
     return r;
 }
 internal void CategorizePropEntries()
 {
     if (this.Children.Count > 0)
     {
         GridEntry[] dest = new GridEntry[this.Children.Count];
         this.Children.CopyTo(dest, 0);
         if ((base.PropertySort & PropertySort.Categorized) != PropertySort.NoSort)
         {
             Hashtable hashtable = new Hashtable();
             for (int i = 0; i < dest.Length; i++)
             {
                 GridEntry entry = dest[i];
                 if (entry != null)
                 {
                     string propertyCategory = entry.PropertyCategory;
                     ArrayList list = (ArrayList) hashtable[propertyCategory];
                     if (list == null)
                     {
                         list = new ArrayList();
                         hashtable[propertyCategory] = list;
                     }
                     list.Add(entry);
                 }
             }
             ArrayList list2 = new ArrayList();
             IDictionaryEnumerator enumerator = hashtable.GetEnumerator();
             while (enumerator.MoveNext())
             {
                 ArrayList list3 = (ArrayList) enumerator.Value;
                 if (list3 != null)
                 {
                     string key = (string) enumerator.Key;
                     if (list3.Count > 0)
                     {
                         GridEntry[] array = new GridEntry[list3.Count];
                         list3.CopyTo(array, 0);
                         try
                         {
                             list2.Add(new CategoryGridEntry(base.ownerGrid, this, key, array));
                             continue;
                         }
                         catch
                         {
                             continue;
                         }
                     }
                 }
             }
             dest = new GridEntry[list2.Count];
             list2.CopyTo(dest, 0);
             StringSorter.Sort(dest);
             base.ChildCollection.Clear();
             base.ChildCollection.AddRange(dest);
         }
     }
 }
Exemplo n.º 25
0
        public static bool Test(int N)
        {
            Hashtable hash1 = new Hashtable();
            Hashtable hash2 = new Hashtable();

            for (int i = 0; i <= 9999; i++)
            {
                hash1.Add("foo_" + i.ToString(), i);
            }

            for (int i = 0; i < N; i++)
            {
                IDictionaryEnumerator it = hash1.GetEnumerator();
                while (it.MoveNext())
                {
                    if (hash2.ContainsKey(it.Key))
                    {
                        int v1 = (int)hash1[it.Key];
                        int v2 = (int)hash2[it.Key];
                        hash2[it.Key] = v1 + v2;
                    }
                    else
                    {
                        hash2.Add(it.Key, hash1[it.Key]);
                    }
                }

                // Make sure that the result is as expected
                if (hash1["foo_0"].ToString() != "0")
                {
                    return (false);
                }
                if (hash1["foo_3705"].ToString() != "3705")
                {
                    return (false);
                }
                if (hash1["foo_9999"].ToString() != "9999")
                {
                    return (false);
                }
                if (hash2["foo_0"].ToString() != "0")
                {
                    return (false);
                }
                if (hash2["foo_3705"].ToString() != (3705 * (i + 1)).ToString())
                {
                    return (false);
                }
                if (hash2["foo_9999"].ToString() != (9999 * (i + 1)).ToString())
                {
                    return (false);
                }
            }

            return (true);
        }
Exemplo n.º 26
0
        private void Terminate()
        {
            AppDomain currentDomain = AppDomain.CurrentDomain;

            currentDomain.AssemblyLoad    -= new AssemblyLoadEventHandler(OnAssemblyLoad);
            currentDomain.AssemblyResolve -= new ResolveEventHandler(OnAssemblyResolve);
            currentDomain.ProcessExit     -= new EventHandler(OnDomainUnload);

            IDictionaryEnumerator i = mExtensionApps.GetEnumerator();

            while (i.MoveNext())
            {
                var app = i.Value as IExtensionApplication;
                if (null != app)
                {
                    app.ShutDown();
                }
            }
            mExtensionApps.Clear();
            mAssemblies.Clear();
        }
Exemplo n.º 27
0
 public static void UpdateSettings(int portalId, Hashtable settings)
 {
     string key;
     string setting;
     IDictionaryEnumerator settingsEnumerator = settings.GetEnumerator();
     while (settingsEnumerator.MoveNext())
     {
         key = Convert.ToString(settingsEnumerator.Key);
         setting = Convert.ToString(settingsEnumerator.Value);
         UpdateSetting(portalId, key, setting);
     }
 }
Exemplo n.º 28
0
 static public int GetEnumerator(IntPtr l)
 {
     try {
         System.Collections.Hashtable self = (System.Collections.Hashtable)checkSelf(l);
         var ret = self.GetEnumerator();
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemplo n.º 29
0
        // . Check for optimal number of barriers needed for a program
        // by trying to put at every possible configurations starting
        // from the configuration with 1, 2, 3, ... barriers.
        // . We could not do this checking directly on the flow graph
        // because it is not possible to check whether a configuration
        // is disabled by a particular barrier (suppose there is a branch
        // and the barrier comes before it, the transition is a reordering
        // between an instruction after the branch and the one before the
        // branch. The barriers may even change the branch condition
        // . So for every configuration we need to run the reachablity
        // analysis again.
        public static void CheckOptimality(State st0)
        {
            int i;

            stateSet.AddState(st0);
            FindGoodState(st0);

            Console.Write("Good end values:");
            for(i = 0; i < goodReportedValues.Count; i++)
                Console.Write(" {0}", goodReportedValues[i]);
            Console.WriteLine();

            stateSet = new StateSet();
            stateSet.AddState(st0);
            badState = -1;
            possibleLocations = new Hashtable();
            FindBadState(st0);

            int nLocations = 0;
            IDictionaryEnumerator iter = possibleLocations.GetEnumerator();
            while(iter.MoveNext())
                if(((CILInstruction)iter.Value).ParentMethod.Name.Equals(".ctor") == false)
                    nLocations++;

            marker = new int[nLocations];
            for(i = 0; i < marker.Length; i++)
                marker[i] = 0;

            ins = new CILInstruction[marker.Length];
            iter = possibleLocations.GetEnumerator();
            i = 0;
            while(iter.MoveNext())
                if(((CILInstruction)iter.Value).ParentMethod.Name.Equals(".ctor") == false)
                    ins[i++] = (CILInstruction)iter.Value;

            found = false;
            int nBarriers = 1;
            initialState = st0;
            while(found == false)
            {
                Console.WriteLine("progress: nBarriers = {0}", nBarriers);
                last = -1;
                GenerateCases(nBarriers);
                nBarriers++;
            }

            for(i = 0; i < marker.Length; i++)
                if(marker[i] == 1)
                    Console.WriteLine(ins[i].ParentMethod.Name + ":" + ins[i]);
        }
Exemplo n.º 30
0
        internal void UnloadHandler(Object sender, EventArgs e)
        {
            IDictionaryEnumerator enumerator = m_tokenTable.GetEnumerator();

            while (enumerator.MoveNext())
            {
                Type key = (Type)enumerator.Key;

                if (AppDomain.CurrentDomain.IsTypeUnloading(key))
                {
                    m_tokenTable.Remove(key);
                }
            }
        }
 static int GetEnumerator(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         System.Collections.Hashtable             obj = (System.Collections.Hashtable)ToLua.CheckObject(L, 1, typeof(System.Collections.Hashtable));
         System.Collections.IDictionaryEnumerator o   = obj.GetEnumerator();
         ToLua.Push(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Exemplo n.º 32
0
 static object GetHashtableValue(System.Collections.Hashtable hash, string Key)
 {
     if (hash.ContainsKey(Key))
     {
         return(hash[Key]);
     }
     System.Collections.IDictionaryEnumerator enumer = hash.GetEnumerator();
     while (enumer.MoveNext())
     {
         if (enumer.Key.ToString().ToLower() == Key.ToLower())
         {
             return(enumer.Value);
         }
     }
     return(null);
 }
Exemplo n.º 33
0
 public IDictionaryEnumerator GetEnumerator()
 {
     Hashtable hashtable = new Hashtable();
     SqlConnection sqlConnection = new SqlConnection(this.dsn);
     SqlCommand sqlCommand = sqlConnection.CreateCommand();
     if (this.language == "")
     {
         this.language = CultureInfo.InvariantCulture.Name;
     }
     if (this.sp == null)
     {
         sqlCommand.CommandText = string.Format("SELECT MessageKey, MessageValue FROM Message WHERE Culture = '{0}'", this.language);
     }
     else
     {
         sqlCommand.CommandText = this.sp;
         sqlCommand.CommandType = CommandType.StoredProcedure;
         sqlCommand.Parameters.AddWithValue("@culture", this.language);
     }
     try
     {
         sqlConnection.Open();
         using (SqlDataReader sqlDataReader = sqlCommand.ExecuteReader())
         {
             while (sqlDataReader.Read())
             {
                 if (sqlDataReader.GetValue(1) != DBNull.Value)
                 {
                     hashtable[sqlDataReader.GetString(0)] = sqlDataReader.GetString(1);
                 }
             }
         }
     }
     catch
     {
         bool flag = false;
         if (bool.TryParse(ConfigurationManager.AppSettings["Gettext.Throw"], out flag) && flag)
         {
             throw;
         }
     }
     finally
     {
         sqlConnection.Close();
     }
     return hashtable.GetEnumerator();
 }
 internal override IDictionaryEnumerator CreateEnumerator()
 {
     Hashtable hashtable = new Hashtable(this._publicCount);
     DateTime utcNow = DateTime.UtcNow;
     lock (this._lock)
     {
         foreach (DictionaryEntry entry in this._entries)
         {
             CacheEntry entry2 = (CacheEntry) entry.Value;
             if ((entry2.IsPublic && (entry2.State == CacheEntry.EntryState.AddedToCache)) && (!base._cacheCommon._enableExpiration || (utcNow <= entry2.UtcExpires)))
             {
                 hashtable[entry2.Key] = entry2.Value;
             }
         }
     }
     return hashtable.GetEnumerator();
 }
Exemplo n.º 35
0
        public ServerMapping(Hashtable mappings)
        {
            IEnumerator itor = mappings.GetEnumerator();
            while (itor.MoveNext())
            {
                DictionaryEntry entry = (DictionaryEntry)itor.Current;
                Hashtable values = (Hashtable)entry.Value;

                Mapping _mapping = new Mapping();
                _mapping.PrivateIP = values["private-ip"] as string;
                _mapping.PrivatePort = Convert.ToInt32(values["private-port"]);
                _mapping.PublicIP = values["public-ip"] as string;
                _mapping.PublicPort = Convert.ToInt32(values["public-port"]);
                actualMappingList.Add(_mapping);
            }

        }
Exemplo n.º 36
0
        public override bool SendMessagesToUsers(Hashtable lst, string sMes, string sTitle)
        {
            if (lst == null || lst.Count == 0)
                return false;
            for (IDictionaryEnumerator e = lst.GetEnumerator(); e.MoveNext(); )
            {
                try
                {

                    SendMessageToUser(e, sMes, sTitle);
                }
                catch (System.Exception e1)
                {
                    Console.WriteLine("SendMessagesToUsers: " + e1.ToString());
                }
            }
            return true;
        }
Exemplo n.º 37
0
 private void InitListViewByCache(ListView listview,Hashtable caches)
 {
     listview.DoubleClick += new EventHandler(listview_DoubleClick);
     /*��ʼ��ʹ�õIJ��*/
     System.Collections.IDictionaryEnumerator enumerator = caches.GetEnumerator();
     //ListViewItem tmp = null;
     PluginAttribute att = null;
     while (enumerator.MoveNext())
     {
         att = enumerator.Value as PluginAttribute;
         if (att != null)
         {
             ListViewItem tmp = new ListViewItem(new string[] { att.Name,enumerator.Key.ToString() });
             tmp.Tag = att;
             listview.Items.Add(tmp);
         }
     }
 }
Exemplo n.º 38
0
        public static void SaveLogfile(string logfilepath, Hashtable logData)
        {
            try
            {
                var writer = new StreamWriter(logfilepath, false);
                IDictionaryEnumerator element = logData.GetEnumerator();
                writer.Write("<?xml version=\"1.0\"?>");
                writer.Write("<ApplDetails>");

                while (element.MoveNext())
                {
                    writer.Write("<Apps_Log>");
                    writer.Write("<ProcessName>");
                    string processname = "<![CDATA[" +
                                         element.Key.ToString().Trim().Substring(0,
                                                                                 element.Key.ToString().Trim().
                                                                                     LastIndexOf("######")).Trim() +
                                         "]]>";
                    processname = processname.Replace("\0", "");
                    writer.Write(processname);
                    writer.Write("</ProcessName>");

                    writer.Write("<ApplicationName>");
                    string applname = "<![CDATA[" +
                                      element.Key.ToString().Trim().Substring(
                                          element.Key.ToString().Trim().LastIndexOf("######") + 6).Trim() + "]]>";
                    writer.Write(applname);
                    writer.Write("</ApplicationName>");
                    writer.Write("<LogData>");
                    string ldata = ("<![CDATA[" + element.Value.ToString().Trim() + "]]>").Replace("\0", "");
                    writer.Write(ldata);

                    writer.Write("</LogData>");
                    writer.Write("</Apps_Log>");
                }
                writer.Write("</ApplDetails>");
                writer.Flush();
                writer.Close();
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message, ex.StackTrace);
            }
        }
Exemplo n.º 39
0
        public static IUmbracoSearchFileFilter GetFilter(string extension)
        {
            if (!_isInitialized)
            {
                init();
            }

            IDictionaryEnumerator ide = _filters.GetEnumerator();

            while (ide.MoveNext())
            {
                if (ide.Key.ToString().IndexOf(extension) > -1)
                {
                    return(Activator.CreateInstance(ide.Value.GetType()) as IUmbracoSearchFileFilter);
                }
            }

            return(null);
        }
Exemplo n.º 40
0
        /// <summary>
        /// Loads and returns the values of an entity given a range of parameters. The 
        /// parameters is given as a Hashtable where the key must be the column 
        /// and the value must be the value the column must have.
        /// </summary>
        /// <example>
        /// // The following will load the values for a Person entity with id 8
        /// Hashtable values = PersonDataAccessObject.Load(new Hashtable { { "id", 8 } });
        /// </example>
        /// <param name="parameters">Conditions to be taking into consideration.</param>
        /// <returns>A Hashtable containing the values to build the entity.</returns>
        public Hashtable Load(Hashtable parameters)
        {
            Contract.Requires(parameters != null);
            Contract.Requires(parameters.Count > 0);

            this.QueryBuilder.SetType("select");
            this.QueryBuilder.SetTable(Table);
            this.QueryBuilder.SetColumns(Columns);
            this.QueryBuilder.SetLimit(1);

            var enumerator = parameters.GetEnumerator();
            while (enumerator.MoveNext()) {
                this.QueryBuilder.AddCondition("`"+enumerator.Key+"` = '"+enumerator.Value+"'");
            }

            var results = this.QueryBuilder.ExecuteQuery();

            return results.Count > 0 ? (Hashtable) results[0] : new Hashtable();
        }
Exemplo n.º 41
0
Arquivo: Data.cs Projeto: XBoom/GodWay
        /// 删除记录
        /// <param name="cmdType">sql语句类型</param>
        /// <param name="str_Sql">sql语句</param>
        /// <param name="ht">表示层传递过来的哈希表对象</param>
        public static void Del(string TableName, string ht_Where, Hashtable ht)
        {
            string cmd_set = "";
            IDictionaryEnumerator ide = ht.GetEnumerator();
            while (ide.MoveNext())
            {
            if (ht_Where.ToLower().IndexOf(ide.Key.ToString())> -1)
            {
                cmd_set += ",[" + ide.Key.ToString() + "]=@" + ide.Key.ToString() + "";

            }
            }
            string cmd_where = cmd_set.Replace(",", " and ");
            string cmd_sql = "delete " + TableName + " where" + cmd_where;
            cmd_sql = cmd_sql.Replace("where and", "where ");
            //sys.errMessage = cmd_sql;

            Data.ExecuteNonQuery(CommandType.Text, cmd_sql, ht);
        }
Exemplo n.º 42
0
		public static string ConcatenateURLParams(Hashtable parameters_in, bool addQuestionmarkSeparator_in) {
			string ConcatenateURLParams_out = "";
			string _separator = (addQuestionmarkSeparator_in) ? "?" : "";

			IDictionaryEnumerator _denum = parameters_in.GetEnumerator();
			_denum.Reset();
			while (_denum.MoveNext()) {
				ConcatenateURLParams_out += string.Format(
					"{0}{1}={2}", 
					/*00*/(ConcatenateURLParams_out == "") ? _separator : "&", 
					/*01*/_denum.Key.ToString(), 
					/*02*/System.Web.HttpUtility.UrlEncode(
						_denum.Value.ToString()
					)
				);
			}

			return ConcatenateURLParams_out;
		}
Exemplo n.º 43
0
        public static DataTable ConvertHastTableToDataTable(System.Collections.Hashtable hashtable)
        {
            var dt1  = new DataTable(hashtable.GetType( ).Name);
            int inti = 1;

            dt1.Columns.Add("رديف");
            dt1.Columns.Add("شماره رنگ");
            dt1.Columns.Add("تعداد تکرار");
            dt1.Columns.Add("رنگ");

            IDictionaryEnumerator enumerator = hashtable.GetEnumerator( );

            while (enumerator.MoveNext( ))
            {
                dt1.Rows.Add(inti, enumerator.Key, enumerator.Value, "");
                ++inti;
            }
            return(dt1);
        }
Exemplo n.º 44
0
        public static int ExecuteNonQuery(CommandType cmdType,string cmdText,Hashtable ht,string conn_type)
        {
            string DataType=ConfigurationManager.ConnectionStrings[conn_type].ConnectionStrings;
            int val=0;
            if(conn_type.IndexOf("MSSQL")>-1)//查找索引位置,没有找到返回-1
            {
                SqlCommand cmd=new SqlCommand();
                SqlConnection conn=GetSqlConnection(conn_type);

                try{
                    conn.Open();
                    cmd.Connection=conn;
                    cmd.CommandText=cmdText;
                    if(ht!=null)
                    {
                        IDictionaryEnumerator ide=ht.GetEnumerator();
                        SqlParameter[] cmdParms=new SqlParameter[ht.Count];
                        int i=0;
                        while(ide.MoveNext())
                        {
                            SqlParameter sp=Data.MakeParm("@"+ide.key.ToString(),ide.Value.ToString());
                            cmdParms[i]=sp;
                            cmd.Parameters.Add(sp);
                            i++;
                        }
                    }
                    val=cmd.ExecuteNonQuery();
                    cmd.Parameters.Clear();
                    conn.Close();
                }
                catch
                {
                    conn.Close();
                    throwl;
                }
            }
            else if (conn_type.IndexOf("ACCESS") > -1)
            {

            }

            return val;
        }
Exemplo n.º 45
0
/** Connect to a running office that is accepting connections.
 *      @return  The ServiceManager to instantiate office components. */
    static private XMultiServiceFactory connect(string[] args)
    {
        if (args.Length == 0)
        {
            Console.WriteLine("You need to provide a file URL to the office" +
                              " program folder\n");
        }
        System.Collections.Hashtable ht = new System.Collections.Hashtable();
        ht.Add("SYSBINDIR", args[0]);
        XComponentContext xContext =
            uno.util.Bootstrap.defaultBootstrap_InitialComponentContext(
                args[0] + "/uno.ini", ht.GetEnumerator());

        if (xContext != null)
        {
            Console.WriteLine("Successfully created XComponentContext\n");
        }
        else
        {
            Console.WriteLine("Could not create XComponentContext\n");
        }

        return(null);
    }
Exemplo n.º 46
0
 public IDictionaryEnumerator GetEnumerator()
 {
     return(hashtable.GetEnumerator());
 }
Exemplo n.º 47
0
        public static void testHessian()
        {
            CHessianProxyFactory factory = new CHessianProxyFactory();

            //String url = "http://localhost:9090/resin-doc/protocols/tutorial/hessian-add/hessian/hessianDotNetTest";
            String url = "http://localhost:9090/resin-doc/protocols/csharphessian/hessian/hessianDotNetTest";

            //String url = "http://localhost/MathService/test.hessian";
            //String url = "http://localhost/MathService/MyHandler.hessian";

            url = "http://localhost:8080/hessiantest/hessian/hessianDotNetTest";
            try
            {
                /*
                 *
                 #region TEST_INPUTSTREAM
                 *              WebRequest webRequest =  WebRequest.Create(new Uri(url));
                 *              webRequest.ContentType = "text/xml";
                 *              webRequest.Method = "POST";
                 *              MemoryStream memoryStream = new MemoryStream();
                 *              CHessianOutput cHessianOutput = new CHessianOutput(memoryStream);
                 *
                 *              cHessianOutput.StartCall("download");
                 *              cHessianOutput.WriteString("C:/resin-3.0.8/webapps/resin-doc/protocols/csharphessian/WEB-INF/classes/HessianTest.java");
                 *              cHessianOutput.CompleteCall();
                 *              Stream sInStream = null;
                 *              Stream sOutStream = null;
                 *
                 *              try
                 *              {
                 *                      webRequest.ContentLength = memoryStream.ToArray().Length;
                 *                      sOutStream = webRequest.GetRequestStream();
                 *                      memoryStream.WriteTo(sOutStream);
                 *
                 *                      sOutStream.Flush();
                 *                      HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse();
                 *                      sInStream = webResponse.GetResponseStream();
                 *                      CHessianInput hessianInput = new CHessianInput(sInStream);
                 *                      hessianInput.StartReply();
                 *                      Stream is2 = hessianInput.ReadInputStream();
                 *                      FileStream fo = new FileStream("hallo_test.txt",FileMode.Create);
                 *                      int b;
                 *                      while((b = is2.ReadByte())!= -1)
                 *                      {
                 *                              fo.WriteByte((byte)b);
                 *                      }
                 *
                 *                      hessianInput.CompleteReply();
                 *                      fo.Close();
                 *                      is2.Close();
                 *                      Console.WriteLine("Datei erfolgreich übertragen: hallo.txt");
                 *
                 *              }
                 *              catch (Exception e)
                 *              {
                 *                      Console.WriteLine("Fehler "+ e.StackTrace);
                 *              }
                 *              finally
                 *              {
                 *                      if (sInStream != null)
                 *                      {
                 *                              sInStream.Close();
                 *                      }
                 *                      if (sOutStream != null)
                 *                      {
                 *                              sOutStream.Close();
                 *                      }
                 *              }
                 #endregion
                 */


                IHessianTest test = (IHessianTest)factory.Create(typeof(IHessianTest), url);

                /*
                 * char shouldChar = new char();
                 * shouldChar = 'R';
                 * Console.WriteLine("ShouldChar"+shouldChar);
                 *
                 * String recievedString = test.testCharToString(shouldChar);
                 *
                 * Console.WriteLine("ReceivedChar: " + recievedString);
                 *
                 */

                //Console.WriteLine("ReceivedChar2: " + test.testChar('P'));
                //Tut nicht



                DateTime dt         = DateTime.Today;
                string   dtASString = test.testDateToString(dt);
                Console.WriteLine(dtASString);
                DateTime dt2 = test.testStringToDate("10.12.2004");
                Console.WriteLine(dt2.ToString());


                Console.WriteLine(test.testConcatString("Hallo ", "Welt"));
                Console.WriteLine(test.testDoubleToString(1.2));
                Console.WriteLine(test.testStringToDouble("4.5"));
                Console.WriteLine(test.testStringToLong("-45675467"));
                Console.WriteLine(test.testStringToShort("5467"));
                Console.WriteLine(test.testFloatToString((float)1.4));
                Console.WriteLine(test.testStringToFloat("1.89"));
                Console.WriteLine(test.testBoolToString(true));
                Console.WriteLine(test.testStringToBoolean("false"));
                Console.WriteLine(test.testStringToByte("7"));
                Console.WriteLine(test.testByteToString(5));



                //Integer Array Test:
                int[]    intArr    = { 23, 467 };
                string[] stringArr = test.testIntArrToString(intArr);
                for (int i = 0; i < stringArr.Length; i++)
                {
                    Console.WriteLine(stringArr[i]);
                }

                string[] stringArr2 = { "788", "343" };
                int[]    intArr2    = test.testStringArrToInt(stringArr2);
                for (int i = 0; i < intArr2.Length; i++)
                {
                    Console.WriteLine(intArr2[i]);
                }

                //Double Arrray Test:
                double[] doubleArr = { 23.467, 78.3 };
                stringArr = test.testDoubleArrToString(doubleArr);
                for (int i = 0; i < stringArr.Length; i++)
                {
                    Console.WriteLine(stringArr[i]);
                }

                string[] stringArrDouble = { "788.56", "343.678" };
                double[] doubleArr2      = test.testStringArrToDouble(stringArrDouble);
                for (int i = 0; i < doubleArr2.Length; i++)
                {
                    Console.WriteLine(doubleArr2[i]);
                }

                //Float Arrray Test:
                float[] floatArr = { (float)22.47, (float)3.3 };
                stringArr = test.testFloatArrToString(floatArr);
                for (int i = 0; i < stringArr.Length; i++)
                {
                    Console.WriteLine(stringArr[i]);
                }

                string[] stringArrFloat = { "88.56", "4.678" };
                float[]  floatArr2      = test.testStringArrToFloat(stringArrFloat);
                for (int i = 0; i < floatArr2.Length; i++)
                {
                    Console.WriteLine(floatArr2[i]);
                }

                //Short Arrray Test:
                short[] shortArr = { 56, 3 };
                stringArr = test.testShortArrToString(shortArr);
                for (int i = 0; i < stringArr.Length; i++)
                {
                    Console.WriteLine(stringArr[i]);
                }

                string[] stringArrShort = { "7", "38" };
                short[]  shortArr2      = test.testStringArrToShort(stringArrShort);
                for (int i = 0; i < shortArr2.Length; i++)
                {
                    Console.WriteLine(shortArr2[i]);
                }

                //Char Arrray Test:
                char[] charArr = { 'c', 'd' };
                stringArr = test.testCharArrToString(charArr);
                for (int i = 0; i < stringArr.Length; i++)
                {
                    Console.WriteLine(stringArr[i]);
                }

                string[] stringArrChar = { "l", "w" };
                char[]   charArr2      = test.testStringArrToChar(stringArrChar);
                for (int i = 0; i < charArr2.Length; i++)
                {
                    Console.WriteLine(charArr2[i]);
                }

                //Long Arrray Test:
                long[] longArr = { 56323, 3232323 };
                stringArr = test.testLongArrToString(longArr);
                for (int i = 0; i < stringArr.Length; i++)
                {
                    Console.WriteLine(stringArr[i]);
                }

                string[] stringArrLong = { "111117", "2222238" };
                long[]   longArr2      = test.testStringArrToLong(stringArrLong);
                for (int i = 0; i < longArr2.Length; i++)
                {
                    Console.WriteLine(longArr2[i]);
                }

                //Byte Arrray Test:
                byte[] byteArr = { 5, 3 };
                stringArr = test.testByteArrToString(byteArr);
                for (int i = 0; i < stringArr.Length; i++)
                {
                    Console.WriteLine(stringArr[i]);
                }

                string[] stringArrByte = { "7", "3" };
                byte[]   byteArr2      = test.testStringArrToByte(stringArrByte);
                for (int i = 0; i < byteArr2.Length; i++)
                {
                    Console.WriteLine(byteArr2[i]);
                }

                //Bool Arrray Test:
                bool[] boolArr = { true, false };
                stringArr = test.testBoolArrToString(boolArr);
                for (int i = 0; i < stringArr.Length; i++)
                {
                    Console.WriteLine(stringArr[i]);
                }

                string[] stringArrBool = { "true", "false" };
                bool[]   boolArr2      = test.testStringArrToBool(stringArrBool);
                for (int i = 0; i < boolArr2.Length; i++)
                {
                    Console.WriteLine(boolArr2[i]);
                }

                Console.WriteLine("Test the hashtable return value");
                System.Collections.Hashtable             testHash = test.testHashMap(new string[] { "Hallo" }, new string [] { "Welt" });
                System.Collections.IDictionaryEnumerator enumer   = testHash.GetEnumerator();
                while (enumer.MoveNext())
                {
                    Console.WriteLine(enumer.Key.ToString() + " " + enumer.Value.ToString());
                }
                Console.WriteLine("Test the hashtable param");
                Console.WriteLine(test.testHashMapParam(testHash));



                ArrayList arrList = test.testArrayList(new string[] { "Hallo", " Dimi" });
                Console.WriteLine(test.testArrayListParam(arrList));


                Console.WriteLine("Test Object");

                ParamObject testPObject = new ParamObject();
                testPObject.setStringVar("Test Test");


                Console.WriteLine(test.testSendParamObject(testPObject));
                Console.WriteLine(test.testReceiveParamObject("REUTLINGEN").getStringVar());



                ParamObject testPObject2 = test.testParamObject(testPObject);

                Console.WriteLine(testPObject2.getStringVar());

                Hashtable h = testPObject2.getHashVar();

                Console.WriteLine(testPObject2.getHashVar()["Message"].ToString());



                Console.ReadLine();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                Console.WriteLine(e.StackTrace);
                Console.ReadLine();
            }
        }
Exemplo n.º 48
0
        /// <summary>
        /// 运行存储过程
        /// </summary>
        /// <param name="sp_cmd">存储过程名称</param>
        /// <param name="ds">DataSet对象</param>
        /// <param name="sp_Input_Params">哈希表,对应存储过程传入参数</param>
        /// <param name="sp_Output_Params">哈希表,对应存储过程传出参数,传址</param>
        public Dictionary <OperateCMD, object> RunProc_CMD(string sp_cmd, System.Data.DataSet ds,
                                                           System.Collections.Hashtable sp_Input_Params, ref System.Collections.Hashtable sp_Output_Params)
        {
            if (m_Conn != null)
            {
                try
                {
                    m_Conn.Close();

                    m_Conn.Open();

                    using (SqlDataAdapter da = new SqlDataAdapter(sp_cmd, m_Conn))
                    {
                        da.SelectCommand = new SqlCommand();

                        da.SelectCommand.CommandType = CommandType.StoredProcedure;

                        da.SelectCommand.CommandText = sp_cmd;

                        da.SelectCommand.Connection = m_Conn;

                        if (sp_Input_Params != null)
                        {
                            IDictionaryEnumerator InputEnume = sp_Input_Params.GetEnumerator();

                            while (InputEnume.MoveNext())
                            {
                                SqlParameter param = new SqlParameter();

                                param.Direction = ParameterDirection.Input;

                                param.ParameterName = InputEnume.Key.ToString();

                                param.Value = InputEnume.Value;

                                da.SelectCommand.Parameters.Add(param);
                            }
                        }


                        if (sp_Output_Params != null)
                        {
                            IDictionaryEnumerator OutputEnume = sp_Output_Params.GetEnumerator();

                            while (OutputEnume.MoveNext())
                            {
                                SqlParameter param = new SqlParameter();

                                param.Direction = ParameterDirection.Output;

                                param.ParameterName = OutputEnume.Key.ToString();

                                param.Value = OutputEnume.Value;

                                da.SelectCommand.Parameters.Add(param);
                            }
                        }

                        int rowcount = da.Fill(ds);

                        if (sp_Output_Params != null)
                        {
                            Hashtable P_OutValue = new Hashtable();

                            IDictionaryEnumerator OutValueEnum = sp_Output_Params.GetEnumerator();

                            OutValueEnum.Reset();

                            while (OutValueEnum.MoveNext())
                            {
                                P_OutValue.Add(OutValueEnum.Key.ToString(),
                                               da.SelectCommand.Parameters[OutValueEnum.Key.ToString()].Value.ToString());
                            }

                            sp_Output_Params = P_OutValue;
                        }

                        if (rowcount == 0)
                        {
                            SetResultValue(null, false, "没有找到任何数据", null);

                            return(m_Result);
                        }
                        else
                        {
                            SetResultValue(ds, true, null, rowcount);

                            return(m_Result);
                        }
                    }
                }
                catch (Exception err)
                {
                    SetResultValue(null, false, err, null);

                    return(m_Result);
                }
            }
            else
            {
                SetResultValue(null, false, "空的数据连接", null);

                return(m_Result);
            }
        }
Exemplo n.º 49
0
 public System.Collections.IEnumerator GetEnumerator()
 {
     //'UPGRADE_TODO: Uncomment and change the following line to return the collection enumerator. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="95F9AAD0-1319-4921-95F0-B9D3C4FF7F1C"'
     return(mRow.GetEnumerator());
 }
Exemplo n.º 50
0
 public System.Collections.IDictionaryEnumerator Enumerator()
 {         // get enumerator of parameters' hash table
     return(parameterList.GetEnumerator());
 }
Exemplo n.º 51
0
 /// <summary>
 /// Returns a dictionary enumerator that will enable enumerating objects in the member collection.
 /// </summary>
 /// <returns>An IEnumerator object instance.</returns>
 public IEnumerator GetEnumerator()
 {
     return(_innerhash.GetEnumerator());
 }
Exemplo n.º 52
0
        private static void testWithConsole(IHessianTest test)
        {
            try
            {
                /*
                 * char shouldChar = new char();
                 * shouldChar = 'R';
                 * Console.WriteLine("ShouldChar"+shouldChar);
                 *
                 * String recievedString = test.testCharToString(shouldChar);
                 *
                 * Console.WriteLine("ReceivedChar: " + recievedString);
                 * char t = test.testChar('P');
                 * Console.WriteLine("ReceivedChar2: " + t);
                 *
                 */

                DateTime dt         = DateTime.Today;
                string   dtASString = test.testDateToString(dt);
                Console.WriteLine(dtASString);
                DateTime dt2 = test.testStringToDate("10.12.2004");
                Console.WriteLine(dt2.ToString());

                string s1 = test.testConcatString("Hallo ", "Welt");
                Console.WriteLine(s1);
                string s2 = test.testDoubleToString(1.2);
                Console.WriteLine(s2);
                double d1 = test.testStringToDouble("4.5");
                Console.WriteLine(d1);
                long l1 = test.testStringToLong("-45675467");
                Console.WriteLine(l1);
                short sh1 = test.testStringToShort("5467");
                Console.WriteLine(sh1);
                string s3 = test.testFloatToString((float)1.4);
                Console.WriteLine(s3);
                float f1 = test.testStringToFloat("1.89");
                Console.WriteLine(f1);
                string s4 = test.testBoolToString(true);
                Console.WriteLine(s4);
                bool b1 = test.testStringToBoolean("false");
                Console.WriteLine(b1);
                byte by1 = test.testStringToByte("7");
                Console.WriteLine(by1);
                string s5 = test.testByteToString(5);
                Console.WriteLine(s5);



                //Integer Array Test:
                int[]    intArr    = { 23, 467 };
                string[] stringArr = test.testIntArrToString(intArr);

                for (int i = 0; i < stringArr.Length; i++)
                {
                    Console.WriteLine(stringArr[i]);
                }

                string[] stringArr2 = { "788", "343" };
                int[]    intArr2    = test.testStringArrToInt(stringArr2);
                for (int i = 0; i < intArr2.Length; i++)
                {
                    Console.WriteLine(intArr2[i]);
                }

                //Double Arrray Test:
                double[] doubleArr = { 23.467, 78.3 };
                stringArr = test.testDoubleArrToString(doubleArr);
                for (int i = 0; i < stringArr.Length; i++)
                {
                    Console.WriteLine(stringArr[i]);
                }

                string[] stringArrDouble = { "788.56", "343.678" };
                double[] doubleArr2      = test.testStringArrToDouble(stringArrDouble);
                for (int i = 0; i < doubleArr2.Length; i++)
                {
                    Console.WriteLine(doubleArr2[i]);
                }

                //Float Arrray Test:
                float[] floatArr = { (float)22.47, (float)3.3 };
                stringArr = test.testFloatArrToString(floatArr);
                for (int i = 0; i < stringArr.Length; i++)
                {
                    Console.WriteLine(stringArr[i]);
                }

                string[] stringArrFloat = { "88.56", "4.678" };
                float[]  floatArr2      = test.testStringArrToFloat(stringArrFloat);
                for (int i = 0; i < floatArr2.Length; i++)
                {
                    Console.WriteLine(floatArr2[i]);
                }

                //Short Arrray Test:
                short[] shortArr = { 56, 3 };
                stringArr = test.testShortArrToString(shortArr);
                for (int i = 0; i < stringArr.Length; i++)
                {
                    Console.WriteLine(stringArr[i]);
                }

                string[] stringArrShort = { "7", "38" };
                short[]  shortArr2      = test.testStringArrToShort(stringArrShort);
                for (int i = 0; i < shortArr2.Length; i++)
                {
                    Console.WriteLine(shortArr2[i]);
                }

                //Char Arrray Test:
                char[] charArr = { 'c', 'd' };
                stringArr = test.testCharArrToString(charArr);
                for (int i = 0; i < stringArr.Length; i++)
                {
                    Console.WriteLine(stringArr[i]);
                }

                string[] stringArrChar = { "l", "w" };
                char[]   charArr2      = test.testStringArrToChar(stringArrChar);
                for (int i = 0; i < charArr2.Length; i++)
                {
                    Console.WriteLine(charArr2[i]);
                }

                //Long Arrray Test:
                long[] longArr = { 56323, 3232323 };
                stringArr = test.testLongArrToString(longArr);
                for (int i = 0; i < stringArr.Length; i++)
                {
                    Console.WriteLine(stringArr[i]);
                }

                string[] stringArrLong = { "111117", "2222238" };
                long[]   longArr2      = test.testStringArrToLong(stringArrLong);
                for (int i = 0; i < longArr2.Length; i++)
                {
                    Console.WriteLine(longArr2[i]);
                }

                //Byte Arrray Test:
                byte[] byteArr = { 5, 3 };
                stringArr = test.testByteArrToString(byteArr);
                for (int i = 0; i < stringArr.Length; i++)
                {
                    Console.WriteLine(stringArr[i]);
                }

                string[] stringArrByte = { "7", "3" };
                byte[]   byteArr2      = test.testStringArrToByte(stringArrByte);
                for (int i = 0; i < byteArr2.Length; i++)
                {
                    Console.WriteLine(byteArr2[i]);
                }

                //Bool Arrray Test:
                bool[] boolArr = { true, false };
                stringArr = test.testBoolArrToString(boolArr);
                for (int i = 0; i < stringArr.Length; i++)
                {
                    Console.WriteLine(stringArr[i]);
                }

                string[] stringArrBool = { "true", "false" };
                bool[]   boolArr2      = test.testStringArrToBool(stringArrBool);
                for (int i = 0; i < boolArr2.Length; i++)
                {
                    Console.WriteLine(boolArr2[i]);
                }

                Console.WriteLine("Test the hashtable return value");
                System.Collections.Hashtable             testHash = test.testHashMap(new string[] { "Hallo" }, new string [] { "Welt" });
                System.Collections.IDictionaryEnumerator enumer   = testHash.GetEnumerator();
                while (enumer.MoveNext())
                {
                    Console.WriteLine(enumer.Key.ToString() + " " + enumer.Value.ToString());
                }
                Console.WriteLine("Test the hashtable param");
                Console.WriteLine(test.testHashMapParam(testHash));


                ArrayList arrList = test.testArrayList(new string[] { "Hallo", " Dimi" });
                Console.WriteLine(test.testArrayListParam(arrList));


                Console.WriteLine("Test Object");

                ParamObject testPObject = new ParamObject();
                testPObject.setStringVar("Test Test");

                Console.WriteLine(test.testSendParamObject(testPObject));
                Console.WriteLine(test.testReceiveParamObject("REUTLINGEN").getStringVar());



                ParamObject testPObject2 = test.testParamObject(testPObject);

                Console.WriteLine(testPObject2.getStringVar());

                Hashtable h = testPObject2.getHashVar();

                Console.WriteLine(testPObject2.getHashVar()["Message"].ToString());
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                Console.WriteLine(e.StackTrace);
                Console.ReadLine();
            }
        }
Exemplo n.º 53
0
 public IDictionaryEnumerator GetEnumerator()
 {
     return(new WHE(container.GetEnumerator()));
 }