Tibialyzer.LootDropForm.TimeToString C# (CSharp) Method

TimeToString() public static method

public static TimeToString ( long totalSeconds ) : string
totalSeconds long
return string
        public static string TimeToString(long totalSeconds)
        {
            string displayString = "";
            if (totalSeconds >= 3600) {
                displayString += (totalSeconds / 3600).ToString() + "h ";
                totalSeconds = totalSeconds % 3600;
            }
            if (totalSeconds >= 60) {
                displayString += (totalSeconds / 60).ToString() + "m ";
                totalSeconds = totalSeconds % 60;
            }
            displayString += totalSeconds.ToString() + "s";
            return displayString;
        }

Usage Example

コード例 #1
0
        public void UpdateSummaryForm()
        {
            int minheight, maxheight;

            ClearControlList(summaryControls, out minheight, out maxheight);
            int y = maxheight < 0 ? 30 : minheight;

            PictureBox loot = CreateSummaryLabel("Loot value (gp)", totalValue.ToString("N0"), x, ref y, StyleManager.ItemGoldColor, summaryControls);

            tooltip.SetToolTip(loot, String.Format("Average gold for these creature kills: {0} gold.", averageValue.ToString("N0")));
            CreateSummaryLabel("Exp gained", HuntManager.activeHunt.totalExp.ToString("N0"), x, ref y, StyleManager.NotificationTextColor, summaryControls);
            CreateSummaryLabel("Time", LootDropForm.TimeToString((long)HuntManager.activeHunt.totalTime), x, ref y, StyleManager.NotificationTextColor, summaryControls);
            CreateSummaryLabel("Supplies used (gp)", totalWaste.ToString("N0"), x, ref y, StyleManager.WasteColor, summaryControls);
            long profit = totalValue - totalWaste;

            CreateSummaryLabel(profit > 0 ? "Profit (gp)" : "Waste (gp)", profit.ToString("N0"), x, ref y, profit > 0 ? StyleManager.ItemGoldColor : StyleManager.WasteColor, summaryControls);
            if (ScanningManager.lastResults != null)
            {
                CreateSummaryLabel("Exp/hour", ScanningManager.lastResults.expPerHour.ToString("N0"), x, ref y, StyleManager.NotificationTextColor, summaryControls);
            }
            if (MemoryReader.experience >= 0)
            {
                long   baseExperience = ExperienceBar.GetExperience(MemoryReader.level - 1);
                long   exp            = MemoryReader.experience - baseExperience;
                long   maxExp         = ExperienceBar.GetExperience(MemoryReader.level) - baseExperience;
                double percentage     = ((double)exp) / ((double)maxExp);
                if (percentage >= 0 && percentage <= 1)
                {
                    var levelBar = CreateSummaryBar("Level", String.Format("{0:0.}%", percentage * 100), percentage, x, ref y, StyleManager.NotificationTextColor, StyleManager.SummaryExperienceColor, summaryControls);
                    tooltip.SetToolTip(levelBar, String.Format("Experience to level up: {0}", (maxExp - exp).ToString("N0")));
                }
            }
        }
All Usage Examples Of Tibialyzer.LootDropForm::TimeToString