public string Format(string template, string description)
 {
     return(template.FormatInvariant(
                description.NaIfEmpty(),
                TotalProcessed.ToString("N0"), TotalRecords.ToString("N0"),
                Success.ToString("N0"), Failure.ToString("N0"), Skipped.ToString("N0"),
                Added.ToString("N0"), Updated.ToString("N0")));
 }
        public override string ToString()
        {
            if (!Content.Contains("{"))
            {
                return(Content);
            }

            var str = Content.FormatInvariant(
                Description.NaIfEmpty(),
                (int)Math.Round(ProcessedPercent),
                TotalProcessed.ToString("N0"), TotalRecords.ToString("N0"),
                Success.ToString("N0"), Failure.ToString("N0"), Skipped.ToString("N0"),
                Added.ToString("N0"), Updated.ToString("N0")
                );

            return(str);
        }
#pragma warning disable 0162
        public String this[int index]
        {
            get
            {
                switch (index)
                {
                case 0:
                    return(ID.ToString());

                    break;

                case 1:
                    return(Quantity.ToString());

                    break;

                case 2:
                    return(Name);

                    break;

                case 3:
                    return(Type);

                    break;

                case 4:
                    return(Added.ToString("MM/dd/yyyy H:mm"));

                    break;

                case 5:
                    return(CloudID);

                    break;

                default:
                    return(Name);

                    break;
                }
            }
        }
Esempio n. 4
0
        public string this[string field]
        {
            get
            {
                switch (field)
                {
                case "ID": return(ID.ToString());

                case "Name": return(Name);

                case "OriginalName": return(OriginalName);

                case "Storage": return(Storage);

                case "Year": return(Year.ToString());

                case "Country": return(Country);

                //case "Genre": return Genre;
                case "Category": return(Category);

                case "Added": return(Added.ToString(Thread.CurrentThread.CurrentCulture.DateTimeFormat));

                case "Language": return(Language);

                case "Description": return(Description);

                case "Actors": return(Actors.ConcatWith(','));

                case "OnlineIdentifier": return(OnlineIdentifier);

                case "Starred": return(Starred.ToString());

                default: return(null);
                }
            }
        }
 public override string ToString()
 {
     return(Added.ToString("d") + ": " + Title + GetChanges());
 }
Esempio n. 6
0
        public void UpdateUi(bool first)
        {
            MainWindow form = Program.Form;

            if (form.InvokeRequired)
            {
                form.Invoke(new UpdateUIDelegate(UpdateUi), new object[] { first });
                return;
            }
            SetText(1, Id.ToString());
            SubItems[1].Tag = Id;
            SetText(2, Toolbox.GetFileSize(SizeWhenDone));
            SubItems[2].Tag = SizeWhenDone;
            SetText(3, Percentage + "%");
            SubItems[3].Tag = Percentage;
            SetText(4, Status);
            SetText(5, string.Format(_seedersColumnFormat, Seeders < 0 ? "?" : Seeders.ToString(), PeersSendingToUs));
            SubItems[5].Tag = Seeders;
            SetText(6, string.Format(_seedersColumnFormat, Leechers < 0 ? "?" : Leechers.ToString(), PeersGettingFromUs));
            SubItems[6].Tag = Leechers;
            SetText(7, DownloadRate > 0 ? Toolbox.GetSpeed(DownloadRate) : "");
            SubItems[7].Tag = DownloadRate;
            SetText(8, UploadRate > 0 ? Toolbox.GetSpeed(UploadRate) : "");
            SubItems[8].Tag = UploadRate;
            SetText(9, Eta > 0 ? TimeSpan.FromSeconds(Eta).ToString() : "");
            SubItems[9].Tag = Eta;
            SetText(10, Toolbox.GetFileSize(Uploaded));
            SubItems[10].Tag = Uploaded;
            SetText(11, LocalRatio < 0 ? "∞" : LocalRatio.ToString());
            SubItems[11].Tag       = LocalRatio;
            SubItems[11].ForeColor = GetRatioColor();
            SetText(12, Added.ToString());
            SubItems[12].Tag = Added;
            if (DoneDate != null)
            {
                SubItems[13].Tag = DoneDate;
                SetText(13, DoneDate.ToString());
            }
            SetText(14, FirstTrackerTrimmed);

            if (first)
            {
                lock (form.stateListBox)
                {
                    if (FirstTrackerTrimmed.Length > 0 && form.stateListBox.FindItem(FirstTrackerTrimmed) == null)
                    {
                        form.stateListBox.Items.Add(new GListBoxItem(FirstTrackerTrimmed, 9));
                    }
                }
                if (Program.Settings.MinToTray && Program.Settings.StartedBalloon && _updateSerial > 2)
                {
                    form.ShowTrayTip(LocalSettingsSingleton.BALLOON_TIMEOUT, TorrentName, String.Format(OtherStrings.NewTorrentIs, Status.ToLower()), ToolTipIcon.Info);
                }
                LogError();
            }
            else if (Program.Settings.MinToTray && CompletionPopupPending)
            {
                CompletionPopupPending = false;
                form.ShowTrayTip(LocalSettingsSingleton.BALLOON_TIMEOUT, TorrentName, OtherStrings.TorrentFinished, ToolTipIcon.Info);
            }
            ForeColor = HasError ? Color.Red : SystemColors.WindowText;
            UpdateIcon();
        }
#pragma warning restore 0162

        public string GetCSV()
        {
            return(ID.ToString() + ',' + Name + ',' + Type + ',' + Added.ToString("MM/dd/yyyy H:mm") + ',' + Quantity + ',' + CloudID + ',' + User + ',' + '\n');
        }