public void Add(TranslationJob job)
        {
            var lines = new TranslationLineTracker(job);

            Trackers.Add(lines);
            TotalLinesCount += lines.LinesCount;
        }
Esempio n. 2
0
        private BoggleTracker CreateTracker(IBogglePlayer player, BoggleBoard board)
        {
            BoggleTracker tracker = new BoggleTracker(player.Id, board);

            Trackers.Add(tracker);
            return(tracker);
        }
Esempio n. 3
0
        private void LoadTrackers()
        {
            foreach (var tracker in Settings.GlobalSettings.Data.Trackers)
            {
                switch (tracker.Type)
                {
                case TrackerType.GitHub:
                    Trackers.Add(new GithubTaskTracker(tracker.Address));
                    break;

                case TrackerType.Jira:
                    Trackers.Add(new JiraTaskTracker(tracker.Address));
                    break;
                }
            }

            if (Trackers.Count == 0)
            {
                Trackers.Add(new GithubTaskTracker("https://github.com/bombomby/optick"));
            }

            var targetTracker = Settings.GlobalSettings.Data.ActiveTracker;

            if (targetTracker != null)
            {
                Tracker = Trackers.FirstOrDefault(t => t.Address == targetTracker.Address && t.TrackerType == targetTracker.Type);
            }

            if (Tracker == null && Trackers.Count > 0)
            {
                Tracker = Trackers[0];
            }
        }
Esempio n. 4
0
        internal virtual ChangeNotificationTracker GetTracker(ModelProperty modelProperty, bool createNew)
        {
            ChangeNotificationTracker tracker = null;

            if (!this.Trackers.TryGetValue(modelProperty, out tracker) && createNew)
            {
                tracker = new ChangeNotificationTracker(this, modelProperty);
                Trackers.Add(modelProperty, tracker);
            }
            return(tracker);
        }
Esempio n. 5
0
        public int AddTracker(int trackerId)
        {
            var tracker = new Tracker()
            {
                TrackerId = trackerId
            };

            lock (lockObj) {
                Trackers.Add(tracker);

                SaveChanges();
            }
            return(tracker.TrackerId);
        }
Esempio n. 6
0
        void ParseTrackers()
        {
            string[] addresses = VotingsUser.Trackers.Split('\n');

            foreach (var line in addresses)
            {
                var parts = line.Split(':');

                IPAddress addr = new IPAddress(0);
                /*int port = 0;*/
                if (parts.Length >= 1 && IPAddress.TryParse(parts[0], out addr) /*&& int.TryParse(parts[1], out port)*/)
                {
                    EndPoint endPoint = new IPEndPoint(addr, CommonHelpers.TrackerPort);

                    Tracker tracker = new Tracker(endPoint, Trackers);

                    //перенаправляем события трекера вне
                    tracker.OnRequestBlocksMessage += (s, e) =>
                    {
                        OnRequestBlocksMessage?.Invoke(s, e);
                    };

                    tracker.OnRequestTransactionsMessage += (s, e) =>
                    {
                        OnRequestTransactionsMessage?.Invoke(s, e);
                    };

                    tracker.OnBlocksMessage += (s, e) =>
                    {
                        OnBlocksMessage?.Invoke(s, e);
                    };

                    tracker.OnTransactionsMessage += (s, e) =>
                    {
                        OnTransactionsMessage?.Invoke(s, e);
                    };


                    //получение пиров
                    tracker.OnPeersMessageFromPeer    += OnPeersMessage;
                    tracker.OnPeersMessageFromTracker += OnPeersMessage;

                    //коннект через трекер
                    tracker.OnConnectToPeerWithTrackerMessage += OnConnectToPeerWithTrackerMessage;

                    Trackers.Add(tracker);
                }
            }
        }
Esempio n. 7
0
        private async Task LoadBills()
        {
            var names = await BudgetDatabase.GetBillPayees();

            //List<Grouping<string, Bill>> data = (bills.GroupBy(x => x.Payee, StringComparer.OrdinalIgnoreCase)
            //            .Select(groupedTable => new Grouping<string, Bill>(groupedTable.Key, groupedTable))).ToList();

            names.Sort();
            Trackers.Clear();
            foreach (var name in names)
            {
                //var bt = new BillTracker(item.Key, item.Grouped);
                Trackers.Add(new BillTrackerQuickViewModel(navigationService, name));
            }
        }
        protected override void CreateTrackers()
        {
            IPoint point = GeometryFactory.CreatePoint((Coordinate)SourceFeature.Geometry.Coordinates[0].Clone());

            Trackers.Add(new TrackerFeature(this, point, 0, /*SelectedImageTracker*/
                                            (VectorStyle != null)
                                                ? TrackerSymbolHelper.GenerateComposite(new Pen(Color.Blue),
                                                                                        new SolidBrush(Color.DarkBlue),
                                                                                        VectorStyle.Symbol.Width,
                                                                                        VectorStyle.Symbol.Height,
                                                                                        6,
                                                                                        6)
                                                : null));
            Trackers[0].Selected = true;
        }
Esempio n. 9
0
        public TrackersListViewModel()
        {
            IsBusy = true;

            // Call api to update list with trackers
            _ = APIHelper.GetTrackersAsync(trackersResult =>
            {
                foreach (TrackerModel tracker in trackersResult)
                {
                    Trackers.Add(tracker);
                }

                IsBusy = false;
                TrackersListIsVisible = true;
            });
        }
Esempio n. 10
0
        public int AddTracker()
        {
            var index = Trackers
                        .OrderBy(tr => tr.TrackerId)
                        .Count() + 1;

            var tracker = new Tracker()
            {
                TrackerId = index,
            };

            lock (lockObj) {
                Trackers.Add(tracker);

                SaveChanges();
            }
            return(tracker.TrackerId);
        }
Esempio n. 11
0
        public async void AddTracker()
        {
            var mgr = IoC.Get <IWindowManager>();

            var dialog = new DialogBoxViewModel(LocalizationProvider.GetLocalizedValue(nameof(Resources.Strings.AddTrackerTitile)), string.Empty, false);
            var result = await mgr.ShowDialogAsync(dialog);

            var maxId = Trackers.Max(x => x.ID) + 1;


            if (dialog.Value is not null)
            {
                var tracker = new TransmissionTorrentTrackers()
                {
                    announce = dialog.Value.ToString(),
                    ID       = maxId
                };
                if (result == true && !Trackers.Contains(tracker))
                {
                    Trackers.Add(tracker);
                    toAdd.Add(dialog.Value.ToString());
                }
            }
        }
Esempio n. 12
0
        private Torrent(string name, string location, List <FileItem> files, List <string> trackers, int pieceSize, byte[] pieceHashes = null, int blockSize = 16384, bool?isPrivate = false)
        {
            Name = name;
            DownloadDirectory = location;
            Files             = files;
            fileWriteLocks    = new object[Files.Count];
            for (int i = 0; i < this.Files.Count; i++)
            {
                fileWriteLocks[i] = new object();
            }

            if (trackers != null)
            {
                foreach (string url in trackers)
                {
                    Tracker tracker = new Tracker(url);
                    Trackers.Add(tracker);
                    tracker.PeerListUpdated += HandlePeerListUpdated;
                }
            }

            PieceSize = pieceSize;
            BlockSize = blockSize;
            IsPrivate = isPrivate;

            int count = Convert.ToInt32(Math.Ceiling(TotalSize / Convert.ToDouble(PieceSize)));

            PieceHashes     = new byte[count][];
            IsPieceVerified = new bool[count];
            IsBlockAcquired = new bool[count][];

            for (int i = 0; i < PieceCount; i++)
            {
                IsBlockAcquired[i] = new bool[GetBlockCount(i)];
            }

            if (pieceHashes == null)
            {
                // this is a new torrent so we have to create the hashes from the files
                for (int i = 0; i < PieceCount; i++)
                {
                    PieceHashes[i] = GetHash(i);
                }
            }
            else
            {
                for (int i = 0; i < PieceCount; i++)
                {
                    PieceHashes[i] = new byte[20];
                    Buffer.BlockCopy(pieceHashes, i * 20, PieceHashes[i], 0, 20);
                }
            }

            object info = TorrentInfoToBEncodingObject(this);

            byte[] bytes = BenCoding.Encode(info);
            Infohash = SHA1.Create().ComputeHash(bytes);

            for (int i = 0; i < PieceCount; i++)
            {
                Verify(i);
            }
        }