Add() public method

public Add ( Object key, Object value ) : void
key Object
value Object
return void
 private void GatherNamespaceToRender(string nsPrefix, SortedList nsListToRender, Hashtable nsLocallyDeclared)
 {
     int num;
     foreach (object obj2 in nsListToRender.GetKeyList())
     {
         if (Utils.HasNamespacePrefix((XmlAttribute) obj2, nsPrefix))
         {
             return;
         }
     }
     XmlAttribute a = (XmlAttribute) nsLocallyDeclared[nsPrefix];
     XmlAttribute nearestRenderedNamespaceWithMatchingPrefix = base.GetNearestRenderedNamespaceWithMatchingPrefix(nsPrefix, out num);
     if (a != null)
     {
         if (Utils.IsNonRedundantNamespaceDecl(a, nearestRenderedNamespaceWithMatchingPrefix))
         {
             nsLocallyDeclared.Remove(nsPrefix);
             nsListToRender.Add(a, null);
         }
     }
     else
     {
         int num2;
         XmlAttribute nearestUnrenderedNamespaceWithMatchingPrefix = base.GetNearestUnrenderedNamespaceWithMatchingPrefix(nsPrefix, out num2);
         if (((nearestUnrenderedNamespaceWithMatchingPrefix != null) && (num2 > num)) && Utils.IsNonRedundantNamespaceDecl(nearestUnrenderedNamespaceWithMatchingPrefix, nearestRenderedNamespaceWithMatchingPrefix))
         {
             nsListToRender.Add(nearestUnrenderedNamespaceWithMatchingPrefix, null);
         }
     }
 }
コード例 #2
0
ファイル: Button.cs プロジェクト: timdetering/Endogine
        public Button()
        {
            this.m_bNoScalingOnSetRect = true;
            Name = "Button";
            this.MouseActive = true;
            m_plStateSprites = new SortedList();

            Frame spFrame = new Frame();
            spFrame.Parent = this;
            spFrame.Member = new MemberSpriteBitmap("Button2Up");
            spFrame.Ink = RasterOps.ROPs.BgTransparent;
            spFrame.Member.ColorKey = Color.FromArgb(0,0,0);
            spFrame.Rect = new ERectangleF(0,0,50,50);
            m_plStateSprites.Add(Sprite.MouseEventType.Leave, (Sprite)spFrame);

            spFrame = new Frame();
            spFrame.Parent = this;
            spFrame.Member = new MemberSpriteBitmap("Button2Down");
            spFrame.Ink = RasterOps.ROPs.BgTransparent;
            spFrame.Member.ColorKey = Color.FromArgb(0,0,0);
            spFrame.Rect = new ERectangleF(0,0,50,50);
            m_plStateSprites.Add(Sprite.MouseEventType.Enter, (Sprite)spFrame);

            for (int i = 0; i < m_plStateSprites.Count; i++)
            {
                ((Sprite)m_plStateSprites.GetByIndex(i)).Visible = false;
            }
            ((Sprite)m_plStateSprites[MouseEventType.Leave]).Visible = true;
        }
コード例 #3
0
ファイル: StateSites.cs プロジェクト: OSEHRA/mdws
 public StateSites(State mdoState)
 {
     this.name = mdoState.Name;
     this.abbr = mdoState.Abbr;
     SortedList lst = new SortedList();
     foreach (DictionaryEntry de in mdoState.Sites)
     {
         Site s = (Site)de.Value;
         if (s.ChildSites != null)
         {
             for (int i = 0; i < s.ChildSites.Length; i++)
             {
                 lst.Add(s.ChildSites[i].Name, s.ChildSites[i]);
             }
         }
         Site clone = new Site();
         clone.Id = s.Id;
         clone.Name = s.Name;
         clone.State = s.State;
         clone.City = s.City;
         clone.DisplayName = s.DisplayName;
         clone.ParentSiteId = s.ParentSiteId;
         clone.RegionId = s.RegionId;
         lst.Add(clone.Name, clone);
     }
     this.sites = new SiteArray(lst);
 }
コード例 #4
0
ファイル: Program.cs プロジェクト: oblivious/Oblivious
        static void Main(string[] args)
        {
            SortedList sl = new SortedList();
            sl.Add("Stack", "Represents a LIFO collection of objects.");
            sl.Add("Queue", "Represents a FIFO collection of objects.");
            sl.Add("SortedList", "Represents a collection of key/value pairs.");

            foreach (DictionaryEntry de in sl)
            {
                Console.WriteLine("{0,12}: {1}", de.Key, de.Value);
            }

            Console.WriteLine("\n" + sl["Queue"]);
            Console.WriteLine(sl.GetByIndex(1));

            Console.WriteLine("\nName Value Collection:");
            NameValueCollection nvc = new NameValueCollection();
            nvc.Add("Stack", "Represents a LIFO collection of objects.");
            nvc.Add("Stack", "A pile of pancakes.");
            nvc.Add("Queue", "Represents a FIFO collection of objects.");
            nvc.Add("Queue", "In England, a line.");
            nvc.Add("SortedList", "Represents a collection of key/value pairs.");

            foreach (string s in nvc.GetValues(0))
                Console.WriteLine(s);

            foreach (string s in nvc.GetValues("Queue"))
                Console.WriteLine(s);
        }
コード例 #5
0
		public void JavascriptAsGenericSortedListTestOptionsTest()
		{
			IDictionary<string, string> options = new SortedList<string, string>();
			options.Add("key1","option1");
			options.Add("key2","option2");
			Assert.AreEqual("{key1:option1, key2:option2}",AbstractHelper.JavascriptOptions(options));
		}
コード例 #6
0
        void btnSave_Click(object sender, EventArgs e)
        {
            SortedList sl = new SortedList();

            Qry = "delete from Unit_master where UnitGroupName='" + cboUnitType.Text + "'";
            sl.Add(sl.Count + 1, Qry);

            for (int i = 0; i < dgvInfo.Rows.Count - 1; i++)
            {
                Qry = "INSERT INTO [dbo].[Unit_Master] " +
                      " ([UnitGroupName]" +
                      " ,[UnitID]" +
                      " ,[UnitName]" +
                      " ,[RelativeFactor]" +
                      " ,[IsBaseUOM]" +
                      " ,[AddedBy]" +
                      " ,[DateAdded])" +
                 " VALUES " +
                       " ('" + cboUnitType.Text + "'," +
                       "'" + dgvInfo.Rows[i].Cells[0].Value.ToString() + "'," +
                      "'" + dgvInfo.Rows[i].Cells[1].Value.ToString() + "'," +
                       "" + dgvInfo.Rows[i].Cells[2].Value.ToString() + "," +
                       "'" + Convert.ToBoolean(dgvInfo.Rows[i].Cells[3].Value) + "'," +
                      "'" + LoginSession.UserID + "',getdate())";
                sl.Add(sl.Count + 1, Qry);
            }

            DbUtility.ExecuteQuery(sl, "");
            MessageBox.Show("Saved");
        }
コード例 #7
0
ファイル: Program.cs プロジェクト: klimskuridin/vamk_csharp
        static void Main(string[] args)
        {
            // Here we define the Hashtable obect and initialize it
            Hashtable countryCodes = new Hashtable();
            countryCodes.Add("358", "Finland");
            countryCodes.Add("1", "Canada");
            countryCodes.Add("254", "Kenya");

            // Here we print the full content of the Hashtable
            foreach (string code in countryCodes.Keys)
                Console.WriteLine(code + " --> " + countryCodes[code]);

            // Here we print all values in the Hastable
            Console.WriteLine("Values in the hash table: ");
            foreach (string value in countryCodes.Values)
                Console.WriteLine(value);
            SortedList countryAbbr = new SortedList();
            countryAbbr.Add("FI", "Finland");
            countryAbbr.Add("NL", "Netherlands");
            countryAbbr.Add("IR", "Iran");
            countryAbbr.Add("CA", "Canada");
            Console.WriteLine("Country with abbreviation NL in sorted list: " + countryAbbr["NL"]);
            Console.WriteLine("Third value in the sorted list: " + countryAbbr.GetByIndex(2));

            // Here we print the full content of the SortedList
            Console.WriteLine("The contnet of the sorted list: ");
            foreach (string abbr in countryAbbr.Keys)
                Console.WriteLine(abbr + " --> " + countryAbbr[abbr]);

            // Here we print all values in the Hastable
            Console.WriteLine("Values in the SortedList: ");
            foreach (string abbr in countryAbbr.Values)
                Console.WriteLine(abbr);
        }
コード例 #8
0
ファイル: CountryNames.cs プロジェクト: camiloamora/AppAjc
 public static SortedList GetCountries(bool insertEmpty)
 {
     SortedList countries = new SortedList();
     if (insertEmpty)
         countries.Add("", "Please select one...");
     foreach (String country in _countries)
         countries.Add(country, country);
     return countries;
 }
コード例 #9
0
ファイル: UnitedStates.cs プロジェクト: camiloamora/AppAjc
 public static SortedList GetStates(bool insertEmpty)
 {
     SortedList states = new SortedList();
     if (insertEmpty)
         states.Add("", "Please select one...");
     foreach (String state in _states)
         states.Add(state, state);
     return states;
 }
コード例 #10
0
 public void CanTestContentsOfSortedList()
 {
     object item = "xyz";
     SortedList list = new SortedList();
     list.Add("a", 123);
     list.Add("b", item);
     list.Add("c", "abc");
     Assert.That(list.Values, new CollectionContainsConstraint(item));
     Assert.That(list.Keys, new CollectionContainsConstraint("b"));
 }
コード例 #11
0
        public void SortedList()
        {
            var list = new SortedList();
            list.Add(5, "Matteo");
            list.Add(4, DateTime.UtcNow);
            list.Add(1, "Pierangeli");

            var firstPosition = list.GetKey(0);
            Assert.That(list[firstPosition], Is.EqualTo("Pierangeli"));
        }
コード例 #12
0
ファイル: CtorTests.cs プロジェクト: gitter-badger/corefx
        public void TestCtorDefault()
        {
            StringBuilder sblMsg = new StringBuilder(99);

            SortedList sl2 = null;

            StringBuilder sbl3 = new StringBuilder(99);
            StringBuilder sbl4 = new StringBuilder(99);
            StringBuilder sblWork1 = new StringBuilder(99);

            //
            // 	Constructor: Create a default SortedList
            //
            sl2 = new SortedList();

            //  Verify that the SortedList is not null.
            Assert.NotNull(sl2);

            //  Verify that the SortedList is empty.
            Assert.Equal(0, sl2.Count);

            //
            // 	Constructor: few more tests
            //
            sl2 = new SortedList();

            var k0 = new CtorTestClass("cde");
            var k1 = new CtorTestClass("abc");
            var k2 = new CtorTestClass("bcd");

            sl2.Add(k0, null);
            sl2.Add(k1, null);
            sl2.Add(k2, null);

            //  Verify that the SortedList is not null.
            Assert.NotNull(sl2);

            //  Verify that the SortedList Count is right.
            Assert.Equal(3, sl2.Count);

            //  Verify that the SortedList actually sorted the hashtable.
            Assert.Equal(2, sl2.IndexOfKey(k0));

            Assert.Equal(0, sl2.IndexOfKey(k1));

            Assert.Equal(1, sl2.IndexOfKey(k2));

            //  Verify that the SortedList contains the right keys.

            Assert.True(((CtorTestClass)sl2.GetKey(0)).GetString().Equals("abc"));

            Assert.True(((CtorTestClass)sl2.GetKey(1)).GetString().Equals("bcd"));

            Assert.True(((CtorTestClass)sl2.GetKey(2)).GetString().Equals("cde"));
        }
コード例 #13
0
		public static HashTestClass CreateHashtableWithStrings()
		{
			SortedList list = new SortedList();
			list.Add("1", "a");
			list.Add("2", "b");
			list.Add("3", "c");

			HashTestClass hash = new HashTestClass();
			hash.ElementHash = list;
			return hash;
		}
コード例 #14
0
		public static HashTestClass CreateHashtableWithElements()
		{
			SortedList list = new SortedList();
			list.Add("1", ElementTestClass.Create("1"));
			list.Add("2", ElementTestClass.Create("2"));
			list.Add("3", ElementTestClass.Create("3"));

			HashTestClass hash = new HashTestClass();
			hash.ElementHash = list;
			return hash;
		}
コード例 #15
0
ファイル: NewLogin.cs プロジェクト: Apache553/BMCL
 public LoginInfo Login(string UserName, string Password, string Client_identifier = "", string Language = "zh-cn")
 {
     LoginInfo LI = new LoginInfo();
     ClientToken = Client_identifier;
     try
     {
         HttpWebRequest auth = (HttpWebRequest)WebRequest.Create(RouteAuthenticate);
         auth.Method = "POST";
         AuthenticationRequest ag = new AuthenticationRequest(UserName, Password);
         DataContractJsonSerializer agJsonSerialiaer = new DataContractJsonSerializer(typeof(AuthenticationRequest));
         MemoryStream agJsonStream = new MemoryStream();
         agJsonSerialiaer.WriteObject(agJsonStream, ag);
         agJsonStream.Position = 0;
         string logindata = (new StreamReader(agJsonStream)).ReadToEnd();
         byte[] postdata = Encoding.UTF8.GetBytes(logindata);
         auth.ContentLength = postdata.LongLength;
         Stream poststream = auth.GetRequestStream();
         poststream.Write(postdata, 0, postdata.Length);
         poststream.Close();
         HttpWebResponse authans = (HttpWebResponse)auth.GetResponse();
         DataContractJsonSerializer ResponseJsonSerializer = new DataContractJsonSerializer(typeof(AuthenticationResponse));
         StreamReader ResponseStream = new StreamReader(authans.GetResponseStream());
         string ResponseJson = ResponseStream.ReadToEnd();
         MemoryStream ResponseJsonStream = new MemoryStream(Encoding.UTF8.GetBytes(ResponseJson));
         ResponseJsonStream.Position = 0;
         AuthenticationResponse Response = ResponseJsonSerializer.ReadObject(ResponseJsonStream) as AuthenticationResponse;
         if (Response.getClientToken() != NewLogin.ClientToken)
         {
             LI.Suc = false;
             LI.Errinfo = "客户端标识和服务器返回不符,这是个不常见的错误,就算是正版启动器这里也没做任何处理,只是报了这么个错。";
             return LI;
         }
         LI.Suc = true;
         LI.UN = Response.getSelectedProfile().getName();
         LI.Client_identifier = NewLogin.ClientToken;
         DataContractSerializer OtherInfoSerializer = new DataContractSerializer(typeof(SortedList));
         SortedList OtherInfoList = new SortedList();
         OtherInfoList.Add("${auth_uuid}",Response.getSelectedProfile().getId());
         OtherInfoList.Add("${auth_access_token}", Response.getAccessToken());
         MemoryStream OtherInfoStream = new MemoryStream();
         OtherInfoSerializer.WriteObject(OtherInfoStream, OtherInfoList);
         OtherInfoStream.Position = 0;
         LI.OtherInfo = (new StreamReader(OtherInfoStream)).ReadToEnd();
         return LI;
     }
     catch (TimeoutException ex)
     {
         LI.Suc = false;
         LI.Errinfo = ex.Message;
         return LI;
     }
 }
コード例 #16
0
ファイル: Program.cs プロジェクト: oblivious/Oblivious
        static void Main(string[] args)
        {
            SortedList mySL = new SortedList();
            mySL.Add("Third", "!");
            mySL.Add("Second", "World");
            mySL.Add("First", "Hello");

            Console.WriteLine("mySL");
            Console.WriteLine("  Count:    {0}", mySL.Count);
            Console.WriteLine("  Capacity: {0}", mySL.Capacity);
            Console.WriteLine("  Keys and Values:");
            PrintKeysAndValues(mySL);
         }
コード例 #17
0
ファイル: Utils.cs プロジェクト: nuxleus/Nuxleus.Extf
 public static string makeCanonicalString( string bucket, string key, SortedList query, WebRequest request )
 {
     SortedList headers = new SortedList();
     foreach ( string header in request.Headers )
     {
         headers.Add(header, request.Headers[header]);
     }
     if (headers["Content-Type"] == null)
     {
         headers.Add("Content-Type", request.ContentType);
     }
     return makeCanonicalString(request.Method, bucket, key, query, headers, null);
 }
コード例 #18
0
ファイル: Utils.cs プロジェクト: nuxleus/Nuxleus.Extf
 public static string makeCanonicalString( string resource, WebRequest request )
 {
     SortedList headers = new SortedList();
     foreach ( string key in request.Headers )
     {
         headers.Add( key, request.Headers[ key ] );
     }
     if (headers["Content-Type"] == null)
     {
         headers.Add("Content-Type", request.ContentType);
     }
     return makeCanonicalString(request.Method, resource, headers, null);
 }
コード例 #19
0
        static void Sample1()
        {
            SortedList mySortedList = new SortedList();

            mySortedList.Add(3, "three");
            mySortedList.Add(2, "second");
            mySortedList.Add(1, "first");

            foreach (DictionaryEntry item in mySortedList)
            {
                Debug.WriteLine(item.Value);
            }
        }
コード例 #20
0
        public void DisplayEmployeesNameAge()
        {
            System.Collections.SortedList nameAge = new System.Collections.SortedList();
            nameAge.Add("Alicia", 30);
            nameAge.Add("Mike", 29);
            nameAge.Add("Adam", 22);
            nameAge.Add("Andrew", 39);


            for (int i = 0; i < nameAge.Count; i++)
            {
                Console.WriteLine("{0}: {1}", nameAge.GetKey(i), nameAge.GetByIndex(i));
            }
        }
コード例 #21
0
ファイル: Archiver.cs プロジェクト: NicolasR/Composants
 /// <summary>
 /// Ajoute la ligne line à la section en forme clé=valeur
 /// </summary>
 /// <param name="section">Dictionnaire de la section</param>
 /// <param name="line">Ligne de l'archive en forme "clé=valeur"</param>
 protected void DoAddLineToSection( SortedList section, string line ) {
   if (section == null) return ;
   int pos = line.IndexOf( '=' ) ;
   if (pos == -1) {
     string trimmed = line.Trim() ;
     if (trimmed != "") section.Add( trimmed, null ) ;
   } else {
     string key = line.Substring( 0, pos ) ;
     string val = line.Substring( pos + 1 ) ;
     int index = section.IndexOfKey( key ) ;
     if (index != -1) section.RemoveAt( index ) ;
     section.Add( key, val ) ;
   }
 }
コード例 #22
0
ファイル: Player.cs プロジェクト: timdetering/Endogine
        public Player(GameMain a_gameMain)
        {
            m_gameMain = a_gameMain;

            this.Name = "Player";
            m_fAngleStep = (float)(5.0*Math.PI/180);
            MemberName = "Ship";
            this.RegPoint = (this.Member.Size.ToEPointF()*0.5f).ToEPoint();

            #region Set up particle system (for thrusters)
            m_particleSystem = new Endogine.ParticleSystem.ParticleEmitter();
            //m_particleSystem.Parent = this;
            m_particleSystem.LocZ = LocZ-1;

            SortedList aColors = new SortedList();
            aColors.Add(0.0, System.Drawing.Color.FromArgb(255,255,0));
            aColors.Add(0.5, System.Drawing.Color.FromArgb(255,0,0));
            aColors.Add(1.0, System.Drawing.Color.FromArgb(0,0,0));
            m_particleSystem.SetColorList(aColors);

            SortedList aSizes = new SortedList();
            aSizes.Add(0.0, 1.0);
            aSizes.Add(1.0, 0.0);
            m_particleSystem.SetSizeList(aSizes);

            m_particleSystem.MaxParticles = 100;
            m_particleSystem.NumNewParticlesPerFrame = 0;

            m_fThrustParticles = 2;

            m_particleSystem.Gravity = 0;
            m_particleSystem.Speed = 5;
            m_particleSystem.SizeFact = 0.3f;

            m_particleSystem.ParticlePicRef = PicRef.GetOrCreate("Particle");
            m_particleSystem.SourceRect = new ERectangle(0,0,10,10);
            m_particleSystem.RegPoint = new EPoint(5,5);
            m_particleSystem.LocZ = 100;
            #endregion

            #region Keys setup
            m_keysSteering = new KeysSteering();
            this.m_keysSteering.AddKeyPreset(KeysSteering.KeyPresets.ArrowsSpace);
            this.m_keysSteering.AddKeyPreset(KeysSteering.KeyPresets.awsdCtrlShift);
            this.m_keysSteering.AddPair("left", "right");
            this.m_keysSteering.AddPair("up", "down");
            //m_keysSteering.ReceiveEndogineKeys(m_endogine);
            m_keysSteering.KeyEvent+=new KeyEventHandler(m_keysSteering_KeyEvent);
            #endregion
        }
コード例 #23
0
        public static void AddNewEntryFromStringArray(
            BankRow entryStrings,
            SortedList kontoEntries,
            SortedList newKontoEntries,
            SortedList newBatchOfKontoEntriesAlreadyRed)
        {
            var newKeyFromHtml = new KontoEntry(entryStrings);
            var key = newKeyFromHtml.KeyForThis;

            if (!kontoEntries.ContainsKey(key) && !newKontoEntries.ContainsKey(key)) // Kollas även senare
            {
                // if (newKontoEntries != null) {// && !newKontoEntries.ContainsKey(key)) {
                if (key != null)
                {
                    newKontoEntries.Add(key, newKeyFromHtml);

                    // }
                    // else {
                    // //Dubblett
                    // }
                }

                // Handle Doubles
            }
            else if (!newBatchOfKontoEntriesAlreadyRed.ContainsKey(key))
            {
                // Om man hade entryn i Excel, innan laddning, och innan man gick igenom nya, så kan man (förutsätter att man då det inte finns saldo (i allkort-kredit), så läses hela listan in i ett svep, det är inte en lista, det kan ev. bli dubblet om två datum hamnar på olika allkort-kredit-fakturor)
                var userDecision = MessageBox.Show(
                    "Found potential double: " + newKeyFromHtml.KeyForThis,
                    "Double, SaveThisEntry?",
                    MessageBoxButtons.YesNo);

                if (userDecision.Equals(DialogResult.Yes))
                {
                    // Detta är en dubblett, men om det finns fler än 2 dubbletter så måste man se till att nyckeln är unik
                    while (newKontoEntries.ContainsKey(newKeyFromHtml.KeyForThis))
                    {
                        // Stega upp saldo, tills en unik nyckel skapats
                        newKeyFromHtml.SaldoOrginal += newKeyFromHtml.KostnadEllerInkomst != 0
                                                           ? newKeyFromHtml.KostnadEllerInkomst
                                                           : 1;
                    }

                    newKontoEntries.Add(newKeyFromHtml.KeyForThis, newKeyFromHtml);
                }

                // För annat än Allkortskredit, så ordnar Detta sig, så länge saldot är med i nyckeln, det är den, så det gäller bara att ha rätt saldo i xls //Om man tagit utt t.ex. 100kr 2 ggr samma dag, från samma bankomat. hm, sätt 1 etta efteråt, men det göller ju bara det som är såna, hm, får ta dem manuellt
            }
        }
コード例 #24
0
        public void fun3()
        {
            SortedList s1 = new SortedList();
            s1.Add(9, 'a');
            s1.Add(5, 'f');
            s1.Add(7, 'h');

            Console.WriteLine(s1.GetKey(0));
            Console.WriteLine(s1.GetByIndex(0));

            foreach (DictionaryEntry de in s1)
            {
                Console.WriteLine("key ={0} value = {1}", de.Key, de.Value);
            }
        }
コード例 #25
0
        public CurvesEffectConfigToken()
        {
            controlPoints = new SortedList<int, int>[1];

            for (int i = 0; i < this.controlPoints.Length; ++i)
            {
                SortedList<int, int> newList = new SortedList<int, int>();

                newList.Add(0, 0);
                newList.Add(255, 255);
                controlPoints[i] = newList;
            }

            colorTransferMode = ColorTransferMode.Luminosity;
        }
コード例 #26
0
        /// <summary>
        /// Add the required auth fields and sing the request.
        /// </summary>
        /// <param name="type"> type of request ([GET|POST]\n[/open|/ws] </param>
        /// <param name="data"> data to sign </param>
        /// <returns>signed data with auth fields.</returns>
        private String sign_request(String type, SortedList data)
        {
            int time = (int)((DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds);

            data.Add("auth_key", options["api_id"]);
            data.Add("auth_timestamp", time.ToString());
            data.Add("auth_version", "1.0");

            string query = array_to_query(data);
            string str_to_sign = type + query;

            var hmacsha256 = new HMACSHA256(Encoding.UTF8.GetBytes(Convert.ToString(options["api_key"])));
            var hash = hmacsha256.ComputeHash(Encoding.UTF8.GetBytes(Convert.ToString(str_to_sign)));
            return query + "&auth_signature=" + BytesToHex(hash);
        }
コード例 #27
0
ファイル: AtomGroup.cs プロジェクト: plamikcho/xbrlpoc
        /// <summary>
        /// Instantiates a new atom group.
        /// </summary>
        /// <param name="logicalOperator">The operator that characterizes the relationship between the atoms and atoms group.</param>
        /// <param name="members">An array containing atoms and atom groups.</param>
        /// <param name="runningMembers">An array containing atoms and atom groups that will actually be run (they can be different
        /// from the members because of atom equivalence).</param>
        internal AtomGroup(LogicalOperator logicalOperator, object[] members, object[] runningMembers)
        {
            this.logicalOperator = logicalOperator;
            this.members = members;

            HashCodeBuilder hcb = new HashCodeBuilder();
            hcb.Append(logicalOperator);
            SortedList<int, object> sortedMembers = new SortedList<int, object>(Comparer<int>.Default);

            // check the members, compute hashcode and build sorted members list
            for(int i=0; i < members.Length; i++) {
                object member =members[i];

                if (member == null) {
                    throw new BREException("An atom group can not contain a null member");
                }
                else if (member is AtomGroup) {
                    if (((AtomGroup)member).logicalOperator == logicalOperator)
                        throw new BREException("An atom group can not contain another group with the same logical operator");
                }
                else if (member is Atom) {
                    if (((Atom)member).HasFormula)
                        throw new BREException("An atom group can not contain an atom that contains a formula");
                }
                else {
                    throw new BREException("An atom group can not hold objects of type: " + member.GetType());
                }

                hcb.Append(member);

                if (runningMembers == null) sortedMembers.Add(GetMemberSortedIndex(members, i), member);
            }

            hashCode = hcb.Value;

            // the members actually used when processing the atom group are not the ones defined in the rule file (usually because of equivalent atoms definitions)
            if (runningMembers != null) {
                for(int i=0; i < runningMembers.Length; i++) sortedMembers.Add(GetMemberSortedIndex(runningMembers, i), runningMembers[i]);
            }

            orderedMembers = sortedMembers.Values;

            allAtoms = new List<Atom>();
            foreach(object member in orderedMembers) {
                if (member is Atom) allAtoms.Add((Atom)member);
                else if (member is AtomGroup) allAtoms.AddRange(((AtomGroup)member).AllAtoms);
            }
        }
コード例 #28
0
        /// <summary>
        /// Gets all User data source names for the local machine.
        /// </summary>
        public SortedList GetUserDataSourceNames()
        {
            System.Collections.SortedList dsnList = new System.Collections.SortedList();

            // get user dsn's
            Microsoft.Win32.RegistryKey reg = (Microsoft.Win32.Registry.CurrentUser).OpenSubKey("Software");
            if (reg != null)
            {
                reg = reg.OpenSubKey("ODBC");
                if (reg != null)
                {
                    reg = reg.OpenSubKey("ODBC.INI");
                    if (reg != null)
                    {
                        reg = reg.OpenSubKey("ODBC Data Sources");
                        if (reg != null)
                        {
                            // Get all DSN entries defined in DSN_LOC_IN_REGISTRY.
                            foreach (string sName in reg.GetValueNames())
                            {
                                dsnList.Add(sName, DataSourceType.User);
                            }
                        }
                        try
                        {
                            reg.Close();
                        }
                        catch { /* ignore this exception if we couldn't close */ }
                    }
                }
            }

            return(dsnList);
        }
コード例 #29
0
        public static Match[] FindSubstrings(string source, string matchPattern, bool findAllUnique)
        {
            SortedList uniqueMatches = new SortedList();
            Match[] retArray = null;

            Regex RE = new Regex(matchPattern, RegexOptions.Multiline);
            MatchCollection theMatches = RE.Matches(source);

            if (findAllUnique)
            {
                for (int counter = 0; counter < theMatches.Count; counter++)
                {
                    if (!uniqueMatches.ContainsKey(theMatches[counter].Value))
                    {
                        uniqueMatches.Add(theMatches[counter].Value,
                                          theMatches[counter]);
                    }
                }

                retArray = new Match[uniqueMatches.Count];
                uniqueMatches.Values.CopyTo(retArray, 0);
            }
            else
            {
                retArray = new Match[theMatches.Count];
                theMatches.CopyTo(retArray, 0);
            }

            return (retArray);
        }
コード例 #30
0
        public void ComputeTrendTest(SortedList<int, double> years, int currentYear)
        {
            var map = new ExtractValuesForIndicatorsMapper();
            var data = new SortedList<int, double>();
            double[] inflationVal ={100.764370305146,104.476042578907,
            164.776810573524,343.810676313218,626.718592068498,672.180651051974,
            90.0966050749321,131.327020980362,342.955110191569,3079.8097030531,
            2313.96466339751,171.671696468307,24.8999485988254,10.6114940961306,
            4.17734724367,3.37611684980121,0.155695900742245,0.527258257063252
            ,0.920336467095566,-1.16689546970002,-0.935939411978723,-1.06663550777849,
            25.8684978656633,13.4428492915644,4.41571792341912,9.63939954620811,
            10.901124534884,
            8.83141298885049};
            int length = inflationVal.Count();

            int year = 2007;
            for (int i = length - 1; i >= 0; i--)
            {
                data.Add(year, inflationVal[i]);
                year--;
            }
            Assert.IsTrue( map.ComputeTrend(data, 1998)<1);
            Assert.IsTrue( map.ComputeTrend(data, 1999)<1);
            Assert.IsTrue( map.ComputeTrend(data, 2000)<1);
            Assert.IsTrue( map.ComputeTrend(data, 2001)<1);
             Assert.IsTrue(map.ComputeTrend(data, 2002)>1);
            Assert.IsTrue(map.ComputeTrend(data, 2003)>1);
            
        }
コード例 #31
0
ファイル: SorterTest.cs プロジェクト: telefunkenvf14/Orc.Sort
        public void SortTest()
        {
            var rnd = new Random();
            var list = new int[1000];
            int i;

            for (i = 0; i < list.Length; ++i)
            {
                list[i] = rnd.Next();
            }

            // create sorted list
#if (SILVERLIGHT)
            var sortedList = new TreeDictionary<int, object>();
#else
            var sortedList = new SortedList();
#endif

            foreach (int key in list)
            {
                sortedList.Add(key, null);
            }

            // sort table
            this.Sorter.Sort(list);

            Assert.AreEqual(sortedList.Keys, list);
        }
コード例 #32
0
        private Image GetAny()
        {
            Image  oPic;
            string sname;

            System.Collections.SortedList filelist = new System.Collections.SortedList();
            foreach (string newname in oExt.ArchiveFileNames)
            {
                if (IsImage(newname))
                {
                    filelist.Add(newname, newname);
                }
            }
            sname = Convert.ToString(filelist.GetByIndex(0));
            Random anyimageindex = new Random();

            sname = Convert.ToString(filelist.GetByIndex(anyimageindex.Next(filelist.Count)));
            Stream iStream = new System.IO.MemoryStream();

            try
            {
                oExt.ExtractFile(sname, iStream);
            }
            catch (Exception ex)
            {
                ComicError("Connot extract " + sname + " from " + currentFile);
                ComicError(ex.Message);
                return(null);
            }
            oPic = System.Drawing.Bitmap.FromStream(iStream);
            return(oPic);
        }
コード例 #33
0
        private void RefreshRelatoriosNormal()
        {
            System.Windows.Forms.ListViewItem lviItem;
            System.Collections.SortedList     sortLstRelatorios = new System.Collections.SortedList();

            m_lvCriados.Columns[0].Width = m_lvCriados.Width - 20;

            m_lvCriados.Items.Clear();

            // Ordenando e Dividindo os Relatorios
            mdlDataBaseAccess.Tabelas.XsdTbRelatorios.tbRelatoriosRow dtrwRelatorio;
            for (int nCont = 0; nCont < m_typDatSetTbRelatorios.tbRelatorios.Rows.Count; nCont++)
            {
                dtrwRelatorio = (mdlDataBaseAccess.Tabelas.XsdTbRelatorios.tbRelatoriosRow)m_typDatSetTbRelatorios.tbRelatorios.Rows[nCont];
                if (dtrwRelatorio.nIdRelatorio > 0 && dtrwRelatorio.nIdExportador == m_nIdExportador)
                {                 // Normal
                    if (!sortLstRelatorios.Contains(dtrwRelatorio.strNomeRelatorio))
                    {
                        sortLstRelatorios.Add(dtrwRelatorio.strNomeRelatorio, dtrwRelatorio);
                    }
                }
            }

            // Inserindo os Relatorios na Lista View
            for (int nCont = 0; nCont < sortLstRelatorios.Count; nCont++)
            {
                dtrwRelatorio = (mdlDataBaseAccess.Tabelas.XsdTbRelatorios.tbRelatoriosRow)sortLstRelatorios.GetByIndex(nCont);
                lviItem       = m_lvCriados.Items.Add(dtrwRelatorio.strNomeRelatorio);
                lviItem.Tag   = dtrwRelatorio.nIdRelatorio;
            }
        }
コード例 #34
0
        /// <summary>
        /// Returns a list of data source names from the local machine.
        /// </summary>
        public SortedList GetAllDataSourceNames()
        {
            // Get the list of user DSN's first.
            System.Collections.SortedList dsnList = GetUserDataSourceNames();

            // Get list of System DSN's and add them to the first list.
            System.Collections.SortedList systemDsnList = GetSystemDataSourceNames();
            for (int i = 0; i < systemDsnList.Count; i++)
            {
                string         sName = systemDsnList.GetKey(i) as string;
                DataSourceType type  = (DataSourceType)systemDsnList.GetByIndex(i);
                try
                {
                    // This dsn to the master list
                    dsnList.Add(sName, type);
                }
                catch
                {
                    // An exception can be thrown if the key being added is a duplicate so
                    // we just catch it here and have to ignore it.
                }
            }

            return(dsnList);
        }
コード例 #35
0
        private void RefreshRelatoriosPadrao()
        {
            System.Windows.Forms.ListViewItem lviItem;
            System.Collections.SortedList     sortLstRelatoriosPadrao = new System.Collections.SortedList();

            m_lvPadrao.Columns[0].Width = m_lvPadrao.Width - 20;

            m_lvPadrao.Items.Clear();

            // Ordenando e Dividindo os Relatorios
            mdlDataBaseAccess.Tabelas.XsdTbRelatorios.tbRelatoriosRow dtrwRelatorio;
            for (int nCont = 0; nCont < m_typDatSetTbRelatoriosPadrao.tbRelatorios.Rows.Count; nCont++)
            {
                dtrwRelatorio = (mdlDataBaseAccess.Tabelas.XsdTbRelatorios.tbRelatoriosRow)m_typDatSetTbRelatoriosPadrao.tbRelatorios.Rows[nCont];
                if (dtrwRelatorio.nIdRelatorio < 1)
                {                 // Padrao
                    if (!sortLstRelatoriosPadrao.Contains(dtrwRelatorio.strNomeRelatorio))
                    {
                        sortLstRelatoriosPadrao.Add(dtrwRelatorio.strNomeRelatorio, dtrwRelatorio);
                    }
                }
            }

            // Inserindo os Relatorios na Lista View
            for (int nCont = 0; nCont < sortLstRelatoriosPadrao.Count; nCont++)
            {
                dtrwRelatorio = (mdlDataBaseAccess.Tabelas.XsdTbRelatorios.tbRelatoriosRow)sortLstRelatoriosPadrao.GetByIndex(nCont);
                lviItem       = m_lvPadrao.Items.Add(dtrwRelatorio.strNomeRelatorio);
                lviItem.Tag   = dtrwRelatorio.nIdRelatorio;
                lviItem.Font  = new System.Drawing.Font(lviItem.Font, System.Drawing.FontStyle.Bold);
            }
        }
コード例 #36
0
        public void MethodSortedList()
        {
            sl.Add("key", "SortedObject");
            int index = sl.IndexOfKey("key");

            if (!(sl["key"].Equals("SortedObject")))
            {
                Environment.Exit(-1);
            }

            if (!(sl.GetByIndex(index).Equals("SortedObject")))
            {
                Environment.Exit(-1);
            }

            sl["key"] = "NewSortedObject";
            if (!(sl["key"].Equals("NewSortedObject")))
            {
                Environment.Exit(-1);
            }

            if (!(sl.GetByIndex(index).Equals("NewSortedObject")))
            {
                Environment.Exit(-1);
            }
        }
コード例 #37
0
    public void debugLocations()
    {
        int activeAttr, maxLength;

        GL.GetProgram(m_programID, GetProgramParameterName.ActiveAttributes, out activeAttr);
        GL.GetProgram(m_programID, GetProgramParameterName.ActiveAttributeMaxLength, out maxLength);
        System.Collections.SortedList info = new System.Collections.SortedList();

        for (int i = 0; i < activeAttr; i++)
        {
            int size, length;
            ActiveAttribType          type;
            System.Text.StringBuilder name = new System.Text.StringBuilder(maxLength);

            GL.GetActiveAttrib(m_programID, i, maxLength, out length, out size, out type, name);
            int location = GL.GetAttribLocation(m_programID, name.ToString());
            info.Add((location >= 0) ? location : (location * i),
                     String.Format("{0} {1} is at location {2}, size {3}",
                                   type.ToString(),
                                   name,
                                   location,
                                   size)
                     );
        }
        foreach (int key in info.Keys)
        {
            Console.WriteLine(info [key]);
        }
    }
コード例 #38
0
        private void AddInfo(SortedList<double, ArrayList> timingInfos, TimingInfo newInfo)
        {
            if (!timingInfos.ContainsKey(newInfo.Fps))
            {
                timingInfos.Add(newInfo.Fps, new ArrayList());
            }

            bool found = false;
            foreach (TimingInfo info in timingInfos[newInfo.Fps])
            {
                if (info.T1Value == newInfo.T1Value && info.T2Value == newInfo.T2Value)
                {
                    found = true;
                }
                if (info.T2Value == newInfo.T1Value && info.T1Value == newInfo.T2Value)
                {
                    //found = true;
                }
            }

            if (!found)
            {
                timingInfos[newInfo.Fps].Add(newInfo);
            }
        }
コード例 #39
0
        /// <summary>
        /// Returns a portion of the list whose keys are greater that the lowerLimit parameter less than the upperLimit parameter.
        /// </summary>
        /// <param name="l">The list where the portion will be extracted.</param>
        /// <param name="limit">The start element of the portion to extract.</param>
        /// <param name="limit">The end element of the portion to extract.</param>
        /// <returns>The portion of the collection.</returns>
        public static System.Collections.SortedList SubMap(System.Collections.SortedList list, System.Object lowerLimit, System.Object upperLimit)
        {
            System.Collections.Comparer   comparer = System.Collections.Comparer.Default;
            System.Collections.SortedList newList  = new System.Collections.SortedList();

            if (list != null)
            {
                if ((list.Count > 0) && (!(lowerLimit.Equals(upperLimit))))
                {
                    int index = 0;
                    while (comparer.Compare(list.GetKey(index), lowerLimit) < 0)
                    {
                        index++;
                    }

                    for (; index < list.Count; index++)
                    {
                        if (comparer.Compare(list.GetKey(index), upperLimit) >= 0)
                        {
                            break;
                        }

                        newList.Add(list.GetKey(index), list[list.GetKey(index)]);
                    }
                }
            }

            return(newList);
        }
コード例 #40
0
        internal void Add(GridItem grid_item)
        {
            string key = grid_item.Label;

            while (list.ContainsKey(key))
            {
                key += "_";
            }
            list.Add(key, grid_item);
        }
コード例 #41
0
ファイル: PlotSurface2D.cs プロジェクト: ratiel/Vindictus
 /// <summary>
 /// If a plot is removed, then the ordering_ list needs to be
 /// recalculated.
 /// </summary>
 private void RefreshZOrdering()
 {
     uniqueCounter_ = 0;
     ordering_      = new SortedList();
     for (int i = 0; i < zPositions_.Count; ++i)
     {
         double zpos     = Convert.ToDouble(zPositions_[i]);
         double fraction = (double)(++uniqueCounter_) / 10000000.0f;
         double d        = zpos + fraction;
         ordering_.Add(d, i);
     }
 }
コード例 #42
0
 //---------------------------------------------------------------------
 public string AddListener(string ServiceAddress_in, int ServicePort_in, SocketHandler SocketHandler_in)
 {
     System.Net.IPHostEntry lipa = System.Net.Dns.GetHostEntry(ServiceAddress_in);
     System.Net.IPEndPoint  lep  = new System.Net.IPEndPoint(lipa.AddressList[0], ServicePort_in);
     SocketHandler_in.Manager    = this;
     SocketHandler_in.Socket     = new System.Net.Sockets.Socket(lep.Address.AddressFamily, System.Net.Sockets.SocketType.Stream, System.Net.Sockets.ProtocolType.Tcp);
     SocketHandler_in.SocketType = "L";
     try
     {
         SocketHandler_in.Socket.Bind(lep);
         SocketHandler_in.Socket.Listen(1000);
         Sockets.Add(SocketHandler_in.SocketID, SocketHandler_in);
         //TraceText("T", "SocketManager::AddListener", "Waiting for a connection on [" & lep.ToString() & "].")
         SocketHandler_in.Socket.BeginAccept(Callback_Accept_, SocketHandler_in);
     }
     catch (Exception ex)
     {
         //TraceText("E", "SocketManager::AddListener", ex.ToString())
         return(null);
     }
     return(SocketHandler_in.SocketID);
 }
コード例 #43
0
        /// <summary>
        /// 导出Excel
        /// </summary>
        /// <param name="dgv"></param>
        /// <param name="filePath"></param>
        public static void ExportExcel(DataTable dtSource, Stream excelStream)
        {
            _listColumnsName = new SortedList(new NoSort());
            for (int i = 0; i < dtSource.Columns.Count; i++)
            {
                _listColumnsName.Add(dtSource.Columns[i].ColumnName, dtSource.Columns[i].ColumnName);
            }

            HSSFWorkbook excelWorkbook = CreateExcelFile();

            InsertRow(dtSource, excelWorkbook);
            SaveExcelFile(excelWorkbook, excelStream);
        }
コード例 #44
0
        private void addLevelSide(
            MamdaOrderBookPriceLevel level,
            TreeMap bookSide)
        {
            MamaPrice price = level.getPrice();

            if (!bookSide.ContainsKey(price))
            {
                bookSide.Add(price, level);
            }
            else
            {
                bookSide[price] = level;                 // Overwrite it anyway
            }
        }
コード例 #45
0
    public void AddPoint(Vector3 r, Vector3 v, float t)
    {
        Tpoint tpoint = new Tpoint();

        tpoint.r = r;
        tpoint.v = v;
        tpoint.t = t;
        // Slow launching rocket can end up at same point for two frames - avoid adding a duplicate
        // Performance: Is there a way to not add an if inside a highly used method?
        try {
            tpoints.Add(tpoint, tpoint);
        } catch (System.ArgumentException) {
            // just skip this point if it already exists
        }
    }
コード例 #46
0
ファイル: mcMainForm.cs プロジェクト: rburchell/obsidian
        public mcServer AddServer()
        {
            mcServer Server = new mcServer();

            System.Random Rnd = new Random();

            /*
             * generate a random key.
             * this should break out eventually.
             */
            for (;;)
            {
                //100 chars should be sufficient entropy ;)...
                Server.HashKey = Server.HashKey + Rnd.Next(500000).ToString();
                if (!Servers.Contains(Server.HashKey))
                {
                    //we have generated a unique hashkey
                    Server.ServerPage.MyNode.Tag = Server.HashKey;
                    TreeNode lvi = new      TreeNode("My Status");
                    lvi.Tag = Server.HashKey;
                    tvcWindows.Nodes.Add(lvi);
                    Server.ServerPage.MyNode = lvi;

                    lvi     = new TreeNode("My Channels");
                    lvi.Tag = Server.HashKey;
                    Server.ServerPage.MyNode.Nodes.Add(lvi);
                    Server.ServerPage.ChannelsNode = lvi;

                    lvi     = new TreeNode("My Messages");
                    lvi.Tag = Server.HashKey;
                    Server.ServerPage.MyNode.Nodes.Add(lvi);
                    Server.ServerPage.MessagesNode = lvi;

                    lvi     = new TreeNode("My Buddies");
                    lvi.Tag = Server.HashKey;
                    Server.ServerPage.MyNode.Nodes.Add(lvi);
                    Server.ServerPage.BuddiesNode = lvi;

                    Servers.Add(Server.HashKey, Server);

                    this.tvcWindows.ExpandAll();

                    //fix: select this Server as active.
                    this.tvcWindows_AfterSelect(this, new TreeViewEventArgs(Server.ServerPage.MyNode, TreeViewAction.ByMouse));
                    return(Server);
                }
            }
        }
コード例 #47
0
 static public int Add(IntPtr l)
 {
     try {
         System.Collections.SortedList self = (System.Collections.SortedList)checkSelf(l);
         System.Object a1;
         checkType(l, 2, out a1);
         System.Object a2;
         checkType(l, 3, out a2);
         self.Add(a1, a2);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #48
0
        private void updateLevelSide(
            MamdaOrderBookPriceLevel level,
            TreeMap bookSide)
        {
            MamaPrice price = level.getPrice();

            if (bookSide.ContainsKey(price))
            {
                MamdaOrderBookPriceLevel fullBookLevel =
                    bookSide[price] as MamdaOrderBookPriceLevel;

                /*Iterate over the entries in the update and apply them to the
                 * full book level according to action*/
                foreach (MamdaOrderBookEntry deltaEntry in level)
                {
                    switch (deltaEntry.getAction())
                    {
                    case MamdaOrderBookEntry.Actions.Add:
                        fullBookLevel.addEntry(deltaEntry);
                        break;

                    case MamdaOrderBookEntry.Actions.Update:
                        fullBookLevel.updateEntry(deltaEntry);
                        break;

                    case MamdaOrderBookEntry.Actions.Delete:
                        fullBookLevel.removeEntry(deltaEntry);
                        break;

                    case MamdaOrderBookEntry.Actions.Unknown:
                        /*Do nothing*/
                        break;

                    default:
                        /*Do nothing*/
                        break;
                    }
                }
                /*Update the details for the level itself*/
                fullBookLevel.setDetails(level);
            }
            else
            {
                bookSide.Add(price, level);                 // Add it anyway
            }
        }
コード例 #49
0
ファイル: PlotSurface2D.cs プロジェクト: ratiel/Vindictus
        /// <summary>
        /// Adds a drawable object to the plot surface against the specified axes. If
        /// the object is an IPlot, the PlotSurface2D axes will also be updated.
        /// </summary>
        /// <param name="p">the IDrawable object to add to the plot surface</param>
        /// <param name="xp">the x-axis to add the plot against.</param>
        /// <param name="yp">the y-axis to add the plot against.</param>
        /// <param name="zOrder">The z-ordering when drawing (objects with lower numbers are drawn first)</param>
        public void Add(IDrawable p, XAxisPosition xp, YAxisPosition yp, int zOrder)
        {
            drawables_.Add(p);
            xAxisPositions_.Add(xp);
            yAxisPositions_.Add(yp);
            zPositions_.Add((double)zOrder);
            // fraction is to make key unique. With 10 million plots at same z, this buggers up..
            double fraction = (double)(++uniqueCounter_) / 10000000.0f;

            ordering_.Add((double)zOrder + fraction, drawables_.Count - 1);

            // if p is just an IDrawable, then it can't affect the axes.
            if (p is IPlot)
            {
                UpdateAxes(false);
            }
        }
コード例 #50
0
        /// <summary>
        /// Returns a portion of the list whose keys are less than the limit object parameter.
        /// </summary>
        /// <param name="l">The list where the portion will be extracted.</param>
        /// <param name="limit">The end element of the portion to extract.</param>
        /// <returns>The portion of the collection whose elements are less than the limit object parameter.</returns>
        public static System.Collections.SortedList HeadMap(System.Collections.SortedList l, System.Object limit)
        {
            System.Collections.Comparer   comparer = System.Collections.Comparer.Default;
            System.Collections.SortedList newList  = new System.Collections.SortedList();

            for (int i = 0; i < l.Count; i++)
            {
                if (comparer.Compare(l.GetKey(i), limit) >= 0)
                {
                    break;
                }

                newList.Add(l.GetKey(i), l[l.GetKey(i)]);
            }

            return(newList);
        }
コード例 #51
0
        ///////////////////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// A message handler for when the user releases the mouse button over the font image
        /// </summary>
        ///////////////////////////////////////////////////////////////////////////////////////////
        private void pictureBoxZoomFontImage_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            // We are only handling left click right now
            if (e.Button != MouseButtons.Left)
            {
                return;
            }

            // If we are setting a glyph
            if (m_IsDraggingGlyph)
            {
                // Make sure the rectangle has positive values to be safe
                if (m_DraggingGlyphRect.Width < 0)
                {
                    m_DraggingGlyphRect.X     = m_DraggingGlyphRect.X + m_DraggingGlyphRect.Width;
                    m_DraggingGlyphRect.Width = (0 - m_DraggingGlyphRect.Width) + 1;
                }

                // Store the rectangle
                char curChar = (char)m_CurUnicodeChar;
                if (m_AddedChars.Contains(curChar))
                {
                    m_AddedChars[curChar] = m_DraggingGlyphRect;
                }
                else
                {
                    m_AddedChars.Add(curChar, m_DraggingGlyphRect);
                    labelFontChars.Text += curChar;
                }
                m_IsDraggingGlyph = false;

                // Step to the next character
                IncrementCurCharacter();
            }

            // We can't be dragging anymore
            m_DraggingStripIndex = -1;
            m_IsDraggingGlyph    = false;

            // Redraw
            pictureBoxZoomFontImage.Refresh();
        }
コード例 #52
0
        private Image GetCover()
        {
            Image  oPic  = null;
            string sname = "";
            int    xfile = 0;

            System.Collections.SortedList filelist = new System.Collections.SortedList();
            foreach (string newname in oExt.ArchiveFileNames)
            {
                if (IsImage(newname))
                {
                    filelist.Add(newname, newname);
                }
            }
            sname = Convert.ToString(filelist.GetByIndex(0));
            if (oExt.ArchiveFileNames.Contains("ComicInfo.xml"))
            {
                MemoryStream xmlStream = new MemoryStream();
                oExt.ExtractFile("ComicInfo.xml", xmlStream);
                xmlStream.Position = 0;
                xfile = coverfromxml(xmlStream);
                if (xfile != -1)
                {
                    sname = Convert.ToString(filelist.GetByIndex(xfile));
                }
            }
            Stream iStream = new System.IO.MemoryStream();

            try
            {
                oExt.ExtractFile(sname, iStream);
            }
            catch (Exception ex)
            {
                ComicError("Connot open " + currentFile);
                ComicError(ex.Message);
                return(null);
            }
            oPic = System.Drawing.Bitmap.FromStream(iStream);
            return(oPic);
        }
コード例 #53
0
        protected void CollectParameterNames()
        {
            _ParametersSortedByName = new System.Collections.SortedList();

            int nameposition = 0;

            for (int i = 0; i < InnerList.Count; i++)
            {
                if (null == this[i].FitFunction)
                {
                    continue;
                }
                IFitFunction func = this[i].FitFunction;
                FitElement   ele  = this[i];

                for (int k = 0; k < func.NumberOfParameters; k++)
                {
                    if (!(_ParametersSortedByName.ContainsKey(ele.ParameterName(k))))
                    {
                        _ParametersSortedByName.Add(ele.ParameterName(k), nameposition++);
                    }
                }
            }

            // now sort the items in the order of the namepositions
            System.Collections.SortedList sortedbypos = new System.Collections.SortedList();
            foreach (DictionaryEntry en in _ParametersSortedByName)
            {
                sortedbypos.Add(en.Value, en.Key);
            }


            _parameterNames = new string[sortedbypos.Count];
            for (int i = 0; i < _parameterNames.Length; i++)
            {
                _parameterNames[i] = (string)sortedbypos[i];
            }
        }
コード例 #54
0
ファイル: Form3.cs プロジェクト: PurpleItMX/AgenteConector
        private void Form3_Load(object sender, EventArgs e)
        {
            comboBox1.Items.Clear();
            SortedList listaODBC = new System.Collections.SortedList();

            Microsoft.Win32.RegistryKey reg =
                (Microsoft.Win32.Registry.CurrentUser).OpenSubKey("Software");
            if (reg != null)
            {
                reg = reg.OpenSubKey("ODBC");
                if (reg != null)
                {
                    reg = reg.OpenSubKey("ODBC.INI");
                    if (reg != null)
                    {
                        reg = reg.OpenSubKey("ODBC Data Sources");
                        if (reg != null)
                        {
                            foreach (string sName in reg.GetValueNames())
                            {
                                listaODBC.Add(sName, DataSourceType.User);
                            }
                        }
                        try
                        {
                            reg.Close();
                        }
                        catch { /* ignorar un posible error */ }
                    }
                }
            }

            //agrega lista de obdc a combo
            foreach (DictionaryEntry key in listaODBC)
            {
                comboBox1.Items.Add(key.Key.ToString());
            }
        }
コード例 #55
0
ファイル: SupportClass.cs プロジェクト: karino2/wikipediaconv
    public static System.Collections.SortedList TailMap(System.Collections.SortedList list, System.Object limit)
    {
        System.Collections.Comparer   comparer = System.Collections.Comparer.Default;
        System.Collections.SortedList newList  = new System.Collections.SortedList();

        if (list != null)
        {
            if (list.Count > 0)
            {
                int index = 0;
                while (comparer.Compare(list.GetKey(index), limit) < 0)
                {
                    index++;
                }

                for (; index < list.Count; index++)
                {
                    newList.Add(list.GetKey(index), list[list.GetKey(index)]);
                }
            }
        }

        return(newList);
    }
コード例 #56
0
ファイル: DataPropertyGrid.cs プロジェクト: ximendatie/sensip
        private string CreaCodigoCompleto()
        {
            System.Collections.SortedList ColRelaciones = new System.Collections.SortedList();
            foreach (System.Data.DataTable tabla in this.DS.Tables)
            {
                if (tabla != this.DS.Tables[0])
                {
                    ColRelaciones.Add(tabla.Columns[0].ColumnName, tabla.Columns[1].ColumnName);
                }
            }
            string codigo = @"
using System;
using System.Data;
using System.ComponentModel;
using System.Reflection;

namespace miNamespace {
[TypeConverter(typeof(PropertySorter))]
public class miClase {
			
			private System.Data.DataRow m_Row = null;
";

            foreach (System.Data.DataTable tabla in this.DS.Tables)
            {
                if (tabla != this.DS.Tables[0])
                {
                    codigo += "public System.Collections.Hashtable Col" + tabla.Columns[0].ColumnName + " = new System.Collections.Hashtable();\n";
                    codigo += "public System.Collections.Hashtable _Col" + tabla.Columns[0].ColumnName + " = new System.Collections.Hashtable();\n";
                }
            }

            codigo += @"public miClase(System.Data.DataRow row)
	{
		m_Row = row;
";

            foreach (System.Data.DataTable tabla in this.DS.Tables)
            {
                if (tabla != this.DS.Tables[0])
                {
                    codigo += "foreach(System.Data.DataRow fila in row.Table.DataSet.Tables[\"" + tabla.TableName + "\"].Rows)";
                    codigo += @"{
";
                    codigo += "Col" + tabla.Columns[0].ColumnName + ".Add(Col" + tabla.Columns[0].ColumnName + ".Count,fila[0]);\n";
                    codigo += "_Col" + tabla.Columns[0].ColumnName + ".Add(fila[0],_Col" + tabla.Columns[0].ColumnName + ".Count);\n";
                    codigo += @"}
";
                }
            }

            codigo += "\n";
            foreach (System.Data.DataColumn col in this.Tabla.Columns)
            {
                if (this.ColCampos.ContainsKey(col.ColumnName))
                {
                    if (ColRelaciones.ContainsKey(col.ColumnName))
                    {
                        codigo += "\t\tif(row[\"" + col.ColumnName + "\"] != DBNull.Value)\n";
                        codigo += "\t\t{\n";
                        codigo += "\t\tif(_Col" + col.ColumnName + "[row[\"" + col.ColumnName + "\"]] != null)\n";
                        codigo += "\t\t{\n";
                        codigo += "\t\t\tthis." + this.ColNombreCampos[col.ColumnName].ToString() + " = (" + col.ColumnName + "_Enum)_Col" + col.ColumnName + "[row[\"" + col.ColumnName + "\"]];\n";
                        codigo += "\t\t}\n";
                        codigo += "\t\t}\n";
                    }
                    else
                    {
                        codigo += "\t\tif(row[\"" + col.ColumnName + "\"] != DBNull.Value)\n";
                        codigo += "\t\t{\n";
                        codigo += "\t\t\tthis." + this.ColNombreCampos[col.ColumnName].ToString() + " = (" + col.DataType.UnderlyingSystemType.ToString() + ")row[\"" + col.ColumnName + "\"];\n";
                        codigo += "\t\t}\n";
                    }
                }
            }
            codigo += "}\n";
            foreach (System.Data.DataColumn col in this.Tabla.Columns)
            {
                if (this.ColCampos.ContainsKey(col.ColumnName))
                {
                    if (ColRelaciones.ContainsKey(col.ColumnName))
                    {
                        string campo     = col.ColumnName + "_Enum m_" + ColNombreCampos[col.ColumnName].ToString();
                        string propiedad = col.ColumnName + "_Enum " + ColNombreCampos[col.ColumnName].ToString();
                        codigo += "private " + campo + ";\n";
                        codigo += "[Category(\"" + ColCategorias[col.ColumnName].ToString()
                                  + "\"),Description(\"" + ColDescripciones[col.ColumnName].ToString()
                                  + "\"),PropertyOrder(" + ColOrden[col.ColumnName].ToString()
                                  + "),ReadOnly(" + ColReadOnly[col.ColumnName].ToString().ToLower() + ")]\n";
                        codigo += "public " + propiedad + @"
	{
		get { return m_"         + ColNombreCampos[col.ColumnName].ToString() + @"; }
		set { 
				m_"                 + ColNombreCampos[col.ColumnName].ToString() + @" = (" + col.ColumnName + "_Enum)value;";
                        codigo += "m_Row[\"" + col.ColumnName + "\"] = Col" + col.ColumnName + "[(int)value];";
                        codigo += @"
			}
	}

	"    ;
                    }
                    else
                    {
                        string campo     = col.DataType.UnderlyingSystemType.ToString() + " m_" + ColNombreCampos[col.ColumnName].ToString();
                        string propiedad = col.DataType.UnderlyingSystemType.ToString() + " " + ColNombreCampos[col.ColumnName].ToString();
                        codigo += "private " + campo + ";\n";
                        codigo += "[Category(\"" + ColCategorias[col.ColumnName].ToString()
                                  + "\"),Description(\"" + ColDescripciones[col.ColumnName].ToString()
                                  + "\"),PropertyOrder(" + ColOrden[col.ColumnName].ToString()
                                  + "),ReadOnly(" + ColReadOnly[col.ColumnName].ToString().ToLower() + ")]\n";
                        codigo += @"
	public "     + propiedad + @"
	{
		get { return m_"         + ColNombreCampos[col.ColumnName].ToString() + @"; }
		set { 
				m_"                 + ColNombreCampos[col.ColumnName].ToString() + @" = value;";
                        codigo += "m_Row[\"" + col.ColumnName + "\"] = value;";
                        codigo += @"
			}
	}

	"    ;
                    }
                }
            }
            foreach (System.Data.DataTable tabla in this.DS.Tables)
            {
                if (tabla != this.DS.Tables[0])
                {
                    codigo += @"

		public enum "        ; codigo += tabla.Columns[0].ColumnName + @"_Enum
		{"        ;
                    int i = 0;
                    foreach (System.Data.DataRow fila in tabla.Rows)
                    {
                        codigo += ObtieneEnumeracion(fila[1].ToString()) + " = " + i + ",\n";
                        i++;
                    }
                    codigo += "}";
                }
            }
            codigo += "}}";

            return(codigo);
        }
コード例 #57
0
        protected void Page_Load(object sender, EventArgs e)
        {
            GooglePageBase google = Page as GooglePageBase;

            DataQuery query = new DataQuery();

            query.Ids         = "ga:" + google.Settings.Current.Id;
            query.Metrics     = "ga:visits";
            query.Dimensions  = "ga:visitorType,ga:date";
            query.Sort        = "ga:date";
            query.GAStartDate = DateTime.Now.AddMonths(-1).AddDays(-1).ToString("yyyy-MM-dd");
            query.GAEndDate   = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd");

            if (google.Referringpage != null)
            {
                query.Filters = "ga:pagePath==" + google.Referringpage;
            }

            DataFeed actual = google.Analytics.Query(query);

            System.Data.DataTable nvsr = new System.Data.DataTable("New vs Returning");
            nvsr.Columns.Add("visitorType", typeof(string));
            nvsr.Columns.Add("Visits", typeof(int));

            System.Collections.SortedList visitors = new System.Collections.SortedList();

            System.Data.DataTable nandr = new System.Data.DataTable("New and Returning");
            nandr.Columns.Add("Date");
            nandr.Columns.Add("New Visitor", typeof(int));
            nandr.Columns.Add("Returning Visitor", typeof(int));

            System.Collections.SortedList newvisitors       = new System.Collections.SortedList();
            System.Collections.SortedList returningvisitors = new System.Collections.SortedList();

            foreach (DataEntry entry in actual.Entries)
            {
                try
                {
                    int      visits      = int.Parse(entry.Metrics[0].Value);
                    string   visitorType = entry.Dimensions[0].Value.ToString();
                    DateTime datetime    = new DateTime(int.Parse(entry.Dimensions[1].Value.Substring(0, 4)), int.Parse(entry.Dimensions[1].Value.Substring(4, 2)), int.Parse(entry.Dimensions[1].Value.Substring(6, 2)));
                    string   date        = datetime.ToString("yyyy-MM-dd");
                    //dt.Rows.Add(new object[] { visitorType,visits });

                    if (visitorType.StartsWith("New"))
                    {
                        if (newvisitors.ContainsKey(date))
                        {
                            int current = int.Parse(newvisitors[date].ToString());
                            current          += visits;
                            newvisitors[date] = current;
                        }
                        else
                        {
                            newvisitors.Add(date, visits);
                        }
                    }
                    else
                    {
                        if (returningvisitors.ContainsKey(date))
                        {
                            int current = int.Parse(returningvisitors[date].ToString());
                            current += visits;
                            returningvisitors[date] = current;
                        }
                        else
                        {
                            returningvisitors.Add(date, visits);
                        }
                    }

                    if (visitors.ContainsKey(visitorType))
                    {
                        int current = int.Parse(visitors[visitorType].ToString());
                        current += visits;
                        visitors[visitorType] = current;
                    }
                    else
                    {
                        visitors.Add(visitorType, visits);
                    }
                }
                catch (Exception ex)
                {
                    Response.Write(ex.ToString());
                }
            }

            foreach (String key in visitors.Keys)
            {
                nvsr.Rows.Add(new object[] { key, int.Parse(visitors[key].ToString()) });
            }

            ArrayList keys = new ArrayList();

            keys.AddRange(newvisitors.Keys);
            keys.AddRange(returningvisitors.Keys);

            foreach (object key in keys)
            {
                int _newvisitors       = 0;
                int _returningvisitors = 0;

                if (newvisitors.ContainsKey(key))
                {
                    _newvisitors = int.Parse(newvisitors[key].ToString());
                }
                if (returningvisitors.ContainsKey(key))
                {
                    _returningvisitors = int.Parse(returningvisitors[key].ToString());
                }

                nandr.Rows.Add(new object[] { key, _newvisitors, _returningvisitors });
            }

            this.pie_newvsreturning.GviEnableEvents = true;
            this.pie_newvsreturning.ChartData(nvsr);

            this.area_newvsreturning.GviEnableEvents = true;
            this.area_newvsreturning.ChartData(nandr);
        }
コード例 #58
0
        private TreeMap determineDiffs(
            TreeMap resultSide,
            TreeMap lhs,
            TreeMap rhs,
            bool ascending)
        {
            IEnumerator lhsEnum    = lhs.Values.GetEnumerator();
            IEnumerator rhsEnum    = rhs.Values.GetEnumerator();
            bool        lhsHasNext = lhsEnum.MoveNext();
            bool        rhsHasNext = rhsEnum.MoveNext();

            while (lhsHasNext || rhsHasNext)
            {
                MamdaOrderBookPriceLevel lhsLevel = null;
                MamdaOrderBookPriceLevel rhsLevel = null;
                double lhsPrice = double.MinValue;
                double rhsPrice = double.MinValue;
                long   lhsSize  = 0;
                long   rhsSize  = 0;

                if (lhsHasNext)
                {
                    lhsLevel = (MamdaOrderBookPriceLevel)lhsEnum.Current;
                    lhsPrice = lhsLevel.getPrice().getValue();
                    lhsSize  = lhsLevel.getSize();
                }
                if (rhsHasNext)
                {
                    rhsLevel = (MamdaOrderBookPriceLevel)rhsEnum.Current;
                    rhsPrice = rhsLevel.getPrice().getValue();
                    rhsSize  = rhsLevel.getSize();
                }

                // Compare two doubles using an epsilon
                if ((doubleEquals(lhsPrice, rhsPrice)) && (lhsSize == rhsSize))
                {
                    // Usual scenario: both levels are the same
                    lhsHasNext = lhsEnum.MoveNext();
                    rhsHasNext = rhsEnum.MoveNext();
                    continue;
                }

                if (doubleEquals(lhsPrice, rhsPrice))
                {
                    // Same price, different size.  Need to determine the
                    // different entries.
                    MamdaOrderBookPriceLevel diffLevel = new MamdaOrderBookPriceLevel();
                    diffLevel.setAsDifference(lhsLevel, rhsLevel);
                    resultSide.Add(lhsLevel.getPrice(), diffLevel);
                    lhsHasNext = lhsEnum.MoveNext();
                    rhsHasNext = rhsEnum.MoveNext();
                    continue;
                }

                if (ascending)
                {
                    if (((lhsPrice > rhsPrice) && (rhsPrice != double.MinValue)) || (lhsPrice == double.MinValue))
                    {
                        // RHS has an additional price level
                        MamdaOrderBookPriceLevel diffLevel = new MamdaOrderBookPriceLevel(rhsLevel);
                        resultSide.Add(rhsLevel.getPrice(), diffLevel);
                        rhsHasNext = rhsEnum.MoveNext();
                        continue;
                    }
                    else
                    {
                        // RHS does not have a price level that is on the LHS.
                        // Copy the LHS level and mark all as deleted.
                        MamdaOrderBookPriceLevel diffLevel = new MamdaOrderBookPriceLevel(lhsLevel);
                        resultSide.Add(lhsLevel.getPrice(), diffLevel);
                        lhsHasNext = lhsEnum.MoveNext();
                        continue;
                    }
                }
                else
                {
                    if (((lhsPrice > rhsPrice) && (lhsPrice != double.MinValue)) || (rhsPrice == double.MinValue))
                    {
                        // LHS has an additional price level
                        MamdaOrderBookPriceLevel diffLevel = new MamdaOrderBookPriceLevel(lhsLevel);
                        resultSide.Add(lhsLevel.getPrice(), diffLevel);                         // CHECK: use indexer?
                        lhsHasNext = lhsEnum.MoveNext();
                        continue;
                    }
                    else
                    {
                        // LHS does not have a price level that is on the RHS.
                        // Copy the RHS level and mark all as deleted.
                        MamdaOrderBookPriceLevel diffLevel = new MamdaOrderBookPriceLevel(rhsLevel);
                        resultSide.Add(rhsLevel.getPrice(), diffLevel);                         // CHECK: use indexer?
                        rhsHasNext = rhsEnum.MoveNext();
                        continue;
                    }
                }
            }
            return(resultSide);
        }
コード例 #59
0
    public void Populate()
    {
        #region Types of Keywords

        FieldPublicDynamic = new { PropPublic1 = "A", PropPublic2 = 1, PropPublic3 = "B", PropPublic4 = "B", PropPublic5 = "B", PropPublic6 = "B", PropPublic7 = "B", PropPublic8 = "B", PropPublic9 = "B", PropPublic10 = "B", PropPublic11 = "B", PropPublic12 = new { PropSubPublic1 = 0, PropSubPublic2 = 1, PropSubPublic3 = 2 } };
        FieldPublicObject  = new StringBuilder("Object - StringBuilder");
        FieldPublicInt32   = int.MaxValue;
        FieldPublicInt64   = long.MaxValue;
        FieldPublicULong   = ulong.MaxValue;
        FieldPublicUInt    = uint.MaxValue;
        FieldPublicDecimal = 100000.999999m;
        FieldPublicDouble  = 100000.999999d;
        FieldPublicChar    = 'A';
        FieldPublicByte    = byte.MaxValue;
        FieldPublicBoolean = true;
        FieldPublicSByte   = sbyte.MaxValue;
        FieldPublicShort   = short.MaxValue;
        FieldPublicUShort  = ushort.MaxValue;
        FieldPublicFloat   = 100000.675555f;

        FieldPublicInt32Nullable   = int.MaxValue;
        FieldPublicInt64Nullable   = 2;
        FieldPublicULongNullable   = ulong.MaxValue;
        FieldPublicUIntNullable    = uint.MaxValue;
        FieldPublicDecimalNullable = 100000.999999m;
        FieldPublicDoubleNullable  = 100000.999999d;
        FieldPublicCharNullable    = 'A';
        FieldPublicByteNullable    = byte.MaxValue;
        FieldPublicBooleanNullable = true;
        FieldPublicSByteNullable   = sbyte.MaxValue;
        FieldPublicShortNullable   = short.MaxValue;
        FieldPublicUShortNullable  = ushort.MaxValue;
        FieldPublicFloatNullable   = 100000.675555f;

        #endregion

        #region System

        FieldPublicDateTime         = new DateTime(2000, 1, 1, 1, 1, 1);
        FieldPublicTimeSpan         = new TimeSpan(1, 10, 40);
        FieldPublicEnumDateTimeKind = DateTimeKind.Local;

        // Instantiate date and time using Persian calendar with years,
        // months, days, hours, minutes, seconds, and milliseconds
        FieldPublicDateTimeOffset = new DateTimeOffset(1387, 2, 12, 8, 6, 32, 545,
                                                       new System.Globalization.PersianCalendar(),
                                                       new TimeSpan(1, 0, 0));

        FieldPublicIntPtr         = new IntPtr(100);
        FieldPublicTimeZone       = TimeZone.CurrentTimeZone;
        FieldPublicTimeZoneInfo   = TimeZoneInfo.Utc;
        FieldPublicTuple          = Tuple.Create <string, int, decimal>("T-string\"", 1, 1.1m);
        FieldPublicType           = typeof(object);
        FieldPublicUIntPtr        = new UIntPtr(100);
        FieldPublicUri            = new Uri("http://www.site.com");
        FieldPublicVersion        = new Version(1, 0, 100, 1);
        FieldPublicGuid           = new Guid("d5010f5b-0cd1-44ca-aacb-5678b9947e6c");
        FieldPublicSingle         = Single.MaxValue;
        FieldPublicException      = new Exception("Test error", new Exception("inner exception"));
        FieldPublicEnumNonGeneric = EnumTest.ValueA;
        FieldPublicAction         = () => true.Equals(true);
        FieldPublicAction2        = (a, b) => true.Equals(true);
        FieldPublicFunc           = () => true;
        FieldPublicFunc2          = (a, b) => true;

        #endregion

        #region Arrays and Collections

        FieldPublicArrayUni    = new string[2];
        FieldPublicArrayUni[0] = "[0]";
        FieldPublicArrayUni[1] = "[1]";

        FieldPublicArrayTwo       = new string[2, 2];
        FieldPublicArrayTwo[0, 0] = "[0, 0]";
        FieldPublicArrayTwo[0, 1] = "[0, 1]";
        FieldPublicArrayTwo[1, 0] = "[1, 0]";
        FieldPublicArrayTwo[1, 1] = "[1, 1]";

        FieldPublicArrayThree          = new string[1, 1, 2];
        FieldPublicArrayThree[0, 0, 0] = "[0, 0, 0]";
        FieldPublicArrayThree[0, 0, 1] = "[0, 0, 1]";

        FieldPublicJaggedArrayTwo    = new string[2][];
        FieldPublicJaggedArrayTwo[0] = new string[5] {
            "a", "b", "c", "d", "e"
        };
        FieldPublicJaggedArrayTwo[1] = new string[4] {
            "a1", "b1", "c1", "d1"
        };

        FieldPublicJaggedArrayThree          = new string[1][][];
        FieldPublicJaggedArrayThree[0]       = new string[1][];
        FieldPublicJaggedArrayThree[0][0]    = new string[2];
        FieldPublicJaggedArrayThree[0][0][0] = "[0][0][0]";
        FieldPublicJaggedArrayThree[0][0][1] = "[0][0][1]";

        FieldPublicMixedArrayAndJagged = new int[3][, ]
        {
            new int[, ] {
                { 1, 3 }, { 5, 7 }
            },
            new int[, ] {
                { 0, 2 }, { 4, 6 }, { 8, 10 }
            },
            new int[, ] {
                { 11, 22 }, { 99, 88 }, { 0, 9 }
            }
        };

        FieldPublicDictionary = new System.Collections.Generic.Dictionary <string, string>();
        FieldPublicDictionary.Add("Key1", "Value1");
        FieldPublicDictionary.Add("Key2", "Value2");
        FieldPublicDictionary.Add("Key3", "Value3");
        FieldPublicDictionary.Add("Key4", "Value4");

        FieldPublicList = new System.Collections.Generic.List <int>();
        FieldPublicList.Add(0);
        FieldPublicList.Add(1);
        FieldPublicList.Add(2);

        FieldPublicQueue = new System.Collections.Generic.Queue <int>();
        FieldPublicQueue.Enqueue(10);
        FieldPublicQueue.Enqueue(11);
        FieldPublicQueue.Enqueue(12);

        FieldPublicHashSet = new System.Collections.Generic.HashSet <string>();
        FieldPublicHashSet.Add("HashSet1");
        FieldPublicHashSet.Add("HashSet2");

        FieldPublicSortedSet = new System.Collections.Generic.SortedSet <string>();
        FieldPublicSortedSet.Add("SortedSet1");
        FieldPublicSortedSet.Add("SortedSet2");
        FieldPublicSortedSet.Add("SortedSet3");

        FieldPublicStack = new System.Collections.Generic.Stack <string>();
        FieldPublicStack.Push("Stack1");
        FieldPublicStack.Push("Stack2");
        FieldPublicStack.Push("Stack3");

        FieldPublicLinkedList = new System.Collections.Generic.LinkedList <string>();
        FieldPublicLinkedList.AddFirst("LinkedList1");
        FieldPublicLinkedList.AddLast("LinkedList2");
        FieldPublicLinkedList.AddAfter(FieldPublicLinkedList.Find("LinkedList1"), "LinkedList1.1");

        FieldPublicObservableCollection = new System.Collections.ObjectModel.ObservableCollection <string>();
        FieldPublicObservableCollection.Add("ObservableCollection1");
        FieldPublicObservableCollection.Add("ObservableCollection2");

        FieldPublicKeyedCollection = new MyDataKeyedCollection();
        FieldPublicKeyedCollection.Add(new MyData()
        {
            Data = "data1", Id = 0
        });
        FieldPublicKeyedCollection.Add(new MyData()
        {
            Data = "data2", Id = 1
        });

        var list = new List <string>();
        list.Add("list1");
        list.Add("list2");
        list.Add("list3");

        FieldPublicReadOnlyCollection = new ReadOnlyCollection <string>(list);

        FieldPublicReadOnlyDictionary           = new ReadOnlyDictionary <string, string>(FieldPublicDictionary);
        FieldPublicReadOnlyObservableCollection = new ReadOnlyObservableCollection <string>(FieldPublicObservableCollection);
        FieldPublicCollection = new Collection <string>();
        FieldPublicCollection.Add("collection1");
        FieldPublicCollection.Add("collection2");
        FieldPublicCollection.Add("collection3");

        FieldPublicArrayListNonGeneric = new System.Collections.ArrayList();
        FieldPublicArrayListNonGeneric.Add(1);
        FieldPublicArrayListNonGeneric.Add("a");
        FieldPublicArrayListNonGeneric.Add(10.0m);
        FieldPublicArrayListNonGeneric.Add(new DateTime(2000, 01, 01));

        FieldPublicBitArray    = new System.Collections.BitArray(3);
        FieldPublicBitArray[2] = true;

        FieldPublicSortedList = new System.Collections.SortedList();
        FieldPublicSortedList.Add("key1", 1);
        FieldPublicSortedList.Add("key2", 2);
        FieldPublicSortedList.Add("key3", 3);
        FieldPublicSortedList.Add("key4", 4);

        FieldPublicHashtableNonGeneric = new System.Collections.Hashtable();
        FieldPublicHashtableNonGeneric.Add("key1", 1);
        FieldPublicHashtableNonGeneric.Add("key2", 2);
        FieldPublicHashtableNonGeneric.Add("key3", 3);
        FieldPublicHashtableNonGeneric.Add("key4", 4);

        FieldPublicQueueNonGeneric = new System.Collections.Queue();
        FieldPublicQueueNonGeneric.Enqueue("QueueNonGeneric1");
        FieldPublicQueueNonGeneric.Enqueue("QueueNonGeneric2");
        FieldPublicQueueNonGeneric.Enqueue("QueueNonGeneric3");

        FieldPublicStackNonGeneric = new System.Collections.Stack();
        FieldPublicStackNonGeneric.Push("StackNonGeneric1");
        FieldPublicStackNonGeneric.Push("StackNonGeneric2");

        FieldPublicIEnumerable = FieldPublicSortedList;

        FieldPublicBlockingCollection = new System.Collections.Concurrent.BlockingCollection <string>();
        FieldPublicBlockingCollection.Add("BlockingCollection1");
        FieldPublicBlockingCollection.Add("BlockingCollection2");

        FieldPublicConcurrentBag = new System.Collections.Concurrent.ConcurrentBag <string>();
        FieldPublicConcurrentBag.Add("ConcurrentBag1");
        FieldPublicConcurrentBag.Add("ConcurrentBag2");
        FieldPublicConcurrentBag.Add("ConcurrentBag3");

        FieldPublicConcurrentDictionary = new System.Collections.Concurrent.ConcurrentDictionary <string, int>();
        FieldPublicConcurrentDictionary.GetOrAdd("ConcurrentDictionary1", 0);
        FieldPublicConcurrentDictionary.GetOrAdd("ConcurrentDictionary2", 0);

        FieldPublicConcurrentQueue = new System.Collections.Concurrent.ConcurrentQueue <string>();
        FieldPublicConcurrentQueue.Enqueue("ConcurrentQueue1");
        FieldPublicConcurrentQueue.Enqueue("ConcurrentQueue2");

        FieldPublicConcurrentStack = new System.Collections.Concurrent.ConcurrentStack <string>();
        FieldPublicConcurrentStack.Push("ConcurrentStack1");
        FieldPublicConcurrentStack.Push("ConcurrentStack2");

        // FieldPublicOrderablePartitioner = new OrderablePartitioner();
        // FieldPublicPartitioner;
        // FieldPublicPartitionerNonGeneric;

        FieldPublicHybridDictionary = new System.Collections.Specialized.HybridDictionary();
        FieldPublicHybridDictionary.Add("HybridDictionaryKey1", "HybridDictionary1");
        FieldPublicHybridDictionary.Add("HybridDictionaryKey2", "HybridDictionary2");

        FieldPublicListDictionary = new System.Collections.Specialized.ListDictionary();
        FieldPublicListDictionary.Add("ListDictionaryKey1", "ListDictionary1");
        FieldPublicListDictionary.Add("ListDictionaryKey2", "ListDictionary2");
        FieldPublicNameValueCollection = new System.Collections.Specialized.NameValueCollection();
        FieldPublicNameValueCollection.Add("Key1", "Value1");
        FieldPublicNameValueCollection.Add("Key2", "Value2");

        FieldPublicOrderedDictionary = new System.Collections.Specialized.OrderedDictionary();
        FieldPublicOrderedDictionary.Add(1, "OrderedDictionary1");
        FieldPublicOrderedDictionary.Add(2, "OrderedDictionary1");
        FieldPublicOrderedDictionary.Add("OrderedDictionaryKey2", "OrderedDictionary2");

        FieldPublicStringCollection = new System.Collections.Specialized.StringCollection();
        FieldPublicStringCollection.Add("StringCollection1");
        FieldPublicStringCollection.Add("StringCollection2");

        #endregion

        #region Several

        PropXmlDocument = new XmlDocument();
        PropXmlDocument.LoadXml("<xml>something</xml>");

        var tr = new StringReader("<Root>Content</Root>");
        PropXDocument         = XDocument.Load(tr);
        PropStream            = GenerateStreamFromString("Stream");
        PropBigInteger        = new System.Numerics.BigInteger(100);
        PropStringBuilder     = new StringBuilder("StringBuilder");
        FieldPublicIQueryable = new List <string>()
        {
            "IQueryable"
        }.AsQueryable();

        #endregion

        #region Custom

        FieldPublicMyCollectionPublicGetEnumerator           = new MyCollectionPublicGetEnumerator("a b c", new char[] { ' ' });
        FieldPublicMyCollectionInheritsPublicGetEnumerator   = new MyCollectionInheritsPublicGetEnumerator("a b c", new char[] { ' ' });
        FieldPublicMyCollectionExplicitGetEnumerator         = new MyCollectionExplicitGetEnumerator("a b c", new char[] { ' ' });
        FieldPublicMyCollectionInheritsExplicitGetEnumerator = new MyCollectionInheritsExplicitGetEnumerator("a b c", new char[] { ' ' });
        FieldPublicMyCollectionInheritsTooIEnumerable        = new MyCollectionInheritsTooIEnumerable("a b c", new char[] { ' ' });

        FieldPublicEnumSpecific = EnumTest.ValueB;
        MyDelegate            = MethodDelegate;
        EmptyClass            = new EmptyClass();
        StructGeneric         = new ThreeTuple <int>(0, 1, 2);
        StructGenericNullable = new ThreeTuple <int>(0, 1, 2);
        FieldPublicNullable   = new Nullable <ThreeTuple <int> >(StructGeneric);

        #endregion
    }
コード例 #60
0
ファイル: Identifier.cs プロジェクト: lijint/DHRQ
        private Image _PIC_Image;                 //照片

        public clsEDZ()
        {
            lstMZ.Add("01", "汉族");
            lstMZ.Add("02", "蒙古族");
            lstMZ.Add("03", "回族");
            lstMZ.Add("04", "藏族");
            lstMZ.Add("05", "维吾尔族");
            lstMZ.Add("06", "苗族");
            lstMZ.Add("07", "彝族");
            lstMZ.Add("08", "壮族");
            lstMZ.Add("09", "布依族");
            lstMZ.Add("10", "朝鲜族");
            lstMZ.Add("11", "满族");
            lstMZ.Add("12", "侗族");
            lstMZ.Add("13", "瑶族");
            lstMZ.Add("14", "白族");
            lstMZ.Add("15", "土家族");
            lstMZ.Add("16", "哈尼族");
            lstMZ.Add("17", "哈萨克族");
            lstMZ.Add("18", "傣族");
            lstMZ.Add("19", "黎族");
            lstMZ.Add("20", "傈僳族");
            lstMZ.Add("21", "佤族");
            lstMZ.Add("22", "畲族");
            lstMZ.Add("23", "高山族");
            lstMZ.Add("24", "拉祜族");
            lstMZ.Add("25", "水族");
            lstMZ.Add("26", "东乡族");
            lstMZ.Add("27", "纳西族");
            lstMZ.Add("28", "景颇族");
            lstMZ.Add("29", "柯尔克孜族");
            lstMZ.Add("30", "土族");
            lstMZ.Add("31", "达翰尔族");
            lstMZ.Add("32", "仫佬族");
            lstMZ.Add("33", "羌族");
            lstMZ.Add("34", "布朗族");
            lstMZ.Add("35", "撒拉族");
            lstMZ.Add("36", "毛南族");
            lstMZ.Add("37", "仡佬族");
            lstMZ.Add("38", "锡伯族");
            lstMZ.Add("39", "阿昌族");
            lstMZ.Add("40", "普米族");
            lstMZ.Add("41", "塔吉克族");
            lstMZ.Add("42", "怒族");
            lstMZ.Add("43", "乌孜别克族");
            lstMZ.Add("44", "俄罗斯族");
            lstMZ.Add("45", "鄂温克族");
            lstMZ.Add("46", "德昂族");
            lstMZ.Add("47", "保安族");
            lstMZ.Add("48", "裕固族");
            lstMZ.Add("49", "京族");
            lstMZ.Add("50", "塔塔尔族");
            lstMZ.Add("51", "独龙族");
            lstMZ.Add("52", "鄂伦春族");
            lstMZ.Add("53", "赫哲族");
            lstMZ.Add("54", "门巴族");
            lstMZ.Add("55", "珞巴族");
            lstMZ.Add("56", "基诺族");
            lstMZ.Add("57", "其它");
            lstMZ.Add("98", "外国人入籍");
        }