/// <summary> /// Log the nice items we found and stashed /// </summary> internal static void LogGoodItems(CachedACDItem acdItem, TrinityItemBaseType itemBaseType, TrinityItemType itemType, double itemValue) { FileStream logStream = null; try { string filePath = Path.Combine(FileManager.LoggingPath, "StashLog - " + Trinity.Player.ActorClass + ".log"); logStream = File.Open(filePath, FileMode.Append, FileAccess.Write, FileShare.Read); //TODO : Change File Log writing using (var logWriter = new StreamWriter(logStream)) { if (!_loggedAnythingThisStash) { _loggedAnythingThisStash = true; logWriter.WriteLine(DateTime.Now + ":"); logWriter.WriteLine("===================="); } string sLegendaryString = ""; bool shouldSendNotifications = false; if (acdItem.Quality >= ItemQuality.Legendary) { if (!Trinity.Settings.Notification.LegendaryScoring) { shouldSendNotifications = true; } else if (Trinity.Settings.Notification.LegendaryScoring && ItemValuation.CheckScoreForNotification(itemBaseType, itemValue)) { shouldSendNotifications = true; } if (shouldSendNotifications) { NotificationManager.AddNotificationToQueue(acdItem.RealName + " [" + itemType + "] (Score=" + itemValue + ". " + acdItem.AcdItem.Stats + ")", ZetaDia.Service.Hero.Name + " new legendary!", ProwlNotificationPriority.Emergency); } sLegendaryString = " {legendary item}"; // Change made by bombastic Logger.Log(TrinityLogLevel.Info, LogCategory.UserInformation, "+=+=+=+=+=+=+=+=+ LEGENDARY FOUND +=+=+=+=+=+=+=+=+"); Logger.Log(TrinityLogLevel.Info, LogCategory.UserInformation, "+ Name: {0} ({1})", acdItem.RealName, itemType); Logger.Log(TrinityLogLevel.Info, LogCategory.UserInformation, "+ Score: {0:0}", itemValue); Logger.Log(TrinityLogLevel.Info, LogCategory.UserInformation, "+ Attributes: {0}", acdItem.AcdItem.Stats.ToString()); Logger.Log(TrinityLogLevel.Info, LogCategory.UserInformation, "+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+"); } else { // Check for non-legendary notifications shouldSendNotifications = ItemValuation.CheckScoreForNotification(itemBaseType, itemValue); if (shouldSendNotifications) { NotificationManager.AddNotificationToQueue(acdItem.RealName + " [" + itemType + "] (Score=" + itemValue + ". " + acdItem.AcdItem.Stats + ")", ZetaDia.Service.Hero.BattleTagName + " new item!", ProwlNotificationPriority.Normal); } } if (shouldSendNotifications) { NotificationManager.EmailMessage.AppendLine(itemBaseType + " - " + itemType + " '" + acdItem.RealName + "'. Score = " + Math.Round(itemValue) + sLegendaryString) .AppendLine(" " + acdItem.AcdItem.Stats) .AppendLine(); } logWriter.WriteLine(itemBaseType + " - " + itemType + " '" + acdItem.RealName + "'. Score = " + Math.Round(itemValue) + sLegendaryString); logWriter.WriteLine(" " + acdItem.AcdItem.Stats); logWriter.WriteLine(""); } logStream.Close(); } catch (IOException) { Logger.Log(TrinityLogLevel.Info, LogCategory.UserInformation, "Fatal Error: File access error for stash log file."); if (logStream != null) { logStream.Close(); } } }