public BotModel(Bot bot) { this.Id = bot.Id; this.Name = bot.Name ?? bot.IPAddress; this.WorkHours = Format.AsAge(bot.CreationDate); this.Profit = Format.AsBitCoin(bot.Balance); this.Efficiency = Format.AsPercent(bot.Share, bot.TotalShare); this.EfficiencyText = string.Format("工作:{0} (总数:{1})", bot.Share, bot.TotalShare); this.Shares = Format.AsCurrentAndPercent(bot.Share, Server.Recent.TotalShare); this.Action = bot.Account == null ? "Authorize" : "Manage"; this.ActionText = bot.Account == null ? "认领" : "管理"; //try get mine information from bot var cm = ComputeManager.ByBot(bot); if (cm != null) { var mine = Mine.Find(cm.MineId); if (mine != null) { this.MineIcon = mine.Icon; this.MineText = mine.IconName; } } //try get bot speed var speed = Server.Recent.TestBotSpeed(bot.Id); this.StatusIcon = "/Content/status/" + Format.AsSpeedIcon(speed) + ".png"; this.StatusText = Format.AsSpeed(speed); }