static void Main()
        {
            StringCollection scol = new StringCollection();

            scol.Add("Tiger");
            scol.Add("Lion");
            scol.Add("Cheetah");
            scol.Add("Panther");
            scol.Add("Lynx");


            Console.WriteLine("Printing the Elements");
            foreach (var item in scol)
            {
                Console.WriteLine(item);
            }
            Console.WriteLine("****************************************");
            Console.WriteLine("Printing Elements using the GetEnumerator Method");

            StringEnumerator se = scol.GetEnumerator();


            while (se.MoveNext())
            {
                Console.WriteLine(se.Current);
            }
            se.Reset();
        }
        private static bool CheckFileNameUsingPaths(string fileName, StringCollection paths, out string fullFileName)
        {
            fullFileName = null;
            string   str  = fileName.Trim(new char[] { '"' });
            FileInfo info = new FileInfo(str);

            if (str.Length != info.Name.Length)
            {
                if (info.Exists)
                {
                    fullFileName = info.FullName;
                }
                return(info.Exists);
            }
            using (StringEnumerator enumerator = paths.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    string   str3  = enumerator.Current + Path.DirectorySeparatorChar + str;
                    FileInfo info2 = new FileInfo(str3);
                    if (info2.Exists)
                    {
                        fullFileName = str3;
                        return(true);
                    }
                }
            }
            return(false);
        }
示例#3
0
        private void ProcessRemoteUrls(DiscoveryClientProtocol client, StringCollection urls, XmlSchemas schemas,
                                       ServiceDescriptionCollection descriptions)
        {
            StringEnumerator enumerator = urls.GetEnumerator();

            while (enumerator.MoveNext())
            {
                string current = enumerator.Current;
                try
                {
                    DiscoveryDocument document = client.DiscoverAny(current);
                    client.ResolveAll();
                }
                catch (Exception exception)
                {
                    throw new InvalidOperationException("General Error " + current, exception);
                }
            }
            IDictionaryEnumerator enumerator2 = client.Documents.GetEnumerator();

            while (enumerator2.MoveNext())
            {
                var entry = (DictionaryEntry)enumerator2.Current;
                AddDocument((string)entry.Key, entry.Value, schemas, descriptions);
            }
        }
示例#4
0
 internal void method_1(Class703 A_0, BinaryWriter A_1)
 {
     A_0.class597_0.class1111_36.int_0 = (int)A_1.BaseStream.Position;
     using (StringEnumerator enumerator = this.stringCollection_0.GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             Class813.smethod_2(enumerator.Current, 0x37, A_1, true, false);
         }
     }
     A_0.class597_0.class1111_36.int_1 = ((int)A_1.BaseStream.Position) - A_0.class597_0.class1111_36.int_0;
     A_0.class597_0.class1111_4.int_0  = (int)A_1.BaseStream.Position;
     A_0.class597_0.class1111_4.int_1  = this.class153_0.vmethod_1(A_1);
     A_0.class929_0.class1111_4.int_0  = (int)A_1.BaseStream.Position;
     A_0.class929_0.class1111_4.int_1  = this.class153_0.method_27(A_1);
     A_0.class597_0.class1111_5.int_0  = (int)A_1.BaseStream.Position;
     A_0.class597_0.class1111_5.int_1  = this.class155_0.vmethod_1(A_1);
     this.method_2();
     A_0.class597_0.class1111_42.int_0 = (int)A_1.BaseStream.Position;
     A_0.class597_0.class1111_42.int_1 = this.class162_0.vmethod_1(A_1);
     A_0.class597_0.class1111_43.int_0 = (int)A_1.BaseStream.Position;
     A_0.class597_0.class1111_43.int_1 = this.class147_0.vmethod_1(A_1);
     A_0.class597_0.class1111_37.int_0 = (int)A_1.BaseStream.Position;
     A_0.class597_0.class1111_37.int_1 = this.class344_0.method_3(A_1);
 }
        public DesignDataSetSource(MapCore mapCore, object originalDataSource)
        {
            StringCollection dataSourceDataMembers = DataBindingHelper.GetDataSourceDataMembers(originalDataSource);
            StringEnumerator enumerator            = dataSourceDataMembers.GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    string    current   = enumerator.Current;
                    DataTable dataTable = new DataTable(current)
                    {
                        Locale = CultureInfo.CurrentCulture
                    };
                    DataBindingHelper.InitDesignDataTable(originalDataSource, current, dataTable);
                    base.Tables.Add(dataTable);
                }
            }
            finally
            {
                IDisposable disposable = enumerator as IDisposable;
                if (disposable != null)
                {
                    disposable.Dispose();
                }
            }
        }
示例#6
0
        /// <summary>
        /// Update MRU list when MRU menu item parent is opened
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnMRUParentPopup(object sender, RoutedEventArgs e)
        {
            // remove all childs
            //if (_menuItemMru.IsParent)
            //{
            _menuItemMru.Items.Clear();
            //}

            // Disable menu item if MRU list is empty
            if (_mruList.Count == 0)
            {
                _menuItemMru.IsEnabled = false;
                return;
            }

            // enable menu item and add child items
            _menuItemMru.IsEnabled = true;

            MenuItem item;

            StringEnumerator myEnumerator = _mruList.GetEnumerator();
            int i = 0;

            while (myEnumerator.MoveNext())
            {
                item        = new MenuItem();
                item.Header = GetDisplayName(myEnumerator.Current);
                item.Tag    = i++;

                // subscribe to item's Click event
                item.Click += OnMRUClicked;

                _menuItemMru.Items.Add(item);
            }
        }
 public CSSStyleEnumerator(StringEnumerator str, CSSStyleParser owner, PDFContextBase context)
 {
     this._str     = str;
     this._owner   = owner;
     this._context = context;
     this._log     = context == null ? new DoNothingTraceLog(TraceRecordLevel.Off) : context.TraceLog;
 }
示例#8
0
        public override int FindTargetFieldIndex(string headerField)
        {
            StringEnumerator targetEnumerator = Target.TargetFieldSynonims.GetEnumerator();

            while (targetEnumerator.MoveNext())
            {
                if (targetEnumerator.Current.Equals(headerField))
                {
                    return(Target.TargetFieldIndex);  // index in Settings
                }
            }
            if (Target.Successor == null)
            {
                Target = CsvTargetFieldsChain.Instance;
                if (isReseted)
                {
                    isReseted = false;
                    return(-1);
                }
                else
                {
                    isReseted = true;
                    return(FindTargetFieldIndex(headerField));
                }
            }
            else
            {
                Target = Target.Successor;
                return(FindTargetFieldIndex(headerField));
            }
        }
        internal static NameValueCollection ToNameValueCollection(IEnumerable <ReportParameter> reportParameters)
        {
            if (reportParameters == null)
            {
                throw new ArgumentNullException("reportParameters");
            }
            NameValueCollection nameValueCollection = new NameValueCollection();

            foreach (ReportParameter reportParameter in reportParameters)
            {
                if (reportParameter == null || reportParameter.Name == null)
                {
                    throw new ArgumentNullException("reportParameters");
                }
                StringEnumerator enumerator2 = reportParameter.Values.GetEnumerator();
                try
                {
                    while (enumerator2.MoveNext())
                    {
                        string current2 = enumerator2.Current;
                        nameValueCollection.Add(reportParameter.Name, current2);
                    }
                }
                finally
                {
                    (enumerator2 as IDisposable)?.Dispose();
                }
            }
            return(nameValueCollection);
        }
示例#10
0
        public string GetValidMCode(string actCode)
        {
            ActivationCodeInfo V_0 = this.ExtractActivationCode(actCode); // 提取激活码

            StringCollection V_1 = GetMacAddressStrs();                   // 获取本机网卡MAC地址

            StringEnumerator V_4 = V_1.GetEnumerator();

            try
            {
                while (V_4.MoveNext())
                {
                    string V_2 = V_4.Current;
                    if (V_2.Equals(V_0.Mac))
                    {
                        string V_3 = V_0.Mac;
                        return(V_3);
                    }
                }
            }
            finally
            {
                if (V_4 is IDisposable)
                {
                    ((IDisposable)V_4).Dispose();
                }
            }

            return(string.Empty);
        }
示例#11
0
        public ExecutionInfo SetExecutionParameters(IEnumerable <ReportParameter> parameters, string parameterLanguage)
        {
            List <ParameterValue> list = new List <ParameterValue>();

            foreach (ReportParameter parameter in parameters)
            {
                StringEnumerator enumerator2 = parameter.Values.GetEnumerator();
                try
                {
                    while (enumerator2.MoveNext())
                    {
                        string         current2       = enumerator2.Current;
                        ParameterValue parameterValue = new ParameterValue();
                        parameterValue.Name  = parameter.Name;
                        parameterValue.Value = current2;
                        list.Add(parameterValue);
                    }
                }
                finally
                {
                    (enumerator2 as IDisposable)?.Dispose();
                }
            }
            return(FromSoapExecutionInfo(Service.SetExecutionParameters(list.ToArray(), parameterLanguage)));
        }
示例#12
0
 public static string ReplaceStrUseSC(string originalStr, StringCollection sc)
 {
     if (!string.IsNullOrEmpty(originalStr))
     {
         StringEnumerator enumerator = sc.GetEnumerator();
         try
         {
             while (enumerator.MoveNext())
             {
                 string current = enumerator.Current;
                 originalStr = Regex.Replace(originalStr, current, "*".PadLeft(current.Length, '*'), RegexOptions.IgnoreCase);
             }
             return(originalStr);
         }
         finally
         {
             IDisposable disposable = enumerator as IDisposable;
             if (disposable != null)
             {
                 disposable.Dispose();
             }
         }
     }
     return(string.Empty);
 }
示例#13
0
        private static System.Reflection.Assembly AssemblyResolver(object sender, ResolveEventArgs args)
        {
            char[] chArray2 = new char[1] {
                ','
            };
            char[] chArray1 = chArray2;
            string text1    = args.Name.Split(chArray1)[0];

            StringEnumerator enumerator1 = HintDirectories.GetEnumerator();

            while (enumerator1.MoveNext())
            {
                string text2 = enumerator1.Current;
                string text3 = Path.Combine(text2, string.Format("{0}.dll", text1));
                if (File.Exists(text3))
                {
                    return(Assembly.LoadFrom(text3));
                }
                text3 = Path.Combine(text2, string.Format("{0}.exe", text1));
                if (File.Exists(text3))
                {
                    return(Assembly.LoadFrom(text3));
                }
            }
            return(null);
        }
示例#14
0
        private void GetPaths(StringCollection localPaths, StringCollection urls)
        {
            StringEnumerator enumerator = paths.GetEnumerator();

            while (enumerator.MoveNext())
            {
                string current = enumerator.Current;
                if (FileExists(current))
                {
                    if (!Path.HasExtension(current))
                    {
                        throw new InvalidOperationException(current + " has no extensions");
                    }
                    localPaths.Add(current);
                }
                else
                {
                    Uri uri = null;
                    try
                    {
                        uri = new Uri(current, true);
                    }
                    catch (Exception)
                    {
                        uri = null;
                    }
                    if (uri == null)
                    {
                        throw new InvalidOperationException(current + " is invalid URI");
                    }
                    urls.Add(uri.AbsoluteUri);
                }
            }
        }
        /// <summary>
        /// Update MRU list when MRU menu item parent is opened
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnMRUParentPopup(object sender, EventArgs e)
        {
            // remove all childs
            //if (menuItemMRU.IsParent)
            //{
            menuItemMRU.DropDownItems.Clear();
            //}

            // Disable menu item if MRU list is empty
            if (mruList.Count == 0)
            {
                menuItemMRU.Enabled = false;
                return;
            }

            // enable menu item and add child items
            menuItemMRU.Enabled = true;

            ToolStripMenuItem item;

            StringEnumerator myEnumerator = mruList.GetEnumerator();
            int i = 0;

            while (myEnumerator.MoveNext())
            {
                item      = new ToolStripMenuItem();
                item.Text = GetDisplayName((string)myEnumerator.Current);
                item.Tag  = i++;

                // subscribe to item's Click event
                item.Click += OnMRUClicked;

                menuItemMRU.DropDownItems.Add(item);
            }
        }
        /// <summary>
        /// Checks the string and restores any encoded HTML Entities such as &amp; and &quot; to their
        /// standard character & and " returning the result. Resets the Buffer
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        private string HTMLUnEntities(string value)
        {
            Buffer.Clear();

            if (value.IndexOf(HTMLEntityStartMarker) > -1)
            {
                StringEnumerator enumerate = new StringEnumerator(value);
                while (enumerate.MoveNext())
                {
                    if (enumerate.Current == HTMLEntityStartMarker)
                    {
                        if (!enumerate.MoveNext())
                        {
                            Buffer.Append(enumerate.Current);
                            return(Buffer.ToString());
                        }
                        else
                        {
                            char unencoded = ReadHtmlEscapedChar(enumerate);
                            Buffer.Append(unencoded);
                            enumerate.MovePrev();
                        }
                    }
                    else
                    {
                        Buffer.Append(enumerate.Current);
                    }
                }
                value = Buffer.ToString();
            }
            return(value);
        }
        public void AddItem(NamedElement item)
        {
            ((IList)items).Add((object)item);
            StringEnumerator enumerator = fieldNames.GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    string    current   = enumerator.Current;
                    Hashtable hashtable = fieldsCache[current] as Hashtable;
                    if (hashtable == null)
                    {
                        continue;
                    }
                    PropertyInfo property = item.GetType().GetProperty("Item");
                    if (property != null)
                    {
                        object value = property.GetValue(item, new object[1]
                        {
                            current
                        });
                        if (value != null)
                        {
                            hashtable[value] = item;
                        }
                    }
                }
            }
            finally
            {
                (enumerator as IDisposable)?.Dispose();
            }
        }
示例#18
0
        public static NameValueCollection ToNameValueCollection(IEnumerable <ReportParameter> reportParameters)
        {
            if (reportParameters == null)
            {
                throw new ArgumentNullException("reportParameters");
            }
            NameValueCollection nameValueCollection = new NameValueCollection();

            foreach (ReportParameter reportParameter in reportParameters)
            {
                if (reportParameter != null && reportParameter.Name != null)
                {
                    StringEnumerator enumerator2 = reportParameter.Values.GetEnumerator();
                    try
                    {
                        while (enumerator2.MoveNext())
                        {
                            string current2 = enumerator2.Current;
                            nameValueCollection.Add(reportParameter.Name, current2);
                        }
                    }
                    finally
                    {
                        IDisposable disposable = enumerator2 as IDisposable;
                        if (disposable != null)
                        {
                            disposable.Dispose();
                        }
                    }
                    continue;
                }
                throw new ArgumentNullException("reportParameters");
            }
            return(nameValueCollection);
        }
示例#19
0
        private void OnMRUParentPopup(object sender, EventArgs e)
        {
            if (mruList.Count == 0)
            {
                menuItemMRU.Enabled = false;
                return;
            }

            menuItemMRU.Enabled = true;

            ToolStripMenuItem item;

            StringEnumerator myEnumerator = mruList.GetEnumerator();
            int i = 0;

            while (myEnumerator.MoveNext())
            {
                item      = new ToolStripMenuItem();
                item.Text = GetDisplayName((string)myEnumerator.Current);
                item.Tag  = i++;

                item.Click += OnMRUClicked;

                menuItemMRU.DropDownItems.Add(item);
            }
        }
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         this._str = null;
     }
 }
示例#21
0
        private SvnLookOutputParser(StringCollection infoLines, StringCollection changedLines, StringCollection diffLines)
        {
            StringEnumerator strings = infoLines.GetEnumerator();

            strings.MoveNext();              // move to first
            strings.MoveNext();              // skip first
            FindAuthor(strings);
            FindTimestamp(strings);
            FindLogMessageSize(strings);
            FindLogMessage(strings);

            strings = changedLines.GetEnumerator();
            bool hasMoreLines = SkipBlanks(strings);

            if (!hasMoreLines)
            {
                throw new ArgumentException("Unexpected: no changes recorded, aborting fatally");
            }

            FindChanges(strings);

            if (diffLines != null && diffLines.Count > 0)
            {
                strings      = diffLines.GetEnumerator();
                hasMoreLines = SkipBlanks(strings);

                if (hasMoreLines)
                {
                    FillDiffCollection(strings);
                }
            }
        }
        static void Main()
        {
            StringCollection mySEnum = new StringCollection();

            mySEnum.Add("This");
            mySEnum.Add("is");
            mySEnum.Add("String");
            mySEnum.Add("Enumerator");
            mySEnum.Add("Demo");


            // Enumerates the elements in the StringCollection.
            StringEnumerator myEnumerator = mySEnum.GetEnumerator();

            while (myEnumerator.MoveNext())
            {
                Console.WriteLine("{0}", myEnumerator.Current);
            }
            Console.WriteLine();

            //// Resets the enumerator and displays the first element again.
            myEnumerator.Reset();
            if (myEnumerator.MoveNext())
            {
                Console.WriteLine("The first element is {0}.", myEnumerator.Current);
            }
        }
示例#23
0
        private void ProcessLocalPaths(DiscoveryClientProtocol client, StringCollection localPaths, XmlSchemas schemas,
                                       ServiceDescriptionCollection descriptions)
        {
            StringEnumerator enumerator = localPaths.GetEnumerator();

            while (enumerator.MoveNext())
            {
                string current   = enumerator.Current;
                string extension = Path.GetExtension(current);
                if (string.Compare(extension, ".discomap", true) == 0)
                {
                    client.ReadAll(current);
                }
                else
                {
                    object document = null;
                    if (string.Compare(extension, ".wsdl", true) == 0)
                    {
                        document = ReadLocalDocument(false, current);
                    }
                    else
                    {
                        if (string.Compare(extension, ".xsd", true) != 0)
                        {
                            throw new InvalidOperationException("Unknown file type " + current);
                        }
                        document = ReadLocalDocument(true, current);
                    }
                    if (document != null)
                    {
                        AddDocument(current, document, schemas, descriptions);
                    }
                }
            }
        }
示例#24
0
        public static void GetEnumerator_ModifiedCollectionTest(StringCollection collection, string[] data)
        {
            StringEnumerator enumerator = collection.GetEnumerator();

            Assert.NotNull(enumerator);
            if (data.Length > 0)
            {
                Assert.True(enumerator.MoveNext());
                string current = enumerator.Current;
                Assert.Equal(data[0], current);
                collection.RemoveAt(0);
                if (data.Length > 1 && data[0] != data[1])
                {
                    Assert.NotEqual(current, collection[0]);
                }
                Assert.Equal(current, enumerator.Current);
                Assert.Throws <InvalidOperationException>(() => enumerator.MoveNext());
                Assert.Throws <InvalidOperationException>(() => enumerator.Reset());
            }
            else
            {
                collection.Add("newValue");
                Assert.Throws <InvalidOperationException>(() => enumerator.MoveNext());
            }
        }
示例#25
0
        public void analyzeShortTermMemory()
        {
            purifyBotsMind();
            StringCollection sc = null;

            sc = new StringCollection();
            botsMemory.Clear();
            if (fullPathName == "")
            {
                sc = readBrainFile();
            }
            else
            {
                sc = readBrainFile(fullPathName);
            }
            StringEnumerator ii = sc.GetEnumerator();

            while (ii.MoveNext())
            {
                if (!botsMemory.Contains(parseForThoughts(ii.Current)))
                {
                    botsMemory.Add(parseForThoughts(ii.Current), parseForWords(ii.Current));
                }
            }
            memorySize = botsMemory.Count;
            return;
        }
示例#26
0
            // This is a subsense in bedic terminology. It can contain {sa}, {hw}, {ex}, {ct},
            // all of which are expected to contain only text, but we don't even need them anyway (yet).
            private IList <Translation> ParseTranslation(StringEnumerator e, string headWord)
            {
                string unused;
                string str = Parse(e, tag => {
                    if (tag == "hw/")
                    {
                        return(headWord);
                    }
                    if (tag == "br/")
                    {
                        return("\n");
                    }
                    if (tag == "hw")
                    {
                        Debug.Print("{hw} setter tag not supported yet");
                        ParseStringElement(e, tag, headWord);
                    }
                    if (tag == "em" || tag == "de")
                    {
                        return(ParseStringElement(e, tag, headWord));
                    }
                    ParseStringElement(e, tag, headWord);
                    return(null);
                }, false, "/ss", out unused);

                if (str == null)
                {
                    throw new InvalidDataException("Expected {/ss}, reached end of entry.");
                }

                // This bit should be optional.
                // First, try ';', because it generally overrides ','. Thus, on the off chance that the
                // translations contain commas, the result will be better. Failing that, let's try commas
                // from other languages.
                List <Translation> list = new List <Translation>();

                string[] parts = str.Split(';');
                if (parts.Length == 1)
                {
                    parts = str.Split(',');
                }
                if (parts.Length == 1)
                {
                    char[] foreignCommas = new char[] { '\u060C' };
                    parts = str.Split(foreignCommas);
                }

                foreach (string s in parts)
                {
                    string trimmed = s.Trim();
                    if (trimmed.Length == 0)
                    {
                        continue;
                    }
                    list.Add(new Translation(trimmed.Normalize()));
                }

                return(list);
            }
示例#27
0
 private void FillDiffCollection(StringEnumerator strings)
 {
     do
     {
         DiffLine dl = DiffLine.Parse(strings.Current);
         _diffLines.Add(dl);
     } while(strings.MoveNext());
 }
        //
        // .ctor
        //

        #region internal HTMLParserEnumerator(HTMLParser parser)

        /// <summary>
        /// Creates a new instance of the HTMLParserEnumerator
        /// </summary>
        /// <param name="parser"></param>
        internal HTMLParserEnumerator(HTMLParser parser)
        {
            if (null == parser)
            {
                throw new ArgumentNullException("parser");
            }

            this._owner = parser;
            this._src   = new StringEnumerator(_owner.Source);
        }
示例#29
0
 protected override void vmethod_3(BinaryWriter A_0)
 {
     using (StringEnumerator enumerator = this.stringCollection_0.GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             Class341.smethod_0(enumerator.Current, A_0);
         }
     }
 }
示例#30
0
    // Uses the enumerator.
    // NOTE: The foreach statement is the preferred way of enumerating the contents of a collection.
    public static void PrintValues2(StringCollection myCol)
    {
        StringEnumerator myEnumerator = myCol.GetEnumerator();

        while (myEnumerator.MoveNext())
        {
            Console.WriteLine("   {0}", myEnumerator.Current);
        }
        Console.WriteLine();
    }