Ejemplo n.º 1
0
        private void UpdateEmptyCollections(DateTime algorithmTime)
        {
            // just in case
            _emptyTradeBars.Clear();
            _emptyQuoteBars.Clear();
            _emptyTicks.Clear();
            _emptySplits.Clear();
            _emptyDividends.Clear();
            _emptyDelistings.Clear();
            _emptyOptionChains.Clear();
            _emptyFuturesChains.Clear();
            _emptySymbolChangedEvents.Clear();

#pragma warning disable 0618 // DataDictionary.Time is deprecated, ignore until removed entirely
            _emptyTradeBars.Time
                              = _emptyQuoteBars.Time
                              = _emptyTicks.Time
                              = _emptySplits.Time
                              = _emptyDividends.Time
                              = _emptyDelistings.Time
                              = _emptyOptionChains.Time
                              = _emptyFuturesChains.Time
                              = _emptySymbolChangedEvents.Time = algorithmTime;
#pragma warning restore 0618
        }
Ejemplo n.º 2
0
        public void UpdateSplits()
        {
            if (isLoading)
            {
                return;
            }

            AlphaSort = rdSortAlpha.Checked;

            Splits.Clear();
            foreach (Control c in flowMain.Controls)
            {
                if (c is OriSplitSettings)
                {
                    OriSplitSettings setting = (OriSplitSettings)c;
                    if (!string.IsNullOrEmpty(setting.cboName.Text) && !string.IsNullOrEmpty(setting.txtValue.Text))
                    {
                        OriSplit split = new OriSplit(setting.cboName.Text, setting.txtValue.Text, setting.chkShouldSplit.Checked);
                        Splits.Add(split);
                    }
                }
            }

            ShowMapDisplay = chkShowMapDisplay.Checked;
            RainbowDash    = chkRainbowDash.Checked;
        }
Ejemplo n.º 3
0
        public void SetSettings(XmlNode settings)
        {
            XmlNode showMapNode = settings.SelectSingleNode(".//MapDisplay");

            if (showMapNode != null && showMapNode.InnerText != "")
            {
                ShowMapDisplay = bool.Parse(showMapNode.InnerText);
            }
            else
            {
                ShowMapDisplay = false;
            }

            XmlNode showRainbow = settings.SelectSingleNode(".//RainbowDash");

            if (showRainbow != null && showRainbow.InnerText != "")
            {
                RainbowDash = bool.Parse(showRainbow.InnerText);
            }
            else
            {
                RainbowDash = false;
            }

            Splits.Clear();
            XmlNodeList splitNodes = settings.SelectNodes(".//Splits/Split");

            foreach (XmlNode splitNode in splitNodes)
            {
                string name        = splitNode.InnerText;
                string value       = splitNode.Attributes["Value"].Value;
                bool   shouldSplit = bool.Parse(splitNode.Attributes["ShouldSplit"].Value);
                Splits.Add(new OriSplit(name, value, shouldSplit));
            }
        }
Ejemplo n.º 4
0
        public void Clean()
        {
            var queue = WaitingForAcksQueue;

            foreach (var datagram in queue.Values)
            {
                datagram.PutPool();
            }

            foreach (var splitPartPackagese in Splits)
            {
                if (splitPartPackagese.Value != null)
                {
                    foreach (SplitPartPackage package in splitPartPackagese.Value)
                    {
                        if (package != null)
                        {
                            package.PutPool();
                        }
                    }
                }
            }

            queue.Clear();
            Splits.Clear();
        }
        public void SetSettings(XmlNode settings)
        {
            XmlNode orderedNode          = settings.SelectSingleNode(".//Ordered");
            XmlNode AutosplitEndRunsNode = settings.SelectSingleNode(".//AutosplitEndRuns");
            bool    isOrdered            = false;
            bool    isAutosplitEndRuns   = false;

            if (orderedNode != null)
            {
                bool.TryParse(orderedNode.InnerText, out isOrdered);
            }
            if (AutosplitEndRunsNode != null)
            {
                bool.TryParse(AutosplitEndRunsNode.InnerText, out isAutosplitEndRuns);
            }
            Ordered          = isOrdered;
            AutosplitEndRuns = isAutosplitEndRuns;

            Splits.Clear();
            XmlNodeList splitNodes = settings.SelectNodes(".//Splits/Split");

            foreach (XmlNode splitNode in splitNodes)
            {
                string    splitDescription = splitNode.InnerText;
                SplitName split            = HollowKnightSplitSettings.GetSplitName(splitDescription);
                Splits.Add(split);
            }
        }
Ejemplo n.º 6
0
        public void SetSettings(XmlNode settings)
        {
            Splits.Clear();
            XmlNodeList splitNodes = settings.SelectNodes(".//Splits/Split");

            foreach (XmlNode splitNode in splitNodes)
            {
                string name        = splitNode.InnerText;
                string value       = splitNode.Attributes["LevelEnum"].Value;
                bool   shouldSplit = bool.Parse(splitNode.Attributes["ShouldSplit"].Value);
                Splits.Add(new EagleIslandSplit(name, value, shouldSplit));
            }
        }
Ejemplo n.º 7
0
        public void SetSettings(XmlNode settings)
        {
            Splits.Clear();
            XmlNodeList splitNodes = settings.SelectNodes(".//Splits/Split");

            foreach (XmlNode splitNode in splitNodes)
            {
                string    splitDescription = splitNode.InnerText;
                SplitName split            = HollowKnightSplitSettings.GetSplitName(splitDescription);
                Splits.Add(split);
            }

            XmlNode gameTime = settings.SelectSingleNode(".//OldGameTime");

            OldGameTime = gameTime == null || string.IsNullOrEmpty(gameTime.InnerText) ? false : bool.Parse(gameTime.InnerText);
        }
Ejemplo n.º 8
0
        public void UpdateSplits()
        {
            if (isLoading)
            {
                return;
            }

            Splits.Clear();
            foreach (Control c in flowMain.Controls)
            {
                if (c is EagleIslandSplitSettings)
                {
                    EagleIslandSplitSettings setting = (EagleIslandSplitSettings)c;
                    if (!string.IsNullOrEmpty(setting.cboName.Text))
                    {
                        EagleIslandSplit split = new EagleIslandSplit(setting.cboName.Text, setting.cboName.SelectedValue.ToString(), setting.chkShouldSplit.Checked);
                        Splits.Add(split);
                    }
                }
            }
        }
Ejemplo n.º 9
0
        public void Clean()
        {
            _cancellationToken.Cancel();

            var queue = WaitingForAcksQueue;

            foreach (var kvp in queue)
            {
                Datagram datagram;
                if (queue.TryRemove(kvp.Key, out datagram))
                {
                    datagram.PutPool();
                }
            }

            foreach (var kvp in Splits)
            {
                SplitPartPackage[] splitPartPackagese;
                if (Splits.TryRemove(kvp.Key, out splitPartPackagese))
                {
                    if (splitPartPackagese == null)
                    {
                        continue;
                    }

                    foreach (SplitPartPackage package in splitPartPackagese)
                    {
                        if (package != null)
                        {
                            package.PutPool();
                        }
                    }
                }
            }

            queue.Clear();
            Splits.Clear();
        }
Ejemplo n.º 10
0
        private void UpdateEmptyCollections(DateTime algorithmTime)
        {
            // just in case
            _emptyTradeBars.Clear();
            _emptyQuoteBars.Clear();
            _emptyTicks.Clear();
            _emptySplits.Clear();
            _emptyDividends.Clear();
            _emptyDelistings.Clear();
            _emptyOptionChains.Clear();
            _emptyFuturesChains.Clear();
            _emptySymbolChangedEvents.Clear();

            _emptyTradeBars.Time
                              = _emptyQuoteBars.Time
                              = _emptyTicks.Time
                              = _emptySplits.Time
                              = _emptyDividends.Time
                              = _emptyDelistings.Time
                              = _emptyOptionChains.Time
                              = _emptyFuturesChains.Time
                              = _emptySymbolChangedEvents.Time = algorithmTime;
        }
Ejemplo n.º 11
0
        public void UpdateSplits()
        {
            if (isLoading)
            {
                return;
            }

            Splits.Clear();
            foreach (Control c in flowMain.Controls)
            {
                if (c is HollowKnightSplitSettings)
                {
                    HollowKnightSplitSettings setting = (HollowKnightSplitSettings)c;
                    if (!string.IsNullOrEmpty(setting.cboName.Text))
                    {
                        SplitName split = HollowKnightSplitSettings.GetSplitName(setting.cboName.Text);
                        Splits.Add(split);
                    }
                }
            }

            OldGameTime = chkOldGameTime.Checked;
        }
Ejemplo n.º 12
0
        public void Close()
        {
            if (Server == null)             // EMULATOR
            {
                if (_tickerHighPrecisionTimer != null)
                {
                    _tickerHighPrecisionTimer.Dispose();
                }

                return;
            }

            PlayerNetworkSession session;

            if (!Server.ServerInfo.PlayerSessions.TryRemove(EndPoint, out session))
            {
                return;
            }

            if (PlayerAckQueue.Count > 0)
            {
                Thread.Sleep(50);
            }

            if (_tickerHighPrecisionTimer != null)
            {
                _tickerHighPrecisionTimer.Dispose();
            }

            State          = ConnectionState.Unconnected;
            Evicted        = true;
            MessageHandler = null;

            SendQueue();

            _cancellationToken.Cancel();
            _waitEvent.Set();
            _mainWaitEvent.Set();
            _queue.Clear();

            var queue = WaitingForAcksQueue;

            foreach (var kvp in queue)
            {
                Datagram datagram;
                if (queue.TryRemove(kvp.Key, out datagram))
                {
                    datagram.PutPool();
                }
            }

            foreach (var kvp in Splits)
            {
                SplitPartPackage[] splitPartPackagese;
                if (Splits.TryRemove(kvp.Key, out splitPartPackagese))
                {
                    if (splitPartPackagese == null)
                    {
                        continue;
                    }

                    foreach (SplitPartPackage package in splitPartPackagese)
                    {
                        if (package != null)
                        {
                            package.PutPool();
                        }
                    }
                }
            }

            queue.Clear();
            Splits.Clear();

            try
            {
                _processingThread = null;
                _cancellationToken.Dispose();
                _waitEvent.Close();
                _mainWaitEvent.Close();
            }
            catch (Exception e)
            {
            }

            if (Log.IsDebugEnabled)
            {
                Log.Warn($"Closed network session for player {Username}");
            }
        }