internal object this[int index]
 {
     get
     {
         if (m_datalist.ContainsKey(index))
         {
             return(m_datalist[index]);
         }
         else
         {
             return(null);
         }
     }
     set
     {
         if (m_datalist.ContainsKey(index))
         {
             m_datalist[index] = value;
         }
         else
         {
             m_datalist.Add(index, value);
         }
     }
 }
示例#2
0
 /// <summary>
 /// If key doesnt exist it will be added and value will be set to default.
 /// If it exist default value will be changed.
 /// </summary>
 /// <param name="key">Key identifier</param>
 /// <param name="obj">object that you want to set as the default value</param>
 public void SetDefault(int key, object obj)
 {
     if (!list.ContainsKey(key))
     {
         SettingItem item = new SettingItem(obj);
         item.Key             = key;
         item.UpdatedSetting += new FmdcEventHandler(item_UpdatedSetting);
         list.Add(key, item);
     }
     else
     {
         list[key].DefaultValue = obj;
     }
 }
示例#3
0
 public void AddColor(float x, float r, float g, float b, float a)
 {
     if (samples.ContainsKey(x))
     {
         samples.Remove(x);
     }
     else
     {
         x_min = Math.Min(x_min, x);
         x_max = Math.Max(x_max, x);
     }
     samples.Add(x, new Vector4(r, g, b, a));
 }
        static StackObject *ContainsKey_0(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.Int32 @key = ptr_of_this_method->Value;

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            System.Collections.Generic.SortedList <System.Int32, ILRuntime.Runtime.Intepreter.ILTypeInstance> instance_of_this_method = (System.Collections.Generic.SortedList <System.Int32, ILRuntime.Runtime.Intepreter.ILTypeInstance>) typeof(System.Collections.Generic.SortedList <System.Int32, ILRuntime.Runtime.Intepreter.ILTypeInstance>).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = instance_of_this_method.ContainsKey(@key);

            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value      = result_of_this_method ? 1 : 0;
            return(__ret + 1);
        }
示例#5
0
文件: Build.cs 项目: nlhepler/mono
		private Node InitializeTree()
		{
			Node root = new Node();
			//Custom Sorted List, to allow where Multple files in Diff directorys might have the same
			//filename. So still to some degree first come first serve but might be close enough
			//to how microsoft System to match much more closely.
			System.Collections.Generic.SortedList<string, System.Collections.Generic.List<nBrowser.File>> list;
			list = new System.Collections.Generic.SortedList<string, System.Collections.Generic.List<nBrowser.File>>();

			for (int i = 0;i <= Browserfiles.Count - 1;i++)
			{
				if (list.ContainsKey(nbrowserfiles[i].FileName) == false)
				{
					System.Collections.Generic.List<nBrowser.File> l;
					l = new System.Collections.Generic.List<nBrowser.File>();
					list.Add(nbrowserfiles[i].FileName, l);
				}
				list[nbrowserfiles[i].FileName].Add(nbrowserfiles[i]);
			}
			nBrowser.File[] files = new nBrowser.File[Browserfiles.Count];

			int count = 0;
			for (int i = 0;i <= list.Count - 1;i++)
			{
				System.Collections.Generic.List<nBrowser.File> l = list[list.Keys[i]];
				for (int b = 0;b <= l.Count - 1;b++)
				{
					files[count] = l[b];
					count++;
				}
			}

			#region Connect Nodes
			for (int i = 0;i <= Browserfiles.Count - 1;i++)
			{
				for (int a = 0;a <= files[i].Keys.Length - 1;a++)
				{
					Node child = files[i].GetNode(files[i].Keys[a]);
					Node parent = null;
					if (child.ParentId.Length > 0)
					{
						parent = this.GetNode(child.ParentId);
						if (parent == null)
							throw new nBrowser.Exception(String.Format("Parent not found with id = {0}", child.ParentId));
					}
					if (parent == null)
						parent = root;
					parent.AddChild(child);
				}
			}
			#endregion
			
			#region Inject DefaultBrowser Nodes
			for (int i = 0;i <= Browserfiles.Count - 1;i++)
			{
				for (int a = 0;a <= files[i].DefaultKeys.Length - 1;a++)
				{
					Node defaultNode = files[i].GetDefaultNode(files[i].DefaultKeys[a]);
					Node node = this.GetNode(defaultNode.Id);
					if (node == defaultNode) 
					{
						// there is no regular node so the defaultNode is already at
						// the correct spot in the tree.
						continue;
					}
					Node parentNode = this.GetNode(node.ParentId);
					if (parentNode == null)
						parentNode = root;
					// insert the default node between the regular node and it's parent.
					parentNode.RemoveChild(node);
					defaultNode.AddChild(node);
					parentNode.AddChild(defaultNode);
				}
			}
			#endregion

			#region Merge Ref Nodes
			for (int i = 0;i <= Browserfiles.Count - 1;i++)
			{
				foreach (Node refNode in files[i].RefNodes) {
					GetNode(refNode.RefId).MergeFrom(refNode);
				}
			}
			#endregion

			return root;
		}
示例#6
0
        private Node InitializeTree()
        {
            Node root = new Node();

            //Custom Sorted List, to allow where Multple files in Diff directorys might have the same
            //filename. So still to some degree first come first serve but might be close enough
            //to how microsoft System to match much more closely.
            System.Collections.Generic.SortedList <string, System.Collections.Generic.List <nBrowser.File> > list;
            list = new System.Collections.Generic.SortedList <string, System.Collections.Generic.List <nBrowser.File> >();

            for (int i = 0; i <= Browserfiles.Count - 1; i++)
            {
                if (list.ContainsKey(nbrowserfiles[i].FileName) == false)
                {
                    System.Collections.Generic.List <nBrowser.File> l;
                    l = new System.Collections.Generic.List <nBrowser.File>();
                    list.Add(nbrowserfiles[i].FileName, l);
                }
                list[nbrowserfiles[i].FileName].Add(nbrowserfiles[i]);
            }
            nBrowser.File[] files = new nBrowser.File[Browserfiles.Count];

            int count = 0;

            for (int i = 0; i <= list.Count - 1; i++)
            {
                System.Collections.Generic.List <nBrowser.File> l = list[list.Keys[i]];
                for (int b = 0; b <= l.Count - 1; b++)
                {
                    files[count] = l[b];
                    count++;
                }
            }

            #region Connect Nodes
            for (int i = 0; i <= Browserfiles.Count - 1; i++)
            {
                for (int a = 0; a <= files[i].Keys.Length - 1; a++)
                {
                    Node child  = files[i].GetNode(files[i].Keys[a]);
                    Node parent = null;
                    if (child.ParentId.Length > 0)
                    {
                        parent = this.GetNode(child.ParentId);
                        if (parent == null)
                        {
                            throw new nBrowser.Exception(String.Format("Parent not found with id = {0}", child.ParentId));
                        }
                    }
                    if (parent == null)
                    {
                        parent = root;
                    }
                    parent.AddChild(child);
                }
            }
            #endregion

            #region Inject DefaultBrowser Nodes
            for (int i = 0; i <= Browserfiles.Count - 1; i++)
            {
                for (int a = 0; a <= files[i].DefaultKeys.Length - 1; a++)
                {
                    Node defaultNode = files[i].GetDefaultNode(files[i].DefaultKeys[a]);
                    Node node        = this.GetNode(defaultNode.Id);
                    if (node == defaultNode)
                    {
                        // there is no regular node so the defaultNode is already at
                        // the correct spot in the tree.
                        continue;
                    }
                    Node parentNode = this.GetNode(node.ParentId);
                    if (parentNode == null)
                    {
                        parentNode = root;
                    }
                    // insert the default node between the regular node and it's parent.
                    parentNode.RemoveChild(node);
                    defaultNode.AddChild(node);
                    parentNode.AddChild(defaultNode);
                }
            }
            #endregion

            #region Merge Ref Nodes
            for (int i = 0; i <= Browserfiles.Count - 1; i++)
            {
                foreach (Node refNode in files[i].RefNodes)
                {
                    GetNode(refNode.RefId).MergeFrom(refNode);
                }
            }
            #endregion

            return(root);
        }
 /// <summary>
 /// Returns true, if the integer <code>nValue</code> is contained in this collection.
 /// </summary>
 /// <param name="nValue">The integer value to test for membership.</param>
 /// <returns>True if the integer value is member of the collection.</returns>
 public bool Contains(int nValue)
 {
     return(_list.ContainsKey(nValue));
 }
        /// <summary>
        /// 一个静态构造方法。
        /// </summary>
        static VerifyCode()
        {
            var configSection = GetSection("VerifyCode");

            if (configSection != null)
            {
                if (!string.IsNullOrEmpty(configSection["VerifyCodeEnumerable"]))
                {
                    System.Collections.Generic.List <string> charVerifyCodeEnumerable = new System.Collections.Generic.List <string>();                                 //字符验证码枚举列表。
                    System.Collections.Generic.SortedList <string, string> keyValueVerifyCodeEnumerable = new System.Collections.Generic.SortedList <string, string>(); //键值对(问题和答案)验证码列表。
                    string[] keyValues = configSection["VerifyCodeEnumerable"].Split(',');
                    foreach (var tmp in keyValues)
                    {
                        int eqIndex = tmp.IndexOf('=');
                        if (eqIndex > 0) //如果是键值对验证码。
                        {
                            string key   = tmp.Substring(0, eqIndex);
                            string value = tmp.Substring(eqIndex + 1);
                            if (!keyValueVerifyCodeEnumerable.ContainsKey(key))
                            {
                                keyValueVerifyCodeEnumerable.Add(key, value);
                            }
                        }
                        else if (!charVerifyCodeEnumerable.Contains(tmp)) //如果是字符型验证码。
                        {
                            charVerifyCodeEnumerable.Add(tmp);
                        }
                    }
                    VerifyCode.VerifyCodeEnumerable         = charVerifyCodeEnumerable.ToArray();
                    VerifyCode.KeyValueVerifyCodeEnumerable = keyValueVerifyCodeEnumerable;
                }

                if (!string.IsNullOrEmpty(configSection["Length"]))
                {
                    VerifyCode.Length = System.Convert.ToInt32(configSection["Length"]);
                }

                if (!string.IsNullOrEmpty(configSection["BendingAngle"]))
                {
                    VerifyCode.BendingAngle = System.Convert.ToInt32(configSection["BendingAngle"]);
                }

                if (!string.IsNullOrEmpty(configSection["FontSize"]))
                {
                    VerifyCode.FontSize = System.Convert.ToInt32(configSection["FontSize"]);
                }

                if (!string.IsNullOrEmpty(configSection["Padding"]))
                {
                    VerifyCode.Padding = System.Convert.ToInt32(configSection["Padding"]);
                }

                if (!string.IsNullOrEmpty(configSection["ForeColors"]))
                {
                    System.Collections.Generic.List <System.Drawing.Color> cs = new System.Collections.Generic.List <System.Drawing.Color>();
                    string[] vs = configSection["ForeColors"].Split(',');
                    foreach (var tmp in vs)
                    {
                        cs.Add(System.Drawing.ColorTranslator.FromHtml(tmp));
                    }
                    VerifyCode.ForeColors = cs.ToArray();
                }

                if (!string.IsNullOrEmpty(configSection["Fonts"]))
                {
                    string[] vs = configSection["Fonts"].Split(',');
                    VerifyCode.Fonts = vs;
                }
            }
        }
示例#9
0
文件: parse.cs 项目: paladin74/Dapple
        /// <summary>
        /// Parse the list stylesheet response.
        /// </summary>
        /// <param name="hDocument">The GeosoftXML response</param>
        /// <param name="oStylesheets">The list of stylesheets</param>
        public void ListStylesheets(System.Xml.XmlDocument hDocument, out System.Collections.Generic.SortedList<string, string> oStylesheets)
        {
            System.Xml.XmlNodeList hItemList;
            System.Xml.XmlNode hNode;

            oStylesheets = new System.Collections.Generic.SortedList<string,string>();

            try
            {
                // --- find all the item elements located anywhere in the document ---

                hItemList = hDocument.SelectNodes("//" + Constant.Tag.STYLESHEET_TAG);

                if (hItemList == null) throw new DapException("No stylesheets found");

                // --- loop through all the datasets adding them to the list ---

                for (int i = 0; i < hItemList.Count; i++)
                {
                    System.Xml.XmlNode hAttr;
                    string strName = string.Empty;
                    string strEdition = string.Empty;

                    hNode = hItemList[i];
                    hAttr = hNode.Attributes.GetNamedItem(Constant.Attribute.NAME_ATTR);
                    if (hAttr != null && hAttr.Value != null)
                        strName = hAttr.Value;

                    hAttr = hNode.Attributes.GetNamedItem(Constant.Attribute.EDITION_ATTR);
                    if (hAttr != null && hAttr.Value != null)
                        strEdition = hAttr.Value;

                    if (!string.IsNullOrEmpty(strName) && !oStylesheets.ContainsKey(strName))
                        oStylesheets.Add(strName, strEdition);
                }
            }
            catch (Exception e)
            {
                throw new DapException("Error compiling list of stylesheets", e);
            }
        }