예제 #1
0
Dispose(bool disposing)
        {
            base.Dispose(disposing);

            if (disposing)
            {
            Current
#else
            DisposeManaged()
            {
                base.DisposeManaged();

                _current
#endif
                = default;

                _joinEnumerable = null;

                _updateEnumerator = null;

                _moveNext = null;

                _subEnumerator = null;
#if !WinCopies3
        }
#endif
            }
        }
        public void AppendWord(System.Collections.Generic.IEnumerator <char> input)
        {
            string         character = "";
            LetterCategory inputCategory;
            LetterCategory previousCategory;
            char           previous;
            char           current            = '\0';
            var            charactersToAppend = new List <string>();

            while (input.MoveNext())
            {
                previous         = current;
                current          = input.Current;
                previousCategory = categorizer.Categorize(previous);
                inputCategory    = categorizer.Categorize(current);
                if (previousCategory != LetterCategory.Vowel && inputCategory == LetterCategory.Vowel)
                {
                    character += current;
                }
                else if (character == "")
                {
                    character += current;
                }
                else if (character.Length == 1)
                {
                    charactersToAppend.Add(character);
                    //Append(character);
                    character  = "";
                    character += current;
                }
                else
                {
                    charactersToAppend.Add(character);
                    //Append(character);
                    character = "";
                }
                if (character.Length >= 2)
                {
                    charactersToAppend.Add(character);
                    //Append(character);
                    character = "";
                }
            }
            if (character.Length > 0)
            {
                charactersToAppend.Add(character);
                //Append(character);
            }
            //Add a newline if this word does not fit on this line
            var currentPosition = this.position * this.Feed + this.Offset;

            if (currentPosition.X + this.Feed.Width * charactersToAppend.Count > PageSize.Width)
            {
                AppendNewLine();
            }
            foreach (var c in charactersToAppend)
            {
                Append(c);
            }
        }
예제 #3
0
 private static System.Collections.Generic.Dictionary <int, BankValueEntry> GetBankValue(System.Collections.Generic.Dictionary <string, string> result)
 {
     System.Collections.Generic.Dictionary <int, BankValueEntry> dictionary = new System.Collections.Generic.Dictionary <int, BankValueEntry>();
     System.Collections.Generic.IEnumerator <string>             enumerator = result.Keys.GetEnumerator();
     while (enumerator.MoveNext())
     {
         string current = enumerator.Current;
         string value   = result[current];
         if ("\0".Equals(value))
         {
             value = System.Convert.ToString(-1000);
         }
         else
         {
             if (string.IsNullOrEmpty(value))
             {
                 value = System.Convert.ToString(-500);
             }
         }
         int num = System.Convert.ToInt32(current.Substring(current.LastIndexOf(".") + 1));
         if (!dictionary.ContainsKey(num))
         {
             BankValueEntry value2 = new BankValueEntry(num);
             dictionary.Add(num, value2);
         }
         BankValueEntry   bankValueEntry   = dictionary[num];
         ApcBankStatusMib apcBankStatusMib = new ApcBankStatusMib(num);
         if (current.StartsWith(apcBankStatusMib.CurrentStatus))
         {
             bankValueEntry.Current = System.Convert.ToString((float)System.Convert.ToInt32(value) / 10f);
         }
     }
     return(dictionary);
 }
        /// <summary>
        /// Takes any character, or a whitespace, and calls the respective appropriate append method.
        /// </summary>
        /// <param name="input"></param>
        public void Append(System.Collections.Generic.IEnumerator <char> input)
        {
            string word = "";

            while (input.MoveNext())
            {
                char current = input.Current;
                if (current == ' ')
                {
                    AppendWord(word.GetEnumerator());
                    this.AppendWhitespace();
                    word = "";
                }
                else if (current == '_')
                {
                    AppendWord(word.GetEnumerator());
                    this.AppendNewLine();
                    word = "";
                }

                else
                {
                    word += current;
                }
            }
            if (word.Length > 0)
            {
                AppendWord(word.GetEnumerator());
            }
        }
예제 #5
0
        public override void InitializeList()
        {
            FilteredElementCollector elements = base.GetElements();

            System.Collections.Generic.IEnumerator <Element> enumerator = elements.GetEnumerator();
            while (enumerator.MoveNext())
            {
                Element element = null;
                try
                {
                    element = enumerator.Current;
                    Parameter parameter = element.get_Parameter((BuiltInParameter)(-1002500));
                    if (parameter != null && !string.IsNullOrEmpty(parameter.AsString()))
                    {
                        base.Add(element);
                    }
                }
                catch (System.Exception)
                {
                    if (element != null)
                    {
                        Log.WriteLine("Get BuiltInParameter.UNIFORMAT_CODE failed: " + element.Id);
                    }
                }
            }
        }
    public bool NegTest1()
    {
        bool   retVal = true;
        String str    = TestLibrary.Generator.GetString(-55, true, minLength, maxLength);

        TestLibrary.TestFramework.BeginScenario("Check the first index...");
        char[] strCopy = new char[str.Length];
        str.CopyTo(0, strCopy, 0, str.Length);

        try
        {
            System.Collections.Generic.IEnumerator <Char> charIEnum = (System.Collections.Generic.IEnumerator <Char>)((System.Collections.Generic.IEnumerable <Char>)str).GetEnumerator();
            charIEnum.Reset();
            char charTest = (char)charIEnum.Current;

            TestLibrary.TestFramework.LogError("003", "No exception occurs!");
            retVal = false;
        }
        catch (InvalidOperationException)
        {
            TestLibrary.TestFramework.LogInformation("InvalidOperationException is throw after fetch IEnumerator.get_Current with -1 index!");
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("004", "Unexpected exception occurs: " + e);
            retVal = false;
        }

        return(retVal);
    }
    public bool PosTest1()
    {
        bool   retVal = true;
        String str    = TestLibrary.Generator.GetString(-55, true, minLength, maxLength);

        TestLibrary.TestFramework.BeginScenario("Check IENumerator.get_Current show the correct element when index is valid...");
        char[] strCopy = new char[str.Length];
        str.CopyTo(0, strCopy, 0, str.Length);

        try
        {
            System.Collections.Generic.IEnumerator <Char> charIEnum = (System.Collections.Generic.IEnumerator <Char>)((System.Collections.Generic.IEnumerable <Char>)str).GetEnumerator();
            charIEnum.Reset();

            for (int i = 0; i < str.Length; i++)
            {
                charIEnum.MoveNext();
                if (!charIEnum.Current.Equals(strCopy[i]))
                {
                    TestLibrary.TestFramework.LogError("001", "IENumerator.get_Current show the wrong element when index is valid!");
                    retVal = false;
                }
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("002", "Unecpected exception occurs :" + e);
            retVal = false;
        }

        return(retVal);
    }
예제 #8
0
            private void InitDelegates()
            {
                _updateEnumerator = () =>
                {
                    _subEnumerator = InnerEnumerator.Current.GetEnumerator();

                    if (_keepEmptyEnumerables)

                        _updateEnumerator = () => _subEnumerator = _joinEnumerable.AppendValues(InnerEnumerator.Current).GetEnumerator();

                    else

                        _updateEnumerator = () => _subEnumerator = new JoinSubEnumerator<T>(InnerEnumerator.Current, _joinEnumerable);
                };

                _moveNext = () =>
                {

                    if (_subEnumerator == null && !_MoveNext())

                        return false;

                    _moveNext = () => __MoveNext();

                    return __MoveNext();
                };
            }
예제 #9
0
            public bool MoveNext()
            {
                if (back)
                {
                    back = false;
                    return(true);
                }

                if (null != this.en && this.en.MoveNext())
                {
                    return(true);
                }

                for (; ;)
                {
                    if (nextzblock >= icl.zblocks.Length)
                    {
                        break;
                    }

                    killprevzblock();

                    icl.zblocks[nextzblock].CopyInto(icl.b12buffer, buf);
                    this.en = icl.b12buffer.GetEnumerator();
                    nextzblock++;
                    if (this.en.MoveNext())
                    {
                        return(true);
                    }
                }
                killprevzblock();
                return(false);
            }
예제 #10
0
    public static string ToEngFormat <T, T2>(this System.Collections.Generic.IEnumerable <T> collection, string word, System.Func <T, T2> select, System.Func <T2, bool> where, System.Func <T2, string> select2)
    {
        System.Collections.Generic.List <string> list = new System.Collections.Generic.List <string>();
        if (typeof(T).IsValueType)
        {
            using (System.Collections.Generic.IEnumerator <T> enumerator = collection.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    T      current = enumerator.Current;
                    T2     arg     = select(current);
                    string item;
                    if (where (arg) && !string.IsNullOrEmpty(item = select2(arg)))
                    {
                        list.Add(item);
                    }
                }
                goto IL_CE;
            }
        }
        foreach (T current2 in collection)
        {
            T2     arg;
            string item;
            if (current2 != null && (arg = select(current2)) != null && where (arg) && !string.IsNullOrEmpty(item = select2(arg)))
            {
                list.Add(item);
            }
        }
IL_CE:
        return(RCextensions.HandleEngFormat(word, list));
    }
예제 #11
0
        public static Polyline[] InterpolatePolylines(Polyline from, Polyline to, int Steps, bool includeEnds = true)
        {
            if (from.Count == to.Count)
            {
                Polyline[] interpolatedPolylines = new Polyline[Steps + (Convert.ToInt32(includeEnds) * 2)];

                for (int i = 0; i < Steps + (Convert.ToInt32(includeEnds) * 2); i++)
                {
                    interpolatedPolylines[i] = new Polyline();
                }


                System.Collections.Generic.IEnumerator <Point3d> enum0 = from.GetEnumerator();
                System.Collections.Generic.IEnumerator <Point3d> enum1 = to.GetEnumerator();



                while (enum0.MoveNext())
                {
                    Point3d[] pt = NGonsCore.PointUtil.InterpolatePoints(enum0.Current, enum1.Current, Steps, includeEnds);

                    for (int i = 0; i < Steps + (Convert.ToInt32(includeEnds) * 2); i++)
                    {
                        interpolatedPolylines[i].Add(pt[i]);
                    }

                    enum1.MoveNext();
                }

                return(interpolatedPolylines);
            }

            return(null);
        }
예제 #12
0
        public static void printActivityTreeA(Activity activity)
        {
            if (tag == null)
            {
                tag = new activityStruct();
                tag.parent = null;
                tag.currentActivity = activity;
                tag.displayName = activity.DisplayName;

            }


            System.Collections.Generic.IEnumerator<Activity> list = WorkflowInspectionServices.GetActivities(activity).GetEnumerator();

            while (list.MoveNext())
            {
                activityStruct temp = new activityStruct();

                temp.parent = tag;
                temp.currentActivity = list.Current;
                temp.displayName = list.Current.DisplayName;
                printActivityTreeA(list.Current);

            }

        }
예제 #13
0
        public static System.Collections.Generic.IEnumerator <byte> Run(System.Collections.Generic.IEnumerator <byte> coroutine, Object tag = null)
        {
            if (coroutine.MoveNext() == true)
            {
                var key = (tag == null ? 0 : tag.GetInstanceID());
                List <IEnumerator> list = null;
                for (int i = 0; i < Coroutines.instance.list.Count; ++i)
                {
                    var item = Coroutines.instance.list[i];
                    if (item.tag == key)
                    {
                        list = item.list;
                    }
                }

                if (list != null)
                {
                    list.Add(coroutine);
                }
                else
                {
                    Coroutines.instance.list.Add(new Item()
                    {
                        tag = key, list = new List <IEnumerator>()
                        {
                            coroutine
                        }
                    });
                }
            }

            return(coroutine);
        }
예제 #14
0
        public void Save()
        {
            lock (this.m_lock)
            {
                Guild guild2;
                using (System.Collections.Generic.IEnumerator <Guild> enumerator = (
                           from guild in this.m_guilds.Values
                           where guild.IsDirty
                           select guild).GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        guild2 = enumerator.Current;
                        guild2.Save(base.Database);
                    }
                    goto IL_8F;
                }
IL_71:
                guild2 = this.m_guildsToDelete.Pop();
                base.Database.Delete(guild2.Record);
IL_8F:
                if (this.m_guildsToDelete.Count > 0)
                {
                    goto IL_71;
                }
            }
        }
예제 #15
0
        public static TSource First <TSource> (IEnumerable <TSource> source)
        {
            Check.Source(source);

            IList <TSource> list = source as IList <TSource>;

            if (list != null)
            {
                if (list.Count != 0)
                {
                    return(list [0]);
                }
            }
            else
            {
                using (System.Collections.Generic.IEnumerator <TSource> enumerator = source.GetEnumerator())
                {
                    if (enumerator.MoveNext())
                    {
                        return(enumerator.Current);
                    }
                }
            }

            throw EmptySequence();
        }
예제 #16
0
        public virtual void TestToStringAndMultiAttributeImplementations()
        {
            AttributeSource src     = new AttributeSource();
            ITermAttribute  termAtt = src.AddAttribute <ITermAttribute>();
            ITypeAttribute  typeAtt = src.AddAttribute <ITypeAttribute>();

            termAtt.SetTermBuffer("TestTerm");
            typeAtt.Type = "TestType";
            Assert.AreEqual("(" + typeAtt.ToString() + "," + termAtt.ToString() + ")", src.ToString(), "Attributes should appear in original order");
            System.Collections.Generic.IEnumerator <Attribute> it = src.GetAttributeImplsIterator().GetEnumerator();
            Assert.IsTrue(it.MoveNext(), "Iterator should have 2 attributes left");
            Assert.AreSame(typeAtt, it.Current, "First AttributeImpl from iterator should be typeAtt");
            Assert.IsTrue(it.MoveNext(), "Iterator should have 1 attributes left");
            Assert.AreSame(termAtt, it.Current, "Second AttributeImpl from iterator should be termAtt");
            Assert.IsFalse(it.MoveNext(), "Iterator should have 0 attributes left");

            src = new AttributeSource();
            src.AddAttributeImpl(new Token());
            // this should not add a new attribute as Token implements TermAttribute, too
            termAtt = src.AddAttribute <ITermAttribute>();
            Assert.IsTrue(termAtt is Token, "TermAttribute should be implemented by Token");
            // get the Token attribute and check, that it is the only one
            it = src.GetAttributeImplsIterator().GetEnumerator();
            Assert.IsTrue(it.MoveNext());
            Token tok = (Token)it.Current;

            Assert.IsFalse(it.MoveNext(), "There should be only one attribute implementation instance");

            termAtt.SetTermBuffer("TestTerm");
            Assert.AreEqual("(" + tok.ToString() + ")", src.ToString(), "Token should only printed once");
        }
예제 #17
0
 public override void DataBind()
 {
     this.Items.Clear();
     this.Items.Add(new System.Web.UI.WebControls.ListItem(this.NullToDisplay, string.Empty));
     if (this.IsUnclassified)
     {
         this.Items.Add(new System.Web.UI.WebControls.ListItem("未分类商品", "0"));
     }
     System.Collections.Generic.IList <CategoryInfo> list;
     if (this.IsTopCategory)
     {
         list = SubsiteCatalogHelper.GetMainCategories();
         using (System.Collections.Generic.IEnumerator <CategoryInfo> enumerator = list.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 CategoryInfo current = enumerator.Current;
                 this.Items.Add(new System.Web.UI.WebControls.ListItem(Globals.HtmlDecode(current.Name), current.CategoryId.ToString()));
             }
             return;
         }
     }
     list = SubsiteCatalogHelper.GetSequenceCategories();
     for (int i = 0; i < list.Count; i++)
     {
         this.Items.Add(new System.Web.UI.WebControls.ListItem(this.FormatDepth(list[i].Depth, Globals.HtmlDecode(list[i].Name)), list[i].CategoryId.ToString(System.Globalization.CultureInfo.InvariantCulture)));
     }
 }
예제 #18
0
        /// <summary>
        /// Counts the items within the given list.
        /// <locDE><para />Zählt die Elemente in der angegebenen Liste.</locDE>
        /// </summary>
        /// <typeparam name="T">The element type of the given list.<locDE><para />Elementtyp der angegebenen Liste.</locDE></typeparam>
        /// <param name="source">The list to count the contained items.<locDE><para />Liste, deren Elemente gezählt werden soll.</locDE></param>
        /// <param name="stopCountAt">Stop counting at this value (i.e. just want to know if there are at least n items).
        /// <locDE><para />Zählung beim Erreichen dieses Wertes abbrechen (wenn man nur wissen will, ob mind. soviele Elemente enthalten sind).</locDE></param>
        /// <returns>Item count (maybe limited by stopCountAt value).<locDE><para />Anzahl der Elemente (ggf. limitiert durch stopCountAt Wert).</locDE></returns>
        public static int Count <T>(this System.Collections.Generic.IEnumerable <T> source, int stopCountAt)
        {
            if (null == source)
            {
                return(0);
            }

            System.Collections.Generic.ICollection <T> genCollection = source as System.Collections.Generic.ICollection <T>;
            if (null != genCollection)
            {
                return(Math.Min(genCollection.Count, stopCountAt));
            }

            System.Collections.ICollection stdcollection = source as System.Collections.ICollection;
            if (null != stdcollection)
            {
                return(Math.Min(stdcollection.Count, stopCountAt));
            }

            int num = 0;

            using (System.Collections.Generic.IEnumerator <T> enumerator = source.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    num++;
                    if (num > stopCountAt)
                    {
                        break;
                    }
                }
            }
            return(num);
        }
예제 #19
0
        private static System.Collections.Generic.Dictionary <int, SensorValueEntry> GetSensorValue(System.Collections.Generic.Dictionary <string, string> result)
        {
            System.Collections.Generic.Dictionary <int, SensorValueEntry> dictionary = new System.Collections.Generic.Dictionary <int, SensorValueEntry>();
            System.Collections.Generic.IEnumerator <string> enumerator = result.Keys.GetEnumerator();
            ApcSensorStatusMib apcSensorStatusMib = null;
            int num = 0;

            while (enumerator.MoveNext())
            {
                string text  = enumerator.Current;
                string text2 = result[text];
                if ("\0".Equals(text2) || "n/a".Equals(text2) || "N/A".Equals(text2) || "-1".Equals(text2))
                {
                    text2 = System.Convert.ToString(-1000);
                }
                else
                {
                    if (string.IsNullOrEmpty(text2) || text2.Equals("Null"))
                    {
                        text2 = System.Convert.ToString(-500);
                    }
                }
                if (text.LastIndexOf(".0") > 0)
                {
                    text = text.Substring(0, text.LastIndexOf(".0"));
                }
                int num2 = System.Convert.ToInt32(text.Substring(text.LastIndexOf(".") + 1));
                if (!dictionary.ContainsKey(num2))
                {
                    SensorValueEntry value = new SensorValueEntry(num2);
                    dictionary.Add(num2, value);
                }
                if (num != num2)
                {
                    apcSensorStatusMib = new ApcSensorStatusMib(num2);
                    num = num2;
                }
                SensorValueEntry sensorValueEntry = dictionary[num2];
                if (text.StartsWith(apcSensorStatusMib.Humidity))
                {
                    sensorValueEntry.Humidity = text2;
                }
                else
                {
                    if (text.StartsWith(apcSensorStatusMib.Temperature))
                    {
                        if (text2.Equals(System.Convert.ToString(-1000)) || text2.Equals(System.Convert.ToString(-500)))
                        {
                            sensorValueEntry.Temperature = text2;
                        }
                        else
                        {
                            sensorValueEntry.Temperature = ((float)System.Convert.ToInt32(text2) / 10f).ToString();
                        }
                    }
                }
            }
            return(dictionary);
        }
예제 #20
0
            protected override void ResetOverride()
            {
                base.ResetOverride();

                _subEnumerator = null;

                InitDelegates();
            }
예제 #21
0
        public static ArchiveExtractionParameters FromProcessParameters(System.Collections.Generic.IEnumerator<string> enumerator)
        {
            var result = new ArchiveExtractionParameters();

            InitFromProcessParameters(result, enumerator);

            return result;
        }
예제 #22
0
        /// <summary>
        /// Initializes a new instance of the EnumeratorProxy class.
        /// </summary>
        /// <param name="wrapperScope">The wrapper scope.</param>
        /// <param name="underlyingImplementation">The underlying implementation of the proxy.</param>
        public EnumeratorProxy(IWrapperScope wrapperScope, System.Collections.Generic.IEnumerator <T> underlyingImplementation)
        {
            ExceptionUtilities.CheckArgumentNotNull(wrapperScope, "wrapperScope");
            ExceptionUtilities.CheckArgumentNotNull(underlyingImplementation, "underlyingImplementation");

            this.Scope = wrapperScope;
            this.underlyingImplementation = underlyingImplementation;
        }
예제 #23
0
        private static System.Collections.Generic.Dictionary <int, BankValueEntry> GetBankValue(System.Collections.Generic.Dictionary <string, string> result)
        {
            System.Collections.Generic.Dictionary <int, BankValueEntry> dictionary = new System.Collections.Generic.Dictionary <int, BankValueEntry>();
            System.Collections.Generic.IEnumerator <string>             enumerator = result.Keys.GetEnumerator();
            int num = 0;

            while (enumerator.MoveNext())
            {
                string current = enumerator.Current;
                string text    = result[current];
                if ("\0".Equals(text))
                {
                    text = System.Convert.ToString(-1000);
                }
                else
                {
                    if (string.IsNullOrEmpty(text))
                    {
                        text = System.Convert.ToString(-500);
                    }
                }
                int num2 = System.Convert.ToInt32(current.Substring(current.LastIndexOf(".") + 1));
                if (!dictionary.ContainsKey(num2))
                {
                    BankValueEntry value = new BankValueEntry(num2);
                    dictionary.Add(num2, value);
                }
                if (num != num2)
                {
                    new BankValueMib(num2);
                    num = num2;
                }
                BankValueEntry          bankValueEntry         = dictionary[num2];
                EatonGroupCurrentMib_M2 eatonGroupCurrentMib_M = new EatonGroupCurrentMib_M2(num2);
                EatonGroupVoltageMib_M2 eatonGroupVoltageMib_M = new EatonGroupVoltageMib_M2(num2);
                EatonGroupPowerMib_M2   eatonGroupPowerMib_M   = new EatonGroupPowerMib_M2(num2);
                if (current.StartsWith(eatonGroupCurrentMib_M.CurrentValue))
                {
                    bankValueEntry.Current = System.Convert.ToString((float)System.Convert.ToInt32(text) / 1000f);
                }
                else
                {
                    if (current.StartsWith(eatonGroupVoltageMib_M.VoltageValue))
                    {
                        bankValueEntry.Voltage = System.Convert.ToString((float)System.Convert.ToInt32(text) / 1000f);
                    }
                    else
                    {
                        if (current.StartsWith(eatonGroupPowerMib_M.PowerValue))
                        {
                            bankValueEntry.Power = text;
                        }
                    }
                }
            }
            return(dictionary);
        }
예제 #24
0
        private void btnUpdateOrderAmount_Click(object sender, System.EventArgs e)
        {
            if (!this.order.CheckAction(OrderActions.SELLER_MODIFY_TRADE))
            {
                this.ShowMsg("你当前订单的状态不能进行修改订单费用操作", false);
                return;
            }
            decimal adjustedFreight;
            decimal payCharge;
            decimal adjustedDiscount;

            if (!this.ValidateValues(out adjustedFreight, out payCharge, out adjustedDiscount))
            {
                return;
            }
            string text = string.Empty;

            this.order.AdjustedFreight  = adjustedFreight;
            this.order.PayCharge        = payCharge;
            this.order.AdjustedDiscount = adjustedDiscount;
            decimal total = this.order.GetTotal();

            this.order.Points = this.GetPoint(this.order);
            ValidationResults validationResults = Validation.Validate <OrderInfo>(this.order, new string[]
            {
                "ValOrder"
            });

            if (!validationResults.IsValid)
            {
                using (System.Collections.Generic.IEnumerator <ValidationResult> enumerator = ((System.Collections.Generic.IEnumerable <ValidationResult>)validationResults).GetEnumerator())
                {
                    if (enumerator.MoveNext())
                    {
                        ValidationResult current = enumerator.Current;
                        text += Formatter.FormatErrorMessage(current.Message);
                        this.ShowMsg(text, false);
                        return;
                    }
                }
            }
            if (total > 0m)
            {
                if (OrderHelper.UpdateOrderAmount(this.order))
                {
                    this.BindTatolAmount(this.order);
                    this.ShowMsg("成功的修改了订单金额", true);
                    return;
                }
                this.ShowMsg("修改订单金额失败", false);
                return;
            }
            else
            {
                this.ShowMsg("订单的应付总金额不应该是负数,请重新输入订单折扣", false);
            }
        }
예제 #25
0
        public static ValueMessage GetValueMessageApcPDU(DevModelConfig modelCfg, System.Collections.Generic.Dictionary <string, string> result)
        {
            ValueMessage valueMessage = new ValueMessage();

            System.Collections.Generic.Dictionary <string, string> dictionary  = new System.Collections.Generic.Dictionary <string, string>();
            System.Collections.Generic.Dictionary <string, string> dictionary2 = new System.Collections.Generic.Dictionary <string, string>();
            System.Collections.Generic.Dictionary <string, string> dictionary3 = new System.Collections.Generic.Dictionary <string, string>();
            System.Collections.Generic.IEnumerator <string>        enumerator  = result.Keys.GetEnumerator();
            while (enumerator.MoveNext())
            {
                string current = enumerator.Current;
                string text    = result[current];
                if (current.StartsWith(ApcDeviceStatusMib.Entry) || current.StartsWith(ApcPhaseStatusMib.Entry))
                {
                    dictionary.Add(current, text);
                }
                else
                {
                    if (current.StartsWith(ApcBankStatusMib.Entry))
                    {
                        dictionary2.Add(current, text);
                    }
                    else
                    {
                        if (current.StartsWith(ApcPDUBaseMib.Mac))
                        {
                            valueMessage.DeviceReplyMac = text.Replace(" ", ":").Replace("-", ":");
                        }
                        else
                        {
                            if (current.StartsWith(ApcSensorStatusMib.Entry))
                            {
                                dictionary3.Add(current, text);
                            }
                        }
                    }
                }
            }
            if (dictionary != null && dictionary.Count > 0)
            {
                valueMessage.DeviceValue = ApcMibParser.GetDeviceValue(dictionary);
            }
            if (dictionary2 != null && dictionary2.Count > 0)
            {
                valueMessage.BankValue = ApcMibParser.GetBankValue(dictionary2);
            }
            if (dictionary3 != null && dictionary3.Count > 0)
            {
                valueMessage.SensorValue = ApcMibParser.GetSensorValue(dictionary3);
            }
            else
            {
                valueMessage.SensorValue = ApcMibParser.GetSensorValue_Empty(dictionary3);
            }
            return(valueMessage);
        }
예제 #26
0
            protected override void Dispose(bool disposing)
            {
                base.Dispose(disposing);

                _joinEnumerator = null;

                _firstValue = default;

                _moveNext = null;
            }
예제 #27
0
        public static SortedSet <T> ToSet <T> (this System.Collections.Generic.IEnumerator <T> obj)
        {
            SortedSet <T> s = new SortedSet <T> ();

            while (obj.MoveNext())
            {
                s.Add(obj.Current);
            }
            return(s);
        }
예제 #28
0
        private static System.Collections.Generic.Dictionary <int, SensorThreshold> GetSensorThreshold(System.Collections.Generic.Dictionary <string, string> result)
        {
            System.Collections.Generic.Dictionary <int, SensorThreshold> dictionary = new System.Collections.Generic.Dictionary <int, SensorThreshold>();
            System.Collections.Generic.IEnumerator <string> enumerator = result.Keys.GetEnumerator();
            ApcSensorConfigMib apcSensorConfigMib = null;
            int num = 0;

            while (enumerator.MoveNext())
            {
                string current = enumerator.Current;
                string text    = result[current];
                if ("\0".Equals(text))
                {
                    text = System.Convert.ToString(-1000);
                }
                else
                {
                    if (text == null || string.IsNullOrEmpty(text) || text.Equals("Null"))
                    {
                        text = System.Convert.ToString(-500);
                    }
                    else
                    {
                        if (text.Equals("-1"))
                        {
                            text = System.Convert.ToString(-600);
                        }
                    }
                }
                int num2 = System.Convert.ToInt32(current.Substring(current.LastIndexOf(".") + 1));
                if (!dictionary.ContainsKey(num2))
                {
                    SensorThreshold value = new SensorThreshold(num2);
                    dictionary.Add(num2, value);
                }
                if (num != num2)
                {
                    apcSensorConfigMib = new ApcSensorConfigMib(num2);
                    num = num2;
                }
                SensorThreshold sensorThreshold = dictionary[num2];
                if (current.StartsWith(apcSensorConfigMib.MaxTemperature))
                {
                    sensorThreshold.MaxTemperatureMT = (float)System.Convert.ToInt32(text);
                }
                else
                {
                    if (current.StartsWith(apcSensorConfigMib.MinHumidity))
                    {
                        sensorThreshold.MinHumidityMT = (float)System.Convert.ToInt32(text);
                    }
                }
            }
            return(dictionary);
        }
예제 #29
0
        private static DeviceValueEntry GetDeviceValue(System.Collections.Generic.Dictionary <string, string> result)
        {
            DeviceValueEntry deviceValueEntry = new DeviceValueEntry();

            System.Collections.Generic.IEnumerator <string> enumerator = result.Keys.GetEnumerator();
            while (enumerator.MoveNext())
            {
                string current = enumerator.Current;
                string text    = result[current];
                if ("\0".Equals(text))
                {
                    text = System.Convert.ToString(-1000);
                }
                else
                {
                    if (string.IsNullOrEmpty(text))
                    {
                        text = System.Convert.ToString(-500);
                    }
                }
                int num = System.Convert.ToInt32(current.Substring(current.LastIndexOf(".") + 1));
                if (num == 1)
                {
                    ApcDeviceStatusMib apcDeviceStatusMib = new ApcDeviceStatusMib(num);
                    ApcPhaseStatusMib  apcPhaseStatusMib  = new ApcPhaseStatusMib(num);
                    System.Convert.ToInt32(text);
                    if (current.StartsWith(apcDeviceStatusMib.PowerStatus))
                    {
                        deviceValueEntry.Power = System.Convert.ToString((float)System.Convert.ToInt32(text) / 100f * 1000f);
                    }
                    else
                    {
                        if (current.StartsWith(apcDeviceStatusMib.PowerDsptStatus))
                        {
                            deviceValueEntry.PowerDissipation = System.Convert.ToString((float)System.Convert.ToInt32(text) / 10f);
                        }
                        else
                        {
                            if (current.StartsWith(apcPhaseStatusMib.CurrentStatus))
                            {
                                deviceValueEntry.Current = System.Convert.ToString((float)System.Convert.ToInt32(text) / 10f);
                            }
                            else
                            {
                                if (current.StartsWith(apcPhaseStatusMib.VoltageStatus))
                                {
                                    deviceValueEntry.Voltage = text;
                                }
                            }
                        }
                    }
                }
            }
            return(deviceValueEntry);
        }
예제 #30
0
        static void printActivityTree(Activity activity, string tag)
        {
            Console.WriteLine("{0} DisplayName:{1},type:{2}", tag, activity.DisplayName, activity.GetType());

            System.Collections.Generic.IEnumerator <Activity> list = WorkflowInspectionServices.GetActivities(activity).GetEnumerator();

            while (list.MoveNext())
            {
                printActivityTree(list.Current, "  " + tag);
            }
        }
예제 #31
0
            public bool MoveNext()
            {
                if (back)
                {
                    back = false;
                    return true;
                }

                if (null != this.en && this.en.MoveNext())
                {
                    return true;
                }

                for (; ; )
                {
                    if (nextzblock >= icl.zblocks.Length)
                    {
                        break;
                    }

                    killprevzblock();

                    icl.zblocks[nextzblock].CopyInto(icl.b12buffer, buf);
                    this.en = icl.b12buffer.GetEnumerator();
                    nextzblock++;
                    if (this.en.MoveNext())
                    {
                        return true;
                    }
                }
                killprevzblock();
                return false;
            }
예제 #32
0
 public Iterator(System.Collections.Generic.IEnumerable<BaseType> enumerable)
 {
     this.enumerator = enumerable.GetEnumerator();
     this.Position = -1;
 }