Esempio n. 1
0
        public AsgardClient()
            : base()
        {
            _netConfig = Config.Get<NetConfig>("network");

            _bifrost = new BifrostClient(_netConfig.Host, _netConfig.Port);
            RPCManager.SetConnection(_bifrost);
            AddInternalSystem(_bifrost, 0);

            float delay_amount = (float)Math.Round((1f / _netConfig.Tickrate) * 6f, 2);

            _jitterBuffer = new JitterBuffer<List<Tuple<Entity, NetworkObject>>>(_netConfig.Tickrate / 5);
            _stateList = new List<PlayerStateData>();
            _moveBuffer = new Core.Collections.LinkedList<PlayerStateData>();
        }
        public void Parse(
            TextReader reader,
            Func <IDocumentElement, bool> onBeginProcessElement,
            Func <IDocumentElement, bool> onEndProcessElement)
        {
            _onBeginProcessElement = onBeginProcessElement;
            _onEndProcessElement   = onEndProcessElement;

            _characterStream = new MarkdownCharacterStream(reader)
            {
                State = MarkdownStates.ParagraphBreak
            };
            _stringParser   = new TextParser(_stringBuilderFactory, _characterStream);
            _elementStack   = new Core.Collections.LinkedList <StackedElement>();
            _references     = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase);
            _anchorsToFixup = new List <AnchorElement>();

            _document = new DocumentElement
            {
                MimeType         = "application/x-markdown",
                ConformanceLevel = 1.0f
            };

            PushElement(_document);

            var line = _stringBuilderFactory.Create();

            while (!_characterStream.Eof)
            {
                line.Clear();
                _stringParser.TakeUntil(line, 1024, '\n', false);
                AddLine(line.ToString());
            }

            while (!(_elementStack.Last().Element is DocumentElement))
            {
                PopElement();
            }

            FixUpReferences();

            End(_document);
        }