Exemple #1
0
        public void Remove(IMyEntity ent, string dummy)
        {
            var          key = new DummyKey(ent, dummy);
            DetectorData res;

            if (_detectorData.TryGetValue(key, out res))
            {
                _detectorData.Remove(key);
                if (res.ProxyId != -1)
                {
                    _detectorTree.RemoveProxy(res.ProxyId);
                }
                else
                {
                    var c = _waitingInsert.Count;
                    while (c-- > 0)
                    {
                        var k = _waitingInsert.Dequeue();
                        if (k != res)
                        {
                            _waitingInsert.Enqueue(k);
                        }
                    }
                }

                CheckWaiting();
            }
        }
Exemple #2
0
        public void AddDetector(IMyEntity ent, string dummy, bool input, bool output)
        {
            var key  = new DummyKey(ent, dummy);
            var data = new DetectorData(ent, dummy, input, output);

            _detectorData.Add(key, data);
            _waitingInsert.Enqueue(data);

            CheckWaiting();
        }
Exemple #3
0
        public void Remove(IMyEntity entity, string path)
        {
            _detectors?.Remove(entity, path);

            var key = new DummyKey(entity, path);
            DummyData <TSegmentType, TConnData> data;

            if (!_pathByDummy.TryGetValue(key, out data))
            {
                return;
            }
            _pathByDummy.Remove(key);
            Segment <TSegmentType, TConnData> .Remove(data);
        }
Exemple #4
0
        public DummyData <TSegmentType, TConnData> GetOrCreate(IMyEntity entity, string path, out bool created)
        {
            created = false;
            var key = new DummyKey(entity, path);
            DummyData <TSegmentType, TConnData> res;

            if (!_pathByDummy.TryGetValue(key, out res))
            {
                res         = new DummyData <TSegmentType, TConnData>(new DummyPathRef(entity, path.Split('/')));
                res.Segment = AllocateSegment(res);
                _pathByDummy.Add(key, res);
                created = true;
            }

            return(res);
        }