Store files separate in the repository instead of compressing

them in ZIP. Supported GZ, BZ2 and LZMA formats.
This commit is contained in:
2017-05-11 19:01:47 +01:00
parent ebde05af36
commit 67d798a213
13 changed files with 175 additions and 338 deletions

View File

@@ -0,0 +1,37 @@
//
// Author:
// Natalia Portillo claunia@claunia.com
//
// Copyright (c) 2017, © Claunia.com
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in
// the documentation and/or other materials provided with the distribution.
// * Neither the name of the [ORGANIZATION] nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
using System;
namespace osrepodbmgr.Core
{
public enum AlgoEnum
{
GZip,
BZip2,
LZMA
}
}

View File

@@ -1,3 +1,14 @@
2017-05-11 Natalia Portillo <claunia@claunia.com>
* Context.cs:
* Workers.cs:
* AlgoEnum.cs:
* Settings.cs:
* packages.config:
* osrepodbmgr.Core.csproj:
Store files separate in the repository instead of
compressing them in ZIP. Supported GZ, BZ2 and LZMA formats.
2017-05-11 Natalia Portillo <claunia@claunia.com>
* Workers.cs:

View File

@@ -43,7 +43,7 @@ namespace osrepodbmgr.Core
public static long noFilesInArchive;
public static string archiveFormat;
public static Process unarProcess;
public static bool copyArchive;
public static bool unzipWithUnAr;
public static string selectedFile;
public static OpticalDiscType workingDisc;
public static BlockMediaType workingDisk;

View File

@@ -29,7 +29,6 @@ using System;
using System.IO;
using System.Xml.Serialization;
using Claunia.PropertyList;
using Ionic.Zip;
using Microsoft.Win32;
namespace osrepodbmgr.Core
@@ -40,7 +39,7 @@ namespace osrepodbmgr.Core
public string DatabasePath;
public string RepositoryPath;
public string UnArchiverPath;
public CompressionMethod CompressionAlgorithm;
public AlgoEnum CompressionAlgorithm;
}
public static class Settings
@@ -104,10 +103,10 @@ namespace osrepodbmgr.Core
if(parsedPreferences.TryGetValue("CompressionAlgorithm", out obj))
{
if(!Enum.TryParse(((NSString)obj).ToString(), true, out Current.CompressionAlgorithm))
Current.CompressionAlgorithm = CompressionMethod.Deflate;
Current.CompressionAlgorithm = AlgoEnum.GZip;
}
else
Current.CompressionAlgorithm = CompressionMethod.Deflate;
Current.CompressionAlgorithm = AlgoEnum.GZip;
}
else {
SetDefaultSettings();
@@ -142,7 +141,7 @@ namespace osrepodbmgr.Core
Current.RepositoryPath = (string)key.GetValue("RepositoryPath");
Current.UnArchiverPath = (string)key.GetValue("UnArchiverPath");
if(!Enum.TryParse((string)key.GetValue("CompressionAlgorithm"), true, out Current.CompressionAlgorithm))
Current.CompressionAlgorithm = CompressionMethod.Deflate;
Current.CompressionAlgorithm = AlgoEnum.GZip;
}
break;
default:
@@ -246,7 +245,7 @@ namespace osrepodbmgr.Core
Current.DatabasePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "osrepodbmgr.db");
Current.RepositoryPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "osrepo");
Current.UnArchiverPath = null;
Current.CompressionAlgorithm = CompressionMethod.Deflate;
Current.CompressionAlgorithm = AlgoEnum.GZip;
}
}
}

View File

@@ -37,6 +37,9 @@ using DiscImageChef.Checksums;
using Ionic.Zip;
using Newtonsoft.Json;
using Schemas;
using SharpCompress.Compressors.Deflate;
using SharpCompress.Compressors.BZip2;
using SharpCompress.Compressors.LZMA;
namespace osrepodbmgr.Core
{
@@ -789,27 +792,6 @@ namespace osrepodbmgr.Core
string mdid = md5.Data(Encoding.UTF8.GetBytes(destination), out tmp);
Console.WriteLine("MDID: {0}", mdid);
destinationFolder = Settings.Current.RepositoryPath;
if(!Directory.Exists(destinationFolder))
Directory.CreateDirectory(destinationFolder);
destinationFolder = Path.Combine(destinationFolder, mdid[0].ToString());
if(!Directory.Exists(destinationFolder))
Directory.CreateDirectory(destinationFolder);
destinationFolder = Path.Combine(destinationFolder, mdid[1].ToString());
if(!Directory.Exists(destinationFolder))
Directory.CreateDirectory(destinationFolder);
destinationFolder = Path.Combine(destinationFolder, mdid[2].ToString());
if(!Directory.Exists(destinationFolder))
Directory.CreateDirectory(destinationFolder);
destinationFolder = Path.Combine(destinationFolder, mdid[3].ToString());
if(!Directory.Exists(destinationFolder))
Directory.CreateDirectory(destinationFolder);
destinationFolder = Path.Combine(destinationFolder, mdid[4].ToString());
if(!Directory.Exists(destinationFolder))
Directory.CreateDirectory(destinationFolder);
destination = Path.Combine(destinationFolder, mdid) + ".zip";
if(dbCore.DBOps.ExistsOS(mdid))
{
if(File.Exists(destination))
@@ -833,13 +815,6 @@ namespace osrepodbmgr.Core
Context.dbInfo.mdid = mdid;
ZipFile zf = new ZipFile(destination);
zf.CompressionLevel = Ionic.Zlib.CompressionLevel.BestCompression;
zf.CompressionMethod = Settings.Current.CompressionAlgorithm;
zf.UseZip64WhenSaving = Zip64Option.AsNecessary;
zf.AlternateEncoding = Encoding.UTF8;
zf.AlternateEncodingUsage = ZipOption.Always;
string filesPath;
if(!string.IsNullOrEmpty(Context.tmpFolder) && Directory.Exists(Context.tmpFolder))
@@ -848,20 +823,82 @@ namespace osrepodbmgr.Core
filesPath = Context.path;
int counter = 0;
foreach(string file in Context.files)
string extension = null;
switch(Settings.Current.CompressionAlgorithm)
{
case AlgoEnum.GZip:
extension = ".gz";
break;
case AlgoEnum.BZip2:
extension = ".bz2";
break;
case AlgoEnum.LZMA:
extension = ".lzma";
break;
}
foreach(KeyValuePair<string, DBFile> file in Context.hashes)
{
if(UpdateProgress != null)
UpdateProgress("Choosing files...", file, counter, Context.files.Count);
UpdateProgress("Compressing...", file.Value.Path, counter, Context.hashes.Count);
FileInfo fi = new FileInfo(file);
destinationFolder = Path.Combine(Settings.Current.RepositoryPath, file.Value.Sha256[0].ToString(), file.Value.Sha256[1].ToString(), file.Value.Sha256[2].ToString(), file.Value.Sha256[3].ToString(), file.Value.Sha256[4].ToString());
Directory.CreateDirectory(destinationFolder);
ZipEntry ze = zf.AddFile(file);
ze.AccessedTime = fi.LastAccessTimeUtc;
ze.Attributes = fi.Attributes;
ze.CreationTime = fi.CreationTimeUtc;
ze.EmitTimesInUnixFormatWhenSaving = true;
ze.LastModified = fi.LastWriteTimeUtc;
ze.FileName = file.Substring(filesPath.Length + 1);
destinationFile = Path.Combine(destinationFolder, file.Value.Sha256 + extension);
if(!File.Exists(destinationFile))
{
FileStream inFs = new FileStream(Path.Combine(filesPath, file.Value.Path), FileMode.Open, FileAccess.Read);
FileStream outFs = new FileStream(destinationFile, FileMode.CreateNew, FileAccess.Write);
Stream zStream = null;
switch(Settings.Current.CompressionAlgorithm)
{
case AlgoEnum.GZip:
zStream = new GZipStream(outFs, SharpCompress.Compressors.CompressionMode.Compress, CompressionLevel.BestCompression);
break;
case AlgoEnum.BZip2:
zStream = new BZip2Stream(outFs, SharpCompress.Compressors.CompressionMode.Compress);
break;
case AlgoEnum.LZMA:
zStream = new LzmaStream(new LzmaEncoderProperties(), false, outFs);
outFs.Write(((LzmaStream)zStream).Properties, 0, ((LzmaStream)zStream).Properties.Length);
outFs.Write(BitConverter.GetBytes(inFs.Length), 0, 8);
break;
}
byte[] buffer = new byte[bufferSize];
while((inFs.Position + bufferSize) <= inFs.Length)
{
if(UpdateProgress2 != null)
UpdateProgress2(string.Format("{0:P}", inFs.Position / (double)inFs.Length),
string.Format("{0} / {1} bytes", inFs.Position, inFs.Length),
inFs.Position, inFs.Length);
inFs.Read(buffer, 0, buffer.Length);
zStream.Write(buffer, 0, buffer.Length);
}
buffer = new byte[inFs.Length - inFs.Position];
if(UpdateProgress2 != null)
UpdateProgress2(string.Format("{0:P}", inFs.Position / (double)inFs.Length),
string.Format("{0} / {1} bytes", inFs.Position, inFs.Length),
inFs.Position, inFs.Length);
inFs.Read(buffer, 0, buffer.Length);
zStream.Write(buffer, 0, buffer.Length);
if(UpdateProgress2 != null)
UpdateProgress2(string.Format("{0:P}", inFs.Length / (double)inFs.Length),
"Finishing...",inFs.Length, inFs.Length);
inFs.Close();
zStream.Close();
}
counter++;
}
@@ -873,14 +910,6 @@ namespace osrepodbmgr.Core
xs.Serialize(xms, Context.metadata);
xms.Position = 0;
ZipEntry zx = zf.AddEntry("metadata.xml", xms);
zx.AccessedTime = DateTime.UtcNow;
zx.Attributes = FileAttributes.Normal;
zx.CreationTime = zx.AccessedTime;
zx.EmitTimesInUnixFormatWhenSaving = true;
zx.LastModified = zx.AccessedTime;
zx.FileName = "metadata.xml";
JsonSerializer js = new JsonSerializer();
js.Formatting = Newtonsoft.Json.Formatting.Indented;
js.NullValueHandling = NullValueHandling.Ignore;
@@ -890,13 +919,9 @@ namespace osrepodbmgr.Core
sw.Close();
jms.Position = 0;
ZipEntry zj = zf.AddEntry("metadata.json", jms);
zj.AccessedTime = DateTime.UtcNow;
zj.Attributes = FileAttributes.Normal;
zj.CreationTime = zx.AccessedTime;
zj.EmitTimesInUnixFormatWhenSaving = true;
zj.LastModified = zx.AccessedTime;
zj.FileName = "metadata.json";
destinationFolder = Path.Combine(Settings.Current.RepositoryPath, "metadata", mdid[0].ToString(), mdid[1].ToString(),
mdid[2].ToString(), mdid[3].ToString(), mdid[4].ToString());
Directory.CreateDirectory(destinationFolder);
FileStream xfs = new FileStream(Path.Combine(destinationFolder, mdid + ".xml"), FileMode.CreateNew, FileAccess.Write);
xms.CopyTo(xfs);
@@ -909,12 +934,8 @@ namespace osrepodbmgr.Core
jms.Position = 0;
}
zipCounter = 0;
zipCurrentEntryName = "";
zf.SaveProgress += Zf_SaveProgress;
if(UpdateProgress != null)
UpdateProgress(null, "Saving...", 0, 0);
zf.Save();
if(FinishedWithText!= null)
FinishedWithText(string.Format("Correctly added operating system with MDID {0}", mdid));
}
catch(Exception ex)
{
@@ -923,30 +944,6 @@ namespace osrepodbmgr.Core
if(Failed != null)
Failed(string.Format("Exception {0}\n{1}", ex.Message, ex.InnerException));
}
if(Finished != null)
Finished();
}
static void Zf_SaveProgress(object sender, SaveProgressEventArgs e)
{
if(e.CurrentEntry != null && e.CurrentEntry.FileName != zipCurrentEntryName)
{
zipCurrentEntryName = e.CurrentEntry.FileName;
zipCounter++;
}
if(UpdateProgress != null && e.CurrentEntry != null && e.EntriesTotal > 0)
UpdateProgress("Compressing...", e.CurrentEntry.FileName, zipCounter, e.EntriesTotal);
if(UpdateProgress2 != null)
UpdateProgress2(string.Format("{0:P}", e.BytesTransferred / (double)e.TotalBytesToTransfer),
string.Format("{0} / {1}", e.BytesTransferred, e.TotalBytesToTransfer),
e.BytesTransferred, e.TotalBytesToTransfer);
Console.WriteLine("{0}", e.EventType);
if(e.EventType == ZipProgressEventType.Error_Saving && Failed != null)
Failed("Failed compression");
if(e.EventType == ZipProgressEventType.Saving_Completed && FinishedWithText != null)
FinishedWithText(e.ArchiveName);
}
public static void CheckUnar()
@@ -1093,7 +1090,7 @@ namespace osrepodbmgr.Core
}
}
Context.copyArchive = false;
Context.unzipWithUnAr = false;
Context.archiveFormat = format;
Context.noFilesInArchive = counter;
@@ -1113,14 +1110,14 @@ namespace osrepodbmgr.Core
if(ZipFile.IsZipFile(Context.path))
{
Context.copyArchive = true;
Context.unzipWithUnAr = true;
ZipFile zf = ZipFile.Read(Context.path);
foreach(ZipEntry ze in zf)
{
// ZIP created with Mac OS X, need to be extracted with The UnArchiver to get correct ResourceFork structure
if(ze.FileName.StartsWith("__MACOSX", StringComparison.CurrentCulture))
{
Context.copyArchive = false;
Context.unzipWithUnAr = false;
break;
}
}
@@ -1176,7 +1173,7 @@ namespace osrepodbmgr.Core
try
{
// If it's a ZIP file not created by Mac OS X, use DotNetZip to uncompress (unar freaks out or corrupts certain ZIP features)
if(ZipFile.IsZipFile(Context.path) && Context.copyArchive)
if(ZipFile.IsZipFile(Context.path) && Context.unzipWithUnAr)
{
try
{
@@ -1256,189 +1253,6 @@ namespace osrepodbmgr.Core
Finished();
}
public static void CopyArchive()
{
try
{
if(string.IsNullOrWhiteSpace(Context.dbInfo.developer))
{
if(Failed != null)
Failed("Developer cannot be empty");
return;
}
if(string.IsNullOrWhiteSpace(Context.dbInfo.product))
{
if(Failed != null)
Failed("Product cannot be empty");
return;
}
if(string.IsNullOrWhiteSpace(Context.dbInfo.version))
{
if(Failed != null)
Failed("Version cannot be empty");
return;
}
string destinationFolder = "";
destinationFolder = Path.Combine(destinationFolder, Context.dbInfo.developer);
destinationFolder = Path.Combine(destinationFolder, Context.dbInfo.product);
destinationFolder = Path.Combine(destinationFolder, Context.dbInfo.version);
if(!string.IsNullOrWhiteSpace(Context.dbInfo.languages))
{
destinationFolder = Path.Combine(destinationFolder, Context.dbInfo.languages);
}
if(!string.IsNullOrWhiteSpace(Context.dbInfo.architecture))
{
destinationFolder = Path.Combine(destinationFolder, Context.dbInfo.architecture);
}
if(Context.dbInfo.oem)
{
destinationFolder = Path.Combine(destinationFolder, "oem");
}
if(!string.IsNullOrWhiteSpace(Context.dbInfo.machine))
{
destinationFolder = Path.Combine(destinationFolder, "for " + Context.dbInfo.machine);
}
string destinationFile = "";
if(!string.IsNullOrWhiteSpace(Context.dbInfo.format))
destinationFile += "[" + Context.dbInfo.format + "]";
if(Context.dbInfo.files)
{
if(destinationFile != "")
destinationFile += "_";
destinationFile += "files";
}
if(Context.dbInfo.netinstall)
{
if(destinationFile != "")
destinationFile += "_";
destinationFile += "netinstall";
}
if(Context.dbInfo.source)
{
if(destinationFile != "")
destinationFile += "_";
destinationFile += "source";
}
if(Context.dbInfo.update)
{
if(destinationFile != "")
destinationFile += "_";
destinationFile += "update";
}
if(Context.dbInfo.upgrade)
{
if(destinationFile != "")
destinationFile += "_";
destinationFile += "upgrade";
}
if(!string.IsNullOrWhiteSpace(Context.dbInfo.description))
{
if(destinationFile != "")
destinationFile += "_";
destinationFile += Context.dbInfo.description;
}
else if(destinationFile == "")
{
destinationFile = "archive";
}
string destination = Path.Combine(destinationFolder, destinationFile) + ".zip";
MD5Context md5 = new MD5Context();
md5.Init();
byte[] tmp;
string mdid = md5.Data(Encoding.UTF8.GetBytes(destination), out tmp);
Console.WriteLine("MDID: {0}", mdid);
destinationFolder = Settings.Current.RepositoryPath;
if(!Directory.Exists(destinationFolder))
Directory.CreateDirectory(destinationFolder);
destinationFolder = Path.Combine(destinationFolder, mdid[0].ToString());
if(!Directory.Exists(destinationFolder))
Directory.CreateDirectory(destinationFolder);
destinationFolder = Path.Combine(destinationFolder, mdid[1].ToString());
if(!Directory.Exists(destinationFolder))
Directory.CreateDirectory(destinationFolder);
destinationFolder = Path.Combine(destinationFolder, mdid[2].ToString());
if(!Directory.Exists(destinationFolder))
Directory.CreateDirectory(destinationFolder);
destinationFolder = Path.Combine(destinationFolder, mdid[3].ToString());
if(!Directory.Exists(destinationFolder))
Directory.CreateDirectory(destinationFolder);
destinationFolder = Path.Combine(destinationFolder, mdid[4].ToString());
if(!Directory.Exists(destinationFolder))
Directory.CreateDirectory(destinationFolder);
destination = Path.Combine(destinationFolder, mdid) + ".zip";
if(dbCore.DBOps.ExistsOS(mdid))
{
if(File.Exists(destination))
{
if(Failed != null)
Failed("OS already exists.");
return;
}
if(Failed != null)
Failed("OS already exists in the database but not in the repository, check for inconsistencies.");
return;
}
if(File.Exists(destination))
{
if(Failed != null)
Failed("OS already exists in the repository but not in the database, check for inconsistencies.");
return;
}
Context.dbInfo.mdid = mdid;
File.Copy(Context.path, destination);
if(Context.metadata != null)
{
MemoryStream xms = new MemoryStream();
XmlSerializer xs = new XmlSerializer(typeof(CICMMetadataType));
xs.Serialize(xms, Context.metadata);
xms.Position = 0;
JsonSerializer js = new JsonSerializer();
js.Formatting = Newtonsoft.Json.Formatting.Indented;
js.NullValueHandling = NullValueHandling.Ignore;
MemoryStream jms = new MemoryStream();
StreamWriter sw = new StreamWriter(jms, Encoding.UTF8, 1048576, true);
js.Serialize(sw, Context.metadata, typeof(CICMMetadataType));
sw.Close();
jms.Position = 0;
FileStream xfs = new FileStream(Path.Combine(destinationFolder, mdid + ".xml"), FileMode.CreateNew, FileAccess.Write);
xms.CopyTo(xfs);
xfs.Close();
FileStream jfs = new FileStream(Path.Combine(destinationFolder, mdid + ".json"), FileMode.CreateNew, FileAccess.Write);
jms.CopyTo(jfs);
jfs.Close();
xms.Position = 0;
jms.Position = 0;
}
if(FinishedWithText != null)
FinishedWithText(destination);
}
catch(Exception ex)
{
if(Debugger.IsAttached)
throw;
if(Failed != null)
Failed(string.Format("Exception {0}\n{1}", ex.Message, ex.InnerException));
}
}
public static void RemoveTempFolder()
{
try

View File

@@ -42,6 +42,9 @@
</Reference>
<Reference Include="System.Xml" />
<Reference Include="System.Data" />
<Reference Include="SharpCompress">
<HintPath>..\packages\SharpCompress.0.15.2\lib\net45\SharpCompress.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
@@ -58,6 +61,7 @@
<Compile Include="Settings.cs" />
<Compile Include="SQLite.cs" />
<Compile Include="Context.cs" />
<Compile Include="AlgoEnum.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />

View File

@@ -3,5 +3,6 @@
<package id="DotNetZip" version="1.10.1" targetFramework="net45" />
<package id="Newtonsoft.Json" version="10.0.2" targetFramework="net45" />
<package id="plist-cil" version="1.15.0" targetFramework="net45" />
<package id="SharpCompress" version="0.15.2" targetFramework="net45" />
<package id="System.Data.SQLite.Core" version="1.0.105.0" targetFramework="net45" />
</packages>

View File

@@ -1,3 +1,13 @@
2017-05-11 Natalia Portillo <claunia@claunia.com>
* dlgAdd.cs:
* frmMain.cs:
* dlgSettings.cs:
* gtk-gui/generated.cs:
* gtk-gui/osrepodbmgr.dlgSettings.cs:
Store files separate in the repository instead of
compressing them in ZIP. Supported GZ, BZ2 and LZMA formats.
2017-05-11 Natalia Portillo <claunia@claunia.com>
* frmMain.cs:

View File

@@ -876,33 +876,8 @@ public partial class dlgAdd : Dialog
Context.dbInfo.update = chkUpdate.Active;
Context.dbInfo.upgrade = chkUpgrade.Active;
if(!string.IsNullOrEmpty(Context.tmpFolder) && Context.copyArchive)
{
thdPulseProgress = new Thread(() =>
{
while(true)
{
Application.Invoke(delegate
{
prgProgress.Pulse();
});
Thread.Sleep(66);
}
});
Workers.UpdateProgress -= UpdateProgress;
Workers.UpdateProgress2 -= UpdateProgress2;
prgProgress.Text = "Copying archive as is.";
thdPulseProgress.Start();
prgProgress2.Visible = false;
lblProgress2.Visible = false;
thdPackFiles = new Thread(Workers.CopyArchive);
thdPackFiles.Start();
}
else
{
thdPackFiles = new Thread(Workers.CompressFiles);
thdPackFiles.Start();
}
thdPackFiles = new Thread(Workers.CompressFiles);
thdPackFiles.Start();
}
public void PackFilesFinished(string text)
@@ -1056,26 +1031,9 @@ public partial class dlgAdd : Dialog
btnArchive.Visible = false;
if(thdPulseProgress != null)
thdPulseProgress.Abort();
if(!Context.copyArchive)
{
thdPulseProgress = new Thread(() =>
{
while(true)
{
Application.Invoke(delegate
{
prgProgress.Pulse();
});
Thread.Sleep(66);
}
});
}
else
{
Workers.UpdateProgress += UpdateProgress;
lblProgress.Visible = true;
lblProgress2.Visible = true;
}
Workers.UpdateProgress += UpdateProgress;
lblProgress.Visible = true;
lblProgress2.Visible = true;
Workers.Failed -= OpenArchiveFailed;
Workers.Finished -= OpenArchiveFinished;
thdOpenArchive = null;

View File

@@ -29,7 +29,6 @@ using System;
using System.IO;
using System.Threading;
using Gtk;
using Ionic.Zip;
using osrepodbmgr.Core;
namespace osrepodbmgr
@@ -57,7 +56,7 @@ namespace osrepodbmgr
cmbCompAlg.Model = lstCompAlgs;
lstCompAlgs.Clear();
foreach(CompressionMethod type in Enum.GetValues(typeof(CompressionMethod)))
foreach(AlgoEnum type in Enum.GetValues(typeof(AlgoEnum)))
lstCompAlgs.AppendValues(type.ToString());
cmbCompAlg.Active = 0;
@@ -86,7 +85,7 @@ namespace osrepodbmgr
Core.Settings.Current.UnArchiverPath = txtUnar.Text;
Core.Settings.Current.DatabasePath = txtDatabase.Text;
Core.Settings.Current.RepositoryPath = txtRepository.Text;
Core.Settings.Current.CompressionAlgorithm = (CompressionMethod)Enum.Parse(typeof(CompressionMethod), cmbCompAlg.ActiveText);
Core.Settings.Current.CompressionAlgorithm = (AlgoEnum)Enum.Parse(typeof(AlgoEnum), cmbCompAlg.ActiveText);
Core.Settings.SaveSettings();
Core.Workers.CloseDB();
Core.Workers.InitDB();

View File

@@ -253,6 +253,8 @@ namespace osrepodbmgr
protected void OnBtnExtractClicked(object sender, EventArgs e)
{
throw new NotImplementedException();
/*
TreeIter osIter;
if(treeOSes.Selection.GetSelected(out osIter))
{
@@ -305,7 +307,7 @@ namespace osrepodbmgr
}
else
dlgFolder.Destroy();
}
}*/
}
public void ExtractArchiveFailed(string text)
@@ -346,7 +348,7 @@ namespace osrepodbmgr
Context.userExtracting = false;
Context.tmpFolder = null;
Context.copyArchive = false;
//Context.copyArchive = false;
Context.path = null;
});
}
@@ -391,13 +393,15 @@ namespace osrepodbmgr
Context.userExtracting = false;
Context.tmpFolder = null;
Context.copyArchive = false;
//Context.copyArchive = false;
Context.path = null;
});
}
protected void OnBtnSaveClicked(object sender, EventArgs e)
{
throw new NotImplementedException();
/*
TreeIter osIter;
if(treeOSes.Selection.GetSelected(out osIter))
{
@@ -447,7 +451,7 @@ namespace osrepodbmgr
}
else
dlgFolder.Destroy();
}
}*/
}
public void CopyFileFailed(string text)
@@ -485,7 +489,7 @@ namespace osrepodbmgr
Context.userExtracting = false;
Context.tmpFolder = null;
Context.copyArchive = false;
//Context.copyArchive = false;
Context.path = null;
});
}
@@ -527,7 +531,7 @@ namespace osrepodbmgr
Context.userExtracting = false;
Context.tmpFolder = null;
Context.copyArchive = false;
//Context.copyArchive = false;
Context.path = null;
});
}

View File

@@ -8,7 +8,7 @@ namespace Stetic
internal static void Initialize(Gtk.Widget iconRenderer)
{
if((Stetic.Gui.initialized == false))
if ((Stetic.Gui.initialized == false))
{
Stetic.Gui.initialized = true;
}
@@ -20,7 +20,7 @@ namespace Stetic
public static Gdk.Pixbuf LoadIcon(Gtk.Widget widget, string name, Gtk.IconSize size)
{
Gdk.Pixbuf res = widget.RenderIcon(name, size, null);
if((res != null))
if ((res != null))
{
return res;
}
@@ -32,9 +32,9 @@ namespace Stetic
{
return Gtk.IconTheme.Default.LoadIcon(name, sz, 0);
}
catch(System.Exception)
catch (System.Exception)
{
if((name != "gtk-missing-image"))
if ((name != "gtk-missing-image"))
{
return Stetic.IconLoader.LoadIcon(widget, "gtk-missing-image", size);
}

View File

@@ -309,7 +309,7 @@ namespace osrepodbmgr
global::Gtk.ButtonBox.ButtonBoxChild w30 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w29[this.btnDialog]));
w30.Expand = false;
w30.Fill = false;
if((this.Child != null))
if ((this.Child != null))
{
this.Child.ShowAll();
}