Commit 6fa1cef6 by Pascal Bigot

--no commit message

parent c3a967ef
......@@ -46,16 +46,13 @@ namespace SmartAppUpdater
GenerateVersionFile();
return;
}
LangSys.Initialize(Cste.STR_DEV_LANG, "EN", "SmartAppUpdater");
string curLang = "EN";
int langArgIndex = arguments.IndexOf("-Lang");
if (langArgIndex != -1 && arguments.Count > langArgIndex + 1)
curLang = arguments[langArgIndex + 1];
LangSys.Initialize(Cste.STR_DEV_LANG, curLang, "SmartAppUpdater");
Form mainForm = new UpdaterMainForm();
Application.Run(mainForm);
/*
StringCollection filesToUpdate = CheckUpdates(arguments);
DownloadFiles(arguments, filesToUpdate);
Console.ReadKey();
}*/
}
public static void StartBatchCopy()
......@@ -73,26 +70,25 @@ namespace SmartAppUpdater
static void GenerateVersionFile()
{
string strAppDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName);
StringCollection AssemblyList = new StringCollection();
AssemblyList.AddRange(Directory.GetFiles(strAppDir, "*.*", SearchOption.TopDirectoryOnly));
//AssemblyList.AddRange(Directory.GetFiles(strAppDir, "*.exe", SearchOption.TopDirectoryOnly));
StringCollection FileList = new StringCollection();
FileList.AddRange(Directory.GetFiles(strAppDir, "*.*", SearchOption.TopDirectoryOnly));
XmlDocument versionFile = new XmlDocument();
versionFile.LoadXml("<root/>");
for (int i = 0; i < AssemblyList.Count; i++)
for (int i = 0; i < FileList.Count; i++)
{
if ((AssemblyList[i].EndsWith(".dll") || AssemblyList[i].EndsWith(".exe")) && !AssemblyList[i].EndsWith(".vshost.exe"))
if ((FileList[i].EndsWith(".dll") || FileList[i].EndsWith(".exe")) && !FileList[i].EndsWith(".vshost.exe"))
{
try
{
Assembly assembly = Assembly.LoadFrom(AssemblyList[i]);
Assembly assembly = Assembly.LoadFrom(FileList[i]);
Version asmVer = assembly.GetName().Version;
XmlNode assemblyNode = versionFile.CreateElement("assemblyInfo");
XmlAttribute attrName = versionFile.CreateAttribute("fileName");
XmlAttribute attrVersion = versionFile.CreateAttribute("lastVersion");
attrVersion.Value = asmVer.ToString();
attrName.Value = Path.GetFileName(AssemblyList[i]);
attrName.Value = Path.GetFileName(FileList[i]);
assemblyNode.Attributes.Append(attrName);
assemblyNode.Attributes.Append(attrVersion);
versionFile.DocumentElement.AppendChild(assemblyNode);
......@@ -100,7 +96,7 @@ namespace SmartAppUpdater
}
catch (Exception)
{
Console.WriteLine("Impossible de charger la version du fichier " + AssemblyList[i]);
Console.WriteLine("Impossible de charger la version du fichier " + FileList[i]);
}
}
}
......
......@@ -57,6 +57,12 @@
</Content>
</ItemGroup>
<ItemGroup>
<None Include="Lang\EN.SmartAppUpdater.po">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Lang\FR.SmartAppUpdater.po">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="postUpdateCopy.bat">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
......
......@@ -54,7 +54,7 @@
this.textBox1.Multiline = true;
this.textBox1.Name = "textBox1";
this.textBox1.ReadOnly = true;
this.textBox1.Size = new System.Drawing.Size(367, 248);
this.textBox1.Size = new System.Drawing.Size(512, 164);
this.textBox1.TabIndex = 2;
//
// label1
......@@ -69,9 +69,9 @@
// button1
//
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.button1.Location = new System.Drawing.Point(261, 12);
this.button1.Location = new System.Drawing.Point(373, 12);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(118, 23);
this.button1.Size = new System.Drawing.Size(151, 23);
this.button1.TabIndex = 4;
this.button1.Text = "Update";
this.button1.UseVisualStyleBackColor = true;
......@@ -81,7 +81,7 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(391, 314);
this.ClientSize = new System.Drawing.Size(536, 230);
this.Controls.Add(this.button1);
this.Controls.Add(this.label1);
this.Controls.Add(this.textBox1);
......
......@@ -21,6 +21,7 @@ namespace SmartAppUpdater
public UpdaterMainForm()
{
InitializeComponent();
Program.LangSys.Initialize(this);
}
protected void AddStatusLine(string message)
......@@ -132,9 +133,9 @@ namespace SmartAppUpdater
}
if (listAssemblyToDownload.Count > 0)
{
AddStatusLine(Program.LangSys.C(
string.Format("Total : {0} file will be downloaded",
listAssemblyToDownload.Count)) + ENDL);
AddStatusLine(string.Format(
Program.LangSys.C("Total : {0} file will be downloaded"),
listAssemblyToDownload.Count) + ENDL);
return listAssemblyToDownload;
}
}
......@@ -157,9 +158,9 @@ namespace SmartAppUpdater
{
foreach (string file in FilesToUpdate)
{
AddStatusLine(Program.LangSys.C(
string.Format("Downloading file {0}",
file)) + ENDL);
AddStatusLine(string.Format(
Program.LangSys.C("Downloading file {0}"),
file) + ENDL);
WebClient wc = new WebClient();
try
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment