Skip to content

Commit

Permalink
Merged in Desmont_McCallock/evemon/v2-PatchXmlCreator-Improvements (p…
Browse files Browse the repository at this point in the history
…ull request peterhaneve#65)

Added support for the handling of the new distribution channel creation process.
  • Loading branch information
JimiC committed Apr 14, 2016
2 parents fa6fc02 + 0eea88b commit 7981c67
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Tools/PatchXmlCreator/Helper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ private static string GetProjectDirectory
/// Gets the output path.
/// </summary>
/// <returns></returns>
private static string GetOutputPath
internal static string GetOutputPath
{
get
{
Expand Down
43 changes: 32 additions & 11 deletions Tools/PatchXmlCreator/PatchXmlCreatorWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,19 @@ internal partial class PatchXmlCreatorWindow : EVEMonForm
#region Fields

private const string CompatibilityMessage = "\nNOT COMPATIBLE with EVEMon prior to version 2.2.0";

private static readonly Dictionary<Control, String> s_listOfInitMessages = new Dictionary<Control, String>();
private static readonly List<Datafile> s_datafiles = new List<Datafile>();
private static readonly CultureInfo s_enUsCulture = new CultureInfo("en-US");

private const string InstallerFilename = "EVEMon-install-{0}.exe";
private const string DateTimeFormat = "dd MMMM yyyy";
private const string DatafilesMessageFormat = "{0} {1} ({2}) {3} data file by the EVEMon Development Team";
private const string DatafileHeader = "eve-";
private const string InstallerArgs = "/S /AUTORUN /SKIPDOTNET";
private const string AdditionalArgs = "/D=%EVEMON_EXECUTABLE_PATH%";

private static readonly Dictionary<Control, String> s_listOfInitMessages = new Dictionary<Control, String>();
private static readonly List<Datafile> s_datafiles = new List<Datafile>();
private static readonly CultureInfo s_enUsCulture = new CultureInfo("en-US");

private static string s_version;

private readonly Action m_action;

private Control m_activeTextBox;
Expand Down Expand Up @@ -136,9 +137,12 @@ private void OnClick(object sender, EventArgs e)
/// <returns></returns>
private static string GetAssemblyVersion()
{
return
AssemblyName.GetAssemblyName(Path.Combine(Helper.GetSourceFilesDirectory, Helper.EVEMonExecFilename))
.Version.ToString();
if (!String.IsNullOrWhiteSpace(s_version))
return s_version;

return s_version = AssemblyName
.GetAssemblyName(Path.Combine(Helper.GetSourceFilesDirectory, Helper.EVEMonExecFilename))
.Version.ToString();
}

/// <summary>
Expand Down Expand Up @@ -177,8 +181,8 @@ internal static FileInfo GetInstallerPath()
{
string installerFile = String.Format(CultureConstants.InvariantCulture, InstallerFilename,
GetAssemblyVersionWithoutRevision(GetAssemblyVersion()));
string installerPath = String.Format(CultureConstants.InvariantCulture, "{1}{0}{2}", Path.DirectorySeparatorChar,
Helper.GetSourceFilesDirectory.Replace("Release", "Installbuilder\\Installer"), installerFile);
string installerPath = Path.Combine(Helper.GetSourceFilesDirectory
.Replace(Helper.GetOutputPath, "bin\\Installbuilder\\Installer\\"), installerFile);
return new FileInfo(installerPath);
}

Expand Down Expand Up @@ -429,7 +433,7 @@ private bool ButtonEnabledFromReleaseControls()
if (String.IsNullOrEmpty(control.Text))
control.BackColor = SystemColors.Highlight;
else if (control == rtbReleaseMessage || (!Path.GetInvalidPathChars().Any(
invalidChar => control.Text.Contains(invalidChar)) && !control.Text.Contains("#")))
invalidChar => control.Text.Contains(invalidChar))))
{
continue;
}
Expand Down Expand Up @@ -522,6 +526,7 @@ private string ExportPatchXml()
SerializablePatch serial = new SerializablePatch();

ExportRelease(serial.Release);
ExportReleases(serial.Releases);
ExportDatafiles(serial.Datafiles);

XmlDocument doc = (XmlDocument)Util.SerializeToXmlDocument(serial);
Expand All @@ -547,6 +552,22 @@ private void ExportRelease(SerializableRelease serialRelease)
serialRelease.Message = rtbReleaseMessage.Text.Trim();
}

/// <summary>
/// Serializes the releases info for the patch file.
/// </summary>
/// <param name="serialReleases">The serial releases.</param>
private static void ExportReleases(ICollection<SerializableRelease> serialReleases)
{
SerializablePatch patch = TryDeserializePatchXml();
if (patch == null)
return;

foreach (SerializableRelease release in patch.Releases)
{
serialReleases.Add(release);
}
}

/// <summary>
/// Serializes the data files info for the patch file.
/// </summary>
Expand Down

0 comments on commit 7981c67

Please sign in to comment.