Skip to content

Commit

Permalink
Added some translations, now auto-deletes all temporary directories (…
Browse files Browse the repository at this point in the history
…previously they couldn't be deleted due to a bug), added check for FAT12/16 maximum partition size ---> 3.1.1
  • Loading branch information
zdimension committed Nov 18, 2015
1 parent f3ed908 commit 37fb07e
Show file tree
Hide file tree
Showing 29 changed files with 95 additions and 12 deletions.
3 changes: 2 additions & 1 deletion SharpBoot/AskUSB.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions SharpBoot/AskUSB.resx
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,10 @@
<value>FAT32 (recommended)</value>
</data>
<data name="cbxFS.Items1" xml:space="preserve">
<value>UDF</value>
<value>FAT12</value>
</data>
<data name="cbxFS.Items2" xml:space="preserve">
<value>FAT16</value>
</data>
<data name="cbxFS.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 119</value>
Expand Down Expand Up @@ -331,6 +334,6 @@
<value>AskUSB</value>
</data>
<data name="&gt;&gt;$this.Type" xml:space="preserve">
<value>SharpBoot.AskPForm, SharpBoot, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null</value>
<value>SharpBoot.AskPForm, SharpBoot, Version=3.1.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
</root>
10 changes: 9 additions & 1 deletion SharpBoot/GenIsoFrm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,11 @@ public void Generate()
abort = true;
return;
}
else if(res == 2)
{
abort = true;
return;
}
if(MessageBox.Show(Strings.FormatError, "SharpBoot", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error) == DialogResult.Cancel)
{
abort = true;
Expand Down Expand Up @@ -206,7 +211,7 @@ public void Generate()

File.WriteAllBytes(Path.Combine(archs, "basedisk.7z"), Resources.basedisk);
File.WriteAllBytes(Path.Combine(archs, "bloader.7z"), bloader.Archive);
File.WriteAllBytes(Path.Combine(archs, "mkisofs.7z"), Resources.mkisofs);
if(!_usb) File.WriteAllBytes(Path.Combine(archs, "mkisofs.7z"), Resources.mkisofs);

ChangeProgress(0, 100, Strings.ExtractBaseDisk);
ext.Extract(Path.Combine(archs, "basedisk.7z"), isodir);
Expand Down Expand Up @@ -240,6 +245,8 @@ public void Generate()
ext.Extract(Path.Combine(archs, "mkisofs.7z"), Path.Combine(f, "mkisofs"));
}

Program.SafeDel(archs);

// copier les fichiers dans le rep temporaire
ChangeProgress(0, Images.Count, Strings.CopyISOfiles);
for (var i = 0; i < Images.Count; i++)
Expand Down Expand Up @@ -311,6 +318,7 @@ public void Generate()

if(_usb)
{
ChangeProgress(23, 100, Strings.InstallingBoot);
BootloaderInst.Install(OutputFilepath, bloader.FolderName);
GenF(f);
}
Expand Down
2 changes: 2 additions & 0 deletions SharpBoot/InstallBoot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ public static void Install(string l, string bl)
{
File.WriteAllBytes(Path.Combine(driveletter, "grldr"), Resources.grldr);
}

Program.SafeDel(d);
}
}

Expand Down
2 changes: 2 additions & 0 deletions SharpBoot/MainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,8 @@ private void launchgeniso(bool usb)

g.Res = new Size(int.Parse(ssize[0]), int.Parse(ssize[1]));
g.ShowDialog(this);

Program.ClrTmp();
}
}

Expand Down
21 changes: 19 additions & 2 deletions SharpBoot/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ public static IDictionary<TKey, TValue> ToDictionary<TKey, TValue>(
[STAThread]
private static void Main()
{
ClrTmp();

Settings.Default.PropertyChanged += Default_PropertyChanged;


Expand All @@ -54,9 +56,9 @@ public static string GetVersion()
public static void ClrTmp()
{
Directory.GetDirectories(Path.GetTempPath())
.Where(x => x.StartsWith("SharpBoot_"))
.Where(x => Path.GetFileName(x).StartsWith("SharpBoot_"))
.ToList()
.ForEach(x => new DirectoryInfo(x).Delete(true));
.ForEach(SafeDel);
}

private static void Application_ApplicationExit(object sender, EventArgs e)
Expand All @@ -77,6 +79,21 @@ public static string ShortLang()
return GetCulture().Name;
}

public static void SafeDel(string d)
{
while (Directory.Exists(d))
{
try
{
Directory.Delete(d, true);
}
catch
{
continue;
}
}
}

public static void SetAppLng(CultureInfo c)
{
Settings.Default.Lang = c.Name;
Expand Down
4 changes: 2 additions & 2 deletions SharpBoot/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@
// en utilisant '*', comme indiqué ci-dessous :
// [assembly: AssemblyVersion("1.0.*")]

[assembly: AssemblyVersion("3.1")]
[assembly: AssemblyFileVersion("3.1")]
[assembly: AssemblyVersion("3.1.1")]
[assembly: AssemblyFileVersion("3.1.1")]
[assembly: NeutralResourcesLanguage("en")]
2 changes: 2 additions & 0 deletions SharpBoot/QEMUISO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ public static void LaunchQemu(string iso, bool usb = false)
}
Thread.Sleep(300);
p.Start();
ext.Close();
p.Exited += (sender, args) => Program.SafeDel(f);
}
}
}
2 changes: 1 addition & 1 deletion SharpBoot/SevenZipExtractor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ protected void OnFinished()
public void Close()
{
// ReSharper disable once AssignNullToNotNullAttribute
new DirectoryInfo(Path.GetDirectoryName(SevenZipPath)).Delete(true);
Program.SafeDel(Path.GetDirectoryName(SevenZipPath));
}

public void Extract(string arch, string output)
Expand Down
18 changes: 18 additions & 0 deletions SharpBoot/Strings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions SharpBoot/Strings.fr.resx
Original file line number Diff line number Diff line change
Expand Up @@ -213,4 +213,10 @@
<data name="Other" xml:space="preserve">
<value>Autre</value>
</data>
<data name="PartitionTooBig" xml:space="preserve">
<value>La partition sélectionnée est trop grande pour {0}</value>
</data>
<data name="InstallingBoot" xml:space="preserve">
<value>Installation de {0} sur {1}...</value>
</data>
</root>
6 changes: 6 additions & 0 deletions SharpBoot/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -213,4 +213,10 @@
<data name="Other" xml:space="preserve">
<value>Other</value>
</data>
<data name="PartitionTooBig" xml:space="preserve">
<value>The selected partition is too big for {0}</value>
</data>
<data name="InstallingBoot" xml:space="preserve">
<value>Installing {0} on {1}...</value>
</data>
</root>
3 changes: 3 additions & 0 deletions SharpBoot/Strings.ro.resx
Original file line number Diff line number Diff line change
Expand Up @@ -210,4 +210,7 @@
<data name="Other" xml:space="preserve">
<value>Altele</value>
</data>
<data name="PartitionTooBig" xml:space="preserve">
<value>Partiția selectata este prea mare pentru {0}</value>
</data>
</root>
18 changes: 18 additions & 0 deletions SharpBoot/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,24 @@ public static uint FormatDrive(string driveLetter,
Verb = "runas"
}
};

try
{
var di = new DriveInfo(driveLetter);
long maxsize = -1;
if (fileSystem == "FAT12") maxsize = 16777216;
if (fileSystem == "FAT16") maxsize = 4000000000;
if(di.TotalSize >= maxsize && maxsize != -1)
{
MessageBox.Show(string.Format(Strings.PartitionTooBig, fileSystem), "SharpBoot", MessageBoxButtons.OK, MessageBoxIcon.Error);
return 2;
}
}
catch
{
return 1;
}

p.StartInfo.Arguments += " /k format /FS:" + fileSystem + " /V:" + label + " /Q /Y " + driveLetter + " & exit";
p.Start();
bool finished = p.WaitForExit(20000);
Expand Down
Binary file modified SharpBoot/bin/Debug/SharpBoot.exe
Binary file not shown.
Binary file modified SharpBoot/obj/Debug/DesignTimeResolveAssemblyReferences.cache
Binary file not shown.
Binary file modified SharpBoot/obj/Debug/SharpBoot.Strings.fr.resources
Binary file not shown.
Binary file modified SharpBoot/obj/Debug/SharpBoot.Strings.resources
Binary file not shown.
Binary file modified SharpBoot/obj/Debug/SharpBoot.Strings.ro.resources
Binary file not shown.
3 changes: 0 additions & 3 deletions SharpBoot/obj/Debug/SharpBoot.csproj.FileListAbsolute.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ D:\Documents\GitHub\SharpBoot\SharpBoot\bin\Debug\SharpBoot.pdb
D:\Documents\GitHub\SharpBoot\SharpBoot\bin\Debug\de\SharpBoot.resources.dll
D:\Documents\GitHub\SharpBoot\SharpBoot\bin\Debug\fr\SharpBoot.resources.dll
D:\Documents\GitHub\SharpBoot\SharpBoot\bin\Debug\ro\SharpBoot.resources.dll
D:\Documents\GitHub\SharpBoot\SharpBoot\bin\Debug\en\SharpBoot.resources.dll
D:\Documents\GitHub\SharpBoot\SharpBoot\obj\Debug\SharpBoot.About.resources
D:\Documents\GitHub\SharpBoot\SharpBoot\obj\Debug\SharpBoot.AddIso.resources
D:\Documents\GitHub\SharpBoot\SharpBoot\obj\Debug\SharpBoot.AskUSB.resources
Expand Down Expand Up @@ -41,7 +40,6 @@ D:\Documents\GitHub\SharpBoot\SharpBoot\obj\Debug\SharpBoot.ISODesc.de.resources
D:\Documents\GitHub\SharpBoot\SharpBoot\obj\Debug\SharpBoot.ISODesc.fr.resources
D:\Documents\GitHub\SharpBoot\SharpBoot\obj\Debug\SharpBoot.ISODesc.ro.resources
D:\Documents\GitHub\SharpBoot\SharpBoot\obj\Debug\SharpBoot.MainWindow.de.resources
D:\Documents\GitHub\SharpBoot\SharpBoot\obj\Debug\SharpBoot.MainWindow.en.resources
D:\Documents\GitHub\SharpBoot\SharpBoot\obj\Debug\SharpBoot.MainWindow.fr.resources
D:\Documents\GitHub\SharpBoot\SharpBoot\obj\Debug\SharpBoot.MainWindow.ro.resources
D:\Documents\GitHub\SharpBoot\SharpBoot\obj\Debug\SharpBoot.Strings.de.resources
Expand All @@ -51,7 +49,6 @@ D:\Documents\GitHub\SharpBoot\SharpBoot\obj\Debug\SharpBoot.csproj.GenerateResou
D:\Documents\GitHub\SharpBoot\SharpBoot\obj\Debug\de\SharpBoot.resources.dll
D:\Documents\GitHub\SharpBoot\SharpBoot\obj\Debug\fr\SharpBoot.resources.dll
D:\Documents\GitHub\SharpBoot\SharpBoot\obj\Debug\ro\SharpBoot.resources.dll
D:\Documents\GitHub\SharpBoot\SharpBoot\obj\Debug\en\SharpBoot.resources.dll
D:\Documents\GitHub\SharpBoot\SharpBoot\obj\Debug\SharpBoot.exe
D:\Documents\GitHub\SharpBoot\SharpBoot\obj\Debug\SharpBoot.pdb
D:\Documents\GitHub\SharpBoot\SharpBoot\obj\Debug\SharpBoot.csprojResolveAssemblyReference.cache
Binary file modified SharpBoot/obj/Debug/SharpBoot.csproj.GenerateResource.Cache
Binary file not shown.
Binary file modified SharpBoot/obj/Debug/SharpBoot.exe
Binary file not shown.
Binary file modified SharpBoot/obj/Debug/SharpBoot.pdb
Binary file not shown.
Binary file modified SharpBoot/obj/Debug/TempPE/Strings.Designer.cs.dll
Binary file not shown.
Binary file modified SharpBoot/obj/Debug/TempPE/Strings.fr.Designer.cs.dll
Binary file not shown.
Binary file modified SharpBoot/obj/Debug/TempPE/Strings.ro.Designer.cs.dll
Binary file not shown.
Binary file modified SharpBoot/obj/Debug/de/SharpBoot.resources.dll
Binary file not shown.
Binary file modified SharpBoot/obj/Debug/fr/SharpBoot.resources.dll
Binary file not shown.
Binary file modified SharpBoot/obj/Debug/ro/SharpBoot.resources.dll
Binary file not shown.

0 comments on commit 37fb07e

Please sign in to comment.