Skip to content

@EliotVU /configuration.cs secret

Embed URL


Subversion checkout URL

You can clone with
Download ZIP
using System.IO;
using System.Windows.Forms;
using System.Xml;
using System.Xml.Serialization;
namespace Imagine_Updater
* Hi there! The Imagine! Updater wants to supply you with a free and easy way to keep your customers software up to date.
* This code is licensed under the Apache 2.0 license.
* If you use this for any bigger project like an indie game or something feel free to shoot me a mail to so I have something to brag about but no pressure!
* HowTo:
* 1. Find the directory of the program you want to have distributed by this software, copy the path to the textBox next to the Create XML-Button and press it!
* 2. Check the register.xml that was created on your desktop. It should show all the files and folder you want to have synced with your customers.
* Be sure none of your files use weird charakters because some are not supported by xml. I replaced ' ' with '+' so '+' is not supported either but ' ' is.
* 3. Upload that directory and the register.xml to a public part of your server. The two free hosters I tested used to have a "public_html"-folder that served that purpose.
* 4. Change the patchPath string below to match the path to the public part of your server. You may want to test different URL using the download function of this updater.
* For example try to enter an URL ending in "/register.xml" to find your freshly uploaded files.
* 5. Start the program and hope everything works. You will need administrative rights if you patch to some directories.
* 6. Feel free to change the other configuartions and the code itself to your liking.
public class UpdaterSettings
#region Patch Settings // Developer settings.
// the url to your server repository. I suggest free servers for smaller projects. worked for me so far. Some hosters ( do not allow .exe!
public string RemotePatchURL = "";
// The name of the executable at the root of your savePath. This will be executed when pressing the playButton.
public string ExecutableName = "UE Explorer.exe";
// The main element in your register. It doesn't matter how you call it because it works anyways but you maybe want a fitting name.
public string xmlRootName = "UEExplorer";
#region UI Settings // Visual modifiers.
// How the Updater is labeled.
public string WindowTitle = "UE Explorer updater";
// The text on the start program button.
public string LaunchButtonTitle = "Launch";
#region User Settings // Settings that may differ from user to user.
// This will automatically switch to the patchnotes if available
public bool ShowPatchNotes = true;
// When true the updater will automatically patch to newest version if one is available.
public bool AutoUpdate = true;
// This will for one thing start the programm instantly when no new version is found on the patch-server. For another it will start the programm as soon as a patch-process is done.
public bool LaunchAfterUpdate = false;
// This will hide or show the download and xml-creation capabilities of this updater and one or two notifications.
public bool DevMode = true;
// I decided to put my files in a bin folder next to the updater to keep things together. But based on this it could become necessary to start the updater with administrative rights.
public string ApplicationDir = Path.GetDirectoryName(Application.ExecutablePath);
// the files added to the notUpdatedFiles string[] won't be added to the xml and therefore not be downloaded and patched. Furthermore files of that kind won't be deleted when found in the savePath.
// I needed this function for one annoying file that somehow changed it's sha1-Hashcode for being downloaded so it was always shown as outdated (not disturbing the functionality of the program).
// You might want to dig into the code when you experience similar issius but need your file patched for new versions. But the one I was talking about was created on runtime anyway.
public static string[] NotUpdatedFiles()
var notUpdatedFiles = new[]
return notUpdatedFiles;
/// <summary>
/// Loads the program's update configuration from an XML file such as "Updater.xml".
/// </summary>
/// <returns>the deserialized XML file as an UpdaterSettings instance</returns>
public static UpdaterSettings Load()
var settingsDir = Application.StartupPath;
const string settingsExtension = "xml";
const string settingsName = "Updater" + "." + settingsExtension;
var settingsPath = Path.Combine( settingsDir, settingsName );
UpdaterSettings settings;
if( !File.Exists( settingsPath ) )
settings = new UpdaterSettings();
using( var writer = new XmlTextWriter( settingsPath, System.Text.Encoding.ASCII ) )
var serializer = new XmlSerializer( typeof(UpdaterSettings) );
serializer.Serialize( writer, settings );
return settings;
using( var reader = new XmlTextReader( settingsPath ) )
var serializer = new XmlSerializer( typeof(UpdaterSettings) );
settings = (UpdaterSettings)serializer.Deserialize( reader );
return settings;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.