private void ScanServerCommandExecuted(object obj) { try { var server = new Server(TelegramSetting.ServerPath, TelegramSetting.ServerAdminUserName, TelegramSetting.ServerAdminPass); foreach (var serverBaseName in server.GetBases()) { if (Bases.FirstOrDefault(b => b.Title == serverBaseName) is null) { var base1C = new Base { Title = serverBaseName, Folder = Path.Combine(TelegramSetting.ServerPath, serverBaseName), User = "******", IsRepository = true, IsServer = true }; db.AddEntity(base1C); } } } catch (Exception e) { MessageBox.Show(e.Message); } }
/// <summary> /// Forces the system to valuate the object type and adds it to the Bases /// </summary> /// <param name="basis">the item to value</param> /// <returns>the new value</returns> public decimal MakeValuation(IInanimateTemplate basis) { IEconomicBasis basi = Bases.FirstOrDefault(bas => bas.ItemType == basis); if (basi != null) { return(basi.Basis * basi.Adjustment); } int newBaseValue = basis.Name.Length; if (basis.Qualities.Any()) { newBaseValue += Math.Max(1, basis.Qualities.Sum(quality => quality.Value)); } EconomicBasis newBasis = new EconomicBasis() { Adjustment = 1, Basis = newBaseValue, ItemType = basis, Trend = 1 }; Bases.Add(newBasis); return(newBasis.Basis * newBasis.Adjustment); }