示例#1
0
        private void CreateSpanAndStartOther()
        {
            NumberFormatInfo provider = new NumberFormatInfo();

            provider.NumberDecimalSeparator = ",";
            provider.NumberGroupSeparator   = ".";

            string title = textTitle.Text;

            Spans.Add(new Span(title, Convert.ToDouble(textLength.Text, provider), PossibleProfiles));

            textTitle.Clear();
            textLength.Clear();

            PossibleProfiles = new List <Profile>();

            comboProfiles.Items.Clear();

            foreach (Profile profile in Main.Profiles)
            {
                comboProfiles.Items.Add(profile);
            }

            dataGridProfiles.Rows.Clear();

            int size = title.Length;

            string prefix = title.Substring(0, 1);

            int number = Convert.ToInt32(title.Substring(1, size - 1));

            textTitle.Text = $"{prefix}{(number + 1)}";

            textLength.Focus();
        }
示例#2
0
        public void AddSpans(Span[] list, double weight, double H)
        {
            Catenary last = null;

            if (Spans.Count > 0)
            {
                last   = Spans.Last();
                weight = last.CableWeight;
                H      = last.HorizontalTension;
            }
            RaiseListChangedEvents = false;
            for (int i = 0; i < list.Length; i++)
            {
                var cat = new Catenary(list[i], weight, H);
                if (last != null)
                {
                    cat.StartPosition = last.EndPosition;
                }
                Spans.Add(cat);
                last = cat;
            }
            RaiseListChangedEvents = true;

            OnRulingSpanChange(new ItemChangeEventArgs());
        }
示例#3
0
        public void AddSpan(Span span)
        {
            if (span.Min > span.Max)
            {
                int tmp = span.Min;
                span.Min = span.Max;
                span.Max = tmp;
            }
            MathHelper.Clamp(span.Min, 0, Height);
            MathHelper.Clamp(span.Max, 0, Height);
            for (int i = 0; i < Spans.Count; ++i)
            {
                Span cur = Spans[i];
                if (cur.Min > span.Max)
                {
                    Spans.Insert(i, span);
                    return;
                }
                else if (cur.Max >= span.Min)
                {
                    if (cur.Min < span.Min)
                    {
                        span.Min = cur.Min;
                    }

                    if (cur.Max > span.Max)
                    {
                        span.Max = cur.Max;
                    }
                    Spans.RemoveAt(i);
                    i--;
                }
            }
            Spans.Add(span);
        }
        public Span AddSpan(string text, ConsoleColor fore, ConsoleColor back, int x)
        {
            var span = new Span(text, fore, back, x);

            Spans.Add(span);
            return(span);
        }
示例#5
0
 /// <inheritdoc />
 public void RecordSpan(SpanData span)
 {
     lock (Spans)
     {
         Spans.Add(span);
     }
 }
示例#6
0
        private ISpan AddSpan(CallInfo callInfo)
        {
            var span = Substitute.For <ISpan>();

            span.Operation = callInfo.Arg <string>();
            Spans.Add(span);
            return(span);
        }
示例#7
0
        // METHODS
        // -> Basic section handling:
        public void JustAddSpan()
        {
            UserSpan newSpan = new UserSpan(); // add span at the end of current section

            newSpan.PropertyChanged += OnUserSpanPropertyChanged;
            Spans.Add(newSpan);
            OrderingSection();
            SelectedUserSpan = Spans.Last();
        }
示例#8
0
 /// <inheritdoc />
 public void RecordSpan(SpanData span)
 {
     _logger.Trace($"Waiting for lock in SpanRecorder.");
     lock (Spans)
     {
         _logger.Trace($"Lock freed, adding new span: {span}");
         Spans.Add(span);
     }
 }
示例#9
0
 protected override void OnBeginChild(Span child)
 {
     lock (this)
     {
         EnsureNotSealed();
         Spans.Add(child);
     }
     base.OnBeginChild(child);
     child.BeginChild += OnBeginChild;
 }
示例#10
0
 private DiagnosticResult AppendSpan(FileLinePositionSpan span, DiagnosticLocationOptions options)
 {
     return(new DiagnosticResult(
                spans: Spans.Add(new DiagnosticLocation(span, options)),
                suppressMessage: _suppressMessage,
                message: _message,
                severity: Severity,
                id: Id,
                messageFormat: MessageFormat,
                messageArguments: MessageArguments));
 }
示例#11
0
        private void buttonCreateSpan_Click(object sender, EventArgs e)
        {
            NumberFormatInfo provider = new NumberFormatInfo();

            provider.NumberDecimalSeparator = ",";
            provider.NumberGroupSeparator   = ".";

            Spans.Add(new Span(textTitle.Text, Convert.ToDouble(textLength.Text, provider), PossibleProfiles));

            Close();
        }
示例#12
0
        public void AddSpans(params Catenary[] list)
        {
            RaiseListChangedEvents = false;
            for (int i = 0; i < list.Length; i++)
            {
                Spans.Add(list[i]);
            }
            RaiseListChangedEvents = true;

            OnRulingSpanChange(new ItemChangeEventArgs());
        }
示例#13
0
 public RulingSpan(RulingSpan other)
     : this(other.Units.Clone())
 {
     RaiseListChangedEvents = false;
     for (int i = 0; i < other.Spans.Count; i++)
     {
         Spans.Add(other.Spans[i].Clone());
     }
     RaiseListChangedEvents = true;
     OnRulingSpanChange(new ItemChangeEventArgs());
 }
 private DiagnosticResult AppendSpan(FileLinePositionSpan span, DiagnosticLocationOptions options)
 {
     return(new DiagnosticResult(
                Spans.Add(new DiagnosticLocation(span, options)),
                _suppressMessage,
                _message,
                Severity,
                Id,
                MessageFormat,
                MessageArguments,
                SuppressedId));
 }
示例#15
0
 protected override void OnBeginChild(Span child)
 {
     lock (this)
     {
         EnsureNotSealed();
         if (_maxSpans == null || Spans.Count < _maxSpans)
         {
             Spans.Add(child);
         }
     }
     base.OnBeginChild(child);
     child.BeginChild += OnBeginChild;
 }
示例#16
0
        public UserLine(UserLine copy)
        {
            #region param checks
            if (copy == null)
            {
                throw new ArgumentNullException("copy");
            }
            #endregion

            CachedWrapAt = -1;
            IsOutput     = copy.IsOutput;

            foreach (var span in copy.Spans)
            {
                Spans.Add(new Span(span));
            }
        }
示例#17
0
        // -> Section handling backstage:
        private void CreateBasicSection()
        {
            UserSpan span0 = new UserSpan();
            UserSpan span1 = new UserSpan();

            span0.PropertyChanged += OnUserSpanPropertyChanged;
            span1.PropertyChanged += OnUserSpanPropertyChanged;

            if (Spans.Count != 0)
            {
                LowLevelSectionErase();
            }

            Spans.Add(span0);
            Spans.Add(span1);

            OrderingSection();
        }
示例#18
0
 public void Normalize()
 {
     if (Spans.Count == 0)
     {
         Spans.Add(AmFactory.Create <RtPureSpan>());
     }
     else
     {
         for (var i = Spans.Count - 1; i > 0; i--)
         {
             if (Spans[i].IsEmpty)
             {
                 Spans.RemoveAt(i);
             }
         }
     }
     // todo: merge spans
 }
        public HighlightRuleSet(XmlElement el)
        {
            if (el.Attributes["name"] != null)
            {
                Name = el.Attributes["name"].InnerText;
            }

            if (el.HasAttribute("escapecharacter"))
            {
                EscapeCharacter = el.GetAttribute("escapecharacter")[index : 0];
            }

            if (el.Attributes["reference"] != null)
            {
                Reference = el.Attributes["reference"].InnerText;
            }

            if (el.Attributes["ignorecase"] != null)
            {
                IgnoreCase = bool.Parse(el.Attributes["ignorecase"].InnerText);
            }

            for (var i = 0; i < Delimiters.Length; ++i)
            {
                Delimiters[i] = false;
            }

            if (el["Delimiters"] != null)
            {
                var delimiterString = el["Delimiters"].InnerText;
                foreach (var ch in delimiterString)
                {
                    Delimiters[ch] = true;
                }
            }

//            Spans       = new LookupTable(!IgnoreCase);

            KeyWords    = new LookupTable(!IgnoreCase);
            PrevMarkers = new LookupTable(!IgnoreCase);
            NextMarkers = new LookupTable(!IgnoreCase);

            var nodes = el.GetElementsByTagName("KeyWords");

            foreach (XmlElement el2 in nodes)
            {
                var color = new HighlightColor(el2);

                var keys = el2.GetElementsByTagName("Key");
                foreach (XmlElement node in keys)
                {
                    KeyWords[node.Attributes["word"].InnerText] = color;
                }
            }

            nodes = el.GetElementsByTagName("Span");
            foreach (XmlElement el2 in nodes)
            {
                Spans.Add(new Span(el2));
            }

            /*
             *  Span span = new Span(el2);
             *  Spans[span.Begin] = span;*/

            nodes = el.GetElementsByTagName("MarkPrevious");
            foreach (XmlElement el2 in nodes)
            {
                var prev = new PrevMarker(el2);
                PrevMarkers[prev.What] = prev;
            }

            nodes = el.GetElementsByTagName("MarkFollowing");
            foreach (XmlElement el2 in nodes)
            {
                var next = new NextMarker(el2);
                NextMarkers[next.What] = next;
            }
        }
示例#20
0
 public RootSpan()
 {
     Spans.Add(this);
 }
示例#21
0
 void AddSpan(object parameter)
 {
     Spans.Add(new Span(Spans.LastOrDefault()));
 }
        //每个RuleSet节点的样子:<RuleSet ignorecase = "false">......</RuleSet>
        public HighlightRuleSet(XmlElement el)
        {
            if (el.Attributes["name"] != null)
            {
                Name = el.Attributes["name"].InnerText;
            }

            if (el.Attributes["noescapesequences"] != null)
            {
                noEscapeSequences = Boolean.Parse(el.Attributes["noescapesequences"].InnerText);
            }

            if (el.Attributes["reference"] != null)
            {
                reference = el.Attributes["reference"].InnerText;
            }

            if (el.Attributes["ignorecase"] != null)
            {
                ignoreCase = Boolean.Parse(el.Attributes["ignorecase"].InnerText);
            }

            for (int i = 0; i < Delimiters.Length; ++i)
            {
                Delimiters[i] = false;
            }

            if (el["Delimiters"] != null)
            {
                string delimiterString = el["Delimiters"].InnerText;
                foreach (char ch in delimiterString)
                {
                    Delimiters[(int)ch] = true;                    //将当前字符置为分隔符.
                }
            }

            XmlNodeList nodes = null;

            //以下是初始化Span.
            nodes = el.GetElementsByTagName("Span");
            foreach (XmlElement el2 in nodes)
            {
                Spans.Add(new Span(el2));
            }

            keyWords    = new LookupTable(!IgnoreCase);
            prevMarkers = new LookupTable(!IgnoreCase);
            nextMarkers = new LookupTable(!IgnoreCase);

            //以下是初始化KeyWords.
            nodes = el.GetElementsByTagName("KeyWords");
            foreach (XmlElement el2 in nodes)
            {
                HighlightColor color = new HighlightColor(el2);

                XmlNodeList keys = el2.GetElementsByTagName("Key");
                foreach (XmlElement node in keys)
                {
                    keyWords[node.Attributes["word"].InnerText] = color;                    //为每个关键字都赋予一个HighLightColor对象.
                }
            }

            //每个MarkPrevious节点的样子:
            //<MarkPrevious bold = "true" italic = "false" color = "MidnightBlue">(</MarkPrevious>
            nodes = el.GetElementsByTagName("MarkPrevious");
            foreach (XmlElement el2 in nodes)
            {
                PrevMarker prev = new PrevMarker(el2);
                prevMarkers[prev.What] = prev;
            }
            //每个MarkFollowing节点的样子和MarkFollowing的样子完全一样.
            nodes = el.GetElementsByTagName("MarkFollowing");
            foreach (XmlElement el2 in nodes)
            {
                NextMarker next = new NextMarker(el2);
                nextMarkers[next.What] = next;
            }
        }