コード例 #1
0
ファイル: ProgressNode.cs プロジェクト: modulexcite/pash-1
        private void RenderFull(ArrayList strCollection, int indentation, int maxWidth, PSHostRawUserInterface rawUI, bool isFullPlus)
        {
            string str = new string(' ', indentation);

            strCollection.Add(StringUtil.TruncateToBufferCellWidth(rawUI, StringUtil.Format(" {0}{1} ", str, base.Activity), maxWidth));
            indentation = indentation + 3;
            str         = new string(' ', indentation);
            ProgressNode.RenderFullDescription(base.StatusDescription, str, maxWidth, rawUI, strCollection, isFullPlus);
            if (base.PercentComplete >= 0)
            {
                int num             = Math.Max(3, maxWidth - indentation - 2 - 2 - 5);
                int percentComplete = base.PercentComplete * num / 100;
                if (base.PercentComplete < 100 && percentComplete == num)
                {
                    percentComplete--;
                }
                object[] objArray = new object[3];
                objArray[0] = str;
                objArray[1] = new string('o', percentComplete);
                objArray[2] = new string(' ', num - percentComplete);
                strCollection.Add(StringUtil.TruncateToBufferCellWidth(rawUI, StringUtil.Format(" {0}[{1}{2}] ", objArray), maxWidth));
            }
            if (base.SecondsRemaining >= 0)
            {
                TimeSpan timeSpan = new TimeSpan(0, 0, base.SecondsRemaining);
                strCollection.Add(StringUtil.TruncateToBufferCellWidth(rawUI, string.Concat(" ", StringUtil.Format(ProgressNodeStrings.SecondsRemaining, str, timeSpan), " "), maxWidth));
            }
            if (!string.IsNullOrEmpty(base.CurrentOperation))
            {
                strCollection.Add(" ");
                ProgressNode.RenderFullDescription(base.CurrentOperation, str, maxWidth, rawUI, strCollection, isFullPlus);
            }
        }
コード例 #2
0
ファイル: ProgressNode.cs プロジェクト: modulexcite/pash-1
        private int LinesRequiredInFullStyleMethod(PSHostRawUserInterface rawUi, int maxWidth, bool isFullPlus)
        {
            int       count      = 1;
            string    str        = new string(' ', 5);
            ArrayList arrayLists = new ArrayList();

            if (!isFullPlus)
            {
                count++;
            }
            else
            {
                arrayLists.Clear();
                ProgressNode.RenderFullDescription(base.StatusDescription, str, maxWidth, rawUi, arrayLists, true);
                count = count + arrayLists.Count;
            }
            if (base.PercentComplete >= 0)
            {
                count++;
            }
            if (base.SecondsRemaining >= 0)
            {
                count++;
            }
            if (!string.IsNullOrEmpty(base.CurrentOperation))
            {
                if (!isFullPlus)
                {
                    count = count + 2;
                }
                else
                {
                    count++;
                    arrayLists.Clear();
                    ProgressNode.RenderFullDescription(base.CurrentOperation, str, maxWidth, rawUi, arrayLists, true);
                    count = count + arrayLists.Count;
                }
            }
            return(count);
        }