/// <summary> /// This method will be called after reading the configuration, so eventually some corrections can be made /// </summary> public override void AfterLoad() { if (OutputDestinations == null) { OutputDestinations = new List<Destination>(); } // Make sure there is an output! if (OutputDestinations.Count == 0) { OutputDestinations.Add(Destination.Editor); } // Check for Outlook, if it's not installed force email format to MAPI if (OutputEMailFormat != EmailFormat.MAPI && !EmailConfigHelper.HasOutlook()) { OutputEMailFormat = EmailFormat.MAPI; } // Prevent both settings at once, bug #3435056 if (OutputDestinations.Contains(Destination.Clipboard) && OutputFileCopyPathToClipboard) { OutputFileCopyPathToClipboard = false; } if (AutoCropDifference < 0) { AutoCropDifference = 0; } if (AutoCropDifference > 255) { AutoCropDifference = 255; } }
/// <summary> /// Supply values we can't put as defaults /// </summary> /// <param name="property">The property to return a default for</param> /// <returns>object with the default value for the supplied property</returns> public override object GetDefault(string property) { switch (property) { case "PluginWhitelist": case "PluginBacklist": return new List<string>(); case "OutputFileAsFullpath": if (IniConfig.IsPortable) { return Path.Combine(Application.StartupPath, @"..\..\Documents\Pictures\Greenshots\dummy.png"); } else { return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "dummy.png"); } case "OutputFilePath": if (IniConfig.IsPortable) { string pafOutputFilePath = Path.Combine(Application.StartupPath, @"..\..\Documents\Pictures\Greenshots"); if (!Directory.Exists(pafOutputFilePath)) { try { Directory.CreateDirectory(pafOutputFilePath); return pafOutputFilePath; } catch (Exception) { // Problem creating directory, fallback to Desktop } } else { return pafOutputFilePath; } } return Environment.GetFolderPath(Environment.SpecialFolder.Desktop); case "DWMBackgroundColor": return Color.White; case "OutputEMailFormat": if (EmailConfigHelper.HasOutlook()) { return EmailFormat.OUTLOOK_HTML; } return EmailFormat.MAPI; } return null; }