Example #1
0
        public OutputChainBuffer AddArticleBuffer()
        {
            // If the last buffer is empty, just replace it.
            var b = _last = new OutputChainArticleBuffer(sandbox, _last);

            return(b);
        }
Example #2
0
 public OutputChain(Sandbox sb, string name)
 {
     sandbox = sb;
     _first  = new OutputChainBuffer(sb, null);
     _last   = _first;
     Name    = name;
 }
Example #3
0
        public void PrintToTarget(object targetName, object value)
        {
            if (!targets.TryGetValue(targetName, out OutputChainBuffer buffer))
            {
                buffer = targets[targetName] = new OutputChainBuffer(sandbox, null);
            }

            buffer.Print(value);
        }
Example #4
0
        public void PrintToTarget(string targetName, string value)
        {
            OutputChainBuffer buffer;

            if (!targets.TryGetValue(targetName, out buffer))
            {
                buffer = targets[targetName] = new OutputChainBuffer(sandbox, null);
            }

            buffer.Print(value);
        }
Example #5
0
        public OutputChainBuffer(Sandbox sb, OutputChainBuffer prev, OutputChainBuffer targetOrigin)
        {
            _prevItem = prev;

            if (prev != null)
            {
                prev._nextItem = this;
                _caps          = prev is OutputChainArticleBuffer && prev.Caps == Capitalization.First ? Capitalization.None : prev._caps;
            }

            _buffer = targetOrigin._buffer;
            sandbox = sb;
        }
Example #6
0
        public OutputChainBuffer(Sandbox sb, OutputChainBuffer prev, OutputChainBuffer targetOrigin)
        {
            NumberFormatter = new NumberFormatter(sb);
            Prev            = prev;

            if (prev != null)
            {
                prev.Next = this;
                _caps     = prev is OutputChainArticleBuffer && prev.Caps == Capitalization.First ? Capitalization.None : prev._caps;
            }

            _buffer  = targetOrigin._buffer;
            _sandbox = sb;
        }
Example #7
0
        public void InsertTarget(object targetName)
        {
            // Check if the buffer was already created
            if (!targets.TryGetValue(targetName, out OutputChainBuffer buffer))
            {
                buffer = targets[targetName] = AddBuffer();
            }
            else
            {
                Last = new OutputChainBuffer(sandbox, Last, buffer);
            }

            // Then add an empty buffer after it so we don't start printing onto the target.
            AddBuffer();
        }
Example #8
0
        public void AddBufferBefore(int bufferInvIndex, string value)
        {
            OutputChainBuffer bufReference = Last;

            for (int i = 0; i < bufferInvIndex; i++)
            {
                bufReference = bufReference.Prev;
            }
            var bufInsert = new OutputChainBuffer(sandbox, bufReference.Prev);

            if (bufInsert.Next == First)
            {
                First = bufInsert;
            }
            bufInsert.Print(value);
        }
Example #9
0
        public OutputChainBuffer(Sandbox sb, OutputChainBuffer prev)
        {
            _prevItem = prev;

            if (prev != null)
            {
                prev._nextItem = this;
                _caps          = prev is OutputChainArticleBuffer && prev.Caps == Capitalization.First ? Capitalization.None : prev._caps;
                _numberFormatter.BinaryFormat       = prev.NumberFormatter.BinaryFormat;
                _numberFormatter.BinaryFormatDigits = prev.NumberFormatter.BinaryFormatDigits;
                _numberFormatter.Endianness         = prev.NumberFormatter.Endianness;
                _numberFormatter.NumberFormat       = prev.NumberFormatter.NumberFormat;
            }

            _isTarget = true;
            _buffer   = new StringBuilder(InitialCapacity);
            sandbox   = sb;
        }
Example #10
0
        public void InsertTarget(string targetName)
        {
            // Check if the buffer was already created
            OutputChainBuffer buffer;

            if (!targets.TryGetValue(targetName, out buffer))
            {
                // If not, make a new one and insert it
                buffer = targets[targetName] = AddBuffer();
            }
            else
            {
                // If it does exist, just create a new instance of it with the same buffer and add it in.
                _last = new OutputChainBuffer(sandbox, _last, buffer);
            }

            // Then add an empty buffer after it so we don't start printing onto the target.
            AddBuffer();
        }
Example #11
0
        public OutputChainBuffer(Sandbox sb, OutputChainBuffer prev)
        {
            NumberFormatter = new NumberFormatter(sb);
            Prev            = prev;

            if (prev != null)
            {
                if (prev.Next != null)
                {
                    prev.Next.Prev = this;
                }
                prev.Next = this;
                _caps     = prev is OutputChainArticleBuffer && prev.Caps == Capitalization.First ? Capitalization.None : prev._caps;
                NumberFormatter.BinaryFormat       = prev.NumberFormatter.BinaryFormat;
                NumberFormatter.BinaryFormatDigits = prev.NumberFormatter.BinaryFormatDigits;
                NumberFormatter.Endianness         = prev.NumberFormatter.Endianness;
                NumberFormatter.NumberFormat       = prev.NumberFormatter.NumberFormat;
            }

            IsTarget = true;
            _buffer  = new StringBuilder(InitialCapacity);
            _sandbox = sb;
        }
Example #12
0
 public OutputChainBuffer AddBuffer()
 {
     return(_last = new OutputChainBuffer(sandbox, _last));
 }
Example #13
0
 public OutputChainArticleBuffer(Sandbox sb, OutputChainBuffer prev, OutputChainBuffer targetOrigin) : base(sb, prev, targetOrigin)
 {
     Initialize();
 }
Example #14
0
 public OutputChainArticleBuffer(Sandbox sb, OutputChainBuffer prev) : base(sb, prev)
 {
     Initialize();
 }