/// <summary> /// Returns false if export failed, else true. /// </summary> /// <param name="itemsToExport">What to export</param> /// <param name="filename">Full path with filename and extension to write the export result to.</param> /// <returns></returns> public bool ExportUninstallers(IEnumerable <ApplicationUninstallerEntry> itemsToExport, string filename) { var applicationUninstallerEntries = itemsToExport as List <ApplicationUninstallerEntry> ?? itemsToExport.ToList(); if (applicationUninstallerEntries.Count <= 0) { return(false); } /* * var result = new StringBuilder(); * result.AppendLine(Localisable.StrExportHeader); * result.AppendLine(); * * foreach (var uninstaller in applicationUninstallerEntries) * result.AppendLine(uninstaller.ToLongString()); */ try { UninstallTools.Uninstaller.ApplicationInfoExport.SerializeApplicationInfo(filename, applicationUninstallerEntries); //File.WriteAllText(filename, result.ToString()); } catch (Exception ex) { MessageBoxes.ExportFailed(ex.Message); return(false); } return(true); }
/// <summary> /// Returns false if export failed, else true. /// </summary> /// <param name="itemsToExport">What to export</param> /// <param name="filename">Full path with filename and extension to write the export result to.</param> /// <returns></returns> public static bool ExportUninstallers(IEnumerable <ApplicationUninstallerEntry> itemsToExport, string filename) { var applicationUninstallerEntries = itemsToExport as List <ApplicationUninstallerEntry> ?? itemsToExport.ToList(); if (applicationUninstallerEntries.Count <= 0) { return(false); } try { ApplicationEntrySerializer.SerializeApplicationEntries(filename, applicationUninstallerEntries); } catch (Exception ex) { MessageBoxes.ExportFailed(ex.Message, null); return(false); } return(true); }