Ejemplo n.º 1
0
 public void UpdatePath(string path)
 {
     try
     {
         CurrentDir = new DirectoryInfo(path);
         SongFiles  = new List <FileInfo>(CurrentDir.GetFiles("*.mp3", SearchOption.AllDirectories));
     }
     catch
     {
         SongFiles = new List <FileInfo>();
     }
     finally
     {
         PathUpdated?.Invoke(this, new EventArgs());
     }
 }
Ejemplo n.º 2
0
        private void Split(DummyData <TSegmentType, TConnData> at)
        {
            var idx = _path.IndexOf(at);

            if (idx == -1)
            {
                throw new Exception(
                          $"Couldn't find {at.Dummy} in {GetHashCode():X8}: {string.Join(", ", _path.Select(x => x.Dummy))}");
            }

            var from = _path[idx - 1];
            var to   = _path[idx];

            var ns = _network.AllocateSegment();

            for (var i = idx; i < _path.Count; i++)
            {
                ns._path.Add(_path[i]);
                _path[i].Segment = ns;
                for (var j = 0; j < _connections.Count; j++)
                {
                    if (_connections[j].From == _path[i] || _connections[j].To == _path[i])
                    {
                        ns._connections.Add(_connections[j]);
                        _connections.RemoveAtFast(j);
                        j--;
                    }
                }
            }

            _path.RemoveRange(idx, _path.Count - idx);

            var conn = new Connection <TSegmentType, TConnData>(from, to, _network.DissolveableConnectionData);

            _connections.Add(conn);
            ns._connections.Add(conn);

            PathUpdated?.Invoke();
            ns.PathUpdated?.Invoke();
        }
Ejemplo n.º 3
0
        private void BreakAfter(int idx)
        {
            idx++;
            var ns = _network.AllocateSegment();

            for (var i = idx; i < _path.Count; i++)
            {
                ns._path.Add(_path[i]);
                _path[i].Segment = ns;
                for (var j = 0; j < _connections.Count; j++)
                {
                    if (_connections[j].From == _path[i] || _connections[j].To == _path[i])
                    {
                        ns._connections.Add(_connections[j]);
                        _connections.RemoveAtFast(j);
                        j--;
                    }
                }
            }

            _path.RemoveRange(idx, _path.Count - idx);
            PathUpdated?.Invoke();
        }
Ejemplo n.º 4
0
 public void TriggerPathUpdate()
 {
     PathUpdated?.Invoke();
 }