当前位置: 首页>>代码示例>>C#>>正文


C# Hashtable.Clone方法代码示例

本文整理汇总了C#中System.Collections.Hashtable.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# Hashtable.Clone方法的具体用法?C# Hashtable.Clone怎么用?C# Hashtable.Clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Collections.Hashtable的用法示例。


在下文中一共展示了Hashtable.Clone方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SelectHighestFrecuency

		private Color[] SelectHighestFrecuency(Hashtable histogram)
		{
			Color[]   salida = new Color[NumColors];
			Hashtable HCopy  = (Hashtable)histogram.Clone();

			Color pixel;
			int i=0;
			while (i<NumColors)
			{
				if (HCopy.Count == 0) {break;}

				pixel = HighestFrecuency(HCopy);

				salida[i] = pixel;
				HCopy.Remove(pixel);

				i++;
			}

			while (i<NumColors)
			{
				salida[i] = Color.Empty;
				i++;
			}

			return salida;
		}
开发者ID:fernandolucasrodriguez,项目名称:colorquantizer,代码行数:27,代码来源:PopularityAlgorithm.cs

示例2: TestCloneShallowCopyReferenceTypes

        public void TestCloneShallowCopyReferenceTypes()
        {
            //[]Clone is a shallow copy, so the objects of the objets reference should be the same
            string strValue;

            var hsh1 = new Hashtable();
            for (int i = 0; i < 10; i++)
            {
                hsh1.Add(i, new Foo());
            }

            var hsh2 = (Hashtable)hsh1.Clone();
            for (int i = 0; i < 10; i++)
            {
                strValue = "Hello World";
                Assert.True(strValue.Equals(((Foo)hsh2[i]).strValue), "Error, Expected value not returned, " + strValue);
            }

            strValue = "Good Bye";
            ((Foo)hsh1[0]).strValue = strValue;
            Assert.True(strValue.Equals(((Foo)hsh1[0]).strValue), "Error, Expected value not returned, " + strValue);

            //da test
            Assert.True(strValue.Equals(((Foo)hsh2[0]).strValue), "Error, Expected value not returned, " + strValue);

            //if we change the object, of course, the previous should not happen
            hsh2[0] = new Foo();

            strValue = "Good Bye";
            Assert.True(strValue.Equals(((Foo)hsh1[0]).strValue), "Error, Expected value not returned, " + strValue);

            strValue = "Hello World";
            Assert.True(strValue.Equals(((Foo)hsh2[0]).strValue), "Error, Expected value not returned, " + strValue);
        }
开发者ID:johnhhm,项目名称:corefx,代码行数:34,代码来源:CloneTests.cs

示例3: LinerComplex

		public static int LinerComplex(string str)
		{
			Hashtable T = new Hashtable () ;
			Hashtable B = new Hashtable () ;
			Hashtable C = new Hashtable () ;
			C .Add (0,1) ;
			B .Add (0,1) ;
			int m = -1 , N = 0 , L = 0 ; //上述步骤完成初始化
			while (N < str.Length )
			{ //计算离差
				int d = str [N ] == '0' ? 0 : 1 ;
				int i = 1 ;
				#region
				while (i <= L ) 
				{					
					if (C .ContainsKey (i ))
					{
						if (str [N-i ] == '1') 
							d += 1 ;  //则ci = 1 
					}
				    i++ ;
				}
				d = d % 2;
				if ( d ==1 ) 
				{
					T = (Hashtable )C.Clone() ;
					foreach (DictionaryEntry k in B )
					{
						if ((int )k .Value == 1)
						{
							int temp = (int )k .Key + N - m ;
							if (C .ContainsKey (temp ))
							{
								C .Remove (temp ) ;
							}
							else
							{
								C .Add (temp ,1 ) ;
							}
						}
					}
					if (L <= (int )Math .Floor (N *0.5) )
					{
						L = N +1 -L ;
						m = N ;
						B =(Hashtable ) T.Clone() ;
					}				
				}
				#endregion
//			    Console.Write("L = {0}  ;", L);
//                foreach (DictionaryEntry j in C )
//                {
//                    Console.Write( j.Key  +" ;");
//                }
//			    Console.WriteLine();
				N ++ ;
			}
			return L ;
		}
开发者ID:windygu,项目名称:asxinyunet,代码行数:59,代码来源:B_Malgorithm.cs

示例4: DBConnectionString

        private DBConnectionString(DbConnectionOptions connectionOptions, string restrictions, KeyRestrictionBehavior behavior, Hashtable synonyms, bool mustCloneDictionary)
        {
            Debug.Assert(null != connectionOptions, "null connectionOptions");
            switch (behavior)
            {
                case KeyRestrictionBehavior.PreventUsage:
                case KeyRestrictionBehavior.AllowOnly:
                    _behavior = behavior;
                    break;
                default:
                    throw ADP.InvalidKeyRestrictionBehavior(behavior);
            }

            // grab all the parsed details from DbConnectionOptions
            _encryptedUsersConnectionString = connectionOptions.UsersConnectionString(false);
            _hasPassword = connectionOptions._hasPasswordKeyword;
            _parsetable = connectionOptions.Parsetable;
            _keychain = connectionOptions._keyChain;

            // we do not want to serialize out user password unless directed so by "persist security info=true"
            // otherwise all instances of user's password will be replaced with "*"
            if (_hasPassword && !connectionOptions.HasPersistablePassword)
            {
                if (mustCloneDictionary)
                {
                    // clone the hashtable to replace user's password/pwd value with "*"
                    // we only need to clone if coming from DbConnectionOptions and password exists
                    _parsetable = (Hashtable)_parsetable.Clone();
                }

                // different than Everett in that instead of removing password/pwd from
                // the hashtable, we replace the value with '*'.  This is okay since we
                // serialize out with '*' so already knows what we do.  Better this way
                // than to treat password specially later on which causes problems.
                const string star = "*";
                if (_parsetable.ContainsKey(KEY.Password))
                {
                    _parsetable[KEY.Password] = star;
                }
                if (_parsetable.ContainsKey(KEY.Pwd))
                {
                    _parsetable[KEY.Pwd] = star;
                }

                // replace user's password/pwd value with "*" in the linked list and build a new string
                _keychain = connectionOptions.ReplacePasswordPwd(out _encryptedUsersConnectionString, true);
            }

            if (!string.IsNullOrEmpty(restrictions))
            {
                _restrictionValues = ParseRestrictions(restrictions, synonyms);
                _restrictions = restrictions;
            }
        }
开发者ID:dotnet,项目名称:corefx,代码行数:54,代码来源:DBConnectionString.cs

示例5: GridFilterCollection

        /// <summary>
        /// Creates a new instance.
        /// </summary>
        /// <param name="columnStyles">List of <see cref="DataGridColumnStyle"/> which are associated with <see cref="IGridFilter"/>s.</param>
        /// <param name="columnStylesToGridFiltersHash">Mapping between <see cref="DataGridColumnStyle"/> and <see cref="IGridFilter"/>s.</param>
        internal GridFilterCollection(IList columnStyles, Hashtable columnStylesToGridFiltersHash)
        {
            _columnStylesToGridFiltersHash = (Hashtable)columnStylesToGridFiltersHash.Clone();

            foreach (DataGridColumnStyle columnStyle in columnStyles)
            {
                IGridFilter gridFilter = (IGridFilter)_columnStylesToGridFiltersHash[columnStyle];
                if (gridFilter != null)
                    base.InnerList.Add(gridFilter);
            }
        }
开发者ID:hayrettinbebek,项目名称:e-cafe,代码行数:16,代码来源:GridFilterCollection.cs

示例6: TestCloneBasic

        public void TestCloneBasic()
        {
            Hashtable hsh1;
            Hashtable hsh2;

            string strKey;
            string strValue;

            //[] empty Hashtable clone
            hsh1 = new Hashtable();
            hsh2 = (Hashtable)hsh1.Clone();

            Assert.Equal(0, hsh2.Count);
            Assert.False(hsh2.IsReadOnly, "Error, Expected value not returned, <<" + hsh1.IsReadOnly + ">> <<" + hsh2.IsReadOnly + ">>");
            Assert.False(hsh2.IsSynchronized, "Error, Expected value not returned, <<" + hsh1.IsSynchronized + ">> <<" + hsh2.IsSynchronized + ">>");

            //[] Clone should exactly replicate a collection to another object reference
            //afterwards these 2 should not hold the same object references
            hsh1 = new Hashtable();
            for (int i = 0; i < 10; i++)
            {
                strKey = "Key_" + i;
                strValue = "string_" + i;
                hsh1.Add(strKey, strValue);
            }

            hsh2 = (Hashtable)hsh1.Clone();
            for (int i = 0; i < 10; i++)
            {
                strValue = "string_" + i;

                Assert.True(strValue.Equals((string)hsh2["Key_" + i]), "Error, Expected value not returned, " + strValue);
            }

            //now we remove an object from the original list
            hsh1.Remove("Key_9");
            Assert.Equal(hsh1["Key_9"], null);

            strValue = "string_" + 9;
            Assert.True(strValue.Equals((string)hsh2["Key_9"]), "Error, Expected value not returned, <<" + hsh1[9] + ">>");

            //[]now we try other test cases
            //are all the 'other' properties of the Hashtable the same?
            hsh1 = new Hashtable(1000);
            hsh2 = (Hashtable)hsh1.Clone();

            Assert.Equal(hsh1.Count, hsh2.Count);
            Assert.Equal(hsh1.IsReadOnly, hsh2.IsReadOnly);
            Assert.Equal(hsh1.IsSynchronized, hsh2.IsSynchronized);
        }
开发者ID:johnhhm,项目名称:corefx,代码行数:50,代码来源:CloneTests.cs

示例7: LinkReferencesRecursive

        private void LinkReferencesRecursive(ModifierProtocol item, Hashtable ancestors)
        {
            Hashtable ht = (ancestors == null) ? new Hashtable() : (Hashtable) ancestors.Clone();

            if (ht.ContainsKey(item.Name))
            {
                throw new InvalidOperationException(String.Format(@"Circular reference to item '{0}'.", item.Name));
            }

            ht.Add(item.Name, item);

            foreach (RelationProtocol relation in item.Relations)
            {
                LinkRelation(item, relation, ht);
            }

            foreach (RelationProtocol relation in item.UniqueRelations)
            {
                LinkRelation(item, relation, ht);
            }
        }
开发者ID:DovetailSoftware,项目名称:dovetail-sdk-web-services,代码行数:21,代码来源:ClarifyGenericSrvIUD.cs

示例8: BeginProcessRequest

        public IAsyncResult BeginProcessRequest ( HttpContext context, AsyncCallback cb, object extraData ) {

            m_stopwatch.Start();

            FileInfo fileInfo = new FileInfo(context.Request.MapPath(context.Request.CurrentExecutionFilePath));
            this.LogDebug("File Date: {0}; File Length: {1}", fileInfo.LastWriteTimeUtc, fileInfo.Length);
            m_CONTENT_IS_MEMCACHED = false;
            m_USE_MEMCACHED = false;
            m_httpContext = context;
            m_returnOutput = true;
            m_httpMethod = m_httpContext.Request.HttpMethod;
            m_memcachedClient = (Client)context.Application["memcached"];
            m_encoding = (UTF8Encoding)context.Application["encoding"];
            m_queueClient = (QueueClient)context.Application["queueclient"];
            m_hashkey = (string)context.Application["hashkey"];
            m_xmlServiceOperationManager = (XPathServiceOperationManager)context.Application["xmlServiceOperationManager"];
            m_xslTransformationManager = (XsltTransformationManager)context.Application["xslTransformationManager"];
            m_transform = m_xslTransformationManager.Transform;
            m_xsltParams = (Hashtable)context.Application["globalXsltParams"];
            m_transformContext = new Transform.Context(context, m_hashAlgorithm, (string)context.Application["hashkey"], fileInfo, (Hashtable)m_xsltParams.Clone(), fileInfo.LastWriteTimeUtc, fileInfo.Length);
            m_namedXsltHashtable = (Hashtable)context.Application["namedXsltHashtable"];
            m_xmlSourceETagDictionary = m_xmlServiceOperationManager.XmlSourceETagDictionary;
            m_xmlReaderDictionary = m_xmlServiceOperationManager.XmlReaderDictionary;
            m_context = new Context(context, m_hashAlgorithm, m_hashkey, fileInfo, fileInfo.LastWriteTimeUtc, fileInfo.Length);
            this.LogDebug("File Date: {0}; File Length: {1}", m_context.RequestXmlFileInfo.LastWriteTimeUtc, m_context.RequestXmlFileInfo.Length);
            m_nuxleusAsyncResult = new Nuxleus.Core.NuxleusAsyncResult(cb, extraData);
            m_callback = cb;
            m_nuxleusAsyncResult.m_context = context;
            m_builder = new StringBuilder();
            m_CONTENT_IS_MEMCACHED = false;
            m_USE_MEMCACHED = (bool)context.Application["usememcached"];
            Uri requestUri = new Uri(m_context.RequestUri);
            m_requestHashcode = m_context.GetRequestHashcode(true).ToString();
            m_lastModifiedKey = String.Format("LastModified:{0}", m_context.RequestUri.GetHashCode());
            m_lastModifiedDate = String.Empty;
            m_request = new TransformRequest();
            m_response = new TransformResponse();
            Guid requestGuid = Guid.NewGuid();
            m_request.ID = requestGuid;

            
            context.Response.ContentType = "text/xml";

            IEnumerator headers = context.Request.Headers.GetEnumerator();
            for (int i = 0; headers.MoveNext(); i++) {
                string local = context.Request.Headers.AllKeys[i].ToString();
                this.LogDebug("KeyName: {0}, KeyValue: {1}", local, context.Request.Headers[local]);
            }
            bool hasXmlSourceChanged = m_xmlServiceOperationManager.HasXmlSourceChanged(m_context.RequestXmlETag, requestUri);

            //if (m_USE_MEMCACHED) {

            //    string obj = (string)m_memcachedClient.Get(m_context.GetRequestHashcode(true).ToString());

            //    if (obj != null && !hasXmlSourceChanged) {
            //        m_response.TransformResult = (string)obj;
            //        m_CONTENT_IS_MEMCACHED = true;
            //        if ((bool)context.Application["debug"]) {
            //            context.Response.ContentType = "text";
            //        }
            //    } else {
            //        //m_writer = new StringWriter(m_builder);
            //        m_CONTENT_IS_MEMCACHED = false;
            //    }
            //} else {
            //    m_writer = new StringWriter(m_builder);
            //}

            m_writer = new StringWriter(m_builder);

            try {

                switch (m_httpMethod) {
                    case "GET":
                    case "HEAD":
                    case "POST": {                     
                            string name = String.Format("Name: {0}", context.Request.QueryString["name"]);
                            this.LogDebug("QueryString Length: {0}", context.Request.QueryString.Count);
                            this.LogDebug(name);
                            this.LogDebug("If-None-Match: {0}, RequestHashCode: {1}", context.Request.Headers["If-None-Match"], m_requestHashcode);
                            this.LogDebug(context.Request.Path);
                            if (context.Request.Headers["If-None-Match"] == m_requestHashcode) {
                                object lastModified;
                                this.LogDebug("They matched.");
                                this.LogDebug("Use memcached: {0}, KeyExists: {1}, XmlSource Changed: {2}", m_USE_MEMCACHED, m_memcachedClient.TryGet(m_lastModifiedKey, out lastModified), hasXmlSourceChanged);
                                this.LogDebug("Last Modified Key Value: {0}", m_lastModifiedKey);
                                if (m_USE_MEMCACHED && m_memcachedClient.TryGet(m_lastModifiedKey, out lastModified) && !hasXmlSourceChanged)
                                {
                                    m_lastModifiedDate = (string)m_memcachedClient.Get(m_lastModifiedKey);
                                    this.LogDebug("Last Modified Date: {0}", m_lastModifiedDate);
                                    if (context.Request.Headers["If-Modified-Since"] == m_lastModifiedDate) {

                                        context.Response.StatusCode = 304;
                                        m_returnOutput = false;
                                        goto CompleteCall;
                                    } else {
                                        goto Process;
                                    }
                                } else if (m_CONTENT_IS_MEMCACHED) {
                                    goto CompleteCall;
//.........这里部分代码省略.........
开发者ID:nuxleus,项目名称:Nuxleus,代码行数:101,代码来源:NuxleusHttpAsyncXmlServiceOperationHandler.cs

示例9: CreateInstance

        internal static RtpSender CreateInstance(IRtpSession session, string name, PayloadType pt, 
            Hashtable priExns, ushort cDataPx, ushort cFecPx)
        {
            // Validate before adding to private extensions
            if(cFecPx == 0)
            {
                throw new ArgumentOutOfRangeException("cFecPx", cFecPx, "Must be >= 1");
            }

            // Add the relevant private extension for FEC
            Hashtable fecExns = null;
            
            if(priExns != null)
            {
                fecExns = (Hashtable)priExns.Clone();
            }
            else
            {
                fecExns = new Hashtable();
            }

            fecExns[Rtcp.PEP_FEC] = cDataPx.ToString() + ":" + cFecPx.ToString();

            // Call generic class factory
            return CreateInstance(session, name, pt, fecExns, null);
        }
开发者ID:tdhieu,项目名称:openvss,代码行数:26,代码来源:RtpSender.cs

示例10: AssignUrlTokens

		private void AssignUrlTokens(MenuNodeCollection objNodes, ref Hashtable objTokens, ref ArrayList objUsedTokens)
		{
			string strLastToken;
			if (objTokens == null)
			{
				GetUrlTokens(objNodes, ref objTokens);
			}
			foreach (MenuNode objNode in objNodes) {
				//look all nodes
				strLastToken = "";
				foreach (string strToken in ((Hashtable)objTokens.Clone()).Keys) {
					//loop all tokens (have to clone so we can modify real collection
					if (!String.IsNullOrEmpty(objNode.NavigateURL) && objNode.NavigateURL.IndexOf(strToken) > -1)
					{
						//if url contains token
						objTokens[strToken] = (int)objTokens[strToken] - 1;
						//remove token from count
						if (strToken.Length > strLastToken.Length && ((int)objTokens[strToken] > 0 || objUsedTokens.Contains(strToken)))
						{
							//if token is better and not only one with match
							strLastToken = strToken;
							//use it
						}
					}
				}
				if (!String.IsNullOrEmpty(strLastToken))
				{
					if (objUsedTokens.Contains(strLastToken) == false)
					{
						objUsedTokens.Add(strLastToken);
					}
					objNode.UrlIndex = objUsedTokens.IndexOf(strLastToken);
					objNode.NavigateURL = objNode.NavigateURL.Substring(strLastToken.Length);
				}
				AssignUrlTokens(objNode.MenuNodes, ref objTokens, ref objUsedTokens);
			}
		}
开发者ID:huayang912,项目名称:cs-dotnetnuke,代码行数:37,代码来源:DNNMenuUpLevelWriter.cs

示例11: RouteAppend1

 /// <summary>
 /// 将线段连成长线-即完整的轨迹线(反方向)
 /// </summary>
 /// <param name="nowRoulentable"></param>
 /// <param name="strStationAddress"></param>
 /// <returns></returns>
 private Hashtable RouteAppend1(Hashtable nowRoulentable, string strStationAddress)
 {
     Hashtable htNew = new Hashtable();
     htNew = (Hashtable)nowRoulentable.Clone();
     foreach (string strKey1 in nowRoulentable.Keys)
     {
         string[] strTemp1 = strKey1.Split(',');
         if (strTemp1[1].Equals(strStationAddress))
         {
             foreach (string strKey2 in nowRoulentable.Keys)
             {
                 if (!nowRoulentable[strKey1].Equals(nowRoulentable[strKey2]))
                 {
                     string[] strTemp2 = strKey2.Split(',');
                     #region [结尾相同处理]
                     if (strTemp1[1].Equals(strTemp2[1]) && strTemp1[1].Equals(strStationAddress))
                     {
                         if (Convert.ToDouble(strTemp1[0]) < Convert.ToDouble(strTemp2[0]))
                         {
                             RouteLength rl1 = (RouteLength)nowRoulentable[strKey1];
                             RouteLength rl2 = (RouteLength)nowRoulentable[strKey2];
                             string strKey4 = strTemp1[0] + "," + strTemp2[0];
                             if (!nowRoulentable.ContainsKey(strKey4))
                             {
                                 if (!htNew.ContainsKey(strKey4))
                                 {
                                     string[] strRouteTemps = rl2.RouteList.Split('|');
                                     string strRouteTemp = string.Empty;
                                     for (int i = strRouteTemps.Length - 1; i >= 0; i--)
                                     {
                                         strRouteTemp += "|" + strRouteTemps[i];
                                     }
                                     htNew[strKey4] = new RouteLength(rl1.RouteList + strRouteTemp, rl1.Length + rl2.Length);
                                 }
                                 else
                                 {
                                     RouteLength rl4 = (RouteLength)htNew[strKey4];
                                     if (rl4.Length > (rl1.Length + rl2.Length))
                                     {
                                         string[] strRouteTemps = rl2.RouteList.Split('|');
                                         string strRouteTemp = string.Empty;
                                         for (int i = strRouteTemps.Length - 1; i >= 0; i--)
                                         {
                                             strRouteTemp += "|" + strRouteTemps[i];
                                         }
                                         htNew[strKey4] = new RouteLength(rl1.RouteList + strRouteTemp, rl1.Length + rl2.Length);
                                     }
                                 }
                             }
                             else
                             {
                                 RouteLength rl5 = (RouteLength)nowRoulentable[strKey4];
                                 if (!htNew.ContainsKey(strKey4))
                                 {
                                     if (rl5.Length > (rl1.Length + rl2.Length))
                                     {
                                         string[] strRouteTemps = rl2.RouteList.Split('|');
                                         string strRouteTemp = string.Empty;
                                         for (int i = strRouteTemps.Length - 1; i >= 0; i--)
                                         {
                                             strRouteTemp += "|" + strRouteTemps[i];
                                         }
                                         htNew[strKey4] = new RouteLength(rl1.RouteList + strRouteTemp, rl1.Length + rl2.Length);
                                     }
                                     else
                                     {
                                         htNew[strKey4] = rl5;
                                     }
                                 }
                                 else
                                 {
                                     RouteLength rl6 = (RouteLength)htNew[strKey4];
                                     if (rl6.Length > (rl1.Length + rl2.Length))
                                     {
                                         string[] strRouteTemps = rl2.RouteList.Split('|');
                                         string strRouteTemp = string.Empty;
                                         for (int i = strRouteTemps.Length - 1; i >= 0; i--)
                                         {
                                             strRouteTemp += "|" + strRouteTemps[i];
                                         }
                                         htNew[strKey4] = new RouteLength(rl1.RouteList + strRouteTemp, rl1.Length + rl2.Length);
                                     }
                                 }
                             }
                         }
                     }
                     #endregion
                 }
             }
         }
     }
     return (Hashtable)htNew.Clone();
 }
开发者ID:ZoeCheck,项目名称:128_5.6_2010,代码行数:99,代码来源:Graphics_DpicBLL.cs

示例12: ColorFrom

	/// <summary>
	/// Changes a GameObject's color values instantly then returns them to the provided properties over time with FULL customization options.  If a GUIText or GUITexture component is attached, it will become the target of the animation.
	/// </summary>
	/// <param name="color">
	/// A <see cref="Color"/> to change the GameObject's color to.
	/// </param>
	/// <param name="r">
	/// A <see cref="System.Single"/> or <see cref="System.Double"/> for the individual setting of the color red.
	/// </param>
	/// <param name="g">
	/// A <see cref="System.Single"/> or <see cref="System.Double"/> for the individual setting of the color green.
	/// </param>
	/// <param name="b">
	/// A <see cref="System.Single"/> or <see cref="System.Double"/> for the individual setting of the color green.
	/// </param>
	/// <param name="a">
	/// A <see cref="System.Single"/> or <see cref="System.Double"/> for the individual setting of the alpha.
	/// </param> 
	/// <param name="namedcolorvalue">
	/// A <see cref="NamedColorValue"/> or <see cref="System.String"/> for the individual setting of the alpha.
	/// </param> 
	/// <param name="includechildren">
	/// A <see cref="System.Boolean"/> for whether or not to include children of this GameObject. True by default.
	/// </param>
	/// <param name="time">
	/// A <see cref="System.Single"/> or <see cref="System.Double"/> for the time in seconds the animation will take to complete.
	/// </param>
	/// <param name="delay">
	/// A <see cref="System.Single"/> or <see cref="System.Double"/> for the time in seconds the animation will wait before beginning.
	/// </param>
	/// <param name="easetype">
	/// A <see cref="EaseType"/> or <see cref="System.String"/> for the shape of the easing curve applied to the animation.
	/// </param>   
	/// <param name="looptype">
	/// A <see cref="LoopType"/> or <see cref="System.String"/> for the type of loop to apply once the animation has completed.
	/// </param>
	/// <param name="onstart">
	/// A <see cref="System.String"/> for the name of a function to launch at the beginning of the animation.
	/// </param>
	/// <param name="onstarttarget">
	/// A <see cref="GameObject"/> for a reference to the GameObject that holds the "onstart" method.
	/// </param>
	/// <param name="onstartparams">
	/// A <see cref="System.Object"/> for arguments to be sent to the "onstart" method.
	/// </param>
	/// <param name="onupdate"> 
	/// A <see cref="System.String"/> for the name of a function to launch on every step of the animation.
	/// </param>
	/// <param name="onupdatetarget">
	/// A <see cref="GameObject"/> for a reference to the GameObject that holds the "onupdate" method.
	/// </param>
	/// <param name="onupdateparams">
	/// A <see cref="System.Object"/> for arguments to be sent to the "onupdate" method.
	/// </param> 
	/// <param name="oncomplete">
	/// A <see cref="System.String"/> for the name of a function to launch at the end of the animation.
	/// </param>
	/// <param name="oncompletetarget">
	/// A <see cref="GameObject"/> for a reference to the GameObject that holds the "oncomplete" method.
	/// </param>
	/// <param name="oncompleteparams">
	/// A <see cref="System.Object"/> for arguments to be sent to the "oncomplete" method.
	/// </param>
	public static void ColorFrom(GameObject target, Hashtable args){	
		Color fromColor = new Color();
		Color tempColor = new Color();
		
		//clean args:
		args = iTween.CleanArgs(args);
		
		//handle children:
		if(!args.Contains("includechildren") || (bool)args["includechildren"]){
			foreach(Transform child in target.transform){
				Hashtable argsCopy = (Hashtable)args.Clone();
				argsCopy["ischild"]=true;
				ColorFrom(child.gameObject,argsCopy);
			}
		}
		
		//set a default easeType of linear if none is supplied since eased color interpolation is nearly unrecognizable:
		if (!args.Contains("easetype")) {
			args.Add("easetype",EaseType.linear);
		}
		
		//set tempColor and base fromColor:

		if(target.GetComponent<GUITexture>()){
				tempColor=fromColor=target.GetComponent<GUITexture>().color;	
		}else if(target.GetComponent<GUIText>()){
				tempColor=fromColor=target.GetComponent<GUIText>().material.color;
			}else if(target.GetComponent<Renderer>()){
				tempColor=fromColor=target.GetComponent<Renderer>().material.color;
			}else if(target.GetComponent<Light>()){
				tempColor=fromColor=target.GetComponent<Light>().color;
		}
		
		
		//set augmented fromColor:
		if(args.Contains("color")){
			fromColor=(Color)args["color"];
//.........这里部分代码省略.........
开发者ID:Bakiet,项目名称:UnityZombieCross,代码行数:101,代码来源:iTween.cs

示例13: MainTagNameToTypeMapper

        internal MainTagNameToTypeMapper(BaseTemplateParser parser) {
            _parser = parser;
            
            if (parser != null) {
                PagesSection pagesConfig = parser.PagesConfig;
                if (pagesConfig != null) {
                    // Clone it so we don't modify the config settings
                    _tagNamespaceRegisterEntries = pagesConfig.TagNamespaceRegisterEntriesInternal;
                    if (_tagNamespaceRegisterEntries != null) {
                        _tagNamespaceRegisterEntries = (TagNamespaceRegisterEntryTable)_tagNamespaceRegisterEntries.Clone();
                    }

                    _userControlRegisterEntries = pagesConfig.UserControlRegisterEntriesInternal;
                    if (_userControlRegisterEntries != null) {
                        _userControlRegisterEntries = (Hashtable)_userControlRegisterEntries.Clone();
                    }
                }

                // 



                if (parser.FInDesigner && (_tagNamespaceRegisterEntries == null)) {
                    _tagNamespaceRegisterEntries = new TagNamespaceRegisterEntryTable();

                    foreach (TagNamespaceRegisterEntry entry in PagesSection.DefaultTagNamespaceRegisterEntries) {
                        _tagNamespaceRegisterEntries[entry.TagPrefix] = new ArrayList(new object[] { entry });
                    }
                }
            }
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:31,代码来源:TagNameToTypeMapper.cs

示例14: VerificaVIN

        /**********************VALIDACION VIN*****************************************/
        /// <summary>
        /// Verifica si el NIV introducido es valido
        /// </summary>
        public bool VerificaVIN(string p_strVin)
        {
            bool isValid;

            int intValue = 0;
            int[] intWeights = { 8, 7, 6, 5, 4, 3, 2, 10, 0, 9, 8, 7, 6, 5, 4, 3, 2 };

            if (p_strVin == null)
            {
                return isValid = false;
            }
            else if (p_strVin.Length != 17)
            {
                return isValid = false;
            }

            p_strVin = p_strVin.ToUpper().Trim();
            int intCheckValue = 0;
            char check = p_strVin[8];
            char year = p_strVin[9];
            char third = p_strVin[2];

            if (!char.IsDigit(check) && check != 'X')
            {
                return isValid = false;
            }
            else
            {
                if (check != 'X')
                {
                    char[] d = new char[] { check };
                    intCheckValue = int.Parse(Encoding.ASCII.GetString(Encoding.ASCII.GetBytes(d)));
                }
                else
                {
                    intCheckValue = 10;
                }
            }

            Hashtable replaceValues = new Hashtable();
            replaceValues.Add('A', 1);
            replaceValues.Add('B', 2);
            replaceValues.Add('C', 3);
            replaceValues.Add('D', 4);
            replaceValues.Add('E', 5);
            replaceValues.Add('F', 6);
            replaceValues.Add('G', 7);
            replaceValues.Add('H', 8);
            replaceValues.Add('J', 1);
            replaceValues.Add('K', 2);
            replaceValues.Add('L', 3);
            replaceValues.Add('M', 4);
            replaceValues.Add('N', 5);
            replaceValues.Add('P', 7);
            replaceValues.Add('R', 9);
            replaceValues.Add('S', 2);
            replaceValues.Add('T', 3);
            replaceValues.Add('U', 4);
            replaceValues.Add('V', 5);
            replaceValues.Add('W', 6);
            replaceValues.Add('X', 7);
            replaceValues.Add('Y', 8);
            replaceValues.Add('Z', 9);
            replaceValues.Add('1', 1);
            replaceValues.Add('2', 2);
            replaceValues.Add('3', 3);
            replaceValues.Add('4', 4);
            replaceValues.Add('5', 5);
            replaceValues.Add('6', 6);
            replaceValues.Add('7', 7);
            replaceValues.Add('8', 8);
            replaceValues.Add('9', 9);
            replaceValues.Add('0', 0);

            //Make sure it is a Valid Year - Created the next 4 lines to correct U, Z & 0 from being in the list
            Hashtable yearValues = (Hashtable)replaceValues.Clone(); //Get a shallow copy of values
            yearValues.Remove('0');
            yearValues.Remove('Z');
            yearValues.Remove('U');
            if (!yearValues.Contains(year))
            {
                return isValid = false;
            }

            //Make sure characters that are in the VIN are the ones allowed.
            for (int i = 0; i < p_strVin.Length; i++)
            {
                if (!replaceValues.Contains(p_strVin[i]))
                {
                    return isValid = false;
                }
                else if (i > 13 && !char.IsDigit(p_strVin[i]) && third == '9')
                {
                    return isValid = false;
                }
                else if (i > 11 && !char.IsDigit(p_strVin[i]) && third != '9')
//.........这里部分代码省略.........
开发者ID:pprbe3,项目名称:Cotizador,代码行数:101,代码来源:EExterna.aspx.cs

示例15: TestClonedHashtableSameAsOriginal

        public void TestClonedHashtableSameAsOriginal()
        {
            string strKey;
            string strValue;

            //1) create a HT, add elements
            //2) create another HT out of the first
            //3) Remove elements from 2) and add
            //4) Clone 3)
            var hsh1 = new Hashtable();
            for (int i = 0; i < 10; i++)
            {
                strKey = "Key_" + i;
                strValue = "string_" + i;
                hsh1.Add(strKey, strValue);
            }

            var hsh2 = new Hashtable(hsh1);
            hsh2.Remove("Key_0");
            hsh2.Remove("Key_1");
            hsh2.Remove("Key_2");

            Assert.Equal(hsh2.Count, 7);
            hsh2["Key_10"] = "string_10";
            hsh2["Key_11"] = "string_11";
            hsh2["Key_12"] = "string_12";

            var hsh3 = (Hashtable)hsh2.Clone();

            Assert.Equal(10, hsh3.Count);

            for (int i = 3; i < 13; i++)
            {
                Assert.True(hsh3.Contains("Key_" + i));
                Assert.True(hsh3.ContainsKey("Key_" + i));
                Assert.True(hsh3.ContainsValue("string_" + i));
            }
        }
开发者ID:johnhhm,项目名称:corefx,代码行数:38,代码来源:CloneTests.cs


注:本文中的System.Collections.Hashtable.Clone方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。