mirror of
https://github.com/claunia/osrepodbmgr.git
synced 2025-12-16 19:14:25 +00:00
Implemented extract of OS from repo, as files or zipped.
This commit is contained in:
@@ -1,3 +1,9 @@
|
|||||||
|
2017-05-12 Natalia Portillo <claunia@claunia.com>
|
||||||
|
|
||||||
|
* DBOps.cs:
|
||||||
|
* Workers.cs:
|
||||||
|
Implemented extract of OS from repo, as files or zipped.
|
||||||
|
|
||||||
2017-05-12 Natalia Portillo <claunia@claunia.com>
|
2017-05-12 Natalia Portillo <claunia@claunia.com>
|
||||||
|
|
||||||
* DBOps.cs:
|
* DBOps.cs:
|
||||||
|
|||||||
@@ -556,6 +556,68 @@ namespace osrepodbmgr.Core
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool GetAllFiles(out List<DBFile> entries, long id)
|
||||||
|
{
|
||||||
|
entries = new List<DBFile>();
|
||||||
|
|
||||||
|
string sql = string.Format("SELECT * from os_{0}", id);
|
||||||
|
|
||||||
|
IDbCommand dbcmd = dbCon.CreateCommand();
|
||||||
|
IDbDataAdapter dataAdapter = dbCore.GetNewDataAdapter();
|
||||||
|
dbcmd.CommandText = sql;
|
||||||
|
DataSet dataSet = new DataSet();
|
||||||
|
dataAdapter.SelectCommand = dbcmd;
|
||||||
|
dataAdapter.Fill(dataSet);
|
||||||
|
DataTable dataTable = dataSet.Tables[0];
|
||||||
|
|
||||||
|
foreach(DataRow dRow in dataTable.Rows)
|
||||||
|
{
|
||||||
|
DBFile fEntry = new DBFile();
|
||||||
|
fEntry.Id = ulong.Parse(dRow["id"].ToString());
|
||||||
|
fEntry.Path = dRow["path"].ToString();
|
||||||
|
fEntry.Sha256 = dRow["sha256"].ToString();
|
||||||
|
fEntry.Length = long.Parse(dRow["length"].ToString());
|
||||||
|
fEntry.CreationTimeUtc = DateTime.Parse(dRow["creation"].ToString());
|
||||||
|
fEntry.LastAccessTimeUtc = DateTime.Parse(dRow["access"].ToString());
|
||||||
|
fEntry.LastWriteTimeUtc = DateTime.Parse(dRow["modification"].ToString());
|
||||||
|
fEntry.Attributes = (FileAttributes)int.Parse(dRow["attributes"].ToString());
|
||||||
|
|
||||||
|
entries.Add(fEntry);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool GetAllFolders(out List<DBFolder> entries, long id)
|
||||||
|
{
|
||||||
|
entries = new List<DBFolder>();
|
||||||
|
|
||||||
|
string sql = string.Format("SELECT * from os_{0}_folders", id);
|
||||||
|
|
||||||
|
IDbCommand dbcmd = dbCon.CreateCommand();
|
||||||
|
IDbDataAdapter dataAdapter = dbCore.GetNewDataAdapter();
|
||||||
|
dbcmd.CommandText = sql;
|
||||||
|
DataSet dataSet = new DataSet();
|
||||||
|
dataAdapter.SelectCommand = dbcmd;
|
||||||
|
dataAdapter.Fill(dataSet);
|
||||||
|
DataTable dataTable = dataSet.Tables[0];
|
||||||
|
|
||||||
|
foreach(DataRow dRow in dataTable.Rows)
|
||||||
|
{
|
||||||
|
DBFolder fEntry = new DBFolder();
|
||||||
|
fEntry.Id = ulong.Parse(dRow["id"].ToString());
|
||||||
|
fEntry.Path = dRow["path"].ToString();
|
||||||
|
fEntry.CreationTimeUtc = DateTime.Parse(dRow["creation"].ToString());
|
||||||
|
fEntry.LastAccessTimeUtc = DateTime.Parse(dRow["access"].ToString());
|
||||||
|
fEntry.LastWriteTimeUtc = DateTime.Parse(dRow["modification"].ToString());
|
||||||
|
fEntry.Attributes = (FileAttributes)int.Parse(dRow["attributes"].ToString());
|
||||||
|
|
||||||
|
entries.Add(fEntry);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -910,7 +910,6 @@ namespace osrepodbmgr.Core
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
byte[] buffer = new byte[bufferSize];
|
byte[] buffer = new byte[bufferSize];
|
||||||
|
|
||||||
while((inFs.Position + bufferSize) <= inFs.Length)
|
while((inFs.Position + bufferSize) <= inFs.Length)
|
||||||
@@ -1389,5 +1388,377 @@ namespace osrepodbmgr.Core
|
|||||||
Failed(string.Format("Exception {0}\n{1}", ex.Message, ex.InnerException));
|
Failed(string.Format("Exception {0}\n{1}", ex.Message, ex.InnerException));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void SaveAs()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if(string.IsNullOrWhiteSpace(Context.path))
|
||||||
|
{
|
||||||
|
if(Failed != null)
|
||||||
|
Failed("Destination cannot be empty");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(File.Exists(Context.path))
|
||||||
|
{
|
||||||
|
if(Failed != null)
|
||||||
|
Failed("Destination cannot be a file");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(Context.dbInfo.id == 0)
|
||||||
|
{
|
||||||
|
if(Failed != null)
|
||||||
|
Failed("Operating system must be set");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<DBFile> files;
|
||||||
|
List<DBFolder> folders;
|
||||||
|
long counter;
|
||||||
|
|
||||||
|
if(UpdateProgress != null)
|
||||||
|
UpdateProgress("", "Asking DB for files...", 1, 100);
|
||||||
|
|
||||||
|
dbCore.DBOps.GetAllFiles(out files, Context.dbInfo.id);
|
||||||
|
|
||||||
|
if(UpdateProgress != null)
|
||||||
|
UpdateProgress("", "Asking DB for folders...", 2, 100);
|
||||||
|
|
||||||
|
dbCore.DBOps.GetAllFolders(out folders, Context.dbInfo.id);
|
||||||
|
|
||||||
|
if(UpdateProgress != null)
|
||||||
|
UpdateProgress("", "Creating folders...", 3, 100);
|
||||||
|
|
||||||
|
counter = 0;
|
||||||
|
foreach(DBFolder folder in folders)
|
||||||
|
{
|
||||||
|
if(UpdateProgress2 != null)
|
||||||
|
UpdateProgress2("", folder.Path, counter, folders.Count);
|
||||||
|
|
||||||
|
DirectoryInfo di = Directory.CreateDirectory(Path.Combine(Context.path, folder.Path));
|
||||||
|
di.Attributes = folder.Attributes;
|
||||||
|
di.CreationTimeUtc = folder.CreationTimeUtc;
|
||||||
|
di.LastAccessTimeUtc = folder.LastAccessTimeUtc;
|
||||||
|
di.LastWriteTimeUtc = folder.LastWriteTimeUtc;
|
||||||
|
|
||||||
|
counter++;
|
||||||
|
}
|
||||||
|
|
||||||
|
counter = 3;
|
||||||
|
foreach(DBFile file in files)
|
||||||
|
{
|
||||||
|
if(UpdateProgress != null)
|
||||||
|
UpdateProgress("", string.Format("Creating {0}...", file.Path), counter, 3 + files.Count);
|
||||||
|
|
||||||
|
Stream zStream = null;
|
||||||
|
string repoPath;
|
||||||
|
AlgoEnum algorithm;
|
||||||
|
|
||||||
|
if(File.Exists(Path.Combine(Settings.Current.RepositoryPath, file.Sha256[0].ToString(),
|
||||||
|
file.Sha256[1].ToString(), file.Sha256[2].ToString(),
|
||||||
|
file.Sha256[3].ToString(), file.Sha256[4].ToString(),
|
||||||
|
file.Sha256 + ".gz")))
|
||||||
|
{
|
||||||
|
repoPath = Path.Combine(Settings.Current.RepositoryPath, file.Sha256[0].ToString(),
|
||||||
|
file.Sha256[1].ToString(), file.Sha256[2].ToString(),
|
||||||
|
file.Sha256[3].ToString(), file.Sha256[4].ToString(),
|
||||||
|
file.Sha256 + ".gz");
|
||||||
|
algorithm = AlgoEnum.GZip;
|
||||||
|
}
|
||||||
|
else if(File.Exists(Path.Combine(Settings.Current.RepositoryPath, file.Sha256[0].ToString(),
|
||||||
|
file.Sha256[1].ToString(), file.Sha256[2].ToString(),
|
||||||
|
file.Sha256[3].ToString(), file.Sha256[4].ToString(),
|
||||||
|
file.Sha256 + ".bz2")))
|
||||||
|
{
|
||||||
|
repoPath = Path.Combine(Settings.Current.RepositoryPath, file.Sha256[0].ToString(),
|
||||||
|
file.Sha256[1].ToString(), file.Sha256[2].ToString(),
|
||||||
|
file.Sha256[3].ToString(), file.Sha256[4].ToString(),
|
||||||
|
file.Sha256 + ".bz2");
|
||||||
|
algorithm = AlgoEnum.BZip2;
|
||||||
|
}
|
||||||
|
else if(File.Exists(Path.Combine(Settings.Current.RepositoryPath, file.Sha256[0].ToString(),
|
||||||
|
file.Sha256[1].ToString(), file.Sha256[2].ToString(),
|
||||||
|
file.Sha256[3].ToString(), file.Sha256[4].ToString(),
|
||||||
|
file.Sha256 + ".lzma")))
|
||||||
|
{
|
||||||
|
repoPath = Path.Combine(Settings.Current.RepositoryPath, file.Sha256[0].ToString(),
|
||||||
|
file.Sha256[1].ToString(), file.Sha256[2].ToString(),
|
||||||
|
file.Sha256[3].ToString(), file.Sha256[4].ToString(),
|
||||||
|
file.Sha256 + ".lzma");
|
||||||
|
algorithm = AlgoEnum.LZMA;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(Failed != null)
|
||||||
|
Failed(string.Format("Cannot find file with hash {0} in the repository", file.Sha256));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
FileStream inFs = new FileStream(repoPath, FileMode.Open, FileAccess.Read);
|
||||||
|
FileStream outFs = new FileStream(Path.Combine(Context.path, file.Path), FileMode.CreateNew, FileAccess.Write);
|
||||||
|
|
||||||
|
switch(algorithm)
|
||||||
|
{
|
||||||
|
case AlgoEnum.GZip:
|
||||||
|
zStream = new GZipStream(inFs, SharpCompress.Compressors.CompressionMode.Decompress);
|
||||||
|
break;
|
||||||
|
case AlgoEnum.BZip2:
|
||||||
|
zStream = new BZip2Stream(inFs, SharpCompress.Compressors.CompressionMode.Decompress);
|
||||||
|
break;
|
||||||
|
case AlgoEnum.LZMA:
|
||||||
|
byte[] properties = new byte[5];
|
||||||
|
inFs.Read(properties, 0, 5);
|
||||||
|
inFs.Seek(8, SeekOrigin.Current);
|
||||||
|
zStream = new LzmaStream(properties, inFs);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] buffer = new byte[bufferSize];
|
||||||
|
|
||||||
|
while((outFs.Position + bufferSize) <= file.Length)
|
||||||
|
{
|
||||||
|
if(UpdateProgress2 != null)
|
||||||
|
UpdateProgress2(string.Format("{0:P}", outFs.Position / (double)file.Length),
|
||||||
|
string.Format("{0} / {1} bytes", outFs.Position, file.Length),
|
||||||
|
outFs.Position, file.Length);
|
||||||
|
|
||||||
|
zStream.Read(buffer, 0, buffer.Length);
|
||||||
|
outFs.Write(buffer, 0, buffer.Length);
|
||||||
|
}
|
||||||
|
|
||||||
|
buffer = new byte[file.Length - outFs.Position];
|
||||||
|
if(UpdateProgress2 != null)
|
||||||
|
UpdateProgress2(string.Format("{0:P}", outFs.Position / (double)file.Length),
|
||||||
|
string.Format("{0} / {1} bytes", outFs.Position, file.Length),
|
||||||
|
outFs.Position, file.Length);
|
||||||
|
|
||||||
|
zStream.Read(buffer, 0, buffer.Length);
|
||||||
|
outFs.Write(buffer, 0, buffer.Length);
|
||||||
|
|
||||||
|
if(UpdateProgress2 != null)
|
||||||
|
UpdateProgress2(string.Format("{0:P}", file.Length / (double)file.Length),
|
||||||
|
"Finishing...", inFs.Length, inFs.Length);
|
||||||
|
|
||||||
|
zStream.Close();
|
||||||
|
outFs.Close();
|
||||||
|
|
||||||
|
FileInfo fi = new FileInfo(Path.Combine(Context.path, file.Path));
|
||||||
|
fi.Attributes = file.Attributes;
|
||||||
|
fi.CreationTimeUtc = file.CreationTimeUtc;
|
||||||
|
fi.LastAccessTimeUtc = file.LastAccessTimeUtc;
|
||||||
|
fi.LastWriteTimeUtc = file.LastWriteTimeUtc;
|
||||||
|
|
||||||
|
counter++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(Finished != null)
|
||||||
|
Finished();
|
||||||
|
}
|
||||||
|
catch(Exception ex)
|
||||||
|
{
|
||||||
|
if(Debugger.IsAttached)
|
||||||
|
throw;
|
||||||
|
if(Failed != null)
|
||||||
|
Failed(string.Format("Exception {0}\n{1}", ex.Message, ex.InnerException));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void CompressTo()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if(string.IsNullOrWhiteSpace(Context.path))
|
||||||
|
{
|
||||||
|
if(Failed != null)
|
||||||
|
Failed("Destination cannot be empty");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(Directory.Exists(Context.path))
|
||||||
|
{
|
||||||
|
if(Failed != null)
|
||||||
|
Failed("Destination cannot be a folder");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(Context.dbInfo.id == 0)
|
||||||
|
{
|
||||||
|
if(Failed != null)
|
||||||
|
Failed("Operating system must be set");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ZipFile zf = new ZipFile(Context.path, Encoding.UTF8);
|
||||||
|
zf.CompressionLevel = Ionic.Zlib.CompressionLevel.BestCompression;
|
||||||
|
zf.CompressionMethod = CompressionMethod.Deflate;
|
||||||
|
zf.SaveProgress += Zf_SaveProgress;
|
||||||
|
zf.EmitTimesInUnixFormatWhenSaving = true;
|
||||||
|
zf.EmitTimesInWindowsFormatWhenSaving = true;
|
||||||
|
zf.UseZip64WhenSaving = Zip64Option.AsNecessary;
|
||||||
|
zf.SortEntriesBeforeSaving = true;
|
||||||
|
List<DBFile> files;
|
||||||
|
List<DBFolder> folders;
|
||||||
|
long counter;
|
||||||
|
|
||||||
|
if(UpdateProgress != null)
|
||||||
|
UpdateProgress("", "Asking DB for files...", 1, 100);
|
||||||
|
|
||||||
|
dbCore.DBOps.GetAllFiles(out files, Context.dbInfo.id);
|
||||||
|
|
||||||
|
if(UpdateProgress != null)
|
||||||
|
UpdateProgress("", "Asking DB for folders...", 2, 100);
|
||||||
|
|
||||||
|
dbCore.DBOps.GetAllFolders(out folders, Context.dbInfo.id);
|
||||||
|
|
||||||
|
if(UpdateProgress != null)
|
||||||
|
UpdateProgress("", "Creating folders...", 3, 100);
|
||||||
|
|
||||||
|
counter = 0;
|
||||||
|
foreach(DBFolder folder in folders)
|
||||||
|
{
|
||||||
|
if(UpdateProgress2 != null)
|
||||||
|
UpdateProgress2("", folder.Path, counter, folders.Count);
|
||||||
|
|
||||||
|
ZipEntry zd = zf.AddDirectoryByName(folder.Path);
|
||||||
|
zd.Attributes = folder.Attributes;
|
||||||
|
zd.CreationTime = folder.CreationTimeUtc;
|
||||||
|
zd.AccessedTime = folder.LastAccessTimeUtc;
|
||||||
|
zd.LastModified = folder.LastWriteTimeUtc;
|
||||||
|
zd.ModifiedTime = folder.LastWriteTimeUtc;
|
||||||
|
|
||||||
|
counter++;
|
||||||
|
}
|
||||||
|
|
||||||
|
counter = 3;
|
||||||
|
Context.hashes = new Dictionary<string, DBFile>();
|
||||||
|
foreach(DBFile file in files)
|
||||||
|
{
|
||||||
|
if(UpdateProgress != null)
|
||||||
|
UpdateProgress("", string.Format("Adding {0}...", file.Path), counter, 3 + files.Count);
|
||||||
|
|
||||||
|
Context.hashes.Add(file.Path, file);
|
||||||
|
|
||||||
|
ZipEntry zi = zf.AddEntry(file.Path, Zf_HandleOpen, Zf_HandleClose);
|
||||||
|
zi.Attributes = file.Attributes;
|
||||||
|
zi.CreationTime = file.CreationTimeUtc;
|
||||||
|
zi.AccessedTime = file.LastAccessTimeUtc;
|
||||||
|
zi.LastModified = file.LastWriteTimeUtc;
|
||||||
|
zi.ModifiedTime = file.LastWriteTimeUtc;
|
||||||
|
|
||||||
|
counter++;
|
||||||
|
}
|
||||||
|
|
||||||
|
zipCounter = 0;
|
||||||
|
zipCurrentEntryName = "";
|
||||||
|
zf.Save();
|
||||||
|
}
|
||||||
|
catch(Exception ex)
|
||||||
|
{
|
||||||
|
if(Debugger.IsAttached)
|
||||||
|
throw;
|
||||||
|
if(Failed != null)
|
||||||
|
Failed(string.Format("Exception {0}\n{1}", ex.Message, ex.InnerException));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Stream Zf_HandleOpen(string entryName)
|
||||||
|
{
|
||||||
|
DBFile file;
|
||||||
|
if(!Context.hashes.TryGetValue(entryName, out file))
|
||||||
|
throw new ArgumentException("Cannot find requested zip entry in hashes dictionary");
|
||||||
|
|
||||||
|
// Special case for empty file, as it seems to crash when SharpCompress tries to unLZMA it.
|
||||||
|
if(file.Length == 0)
|
||||||
|
return new MemoryStream();
|
||||||
|
|
||||||
|
Stream zStream = null;
|
||||||
|
string repoPath;
|
||||||
|
AlgoEnum algorithm;
|
||||||
|
|
||||||
|
if(File.Exists(Path.Combine(Settings.Current.RepositoryPath, file.Sha256[0].ToString(),
|
||||||
|
file.Sha256[1].ToString(), file.Sha256[2].ToString(),
|
||||||
|
file.Sha256[3].ToString(), file.Sha256[4].ToString(),
|
||||||
|
file.Sha256 + ".gz")))
|
||||||
|
{
|
||||||
|
repoPath = Path.Combine(Settings.Current.RepositoryPath, file.Sha256[0].ToString(),
|
||||||
|
file.Sha256[1].ToString(), file.Sha256[2].ToString(),
|
||||||
|
file.Sha256[3].ToString(), file.Sha256[4].ToString(),
|
||||||
|
file.Sha256 + ".gz");
|
||||||
|
algorithm = AlgoEnum.GZip;
|
||||||
|
}
|
||||||
|
else if(File.Exists(Path.Combine(Settings.Current.RepositoryPath, file.Sha256[0].ToString(),
|
||||||
|
file.Sha256[1].ToString(), file.Sha256[2].ToString(),
|
||||||
|
file.Sha256[3].ToString(), file.Sha256[4].ToString(),
|
||||||
|
file.Sha256 + ".bz2")))
|
||||||
|
{
|
||||||
|
repoPath = Path.Combine(Settings.Current.RepositoryPath, file.Sha256[0].ToString(),
|
||||||
|
file.Sha256[1].ToString(), file.Sha256[2].ToString(),
|
||||||
|
file.Sha256[3].ToString(), file.Sha256[4].ToString(),
|
||||||
|
file.Sha256 + ".bz2");
|
||||||
|
algorithm = AlgoEnum.BZip2;
|
||||||
|
}
|
||||||
|
else if(File.Exists(Path.Combine(Settings.Current.RepositoryPath, file.Sha256[0].ToString(),
|
||||||
|
file.Sha256[1].ToString(), file.Sha256[2].ToString(),
|
||||||
|
file.Sha256[3].ToString(), file.Sha256[4].ToString(),
|
||||||
|
file.Sha256 + ".lzma")))
|
||||||
|
{
|
||||||
|
repoPath = Path.Combine(Settings.Current.RepositoryPath, file.Sha256[0].ToString(),
|
||||||
|
file.Sha256[1].ToString(), file.Sha256[2].ToString(),
|
||||||
|
file.Sha256[3].ToString(), file.Sha256[4].ToString(),
|
||||||
|
file.Sha256 + ".lzma");
|
||||||
|
algorithm = AlgoEnum.LZMA;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
throw new ArgumentException(string.Format("Cannot find file with hash {0} in the repository", file.Sha256));
|
||||||
|
|
||||||
|
FileStream inFs = new FileStream(repoPath, FileMode.Open, FileAccess.Read);
|
||||||
|
|
||||||
|
switch(algorithm)
|
||||||
|
{
|
||||||
|
case AlgoEnum.GZip:
|
||||||
|
zStream = new GZipStream(inFs, SharpCompress.Compressors.CompressionMode.Decompress);
|
||||||
|
break;
|
||||||
|
case AlgoEnum.BZip2:
|
||||||
|
zStream = new BZip2Stream(inFs, SharpCompress.Compressors.CompressionMode.Decompress);
|
||||||
|
break;
|
||||||
|
case AlgoEnum.LZMA:
|
||||||
|
byte[] properties = new byte[5];
|
||||||
|
inFs.Read(properties, 0, 5);
|
||||||
|
inFs.Seek(8, SeekOrigin.Current);
|
||||||
|
zStream = new LzmaStream(properties, inFs, inFs.Length - 13, file.Length);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return zStream;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Zf_HandleClose(string entryName, Stream stream)
|
||||||
|
{
|
||||||
|
stream.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
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 && e.TotalBytesToTransfer > 0)
|
||||||
|
UpdateProgress2(string.Format("{0:P}", e.BytesTransferred / (double)e.TotalBytesToTransfer),
|
||||||
|
string.Format("{0} / {1}", e.BytesTransferred, e.TotalBytesToTransfer),
|
||||||
|
e.BytesTransferred, e.TotalBytesToTransfer);
|
||||||
|
|
||||||
|
if(e.EventType == ZipProgressEventType.Error_Saving && Failed != null)
|
||||||
|
Failed("An error occurred creating ZIP file.");
|
||||||
|
|
||||||
|
if(e.EventType == ZipProgressEventType.Saving_Completed && Finished != null)
|
||||||
|
Finished();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,11 @@
|
|||||||
|
2017-05-12 Natalia Portillo <claunia@claunia.com>
|
||||||
|
|
||||||
|
* frmMain.cs:
|
||||||
|
* gtk-gui/gui.stetic:
|
||||||
|
* gtk-gui/generated.cs:
|
||||||
|
* gtk-gui/osrepodbmgr.frmMain.cs:
|
||||||
|
Implemented extract of OS from repo, as files or zipped.
|
||||||
|
|
||||||
2017-05-11 Natalia Portillo <claunia@claunia.com>
|
2017-05-11 Natalia Portillo <claunia@claunia.com>
|
||||||
|
|
||||||
* dlgAdd.cs:
|
* dlgAdd.cs:
|
||||||
|
|||||||
@@ -38,8 +38,8 @@ namespace osrepodbmgr
|
|||||||
ListStore osView;
|
ListStore osView;
|
||||||
Thread thdPulseProgress;
|
Thread thdPulseProgress;
|
||||||
Thread thdPopulateOSes;
|
Thread thdPopulateOSes;
|
||||||
Thread thdExtractArchive;
|
Thread thdCompressTo;
|
||||||
Thread thdCopyFile;
|
Thread thdSaveAs;
|
||||||
|
|
||||||
public frmMain() :
|
public frmMain() :
|
||||||
base(WindowType.Toplevel)
|
base(WindowType.Toplevel)
|
||||||
@@ -169,7 +169,7 @@ namespace osrepodbmgr
|
|||||||
treeOSes.Sensitive = true;
|
treeOSes.Sensitive = true;
|
||||||
btnAdd.Visible = true;
|
btnAdd.Visible = true;
|
||||||
btnRemove.Visible = true;
|
btnRemove.Visible = true;
|
||||||
btnExtract.Visible = true;
|
btnCompress.Visible = true;
|
||||||
btnSave.Visible = true;
|
btnSave.Visible = true;
|
||||||
btnHelp.Visible = true;
|
btnHelp.Visible = true;
|
||||||
btnSettings.Visible = true;
|
btnSettings.Visible = true;
|
||||||
@@ -251,43 +251,31 @@ namespace osrepodbmgr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void OnBtnExtractClicked(object sender, EventArgs e)
|
protected void OnBtnSaveClicked(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
|
||||||
/*
|
|
||||||
TreeIter osIter;
|
TreeIter osIter;
|
||||||
if(treeOSes.Selection.GetSelected(out osIter))
|
if(treeOSes.Selection.GetSelected(out osIter))
|
||||||
{
|
{
|
||||||
Context.path = (string)osView.GetValue(osIter, 16);
|
Context.dbInfo.id = (long)osView.GetValue(osIter, 17);
|
||||||
|
|
||||||
if(!File.Exists(Context.path))
|
FileChooserDialog dlgFolder = new FileChooserDialog("Save to...", this, FileChooserAction.SelectFolder,
|
||||||
{
|
|
||||||
MessageDialog dlgMsg = new MessageDialog(this, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, "File is not in repository.");
|
|
||||||
dlgMsg.Run();
|
|
||||||
dlgMsg.Destroy();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
FileChooserDialog dlgFolder = new FileChooserDialog("Extract to...", this, FileChooserAction.SelectFolder,
|
|
||||||
"Cancel", ResponseType.Cancel, "Choose", ResponseType.Accept);
|
"Cancel", ResponseType.Cancel, "Choose", ResponseType.Accept);
|
||||||
dlgFolder.SelectMultiple = false;
|
dlgFolder.SelectMultiple = false;
|
||||||
|
|
||||||
if(dlgFolder.Run() == (int)ResponseType.Accept)
|
if(dlgFolder.Run() == (int)ResponseType.Accept)
|
||||||
{
|
{
|
||||||
Context.userExtracting = true;
|
Context.path = dlgFolder.Filename;
|
||||||
Context.tmpFolder = dlgFolder.Filename;
|
|
||||||
Context.copyArchive = true;
|
|
||||||
|
|
||||||
dlgFolder.Destroy();
|
dlgFolder.Destroy();
|
||||||
|
|
||||||
lblProgress.Visible = true;
|
lblProgress.Visible = true;
|
||||||
lblProgress2.Visible = true;
|
|
||||||
prgProgress.Visible = true;
|
prgProgress.Visible = true;
|
||||||
|
lblProgress2.Visible = true;
|
||||||
prgProgress2.Visible = true;
|
prgProgress2.Visible = true;
|
||||||
treeOSes.Sensitive = false;
|
treeOSes.Sensitive = false;
|
||||||
btnAdd.Visible = false;
|
btnAdd.Visible = false;
|
||||||
btnRemove.Visible = false;
|
btnRemove.Visible = false;
|
||||||
btnExtract.Visible = false;
|
btnCompress.Visible = false;
|
||||||
btnSave.Visible = false;
|
btnSave.Visible = false;
|
||||||
btnHelp.Visible = false;
|
btnHelp.Visible = false;
|
||||||
btnSettings.Visible = false;
|
btnSettings.Visible = false;
|
||||||
@@ -298,19 +286,19 @@ namespace osrepodbmgr
|
|||||||
thdPulseProgress.Abort();
|
thdPulseProgress.Abort();
|
||||||
thdPulseProgress = null;
|
thdPulseProgress = null;
|
||||||
}
|
}
|
||||||
Workers.Failed += ExtractArchiveFailed;
|
Workers.Failed += SaveAsFailed;
|
||||||
Workers.Finished += ExtractArchiveFinished;
|
Workers.Finished += SaveAsFinished;
|
||||||
Workers.UpdateProgress += UpdateProgress;
|
Workers.UpdateProgress += UpdateProgress;
|
||||||
Workers.UpdateProgress2 += UpdateProgress2;
|
Workers.UpdateProgress2 += UpdateProgress2;
|
||||||
thdExtractArchive = new Thread(Workers.ExtractArchive);
|
thdSaveAs = new Thread(Workers.SaveAs);
|
||||||
thdExtractArchive.Start();
|
thdSaveAs.Start();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
dlgFolder.Destroy();
|
dlgFolder.Destroy();
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ExtractArchiveFailed(string text)
|
public void SaveAsFailed(string text)
|
||||||
{
|
{
|
||||||
Application.Invoke(delegate
|
Application.Invoke(delegate
|
||||||
{
|
{
|
||||||
@@ -322,38 +310,35 @@ namespace osrepodbmgr
|
|||||||
thdPulseProgress.Abort();
|
thdPulseProgress.Abort();
|
||||||
thdPulseProgress = null;
|
thdPulseProgress = null;
|
||||||
}
|
}
|
||||||
if(thdExtractArchive != null)
|
if(thdSaveAs != null)
|
||||||
{
|
{
|
||||||
thdExtractArchive.Abort();
|
thdSaveAs.Abort();
|
||||||
thdExtractArchive = null;
|
thdSaveAs = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
lblProgress.Visible = false;
|
lblProgress.Visible = false;
|
||||||
lblProgress2.Visible = false;
|
|
||||||
prgProgress.Visible = false;
|
prgProgress.Visible = false;
|
||||||
|
lblProgress2.Visible = false;
|
||||||
prgProgress2.Visible = false;
|
prgProgress2.Visible = false;
|
||||||
treeOSes.Sensitive = true;
|
treeOSes.Sensitive = true;
|
||||||
btnAdd.Visible = true;
|
btnAdd.Visible = true;
|
||||||
btnRemove.Visible = true;
|
btnRemove.Visible = true;
|
||||||
btnExtract.Visible = true;
|
btnCompress.Visible = true;
|
||||||
btnSave.Visible = true;
|
btnSave.Visible = true;
|
||||||
btnHelp.Visible = true;
|
btnHelp.Visible = true;
|
||||||
btnSettings.Visible = true;
|
btnSettings.Visible = true;
|
||||||
btnStop.Visible = false;
|
btnStop.Visible = false;
|
||||||
|
|
||||||
Workers.Failed -= ExtractArchiveFailed;
|
Workers.Failed -= SaveAsFailed;
|
||||||
Workers.Finished -= ExtractArchiveFinished;
|
Workers.Finished -= SaveAsFinished;
|
||||||
Workers.UpdateProgress -= UpdateProgress;
|
Workers.UpdateProgress -= UpdateProgress;
|
||||||
Workers.UpdateProgress2 -= UpdateProgress2;
|
Workers.UpdateProgress2 -= UpdateProgress2;
|
||||||
|
|
||||||
Context.userExtracting = false;
|
|
||||||
Context.tmpFolder = null;
|
|
||||||
//Context.copyArchive = false;
|
|
||||||
Context.path = null;
|
Context.path = null;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ExtractArchiveFinished()
|
public void SaveAsFinished()
|
||||||
{
|
{
|
||||||
Application.Invoke(delegate
|
Application.Invoke(delegate
|
||||||
{
|
{
|
||||||
@@ -362,176 +347,34 @@ namespace osrepodbmgr
|
|||||||
thdPulseProgress.Abort();
|
thdPulseProgress.Abort();
|
||||||
thdPulseProgress = null;
|
thdPulseProgress = null;
|
||||||
}
|
}
|
||||||
if(thdExtractArchive != null)
|
if(thdSaveAs != null)
|
||||||
{
|
{
|
||||||
thdExtractArchive.Abort();
|
thdSaveAs.Abort();
|
||||||
thdExtractArchive = null;
|
thdSaveAs = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
lblProgress.Visible = false;
|
lblProgress.Visible = false;
|
||||||
lblProgress2.Visible = false;
|
|
||||||
prgProgress.Visible = false;
|
prgProgress.Visible = false;
|
||||||
|
lblProgress2.Visible = false;
|
||||||
prgProgress2.Visible = false;
|
prgProgress2.Visible = false;
|
||||||
treeOSes.Sensitive = true;
|
treeOSes.Sensitive = true;
|
||||||
btnAdd.Visible = true;
|
btnAdd.Visible = true;
|
||||||
btnRemove.Visible = true;
|
btnRemove.Visible = true;
|
||||||
btnExtract.Visible = true;
|
btnCompress.Visible = true;
|
||||||
btnSave.Visible = true;
|
btnSave.Visible = true;
|
||||||
btnHelp.Visible = true;
|
btnHelp.Visible = true;
|
||||||
btnSettings.Visible = true;
|
btnSettings.Visible = true;
|
||||||
btnStop.Visible = false;
|
btnStop.Visible = false;
|
||||||
|
|
||||||
Workers.Failed -= ExtractArchiveFailed;
|
Workers.Failed -= SaveAsFailed;
|
||||||
Workers.Finished -= ExtractArchiveFinished;
|
Workers.Finished -= SaveAsFinished;
|
||||||
Workers.UpdateProgress -= UpdateProgress;
|
|
||||||
Workers.UpdateProgress2 -= UpdateProgress2;
|
|
||||||
|
|
||||||
MessageDialog dlgMsg = new MessageDialog(this, DialogFlags.Modal, MessageType.Info, ButtonsType.Ok,
|
|
||||||
string.Format("Correctly extracted to {0}", Context.tmpFolder));
|
|
||||||
dlgMsg.Run();
|
|
||||||
dlgMsg.Destroy();
|
|
||||||
|
|
||||||
Context.userExtracting = false;
|
|
||||||
Context.tmpFolder = null;
|
|
||||||
//Context.copyArchive = false;
|
|
||||||
Context.path = null;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void OnBtnSaveClicked(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
/*
|
|
||||||
TreeIter osIter;
|
|
||||||
if(treeOSes.Selection.GetSelected(out osIter))
|
|
||||||
{
|
|
||||||
Context.path = (string)osView.GetValue(osIter, 16);
|
|
||||||
|
|
||||||
if(!File.Exists(Context.path))
|
|
||||||
{
|
|
||||||
MessageDialog dlgMsg = new MessageDialog(this, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, "File is not in repository.");
|
|
||||||
dlgMsg.Run();
|
|
||||||
dlgMsg.Destroy();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
FileChooserDialog dlgFolder = new FileChooserDialog("Copy to...", this, FileChooserAction.Save,
|
|
||||||
"Cancel", ResponseType.Cancel, "Choose", ResponseType.Accept);
|
|
||||||
dlgFolder.SelectMultiple = false;
|
|
||||||
|
|
||||||
if(dlgFolder.Run() == (int)ResponseType.Accept)
|
|
||||||
{
|
|
||||||
Context.userExtracting = true;
|
|
||||||
Context.tmpFolder = dlgFolder.Filename;
|
|
||||||
Context.copyArchive = true;
|
|
||||||
|
|
||||||
dlgFolder.Destroy();
|
|
||||||
|
|
||||||
lblProgress.Visible = true;
|
|
||||||
prgProgress.Visible = true;
|
|
||||||
treeOSes.Sensitive = false;
|
|
||||||
btnAdd.Visible = false;
|
|
||||||
btnRemove.Visible = false;
|
|
||||||
btnExtract.Visible = false;
|
|
||||||
btnSave.Visible = false;
|
|
||||||
btnHelp.Visible = false;
|
|
||||||
btnSettings.Visible = false;
|
|
||||||
btnStop.Visible = true;
|
|
||||||
|
|
||||||
if(thdPulseProgress != null)
|
|
||||||
{
|
|
||||||
thdPulseProgress.Abort();
|
|
||||||
thdPulseProgress = null;
|
|
||||||
}
|
|
||||||
Workers.Failed += CopyFileFailed;
|
|
||||||
Workers.Finished += CopyFileFinished;
|
|
||||||
Workers.UpdateProgress += UpdateProgress;
|
|
||||||
thdCopyFile = new Thread(Workers.CopyFile);
|
|
||||||
thdCopyFile.Start();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
dlgFolder.Destroy();
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
|
|
||||||
public void CopyFileFailed(string text)
|
|
||||||
{
|
|
||||||
Application.Invoke(delegate
|
|
||||||
{
|
|
||||||
MessageDialog dlgMsg = new MessageDialog(this, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, text);
|
|
||||||
dlgMsg.Run();
|
|
||||||
dlgMsg.Destroy();
|
|
||||||
if(thdPulseProgress != null)
|
|
||||||
{
|
|
||||||
thdPulseProgress.Abort();
|
|
||||||
thdPulseProgress = null;
|
|
||||||
}
|
|
||||||
if(thdCopyFile != null)
|
|
||||||
{
|
|
||||||
thdCopyFile.Abort();
|
|
||||||
thdCopyFile = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
lblProgress.Visible = false;
|
|
||||||
prgProgress.Visible = false;
|
|
||||||
treeOSes.Sensitive = true;
|
|
||||||
btnAdd.Visible = true;
|
|
||||||
btnRemove.Visible = true;
|
|
||||||
btnExtract.Visible = true;
|
|
||||||
btnSave.Visible = true;
|
|
||||||
btnHelp.Visible = true;
|
|
||||||
btnSettings.Visible = true;
|
|
||||||
btnStop.Visible = false;
|
|
||||||
|
|
||||||
Workers.Failed -= CopyFileFailed;
|
|
||||||
Workers.Finished -= CopyFileFinished;
|
|
||||||
Workers.UpdateProgress -= UpdateProgress;
|
|
||||||
|
|
||||||
Context.userExtracting = false;
|
|
||||||
Context.tmpFolder = null;
|
|
||||||
//Context.copyArchive = false;
|
|
||||||
Context.path = null;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public void CopyFileFinished()
|
|
||||||
{
|
|
||||||
Application.Invoke(delegate
|
|
||||||
{
|
|
||||||
if(thdPulseProgress != null)
|
|
||||||
{
|
|
||||||
thdPulseProgress.Abort();
|
|
||||||
thdPulseProgress = null;
|
|
||||||
}
|
|
||||||
if(thdCopyFile != null)
|
|
||||||
{
|
|
||||||
thdCopyFile.Abort();
|
|
||||||
thdCopyFile = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
lblProgress.Visible = false;
|
|
||||||
prgProgress.Visible = false;
|
|
||||||
treeOSes.Sensitive = true;
|
|
||||||
btnAdd.Visible = true;
|
|
||||||
btnRemove.Visible = true;
|
|
||||||
btnExtract.Visible = true;
|
|
||||||
btnSave.Visible = true;
|
|
||||||
btnHelp.Visible = true;
|
|
||||||
btnSettings.Visible = true;
|
|
||||||
btnStop.Visible = false;
|
|
||||||
|
|
||||||
Workers.Failed -= CopyFileFailed;
|
|
||||||
Workers.Finished -= CopyFileFinished;
|
|
||||||
Workers.UpdateProgress -= UpdateProgress;
|
Workers.UpdateProgress -= UpdateProgress;
|
||||||
|
|
||||||
MessageDialog dlgMsg = new MessageDialog(this, DialogFlags.Modal, MessageType.Info, ButtonsType.Ok,
|
MessageDialog dlgMsg = new MessageDialog(this, DialogFlags.Modal, MessageType.Info, ButtonsType.Ok,
|
||||||
string.Format("Correctly saved as {0}", Context.tmpFolder));
|
string.Format("Correctly saved to {0}", Context.path));
|
||||||
dlgMsg.Run();
|
dlgMsg.Run();
|
||||||
dlgMsg.Destroy();
|
dlgMsg.Destroy();
|
||||||
|
|
||||||
Context.userExtracting = false;
|
|
||||||
Context.tmpFolder = null;
|
|
||||||
//Context.copyArchive = false;
|
|
||||||
Context.path = null;
|
Context.path = null;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -568,15 +411,15 @@ namespace osrepodbmgr
|
|||||||
thdPopulateOSes.Abort();
|
thdPopulateOSes.Abort();
|
||||||
thdPopulateOSes = null;
|
thdPopulateOSes = null;
|
||||||
}
|
}
|
||||||
if(thdExtractArchive != null)
|
if(thdCompressTo != null)
|
||||||
{
|
{
|
||||||
thdPopulateOSes.Abort();
|
thdPopulateOSes.Abort();
|
||||||
thdPopulateOSes = null;
|
thdPopulateOSes = null;
|
||||||
}
|
}
|
||||||
if(thdCopyFile != null)
|
if(thdSaveAs != null)
|
||||||
{
|
{
|
||||||
thdCopyFile.Abort();
|
thdSaveAs.Abort();
|
||||||
thdCopyFile = null;
|
thdSaveAs = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -584,5 +427,134 @@ namespace osrepodbmgr
|
|||||||
{
|
{
|
||||||
OnBtnStopClicked(sender, e);
|
OnBtnStopClicked(sender, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void OnBtnCompressClicked(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
TreeIter osIter;
|
||||||
|
if(treeOSes.Selection.GetSelected(out osIter))
|
||||||
|
{
|
||||||
|
Context.dbInfo.id = (long)osView.GetValue(osIter, 17);
|
||||||
|
|
||||||
|
FileChooserDialog dlgFolder = new FileChooserDialog("Compress to...", this, FileChooserAction.Save,
|
||||||
|
"Cancel", ResponseType.Cancel, "Choose", ResponseType.Accept);
|
||||||
|
dlgFolder.SelectMultiple = false;
|
||||||
|
|
||||||
|
if(dlgFolder.Run() == (int)ResponseType.Accept)
|
||||||
|
{
|
||||||
|
Context.path = dlgFolder.Filename;
|
||||||
|
|
||||||
|
dlgFolder.Destroy();
|
||||||
|
|
||||||
|
lblProgress.Visible = true;
|
||||||
|
prgProgress.Visible = true;
|
||||||
|
lblProgress2.Visible = true;
|
||||||
|
prgProgress2.Visible = true;
|
||||||
|
treeOSes.Sensitive = false;
|
||||||
|
btnAdd.Visible = false;
|
||||||
|
btnRemove.Visible = false;
|
||||||
|
btnCompress.Visible = false;
|
||||||
|
btnSave.Visible = false;
|
||||||
|
btnHelp.Visible = false;
|
||||||
|
btnSettings.Visible = false;
|
||||||
|
btnStop.Visible = true;
|
||||||
|
|
||||||
|
if(thdPulseProgress != null)
|
||||||
|
{
|
||||||
|
thdPulseProgress.Abort();
|
||||||
|
thdPulseProgress = null;
|
||||||
|
}
|
||||||
|
Workers.Failed += CompressToFailed;
|
||||||
|
Workers.Finished += CompressToFinished;
|
||||||
|
Workers.UpdateProgress += UpdateProgress;
|
||||||
|
Workers.UpdateProgress2 += UpdateProgress2;
|
||||||
|
thdCompressTo = new Thread(Workers.CompressTo);
|
||||||
|
thdCompressTo.Start();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
dlgFolder.Destroy();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CompressToFailed(string text)
|
||||||
|
{
|
||||||
|
Application.Invoke(delegate
|
||||||
|
{
|
||||||
|
MessageDialog dlgMsg = new MessageDialog(this, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, text);
|
||||||
|
dlgMsg.Run();
|
||||||
|
dlgMsg.Destroy();
|
||||||
|
if(thdPulseProgress != null)
|
||||||
|
{
|
||||||
|
thdPulseProgress.Abort();
|
||||||
|
thdPulseProgress = null;
|
||||||
|
}
|
||||||
|
if(thdCompressTo != null)
|
||||||
|
{
|
||||||
|
thdCompressTo.Abort();
|
||||||
|
thdCompressTo = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
lblProgress.Visible = false;
|
||||||
|
lblProgress2.Visible = false;
|
||||||
|
prgProgress.Visible = false;
|
||||||
|
prgProgress2.Visible = false;
|
||||||
|
treeOSes.Sensitive = true;
|
||||||
|
btnAdd.Visible = true;
|
||||||
|
btnRemove.Visible = true;
|
||||||
|
btnCompress.Visible = true;
|
||||||
|
btnSave.Visible = true;
|
||||||
|
btnHelp.Visible = true;
|
||||||
|
btnSettings.Visible = true;
|
||||||
|
btnStop.Visible = false;
|
||||||
|
|
||||||
|
Workers.Failed -= CompressToFailed;
|
||||||
|
Workers.Finished -= CompressToFinished;
|
||||||
|
Workers.UpdateProgress -= UpdateProgress;
|
||||||
|
Workers.UpdateProgress2 -= UpdateProgress2;
|
||||||
|
|
||||||
|
Context.path = null;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CompressToFinished()
|
||||||
|
{
|
||||||
|
Application.Invoke(delegate
|
||||||
|
{
|
||||||
|
if(thdPulseProgress != null)
|
||||||
|
{
|
||||||
|
thdPulseProgress.Abort();
|
||||||
|
thdPulseProgress = null;
|
||||||
|
}
|
||||||
|
if(thdCompressTo != null)
|
||||||
|
{
|
||||||
|
thdCompressTo.Abort();
|
||||||
|
thdCompressTo = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
lblProgress.Visible = false;
|
||||||
|
lblProgress2.Visible = false;
|
||||||
|
prgProgress.Visible = false;
|
||||||
|
prgProgress2.Visible = false;
|
||||||
|
treeOSes.Sensitive = true;
|
||||||
|
btnAdd.Visible = true;
|
||||||
|
btnRemove.Visible = true;
|
||||||
|
btnCompress.Visible = true;
|
||||||
|
btnSave.Visible = true;
|
||||||
|
btnHelp.Visible = true;
|
||||||
|
btnSettings.Visible = true;
|
||||||
|
btnStop.Visible = false;
|
||||||
|
|
||||||
|
Workers.Failed -= CompressToFailed;
|
||||||
|
Workers.Finished -= CompressToFinished;
|
||||||
|
Workers.UpdateProgress -= UpdateProgress;
|
||||||
|
Workers.UpdateProgress2 -= UpdateProgress2;
|
||||||
|
|
||||||
|
MessageDialog dlgMsg = new MessageDialog(this, DialogFlags.Modal, MessageType.Info, ButtonsType.Ok,
|
||||||
|
string.Format("Correctly compressed as {0}", Context.path));
|
||||||
|
dlgMsg.Run();
|
||||||
|
dlgMsg.Destroy();
|
||||||
|
|
||||||
|
Context.path = null;
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -12563,11 +12563,11 @@ QNX/QNX/20090229/source.zip</property>
|
|||||||
<property name="MemberName" />
|
<property name="MemberName" />
|
||||||
<property name="Visible">False</property>
|
<property name="Visible">False</property>
|
||||||
<property name="CanFocus">True</property>
|
<property name="CanFocus">True</property>
|
||||||
<property name="UseStock">True</property>
|
<property name="Type">TextAndIcon</property>
|
||||||
<property name="Type">StockItem</property>
|
<property name="Icon">stock:gtk-directory Menu</property>
|
||||||
<property name="StockId">gtk-save-as</property>
|
<property name="Label" translatable="yes">Save _As</property>
|
||||||
|
<property name="UseUnderline">True</property>
|
||||||
<signal name="Clicked" handler="OnBtnSaveClicked" />
|
<signal name="Clicked" handler="OnBtnSaveClicked" />
|
||||||
<property name="label">gtk-save-as</property>
|
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="PackType">End</property>
|
<property name="PackType">End</property>
|
||||||
@@ -12578,15 +12578,14 @@ QNX/QNX/20090229/source.zip</property>
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<widget class="Gtk.Button" id="btnExtract">
|
<widget class="Gtk.Button" id="btnCompress">
|
||||||
<property name="MemberName" />
|
<property name="MemberName" />
|
||||||
<property name="Visible">False</property>
|
|
||||||
<property name="CanFocus">True</property>
|
<property name="CanFocus">True</property>
|
||||||
<property name="Type">TextAndIcon</property>
|
<property name="Type">TextAndIcon</property>
|
||||||
<property name="Icon">stock:gtk-directory Menu</property>
|
<property name="Icon">stock:gtk-save Menu</property>
|
||||||
<property name="Label" translatable="yes">Extract to</property>
|
<property name="Label" translatable="yes">Compress to</property>
|
||||||
<property name="UseUnderline">True</property>
|
<property name="UseUnderline">True</property>
|
||||||
<signal name="Clicked" handler="OnBtnExtractClicked" />
|
<signal name="Clicked" handler="OnBtnCompressClicked" />
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="PackType">End</property>
|
<property name="PackType">End</property>
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ namespace osrepodbmgr
|
|||||||
|
|
||||||
private global::Gtk.Button btnSave;
|
private global::Gtk.Button btnSave;
|
||||||
|
|
||||||
private global::Gtk.Button btnExtract;
|
private global::Gtk.Button btnCompress;
|
||||||
|
|
||||||
private global::Gtk.Button btnStop;
|
private global::Gtk.Button btnStop;
|
||||||
|
|
||||||
@@ -206,30 +206,32 @@ namespace osrepodbmgr
|
|||||||
this.btnSave = new global::Gtk.Button();
|
this.btnSave = new global::Gtk.Button();
|
||||||
this.btnSave.CanFocus = true;
|
this.btnSave.CanFocus = true;
|
||||||
this.btnSave.Name = "btnSave";
|
this.btnSave.Name = "btnSave";
|
||||||
this.btnSave.UseStock = true;
|
|
||||||
this.btnSave.UseUnderline = true;
|
this.btnSave.UseUnderline = true;
|
||||||
this.btnSave.Label = "gtk-save-as";
|
this.btnSave.Label = global::Mono.Unix.Catalog.GetString("Save _As");
|
||||||
|
global::Gtk.Image w17 = new global::Gtk.Image();
|
||||||
|
w17.Pixbuf = global::Stetic.IconLoader.LoadIcon(this, "gtk-directory", global::Gtk.IconSize.Menu);
|
||||||
|
this.btnSave.Image = w17;
|
||||||
this.hbox1.Add(this.btnSave);
|
this.hbox1.Add(this.btnSave);
|
||||||
global::Gtk.Box.BoxChild w17 = ((global::Gtk.Box.BoxChild)(this.hbox1[this.btnSave]));
|
global::Gtk.Box.BoxChild w18 = ((global::Gtk.Box.BoxChild)(this.hbox1[this.btnSave]));
|
||||||
w17.PackType = ((global::Gtk.PackType)(1));
|
w18.PackType = ((global::Gtk.PackType)(1));
|
||||||
w17.Position = 5;
|
w18.Position = 5;
|
||||||
w17.Expand = false;
|
w18.Expand = false;
|
||||||
w17.Fill = false;
|
w18.Fill = false;
|
||||||
// Container child hbox1.Gtk.Box+BoxChild
|
// Container child hbox1.Gtk.Box+BoxChild
|
||||||
this.btnExtract = new global::Gtk.Button();
|
this.btnCompress = new global::Gtk.Button();
|
||||||
this.btnExtract.CanFocus = true;
|
this.btnCompress.CanFocus = true;
|
||||||
this.btnExtract.Name = "btnExtract";
|
this.btnCompress.Name = "btnCompress";
|
||||||
this.btnExtract.UseUnderline = true;
|
this.btnCompress.UseUnderline = true;
|
||||||
this.btnExtract.Label = global::Mono.Unix.Catalog.GetString("Extract to");
|
this.btnCompress.Label = global::Mono.Unix.Catalog.GetString("Compress to");
|
||||||
global::Gtk.Image w18 = new global::Gtk.Image();
|
global::Gtk.Image w19 = new global::Gtk.Image();
|
||||||
w18.Pixbuf = global::Stetic.IconLoader.LoadIcon(this, "gtk-directory", global::Gtk.IconSize.Menu);
|
w19.Pixbuf = global::Stetic.IconLoader.LoadIcon(this, "gtk-save", global::Gtk.IconSize.Menu);
|
||||||
this.btnExtract.Image = w18;
|
this.btnCompress.Image = w19;
|
||||||
this.hbox1.Add(this.btnExtract);
|
this.hbox1.Add(this.btnCompress);
|
||||||
global::Gtk.Box.BoxChild w19 = ((global::Gtk.Box.BoxChild)(this.hbox1[this.btnExtract]));
|
global::Gtk.Box.BoxChild w20 = ((global::Gtk.Box.BoxChild)(this.hbox1[this.btnCompress]));
|
||||||
w19.PackType = ((global::Gtk.PackType)(1));
|
w20.PackType = ((global::Gtk.PackType)(1));
|
||||||
w19.Position = 6;
|
w20.Position = 6;
|
||||||
w19.Expand = false;
|
w20.Expand = false;
|
||||||
w19.Fill = false;
|
w20.Fill = false;
|
||||||
// Container child hbox1.Gtk.Box+BoxChild
|
// Container child hbox1.Gtk.Box+BoxChild
|
||||||
this.btnStop = new global::Gtk.Button();
|
this.btnStop = new global::Gtk.Button();
|
||||||
this.btnStop.CanFocus = true;
|
this.btnStop.CanFocus = true;
|
||||||
@@ -238,16 +240,16 @@ namespace osrepodbmgr
|
|||||||
this.btnStop.UseUnderline = true;
|
this.btnStop.UseUnderline = true;
|
||||||
this.btnStop.Label = "gtk-stop";
|
this.btnStop.Label = "gtk-stop";
|
||||||
this.hbox1.Add(this.btnStop);
|
this.hbox1.Add(this.btnStop);
|
||||||
global::Gtk.Box.BoxChild w20 = ((global::Gtk.Box.BoxChild)(this.hbox1[this.btnStop]));
|
global::Gtk.Box.BoxChild w21 = ((global::Gtk.Box.BoxChild)(this.hbox1[this.btnStop]));
|
||||||
w20.PackType = ((global::Gtk.PackType)(1));
|
w21.PackType = ((global::Gtk.PackType)(1));
|
||||||
w20.Position = 7;
|
w21.Position = 7;
|
||||||
w20.Expand = false;
|
|
||||||
w20.Fill = false;
|
|
||||||
this.vbox2.Add(this.hbox1);
|
|
||||||
global::Gtk.Box.BoxChild w21 = ((global::Gtk.Box.BoxChild)(this.vbox2[this.hbox1]));
|
|
||||||
w21.Position = 3;
|
|
||||||
w21.Expand = false;
|
w21.Expand = false;
|
||||||
w21.Fill = false;
|
w21.Fill = false;
|
||||||
|
this.vbox2.Add(this.hbox1);
|
||||||
|
global::Gtk.Box.BoxChild w22 = ((global::Gtk.Box.BoxChild)(this.vbox2[this.hbox1]));
|
||||||
|
w22.Position = 3;
|
||||||
|
w22.Expand = false;
|
||||||
|
w22.Fill = false;
|
||||||
this.Add(this.vbox2);
|
this.Add(this.vbox2);
|
||||||
if((this.Child != null))
|
if((this.Child != null))
|
||||||
{
|
{
|
||||||
@@ -262,14 +264,13 @@ namespace osrepodbmgr
|
|||||||
this.btnSettings.Hide();
|
this.btnSettings.Hide();
|
||||||
this.btnHelp.Hide();
|
this.btnHelp.Hide();
|
||||||
this.btnSave.Hide();
|
this.btnSave.Hide();
|
||||||
this.btnExtract.Hide();
|
|
||||||
this.btnStop.Hide();
|
this.btnStop.Hide();
|
||||||
this.Show();
|
this.Show();
|
||||||
this.DeleteEvent += new global::Gtk.DeleteEventHandler(this.OnDeleteEvent);
|
this.DeleteEvent += new global::Gtk.DeleteEventHandler(this.OnDeleteEvent);
|
||||||
this.btnAdd.Clicked += new global::System.EventHandler(this.OnBtnAddClicked);
|
this.btnAdd.Clicked += new global::System.EventHandler(this.OnBtnAddClicked);
|
||||||
this.btnRemove.Clicked += new global::System.EventHandler(this.OnBtnRemoveClicked);
|
this.btnRemove.Clicked += new global::System.EventHandler(this.OnBtnRemoveClicked);
|
||||||
this.btnStop.Clicked += new global::System.EventHandler(this.OnBtnStopClicked);
|
this.btnStop.Clicked += new global::System.EventHandler(this.OnBtnStopClicked);
|
||||||
this.btnExtract.Clicked += new global::System.EventHandler(this.OnBtnExtractClicked);
|
this.btnCompress.Clicked += new global::System.EventHandler(this.OnBtnCompressClicked);
|
||||||
this.btnSave.Clicked += new global::System.EventHandler(this.OnBtnSaveClicked);
|
this.btnSave.Clicked += new global::System.EventHandler(this.OnBtnSaveClicked);
|
||||||
this.btnHelp.Clicked += new global::System.EventHandler(this.OnBtnHelpClicked);
|
this.btnHelp.Clicked += new global::System.EventHandler(this.OnBtnHelpClicked);
|
||||||
this.btnSettings.Clicked += new global::System.EventHandler(this.OnBtnSettingsClicked);
|
this.btnSettings.Clicked += new global::System.EventHandler(this.OnBtnSettingsClicked);
|
||||||
|
|||||||
Reference in New Issue
Block a user