Initial version.

This commit is contained in:
2017-04-20 06:56:49 +01:00
commit c3ed2192b8
24 changed files with 4862 additions and 0 deletions

40
.gitignore vendored Normal file
View File

@@ -0,0 +1,40 @@
# Autosave files
*~
# build
[Oo]bj/
[Bb]in/
packages/
TestResults/
# globs
Makefile.in
*.DS_Store
*.sln.cache
*.suo
*.cache
*.pidb
*.userprefs
*.usertasks
config.log
config.make
config.status
aclocal.m4
install-sh
autom4te.cache/
*.user
*.tar.gz
tarballs/
test-results/
Thumbs.db
# Mac bundle stuff
*.dmg
*.app
# resharper
*_Resharper.*
*.Resharper
# dotCover
*.dotCover

50
osrepodbmgr.sln Normal file
View File

@@ -0,0 +1,50 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osrepodbmgr", "osrepodbmgr\osrepodbmgr.csproj", "{19FB7436-031F-42B3-87F6-8508F63EDADA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{19FB7436-031F-42B3-87F6-8508F63EDADA}.Debug|x86.ActiveCfg = Debug|x86
{19FB7436-031F-42B3-87F6-8508F63EDADA}.Debug|x86.Build.0 = Debug|x86
{19FB7436-031F-42B3-87F6-8508F63EDADA}.Release|x86.ActiveCfg = Release|x86
{19FB7436-031F-42B3-87F6-8508F63EDADA}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
Policies = $0
$0.TextStylePolicy = $1
$1.FileWidth = 120
$1.inheritsSet = VisualStudio
$1.inheritsScope = text/plain
$1.scope = text/x-csharp
$0.CSharpFormattingPolicy = $2
$2.IndentSwitchSection = True
$2.NewLinesForBracesInProperties = True
$2.NewLinesForBracesInAccessors = True
$2.NewLinesForBracesInAnonymousMethods = True
$2.NewLinesForBracesInControlBlocks = True
$2.NewLinesForBracesInAnonymousTypes = True
$2.NewLinesForBracesInObjectCollectionArrayInitializers = True
$2.NewLinesForBracesInLambdaExpressionBody = True
$2.NewLineForElse = True
$2.NewLineForCatch = True
$2.NewLineForFinally = True
$2.inheritsSet = Mono
$2.inheritsScope = text/x-csharp
$2.scope = text/x-csharp
$2.SpacingAfterMethodDeclarationName = False
$2.SpaceAfterMethodCallName = False
$2.SpaceAfterControlFlowStatementKeyword = False
$2.SpaceBeforeOpenSquareBracket = False
$0.ChangeLogPolicy = $3
$3.UpdateMode = ProjectRoot
$3.MessageStyle = $4
$4.LastFilePostfix = "@:\n "
$4.IncludeDirectoryPaths = True
$3.inheritsSet = Mono
EndGlobalSection
EndGlobal

25
osrepodbmgr/ChangeLog Normal file
View File

@@ -0,0 +1,25 @@
2017-04-20 Natalia Portillo <claunia@claunia.com>
* Core.cs:
* Schema.cs:
* SQLite.cs:
* DBCore.cs:
* frmHelp.cs:
* Program.cs:
* DetectOS.cs:
* Settings.cs:
* DBEntries.cs:
* PlatformID.cs:
* MainWindow.cs:
* frmSettings.cs:
* packages.config:
* SHA256Context.cs:
* osrepodbmgr.csproj:
* gtk-gui/gui.stetic:
* gtk-gui/generated.cs:
* gtk-gui/MainWindow.cs:
* Properties/AssemblyInfo.cs:
* gtk-gui/osrepodbmgr.frmHelp.cs:
* gtk-gui/osrepodbmgr.frmSettings.cs:
Initial version.

274
osrepodbmgr/Core.cs Normal file
View File

@@ -0,0 +1,274 @@
//
// 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;
using System.Collections.Generic;
using System.IO;
using System.Text;
namespace osrepodbmgr
{
public static class Core
{
// Sets a 128Kbyte buffer
const long bufferSize = 131072;
public delegate void UpdateProgressDelegate(string text, string inner, long current, long maximum);
public delegate void UpdateProgress2Delegate(string text, string inner, long current, long maximum);
public delegate void FailedDelegate(string text);
public delegate void FinishedWithoutErrorDelegate();
public delegate void AddEntryDelegate(string filename, string hash, bool known);
public static event UpdateProgressDelegate UpdateProgress;
public static event UpdateProgress2Delegate UpdateProgress2;
public static event FailedDelegate Failed;
public static event FinishedWithoutErrorDelegate Finished;
public static event AddEntryDelegate AddEntry;
static DBCore dbCore;
public static void FindFiles()
{
if(string.IsNullOrEmpty(MainClass.path))
{
if(Failed != null)
Failed("Path is null or empty");
}
if(!Directory.Exists(MainClass.path))
{
if(Failed != null)
Failed("Directory not found");
}
try
{
MainClass.files = new List<string>(Directory.EnumerateFiles(MainClass.path, "*", SearchOption.AllDirectories));
MainClass.files.Sort();
if(Finished != null)
Finished();
}
catch(Exception ex)
{
if(System.Diagnostics.Debugger.IsAttached)
throw;
if(Failed != null)
Failed(string.Format("Exception {0}\n{1}", ex.Message, ex.InnerException));
}
}
public static void HashFiles()
{
try
{
MainClass.hashes = new Dictionary<string, string>();
long counter = 1;
foreach(string file in MainClass.files)
{
string relpath = file.Substring(MainClass.path.Length + 1);
if(UpdateProgress != null)
UpdateProgress(string.Format("Hashing file {0} of {1}", counter, MainClass.files.Count), null, counter, MainClass.files.Count);
FileStream fileStream = new FileStream(file, FileMode.Open, FileAccess.Read);
byte[] dataBuffer = new byte[bufferSize];
SHA256Context sha256Context = new SHA256Context();
sha256Context.Init();
if(fileStream.Length > bufferSize)
{
long offset;
long remainder = fileStream.Length % bufferSize;
for(offset = 0; offset < (fileStream.Length - remainder); offset += (int)bufferSize)
{
if(UpdateProgress2 != null)
UpdateProgress2(string.Format("{0:P}", offset / (double)fileStream.Length), relpath, offset, fileStream.Length);
dataBuffer = new byte[bufferSize];
fileStream.Read(dataBuffer, 0, (int)bufferSize);
sha256Context.Update(dataBuffer);
}
if(UpdateProgress2 != null)
UpdateProgress2(string.Format("{0:P}", offset / (double)fileStream.Length), relpath, offset, fileStream.Length);
dataBuffer = new byte[remainder];
fileStream.Read(dataBuffer, 0, (int)remainder);
sha256Context.Update(dataBuffer);
}
else {
if(UpdateProgress2 != null)
UpdateProgress2(string.Format("{0:P}", 0 / (double)fileStream.Length), relpath, 0, fileStream.Length);
dataBuffer = new byte[fileStream.Length];
fileStream.Read(dataBuffer, 0, (int)fileStream.Length);
sha256Context.Update(dataBuffer);
}
fileStream.Close();
string hash = stringify(sha256Context.Final());
MainClass.hashes.Add(relpath, hash);
counter++;
}
if(Finished != null)
Finished();
}
catch(Exception ex)
{
if(System.Diagnostics.Debugger.IsAttached)
throw;
if(Failed != null)
Failed(string.Format("Exception {0}\n{1}", ex.Message, ex.InnerException));
}
}
public static void CheckDbForFiles()
{
try
{
long counter = 0;
foreach(KeyValuePair<string, string> kvp in MainClass.hashes)
{
if(UpdateProgress != null)
UpdateProgress(null, "Checking files in database", counter, MainClass.hashes.Count);
if(AddEntry != null)
AddEntry(kvp.Key, kvp.Value, dbCore.DBEntries.ExistsFile(kvp.Value));
counter++;
}
if(Finished != null)
Finished();
}
catch(Exception ex)
{
if(System.Diagnostics.Debugger.IsAttached)
throw;
if(Failed != null)
Failed(string.Format("Exception {0}\n{1}", ex.Message, ex.InnerException));
}
}
public static void AddFilesToDb()
{
try
{
long counter = 0;
foreach(KeyValuePair<string, string> kvp in MainClass.hashes)
{
if(UpdateProgress != null)
UpdateProgress(null, "Adding files to database", counter, MainClass.hashes.Count);
if(!dbCore.DBEntries.ExistsFile(kvp.Value))
dbCore.DBEntries.AddFile(kvp.Value);
counter++;
}
if(UpdateProgress != null)
UpdateProgress(null, "Adding OS information", counter, MainClass.hashes.Count);
dbCore.DBEntries.AddOS(MainClass.dbInfo);
if(Finished != null)
Finished();
}
catch(Exception ex)
{
if(System.Diagnostics.Debugger.IsAttached)
throw;
if(Failed != null)
Failed(string.Format("Exception {0}\n{1}", ex.Message, ex.InnerException));
}
}
static string stringify(byte[] hash)
{
StringBuilder hashOutput = new StringBuilder();
for(int i = 0; i < hash.Length; i++)
{
hashOutput.Append(hash[i].ToString("x2"));
}
return hashOutput.ToString();
}
public static void InitDB()
{
CloseDB();
dbCore = null;
try
{
if(string.IsNullOrEmpty(Settings.Current.DatabasePath))
{
if(Failed != null)
Failed("No database file specified");
return;
}
dbCore = new SQLite();
if(File.Exists(Settings.Current.DatabasePath))
{
if(!dbCore.OpenDB(Settings.Current.DatabasePath, null, null, null))
{
if(Failed != null)
Failed("Could not open database, correct file selected?");
dbCore = null;
return;
}
}
else {
if(!dbCore.CreateDB(Settings.Current.DatabasePath, null, null, null))
{
if(Failed != null)
Failed("Could not create database, correct file selected?");
dbCore = null;
return;
}
if(!dbCore.OpenDB(Settings.Current.DatabasePath, null, null, null))
{
if(Failed != null)
Failed("Could not open database, correct file selected?");
dbCore = null;
return;
}
}
if(Finished != null)
Finished();
}
catch(Exception ex)
{
if(System.Diagnostics.Debugger.IsAttached)
throw;
if(Failed != null)
Failed(string.Format("Exception {0}\n{1}", ex.Message, ex.InnerException));
}
}
public static void CloseDB()
{
if(dbCore != null)
dbCore.CloseDB();
}
}
}

44
osrepodbmgr/DBCore.cs Normal file
View File

@@ -0,0 +1,44 @@
//
// 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.Data;
namespace osrepodbmgr
{
public abstract class DBCore
{
public abstract bool OpenDB(string database, string server, string user, string password);
public abstract void CloseDB();
public abstract bool CreateDB(string database, string server, string user, string password);
public DBEntries DBEntries;
public abstract IDbDataAdapter GetNewDataAdapter();
}
}

252
osrepodbmgr/DBEntries.cs Normal file
View File

@@ -0,0 +1,252 @@
//
// 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;
using System.Collections.Generic;
using System.Data;
namespace osrepodbmgr
{
public struct DBEntry
{
public string developer;
public string product;
public string version;
public string languages;
public string architecture;
public string machine;
public string format;
public string description;
public bool oem;
public bool upgrade;
public bool update;
public bool source;
public bool files;
public bool netinstall;
}
public class DBEntries
{
readonly IDbConnection dbCon;
readonly DBCore dbCore;
public DBEntries(IDbConnection connection, DBCore core)
{
dbCon = connection;
dbCore = core;
}
public bool GetAllOSes(out List<DBEntry> entries)
{
entries = new List<DBEntry>();
const string sql = "SELECT * from oses";
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)
{
DBEntry fEntry = new DBEntry();
fEntry.developer = dRow["name"].ToString();
fEntry.product = dRow["founded"].ToString();
fEntry.version = dRow["website"].ToString();
fEntry.languages = dRow["twitter"].ToString();
fEntry.architecture = dRow["facebook"].ToString();
fEntry.machine = dRow["sold"].ToString();
fEntry.format = dRow["sold_to"].ToString();
fEntry.description = dRow["address"].ToString();
fEntry.oem = bool.Parse(dRow["city"].ToString());
fEntry.upgrade = bool.Parse(dRow["province"].ToString());
fEntry.update = bool.Parse(dRow["postal_code"].ToString());
fEntry.source = bool.Parse(dRow["country"].ToString());
fEntry.files = bool.Parse(dRow["city"].ToString());
fEntry.netinstall = bool.Parse(dRow["city"].ToString());
entries.Add(fEntry);
}
return true;
}
IDbCommand GetOSCommand(DBEntry entry)
{
IDbCommand dbcmd = dbCon.CreateCommand();
IDbDataParameter param1 = dbcmd.CreateParameter();
IDbDataParameter param2 = dbcmd.CreateParameter();
IDbDataParameter param3 = dbcmd.CreateParameter();
IDbDataParameter param4 = dbcmd.CreateParameter();
IDbDataParameter param5 = dbcmd.CreateParameter();
IDbDataParameter param6 = dbcmd.CreateParameter();
IDbDataParameter param7 = dbcmd.CreateParameter();
IDbDataParameter param8 = dbcmd.CreateParameter();
IDbDataParameter param9 = dbcmd.CreateParameter();
IDbDataParameter param10 = dbcmd.CreateParameter();
IDbDataParameter param11 = dbcmd.CreateParameter();
IDbDataParameter param12 = dbcmd.CreateParameter();
IDbDataParameter param13 = dbcmd.CreateParameter();
IDbDataParameter param14 = dbcmd.CreateParameter();
param1.ParameterName = "@developer";
param2.ParameterName = "@product";
param3.ParameterName = "@version";
param4.ParameterName = "@languages";
param5.ParameterName = "@architecture";
param6.ParameterName = "@machine";
param7.ParameterName = "@format";
param8.ParameterName = "@description";
param9.ParameterName = "@oem";
param10.ParameterName = "@upgrade";
param11.ParameterName = "@update";
param12.ParameterName = "@source";
param13.ParameterName = "@files";
param14.ParameterName = "@netinstall";
param1.DbType = DbType.String;
param2.DbType = DbType.String;
param3.DbType = DbType.String;
param4.DbType = DbType.String;
param5.DbType = DbType.String;
param7.DbType = DbType.String;
param8.DbType = DbType.String;
param9.DbType = DbType.Boolean;
param10.DbType = DbType.Boolean;
param11.DbType = DbType.Boolean;
param12.DbType = DbType.Boolean;
param13.DbType = DbType.Boolean;
param14.DbType = DbType.Boolean;
param1.Value = entry.developer;
param2.Value = entry.product;
param3.Value = entry.version;
param4.Value = entry.languages;
param5.Value = entry.architecture;
param6.Value = entry.machine;
param7.Value = entry.format;
param8.Value = entry.description;
param9.Value = entry.oem;
param10.Value = entry.upgrade;
param11.Value = entry.update;
param12.Value = entry.source;
param13.Value = entry.files;
param14.Value = entry.netinstall;
dbcmd.Parameters.Add(param1);
dbcmd.Parameters.Add(param2);
dbcmd.Parameters.Add(param3);
dbcmd.Parameters.Add(param4);
dbcmd.Parameters.Add(param5);
dbcmd.Parameters.Add(param6);
dbcmd.Parameters.Add(param7);
dbcmd.Parameters.Add(param8);
dbcmd.Parameters.Add(param9);
dbcmd.Parameters.Add(param10);
dbcmd.Parameters.Add(param11);
dbcmd.Parameters.Add(param12);
dbcmd.Parameters.Add(param13);
dbcmd.Parameters.Add(param14);
return dbcmd;
}
public bool AddOS(DBEntry entry)
{
IDbCommand dbcmd = GetOSCommand(entry);
IDbTransaction trans = dbCon.BeginTransaction();
dbcmd.Transaction = trans;
const string sql = "INSERT INTO oses (developer, product, version, languages, architecture, machine, format, description, oem, upgrade, `update`, source, files, netinstall)" +
" VALUES (@developer, @product, @version, @languages, @architecture, @machine, @format, @description, @oem, @upgrade, @update, @source, @files, @netinstall)";
dbcmd.CommandText = sql;
dbcmd.ExecuteNonQuery();
trans.Commit();
dbcmd.Dispose();
return true;
}
public bool AddFile(string hash)
{
Console.WriteLine("Adding {0}", hash);
IDbCommand dbcmd = dbCon.CreateCommand();
IDbDataParameter param1 = dbcmd.CreateParameter();
param1.ParameterName = "@hash";
param1.DbType = DbType.String;
param1.Value = hash;
dbcmd.Parameters.Add(param1);
IDbTransaction trans = dbCon.BeginTransaction();
dbcmd.Transaction = trans;
const string sql = "INSERT INTO files (sha256) VALUES (@hash)";
dbcmd.CommandText = sql;
dbcmd.ExecuteNonQuery();
trans.Commit();
dbcmd.Dispose();
return true;
}
public bool ExistsFile(string hash)
{
IDbCommand dbcmd = dbCon.CreateCommand();
IDbDataParameter param1 = dbcmd.CreateParameter();
param1.ParameterName = "@hash";
param1.DbType = DbType.String;
param1.Value = hash;
dbcmd.Parameters.Add(param1);
dbcmd.CommandText = "SELECT * FROM files WHERE sha256 = @hash";
DataSet dataSet = new DataSet();
IDbDataAdapter dataAdapter = dbCore.GetNewDataAdapter();
dataAdapter.SelectCommand = dbcmd;
dataAdapter.Fill(dataSet);
DataTable dataTable = dataSet.Tables[0];
foreach(DataRow dRow in dataTable.Rows)
{
return true;
}
return false;
}
}
}

217
osrepodbmgr/DetectOS.cs Normal file
View File

@@ -0,0 +1,217 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : DetectOS.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Interop services.
//
// --[ Description ] ----------------------------------------------------------
//
// Detects underlying operating system.
//
// --[ License ] --------------------------------------------------------------
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2016 Natalia Portillo
// ****************************************************************************/
using System;
using System.Runtime.InteropServices;
namespace DiscImageChef.Interop
{
public static class DetectOS
{
/// <summary>
/// POSIX uname structure, size from OSX, big enough to handle extra fields
/// </summary>
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
struct utsname
{
/// <summary>
/// System name
/// </summary>
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
public string sysname;
/// <summary>
/// Node name
/// </summary>
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
public string nodename;
/// <summary>
/// Release level
/// </summary>
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
public string release;
/// <summary>
/// Version level
/// </summary>
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
public string version;
/// <summary>
/// Hardware level
/// </summary>
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
public string machine;
}
[DllImport("libc", SetLastError = true)]
static extern int uname(out utsname name);
[DllImport("libc", SetLastError = true, EntryPoint = "sysctlbyname", CharSet = CharSet.Ansi)]
static extern int OSX_sysctlbyname(string name, IntPtr oldp, IntPtr oldlenp, IntPtr newp, uint newlen);
public static PlatformID GetRealPlatformID()
{
if((int)Environment.OSVersion.Platform < 4 ||
(int)Environment.OSVersion.Platform == 5)
{
return (PlatformID)((int)Environment.OSVersion.Platform);
}
utsname unixname;
int error = uname(out unixname);
if(error != 0)
throw new Exception(string.Format("Unhandled exception calling uname: {0}", Marshal.GetLastWin32Error()));
switch(unixname.sysname)
{
// TODO: Differentiate Linux, Android, Tizen
case "Linux":
{
#if __ANDROID__
return PlatformID.Android;
#else
return PlatformID.Linux;
#endif
}
case "Darwin":
{
int osx_error;
IntPtr pLen = Marshal.AllocHGlobal(sizeof(int));
osx_error = OSX_sysctlbyname("hw.machine", IntPtr.Zero, pLen, IntPtr.Zero, 0);
if(osx_error != 0)
{
Marshal.FreeHGlobal(pLen);
throw new Exception(string.Format("Unhandled exception calling uname: {0}", Marshal.GetLastWin32Error()));
}
int length = Marshal.ReadInt32(pLen);
IntPtr pStr = Marshal.AllocHGlobal(length);
osx_error = OSX_sysctlbyname("hw.machine", pStr, pLen, IntPtr.Zero, 0);
if(osx_error != 0)
{
Marshal.FreeHGlobal(pStr);
Marshal.FreeHGlobal(pLen);
throw new Exception(string.Format("Unhandled exception calling uname: {0}", Marshal.GetLastWin32Error()));
}
string machine = Marshal.PtrToStringAnsi(pStr);
Marshal.FreeHGlobal(pStr);
Marshal.FreeHGlobal(pLen);
if(machine.StartsWith("iPad", StringComparison.Ordinal) ||
machine.StartsWith("iPod", StringComparison.Ordinal) ||
machine.StartsWith("iPhone", StringComparison.Ordinal))
return PlatformID.iOS;
return PlatformID.MacOSX;
}
case "GNU":
return PlatformID.Hurd;
case "FreeBSD":
case "GNU/kFreeBSD":
return PlatformID.FreeBSD;
case "DragonFly":
return PlatformID.DragonFly;
case "Haiku":
return PlatformID.Haiku;
case "HP-UX":
return PlatformID.HPUX;
case "AIX":
return PlatformID.AIX;
case "OS400":
return PlatformID.OS400;
case "IRIX":
case "IRIX64":
return PlatformID.IRIX;
case "Minix":
return PlatformID.Minix;
case "NetBSD":
return PlatformID.NetBSD;
case "NONSTOP_KERNEL":
return PlatformID.NonStop;
case "OpenBSD":
return PlatformID.OpenBSD;
case "QNX":
return PlatformID.QNX;
case "SINIX-Y":
return PlatformID.SINIX;
case "SunOS":
return PlatformID.Solaris;
case "OSF1":
return PlatformID.Tru64;
case "ULTRIX":
return PlatformID.Ultrix;
case "SCO_SV":
return PlatformID.OpenServer;
case "UnixWare":
return PlatformID.UnixWare;
case "Interix":
case "UWIN-W7":
return PlatformID.Win32NT;
default:
{
if(unixname.sysname.StartsWith("CYGWIN_NT", StringComparison.Ordinal) ||
unixname.sysname.StartsWith("MINGW32_NT", StringComparison.Ordinal) ||
unixname.sysname.StartsWith("MSYS_NT", StringComparison.Ordinal) ||
unixname.sysname.StartsWith("UWIN", StringComparison.Ordinal))
return PlatformID.Win32NT;
return PlatformID.Unknown;
}
}
}
/// <summary>
/// Checks if the underlying runtime runs in 64-bit mode
/// </summary>
public static bool Is64Bit()
{
return IntPtr.Size == 8;
}
/// <summary>
/// Checks if the underlying runtime runs in 32-bit mode
/// </summary>
public static bool Is32Bit()
{
return IntPtr.Size == 4;
}
}
}

532
osrepodbmgr/MainWindow.cs Normal file
View File

@@ -0,0 +1,532 @@
//
// 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;
using System.Threading;
using Gtk;
using osrepodbmgr;
using System.Collections.Generic;
public partial class MainWindow : Window
{
Thread thdPulseProgress;
Thread thdFindFiles;
Thread thdHashFiles;
Thread thdCheckFiles;
Thread thdAddFiles;
bool stopped;
ListStore view;
public MainWindow() : base(WindowType.Toplevel)
{
Build();
Core.InitDB();
}
protected void OnDeleteEvent(object sender, DeleteEventArgs a)
{
if(btnStop.Visible)
OnBtnStopClicked(sender, a);
if(btnClose.Sensitive)
OnBtnCloseClicked(sender, a);
Application.Quit();
a.RetVal = true;
}
protected void OnBtnHelpClicked(object sender, EventArgs e)
{
frmHelp _help = new frmHelp();
_help.Show();
}
protected void OnBtnFolderClicked(object sender, EventArgs e)
{
FileChooserDialog dlgFolder = new FileChooserDialog("Open folder", this, FileChooserAction.SelectFolder,
"Cancel", ResponseType.Cancel, "Choose", ResponseType.Accept);
dlgFolder.SelectMultiple = false;
if(dlgFolder.Run() == (int)ResponseType.Accept)
{
stopped = false;
lblProgress.Text = "Finding files";
lblProgress.Visible = true;
prgProgress.Visible = true;
btnExit.Sensitive = false;
btnFolder.Visible = false;
btnArchive.Visible = false;
btnSettings.Sensitive = false;
thdPulseProgress = new Thread(() =>
{
Application.Invoke(delegate
{
prgProgress.Pulse();
});
Thread.Sleep(10);
});
thdFindFiles = new Thread(Core.FindFiles);
MainClass.path = dlgFolder.Filename;
Core.Failed += FindFilesFailed;
Core.Finished += FindFilesFinished;
btnStop.Visible = true;
thdPulseProgress.Start();
thdFindFiles.Start();
}
dlgFolder.Destroy();
}
void FindFilesFailed(string text)
{
Application.Invoke(delegate
{
if(!stopped)
{
MessageDialog dlgMsg = new MessageDialog(this, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, text);
dlgMsg.Run();
dlgMsg.Destroy();
}
if(thdPulseProgress != null)
thdPulseProgress.Abort();
lblProgress.Visible = false;
prgProgress.Visible = false;
btnExit.Sensitive = true;
btnFolder.Visible = true;
btnArchive.Visible = true;
btnSettings.Sensitive = true;
Core.Failed -= FindFilesFailed;
Core.Finished -= FindFilesFinished;
thdFindFiles = null;
});
}
void FindFilesFinished()
{
Application.Invoke(delegate
{
if(thdPulseProgress != null)
thdPulseProgress.Abort();
Core.Failed -= FindFilesFailed;
Core.Finished -= FindFilesFinished;
lblProgress.Visible = true;
prgProgress.Visible = true;
lblProgress2.Visible = true;
prgProgress2.Visible = true;
thdFindFiles = null;
thdHashFiles = new Thread(Core.HashFiles);
Core.Failed += HashFilesFailed;
Core.Finished += HashFilesFinished;
Core.UpdateProgress += UpdateProgress;
Core.UpdateProgress2 += UpdateProgress2;
thdHashFiles.Start();
});
}
void HashFilesFailed(string text)
{
Application.Invoke(delegate
{
if(!stopped)
{
MessageDialog dlgMsg = new MessageDialog(this, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, text);
dlgMsg.Run();
dlgMsg.Destroy();
}
lblProgress.Visible = false;
prgProgress.Visible = false;
lblProgress2.Visible = false;
prgProgress2.Visible = false;
Core.Failed -= HashFilesFailed;
Core.Finished -= HashFilesFinished;
Core.UpdateProgress -= UpdateProgress;
Core.UpdateProgress2 -= UpdateProgress2;
btnExit.Sensitive = true;
btnFolder.Visible = true;
btnArchive.Visible = true;
btnSettings.Sensitive = true;
thdHashFiles = null;
});
}
void HashFilesFinished()
{
Application.Invoke(delegate
{
lblProgress.Visible = false;
prgProgress.Visible = false;
lblProgress.Visible = false;
prgProgress.Visible = false;
lblProgress2.Visible = false;
prgProgress2.Visible = false;
Core.Failed -= HashFilesFailed;
Core.Finished -= HashFilesFinished;
Core.UpdateProgress -= UpdateProgress;
Core.UpdateProgress2 -= UpdateProgress2;
thdHashFiles = null;
prgProgress.Visible = true;
CellRendererText filenameCell = new CellRendererText();
CellRendererText hashCell = new CellRendererText();
CellRendererToggle dbCell = new CellRendererToggle();
TreeViewColumn filenameColumn = new TreeViewColumn("Path", filenameCell, "text", 0, "background", 3, "foreground", 4);
TreeViewColumn hashColumn = new TreeViewColumn("SHA256", hashCell, "text", 1, "background", 3, "foreground", 4);
TreeViewColumn dbColumn = new TreeViewColumn("Known?", dbCell, "active", 2);
view = new ListStore(typeof(string), typeof(string), typeof(bool), typeof(string), typeof(string));
treeFiles.Model = view;
treeFiles.AppendColumn(filenameColumn);
treeFiles.AppendColumn(hashColumn);
treeFiles.AppendColumn(dbColumn);
thdCheckFiles = new Thread(Core.CheckDbForFiles);
Core.Failed += ChkFilesFailed;
Core.Finished += ChkFilesFinished;
Core.UpdateProgress += UpdateProgress;
Core.AddEntry += AddFile;
btnAdd.Sensitive = false;
thdCheckFiles.Start();
});
}
void ChkFilesFailed(string text)
{
Application.Invoke(delegate
{
if(!stopped)
{
MessageDialog dlgMsg = new MessageDialog(this, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, text);
dlgMsg.Run();
dlgMsg.Destroy();
}
if(thdCheckFiles != null)
thdCheckFiles.Abort();
prgProgress.Visible = false;
btnStop.Visible = false;
btnClose.Visible = true;
btnExit.Sensitive = true;
Core.Failed -= ChkFilesFailed;
Core.Finished -= ChkFilesFinished;
Core.UpdateProgress -= UpdateProgress;
Core.AddEntry -= AddFile;
thdHashFiles = null;
if(view != null)
{
view.Clear();
treeFiles.Model = null;
view = null;
}
});
}
void ChkFilesFinished()
{
Application.Invoke(delegate
{
if(thdCheckFiles != null)
thdCheckFiles.Abort();
Core.Failed -= ChkFilesFailed;
Core.Finished -= ChkFilesFinished;
Core.UpdateProgress -= UpdateProgress;
Core.AddEntry -= AddFile;
thdHashFiles = null;
prgProgress.Visible = false;
btnStop.Visible = false;
btnClose.Visible = true;
btnExit.Sensitive = true;
btnSettings.Sensitive = true;
btnAdd.Visible = true;
btnPack.Visible = true;
txtFormat.IsEditable = true;
txtMachine.IsEditable = true;
txtProduct.IsEditable = true;
txtVersion.IsEditable = true;
txtLanguages.IsEditable = true;
txtDeveloper.IsEditable = true;
txtDescription.IsEditable = true;
txtArchitecture.IsEditable = true;
chkOem.Sensitive = true;
chkFiles.Sensitive = true;
chkUpdate.Sensitive = true;
chkUpgrade.Sensitive = true;
chkNetinstall.Sensitive = true;
chkSource.Sensitive = true;
});
}
void AddFile(string filename, string hash, bool known)
{
Application.Invoke(delegate
{
string color = known ? "green" : "red";
view.AppendValues(filename, hash, known, color, "black");
btnAdd.Sensitive |= !known;
});
}
protected void OnBtnExitClicked(object sender, EventArgs e)
{
if(btnClose.Sensitive)
OnBtnCloseClicked(sender, e);
Application.Quit();
}
protected void OnBtnCloseClicked(object sender, EventArgs e)
{
btnFolder.Visible = true;
btnArchive.Visible = true;
MainClass.path = "";
MainClass.files = null;
MainClass.hashes = null;
btnStop.Visible = false;
btnAdd.Visible = false;
btnPack.Visible = false;
btnClose.Visible = false;
if(view != null)
{
view.Clear();
treeFiles.Model = null;
view = null;
}
txtFormat.IsEditable = false;
txtMachine.IsEditable = false;
txtProduct.IsEditable = false;
txtVersion.IsEditable = false;
txtLanguages.IsEditable = false;
txtDeveloper.IsEditable = false;
txtDescription.IsEditable = false;
txtArchitecture.IsEditable = false;
chkOem.Sensitive = false;
chkFiles.Sensitive = false;
chkUpdate.Sensitive = false;
chkUpgrade.Sensitive = false;
chkNetinstall.Sensitive = false;
chkSource.Sensitive = false;
txtFormat.Text = "";
txtMachine.Text = "";
txtProduct.Text = "";
txtVersion.Text = "";
txtLanguages.Text = "";
txtDeveloper.Text = "";
txtDescription.Text = "";
txtArchitecture.Text = "";
chkOem.Active = false;
chkFiles.Active = false;
chkUpdate.Active = false;
chkUpgrade.Active = false;
chkNetinstall.Active = false;
chkSource.Active = false;
}
public void UpdateProgress(string text, string inner, long current, long maximum)
{
Application.Invoke(delegate
{
lblProgress.Text = text;
prgProgress.Text = inner;
if(maximum > 0)
prgProgress.Fraction = current / (double)maximum;
else
prgProgress.Pulse();
});
}
public void UpdateProgress2(string text, string inner, long current, long maximum)
{
Application.Invoke(delegate
{
lblProgress2.Text = text;
prgProgress2.Text = inner;
if(maximum > 0)
prgProgress2.Fraction = current / (double)maximum;
else
prgProgress2.Pulse();
});
}
protected void OnBtnStopClicked(object sender, EventArgs e)
{
stopped = true;
if(thdPulseProgress != null)
{
thdPulseProgress.Abort();
thdPulseProgress = null;
}
if(thdFindFiles != null)
{
thdFindFiles.Abort();
thdFindFiles = null;
}
if(thdHashFiles != null)
{
thdHashFiles.Abort();
thdHashFiles = null;
}
if(thdCheckFiles != null)
{
thdCheckFiles.Abort();
thdCheckFiles = null;
}
lblProgress.Visible = false;
prgProgress.Visible = false;
lblProgress2.Visible = false;
prgProgress2.Visible = false;
Core.Failed -= HashFilesFailed;
Core.Finished -= HashFilesFinished;
Core.UpdateProgress -= UpdateProgress;
Core.UpdateProgress2 -= UpdateProgress2;
btnExit.Sensitive = true;
btnFolder.Visible = true;
btnArchive.Visible = true;
btnSettings.Sensitive = true;
lblProgress.Visible = false;
prgProgress.Visible = false;
btnExit.Sensitive = true;
btnFolder.Visible = true;
btnArchive.Visible = true;
btnSettings.Sensitive = true;
Core.Failed -= FindFilesFailed;
Core.Finished -= FindFilesFinished;
btnStop.Visible = false;
if(view != null)
{
view.Clear();
treeFiles.Model = null;
view = null;
}
}
protected void OnBtnAddClicked(object sender, EventArgs e)
{
btnAdd.Sensitive = false;
btnPack.Sensitive = false;
btnClose.Sensitive = false;
prgProgress.Visible = true;
txtFormat.IsEditable = false;
txtMachine.IsEditable = false;
txtProduct.IsEditable = false;
txtVersion.IsEditable = false;
txtLanguages.IsEditable = false;
txtDeveloper.IsEditable = false;
txtDescription.IsEditable = false;
txtArchitecture.IsEditable = false;
chkOem.Sensitive = false;
chkFiles.Sensitive = false;
chkUpdate.Sensitive = false;
chkUpgrade.Sensitive = false;
chkNetinstall.Sensitive = false;
chkSource.Sensitive = false;
Core.UpdateProgress += UpdateProgress;
Core.Finished += AddFilesToDbFinished;
Core.Failed += AddFilesToDbFailed;
MainClass.dbInfo.architecture = txtArchitecture.Text;
MainClass.dbInfo.description = txtDescription.Text;
MainClass.dbInfo.developer = txtDeveloper.Text;
MainClass.dbInfo.format = txtFormat.Text;
MainClass.dbInfo.languages = txtLanguages.Text;
MainClass.dbInfo.machine = txtMachine.Text;
MainClass.dbInfo.product = txtProduct.Text;
MainClass.dbInfo.version = txtVersion.Text;
MainClass.dbInfo.files = chkFiles.Active;
MainClass.dbInfo.netinstall = chkNetinstall.Active;
MainClass.dbInfo.oem = chkOem.Active;
MainClass.dbInfo.source = chkSource.Active;
MainClass.dbInfo.update = chkUpdate.Active;
MainClass.dbInfo.upgrade = chkUpgrade.Active;
thdHashFiles = new Thread(Core.AddFilesToDb);
thdHashFiles.Start();
}
public void AddFilesToDbFinished()
{
Application.Invoke(delegate
{
if(thdAddFiles != null)
thdAddFiles.Abort();
Core.UpdateProgress -= UpdateProgress;
Core.Finished -= AddFilesToDbFinished;
Core.Failed -= AddFilesToDbFailed;
long counter = 0;
view.Clear();
foreach(KeyValuePair<string, string> kvp in MainClass.hashes)
{
UpdateProgress(null, "Updating table", counter, MainClass.hashes.Count);
view.AppendValues(kvp.Key, kvp.Value, true, "green", "black");
counter++;
}
prgProgress.Visible = false;
btnPack.Sensitive = true;
btnClose.Sensitive = true;
});
}
public void AddFilesToDbFailed(string text)
{
Application.Invoke(delegate
{
if(!stopped)
{
MessageDialog dlgMsg = new MessageDialog(this, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, text);
dlgMsg.Run();
dlgMsg.Destroy();
}
if(thdAddFiles != null)
thdAddFiles.Abort();
Core.UpdateProgress -= UpdateProgress;
Core.Finished -= AddFilesToDbFinished;
Core.Failed -= AddFilesToDbFailed;
ChkFilesFinished();
});
}
protected void OnBtnSettingsClicked(object sender, EventArgs e)
{
frmSettings _frmSettings = new frmSettings();
_frmSettings.Show();
}
}

189
osrepodbmgr/PlatformID.cs Normal file
View File

@@ -0,0 +1,189 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : PlatformID.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Interop services.
//
// --[ Description ] ----------------------------------------------------------
//
// Contains an enhanced PlatformID enumeration.
//
// --[ License ] --------------------------------------------------------------
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2016 Natalia Portillo
// ****************************************************************************/
namespace DiscImageChef.Interop
{
public enum PlatformID
{
/// <summary>
/// Win32s
/// </summary>
Win32S = 0,
/// <summary>
/// Win32 (Windows 9x)
/// </summary>
Win32Windows = 1,
/// <summary>
/// Windows NT
/// </summary>
Win32NT = 2,
/// <summary>
/// Windows Mobile
/// </summary>
WinCE = 3,
/// <summary>
/// UNIX (do not use, too generic)
/// </summary>
Unix = 4,
/// <summary>
/// Xbox 360
/// </summary>
Xbox = 5,
/// <summary>
/// OS X
/// </summary>
MacOSX = 6,
/// <summary>
/// iOS is not OS X
/// </summary>
iOS = 7,
/// <summary>
/// Linux
/// </summary>
Linux = 8,
/// <summary>
/// Sun Solaris
/// </summary>
Solaris = 9,
/// <summary>
/// NetBSD
/// </summary>
NetBSD = 10,
/// <summary>
/// OpenBSD
/// </summary>
OpenBSD = 11,
/// <summary>
/// FreeBSD
/// </summary>
FreeBSD = 12,
/// <summary>
/// DragonFly BSD
/// </summary>
DragonFly = 13,
/// <summary>
/// Nintendo Wii
/// </summary>
Wii = 14,
/// <summary>
/// Nintendo Wii U
/// </summary>
WiiU = 15,
/// <summary>
/// Sony PlayStation 3
/// </summary>
PlayStation3 = 16,
/// <summary>
/// Sony Playstation 4
/// </summary>
PlayStation4 = 17,
/// <summary>
/// Google Android
/// </summary>
Android = 18,
/// <summary>
/// Samsung Tizen
/// </summary>
Tizen = 19,
/// <summary>
/// Windows Phone
/// </summary>
WindowsPhone = 20,
/// <summary>
/// GNU/Hurd
/// </summary>
Hurd = 21,
/// <summary>
/// Haiku
/// </summary>
Haiku = 22,
/// <summary>
/// HP-UX
/// </summary>
HPUX = 23,
/// <summary>
/// AIX
/// </summary>
AIX = 24,
/// <summary>
/// OS/400
/// </summary>
OS400 = 25,
/// <summary>
/// IRIX
/// </summary>
IRIX = 26,
/// <summary>
/// Minix
/// </summary>
Minix = 27,
/// <summary>
/// NonStop
/// </summary>
NonStop = 28,
/// <summary>
/// QNX
/// </summary>
QNX = 29,
/// <summary>
/// SINIX
/// </summary>
SINIX = 30,
/// <summary>
/// Tru64 UNIX
/// </summary>
Tru64 = 31,
/// <summary>
/// Ultrix
/// </summary>
Ultrix = 32,
/// <summary>
/// SCO OpenServer / SCO UNIX
/// </summary>
OpenServer = 33,
/// <summary>
/// SCO UnixWare
/// </summary>
UnixWare = 34,
/// <summary>
/// IBM z/OS
/// </summary>
zOS = 35,
Unknown = -1
}
}

49
osrepodbmgr/Program.cs Normal file
View File

@@ -0,0 +1,49 @@
//
// 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.Collections.Generic;
using Gtk;
namespace osrepodbmgr
{
static class MainClass
{
public static List<string> files;
public static Dictionary<string, string> hashes;
public static string path;
public static DBEntry dbInfo;
public static void Main(string[] args)
{
Settings.LoadSettings();
Application.Init();
MainWindow win = new MainWindow();
win.Show();
Application.Run();
}
}
}

View File

@@ -0,0 +1,53 @@
//
// 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.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle ("osrepodbmgr")]
[assembly: AssemblyDescription ("")]
[assembly: AssemblyConfiguration ("")]
[assembly: AssemblyCompany ("Claunia.com")]
[assembly: AssemblyProduct ("")]
[assembly: AssemblyCopyright ("© Claunia.com")]
[assembly: AssemblyTrademark ("")]
[assembly: AssemblyCulture ("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion ("1.0.*")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]

View File

@@ -0,0 +1,152 @@
//
// 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.IO;
using System.Security.Cryptography;
using System.Text;
namespace osrepodbmgr
{
/// <summary>
/// Provides a UNIX similar API to .NET SHA256.
/// </summary>
public class SHA256Context
{
SHA256 _sha256Provider;
/// <summary>
/// Initializes the SHA256 hash provider
/// </summary>
public void Init()
{
_sha256Provider = SHA256.Create();
}
/// <summary>
/// Updates the hash with data.
/// </summary>
/// <param name="data">Data buffer.</param>
/// <param name="len">Length of buffer to hash.</param>
public void Update(byte[] data, uint len)
{
_sha256Provider.TransformBlock(data, 0, (int)len, data, 0);
}
/// <summary>
/// Updates the hash with data.
/// </summary>
/// <param name="data">Data buffer.</param>
public void Update(byte[] data)
{
Update(data, (uint)data.Length);
}
/// <summary>
/// Returns a byte array of the hash value.
/// </summary>
public byte[] Final()
{
_sha256Provider.TransformFinalBlock(new byte[0], 0, 0);
return _sha256Provider.Hash;
}
/// <summary>
/// Returns a hexadecimal representation of the hash value.
/// </summary>
public string End()
{
_sha256Provider.TransformFinalBlock(new byte[0], 0, 0);
StringBuilder sha256Output = new StringBuilder();
for(int i = 0; i < _sha256Provider.Hash.Length; i++)
{
sha256Output.Append(_sha256Provider.Hash[i].ToString("x2"));
}
return sha256Output.ToString();
}
/// <summary>
/// Gets the hash of a file
/// </summary>
/// <param name="filename">File path.</param>
public byte[] File(string filename)
{
FileStream fileStream = new FileStream(filename, FileMode.Open);
return _sha256Provider.ComputeHash(fileStream);
}
/// <summary>
/// Gets the hash of a file in hexadecimal and as a byte array.
/// </summary>
/// <param name="filename">File path.</param>
/// <param name="hash">Byte array of the hash value.</param>
public string File(string filename, out byte[] hash)
{
FileStream fileStream = new FileStream(filename, FileMode.Open);
hash = _sha256Provider.ComputeHash(fileStream);
StringBuilder sha256Output = new StringBuilder();
for(int i = 0; i < hash.Length; i++)
{
sha256Output.Append(hash[i].ToString("x2"));
}
return sha256Output.ToString();
}
/// <summary>
/// Gets the hash of the specified data buffer.
/// </summary>
/// <param name="data">Data buffer.</param>
/// <param name="len">Length of the data buffer to hash.</param>
/// <param name="hash">Byte array of the hash value.</param>
public string Data(byte[] data, uint len, out byte[] hash)
{
hash = _sha256Provider.ComputeHash(data, 0, (int)len);
StringBuilder sha256Output = new StringBuilder();
for(int i = 0; i < hash.Length; i++)
{
sha256Output.Append(hash[i].ToString("x2"));
}
return sha256Output.ToString();
}
/// <summary>
/// Gets the hash of the specified data buffer.
/// </summary>
/// <param name="data">Data buffer.</param>
/// <param name="hash">Byte array of the hash value.</param>
public string Data(byte[] data, out byte[] hash)
{
return Data(data, (uint)data.Length, out hash);
}
}
}

138
osrepodbmgr/SQLite.cs Normal file
View File

@@ -0,0 +1,138 @@
//
// 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;
using System.Data;
using System.Data.SQLite;
namespace osrepodbmgr
{
public class SQLite : DBCore
{
SQLiteConnection dbCon;
#region implemented abstract members of DBCore
public override bool OpenDB(string database, string server, string user, string password)
{
try
{
string dataSrc = string.Format("URI=file:{0}", database);
dbCon = new SQLiteConnection(dataSrc);
dbCon.Open();
string sql;
sql = "SELECT * FROM cicm";
SQLiteCommand dbcmd = dbCon.CreateCommand();
dbcmd.CommandText = sql;
SQLiteDataAdapter dAdapter = new SQLiteDataAdapter();
dAdapter.SelectCommand = dbcmd;
DataSet dSet = new DataSet();
dAdapter.Fill(dSet);
DataTable dTable = dSet.Tables[0];
if(dTable.Rows.Count != 1)
return false;
if((long)dTable.Rows[0]["version"] != 1)
{
dbCon = null;
return false;
}
DBEntries = new DBEntries(dbCon, this);
return true;
}
catch(SQLiteException ex)
{
Console.WriteLine("Error opening DB.");
Console.WriteLine(ex.Message);
dbCon = null;
return false;
}
}
public override void CloseDB()
{
if(dbCon != null)
dbCon.Close();
DBEntries = null;
}
public override bool CreateDB(string database, string server, string user, string password)
{
try
{
string dataSrc = string.Format("URI=file:{0}", database);
dbCon = new SQLiteConnection(dataSrc);
dbCon.Open();
SQLiteCommand dbCmd = dbCon.CreateCommand();
string sql;
Console.WriteLine("Creating cicm table");
sql = "CREATE TABLE cicm ( version INTEGER, name TEXT )";
dbCmd.CommandText = sql;
dbCmd.ExecuteNonQuery();
sql = "INSERT INTO cicm ( version, name ) VALUES ( '1', 'Canary Islands Computer Museum' )";
dbCmd.CommandText = sql;
dbCmd.ExecuteNonQuery();
Console.WriteLine("Creating oses table");
dbCmd.CommandText = Schema.OSesTableSql;
dbCmd.ExecuteNonQuery();
Console.WriteLine("Creating files table");
dbCmd.CommandText = Schema.FilesTableSql;
dbCmd.ExecuteNonQuery();
dbCmd.Dispose();
dbCon = null;
return true;
}
catch(SQLiteException ex)
{
Console.WriteLine("Error opening DB.");
Console.WriteLine(ex.Message);
dbCon = null;
return false;
}
}
public override IDbDataAdapter GetNewDataAdapter()
{
return new SQLiteDataAdapter();
}
#endregion
}
}

72
osrepodbmgr/Schema.cs Normal file
View File

@@ -0,0 +1,72 @@
//
// 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.
//
namespace osrepodbmgr
{
public static class Schema
{
public const string FilesTableSql = "-- -----------------------------------------------------\n" +
"-- Table `files`\n" +
"-- -----------------------------------------------------\n" +
"DROP TABLE IF EXISTS `files` ;\n\n" +
"CREATE TABLE IF NOT EXISTS `files` (\n" +
" `id` INTEGER PRIMARY KEY AUTOINCREMENT,\n" +
" `sha256` VARCHAR(64) NOT NULL);\n\n" +
"CREATE UNIQUE INDEX `files_id_UNIQUE` ON `files` (`id` ASC);\n\n" +
"CREATE UNIQUE INDEX `files_sha256_UNIQUE` ON `files` (`sha256` ASC);";
public const string OSesTableSql = "-- -----------------------------------------------------\n" +
"-- Table `oses`\n" +
"-- -----------------------------------------------------\n" +
"DROP TABLE IF EXISTS `oses` ;\n\n" +
"CREATE TABLE IF NOT EXISTS `oses` (\n" +
" `id` INTEGER PRIMARY KEY AUTOINCREMENT,\n" +
" `developer` VARCHAR(45) NOT NULL,\n" +
" `product` VARCHAR(45) NOT NULL,\n" +
" `version` VARCHAR(45) NULL,\n" +
" `languages` VARCHAR(45) NULL,\n" +
" `architecture` VARCHAR(45) NULL,\n" +
" `machine` VARCHAR(45) NULL,\n" +
" `format` VARCHAR(45) NULL,\n" +
" `description` VARCHAR(45) NULL,\n" +
" `oem` BOOLEAN NULL,\n" +
" `upgrade` BOOLEAN NULL,\n" +
" `update` BOOLEAN NULL,\n" +
" `source` BOOLEAN NULL,\n" +
" `files` BOOLEAN NULL,\n" +
" `netinstall` BOOLEAN NULL);\n\n" +
"CREATE UNIQUE INDEX `oses_id_UNIQUE` ON `oses` (`id` ASC);\n\n" +
"CREATE INDEX `oses_developer_idx` ON `oses` (`developer` ASC);\n\n" +
"CREATE INDEX `oses_product_idx` ON `oses` (`product` ASC);\n\n" +
"CREATE INDEX `oses_version_idx` ON `oses` (`version` ASC);\n\n" +
"CREATE INDEX `oses_architecture_idx` ON `oses` (`architecture` ASC);\n\n" +
"CREATE INDEX `oses_format_idx` ON `oses` (`format` ASC);\n\n" +
"CREATE INDEX `oses_machine_idx` ON `oses` (`machine` ASC);\n\n" +
"CREATE INDEX `oses_description_idx` ON `oses` (`description` ASC);";
}
}

237
osrepodbmgr/Settings.cs Normal file
View File

@@ -0,0 +1,237 @@
//
// Author:
// Natalia Portillo claunia@claunia.com
//
// Copyright (c) 2017, © Canary Islands Computer Museum
//
// 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;
using System.IO;
using System.Xml.Serialization;
using Claunia.PropertyList;
using Microsoft.Win32;
namespace osrepodbmgr
{
public class SetSettings
{
public string TemporaryFolder;
public string DatabasePath;
public string RepositoryPath;
public string UnArchiverPath;
}
public static class Settings
{
public static SetSettings Current;
public static void LoadSettings()
{
Current = new SetSettings();
DiscImageChef.Interop.PlatformID ptID = DiscImageChef.Interop.DetectOS.GetRealPlatformID();
try
{
switch(ptID)
{
case DiscImageChef.Interop.PlatformID.MacOSX:
case DiscImageChef.Interop.PlatformID.iOS:
{
string preferencesPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Library", "Preferences");
string preferencesFilePath = Path.Combine(preferencesPath, "com.claunia.museum.osrepodbmgr.plist");
if(!File.Exists(preferencesFilePath))
{
SetDefaultSettings();
SaveSettings();
}
NSDictionary parsedPreferences = (NSDictionary)BinaryPropertyListParser.Parse(new FileInfo(preferencesFilePath));
if(parsedPreferences != null)
{
NSObject obj;
if(parsedPreferences.TryGetValue("TemporaryFolder", out obj))
{
Current.TemporaryFolder = ((NSString)obj).ToString();
}
else
Current.TemporaryFolder = Path.GetTempPath();
if(parsedPreferences.TryGetValue("DatabasePath", out obj))
{
Current.DatabasePath = ((NSString)obj).ToString();
}
else
Current.DatabasePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "osrepodbmgr.db");
if(parsedPreferences.TryGetValue("RepositoryPath", out obj))
{
Current.RepositoryPath = ((NSString)obj).ToString();
}
else
Current.RepositoryPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "osrepo");
if(parsedPreferences.TryGetValue("UnArchiverPath", out obj))
{
Current.UnArchiverPath = ((NSString)obj).ToString();
}
else
Current.UnArchiverPath = null;
}
else {
SetDefaultSettings();
SaveSettings();
}
}
break;
case DiscImageChef.Interop.PlatformID.Win32NT:
case DiscImageChef.Interop.PlatformID.Win32S:
case DiscImageChef.Interop.PlatformID.Win32Windows:
case DiscImageChef.Interop.PlatformID.WinCE:
case DiscImageChef.Interop.PlatformID.WindowsPhone:
{
RegistryKey parentKey = Registry.CurrentUser.OpenSubKey("SOFTWARE").OpenSubKey("Canary Islands Computer Museum");
if(parentKey == null)
{
SetDefaultSettings();
SaveSettings();
return;
}
RegistryKey key = parentKey.OpenSubKey("OSRepoDBMgr");
if(key == null)
{
SetDefaultSettings();
SaveSettings();
return;
}
Current.TemporaryFolder = (string)key.GetValue("TemporaryFolder");
Current.DatabasePath = (string)key.GetValue("DatabasePath");
Current.RepositoryPath = (string)key.GetValue("RepositoryPath");
Current.UnArchiverPath = (string)key.GetValue("UnArchiverPath");
}
break;
default:
{
string configPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".config");
string settingsPath = Path.Combine(configPath, "OSRepoDBMgr.xml");
if(!Directory.Exists(configPath))
{
SetDefaultSettings();
SaveSettings();
return;
}
XmlSerializer xs = new XmlSerializer(Current.GetType());
StreamReader sr = new StreamReader(settingsPath);
Current = (SetSettings)xs.Deserialize(sr);
}
break;
}
}
catch
{
SetDefaultSettings();
SaveSettings();
}
}
public static void SaveSettings()
{
try
{
DiscImageChef.Interop.PlatformID ptID = DiscImageChef.Interop.DetectOS.GetRealPlatformID();
switch(ptID)
{
case DiscImageChef.Interop.PlatformID.MacOSX:
case DiscImageChef.Interop.PlatformID.iOS:
{
NSDictionary root = new NSDictionary();
root.Add("TemporaryFolder", Current.TemporaryFolder);
root.Add("DatabasePath", Current.DatabasePath);
root.Add("RepositoryPath", Current.RepositoryPath);
root.Add("UnArchiverPath", Current.UnArchiverPath);
string preferencesPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Library", "Preferences");
string preferencesFilePath = Path.Combine(preferencesPath, "com.claunia.museum.osrepodbmgr.plist");
FileStream fs = new FileStream(preferencesFilePath, FileMode.Create);
BinaryPropertyListWriter.Write(fs, root);
fs.Close();
}
break;
case DiscImageChef.Interop.PlatformID.Win32NT:
case DiscImageChef.Interop.PlatformID.Win32S:
case DiscImageChef.Interop.PlatformID.Win32Windows:
case DiscImageChef.Interop.PlatformID.WinCE:
case DiscImageChef.Interop.PlatformID.WindowsPhone:
{
RegistryKey parentKey = Registry.CurrentUser.OpenSubKey("SOFTWARE").CreateSubKey("Canary Islands Computer Museum");
RegistryKey key = parentKey.CreateSubKey("OSRepoDBMgr");
key.SetValue("TemporaryFolder", Current.TemporaryFolder);
key.SetValue("DatabasePath", Current.DatabasePath);
key.SetValue("RepositoryPath", Current.RepositoryPath);
key.SetValue("UnArchiverPath", Current.UnArchiverPath);
}
break;
default:
{
string configPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".config");
string settingsPath = Path.Combine(configPath, "OSRepoDBMgr.xml");
if(!Directory.Exists(configPath))
Directory.CreateDirectory(configPath);
FileStream fs = new FileStream(settingsPath, FileMode.Create);
XmlSerializer xs = new XmlSerializer(Current.GetType());
xs.Serialize(fs, Current);
fs.Close();
}
break;
}
}
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
catch
#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body
{
}
}
public static void SetDefaultSettings()
{
Current = new SetSettings();
Current.TemporaryFolder = Path.GetTempPath();
Current.DatabasePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "osrepodbmgr.db");
Current.RepositoryPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "osrepo");
Current.UnArchiverPath = null;
}
}
}

44
osrepodbmgr/frmHelp.cs Normal file
View File

@@ -0,0 +1,44 @@
//
// 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
{
public partial class frmHelp : Gtk.Window
{
public frmHelp() :
base(Gtk.WindowType.Toplevel)
{
Build();
}
protected void OnBtnOKClicked(object sender, EventArgs e)
{
Destroy();
}
}
}

175
osrepodbmgr/frmSettings.cs Normal file
View File

@@ -0,0 +1,175 @@
//
// 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;
using Gtk;
namespace osrepodbmgr
{
public partial class frmSettings : Window
{
public frmSettings() :
base(WindowType.Toplevel)
{
Build();
txtTmp.Text = osrepodbmgr.Settings.Current.TemporaryFolder;
txtUnar.Text = osrepodbmgr.Settings.Current.UnArchiverPath;
txtDatabase.Text = osrepodbmgr.Settings.Current.DatabasePath;
txtRepository.Text = osrepodbmgr.Settings.Current.RepositoryPath;
}
protected void OnBtnCancelClicked(object sender, EventArgs e)
{
Destroy();
}
protected void OnBtnApplyClicked(object sender, EventArgs e)
{
// TODO: Check sanity
osrepodbmgr.Settings.Current.TemporaryFolder = txtTmp.Text;
osrepodbmgr.Settings.Current.UnArchiverPath = txtUnar.Text;
osrepodbmgr.Settings.Current.DatabasePath = txtDatabase.Text;
osrepodbmgr.Settings.Current.RepositoryPath = txtRepository.Text;
osrepodbmgr.Settings.SaveSettings();
Core.CloseDB();
Core.InitDB();
Destroy();
}
protected void OnBtnUnarClicked(object sender, EventArgs e)
{
FileChooserDialog dlgFile = new FileChooserDialog("Choose UnArchiver executable", this, FileChooserAction.Open,
"Cancel", ResponseType.Cancel, "Choose", ResponseType.Accept);
dlgFile.SelectMultiple = false;
dlgFile.SetCurrentFolder(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles));
// TODO: Check it is really unarchiver
if(dlgFile.Run() == (int)ResponseType.Accept)
{
txtUnar.Text = dlgFile.Filename;
}
dlgFile.Destroy();
}
protected void OnBtnTmpClicked(object sender, EventArgs e)
{
FileChooserDialog dlgFolder = new FileChooserDialog("Choose temporary folder", this, FileChooserAction.SelectFolder,
"Cancel", ResponseType.Cancel, "Choose", ResponseType.Accept);
dlgFolder.SelectMultiple = false;
dlgFolder.SetCurrentFolder(System.IO.Path.GetTempPath());
if(dlgFolder.Run() == (int)ResponseType.Accept)
{
txtTmp.Text = dlgFolder.Filename;
}
dlgFolder.Destroy();
}
protected void OnBtnRepositoryClicked(object sender, EventArgs e)
{
FileChooserDialog dlgFolder = new FileChooserDialog("Choose repository folder", this, FileChooserAction.SelectFolder,
"Cancel", ResponseType.Cancel, "Choose", ResponseType.Accept);
dlgFolder.SelectMultiple = false;
dlgFolder.SetCurrentFolder(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments));
// TODO: Check it is really unarchiver
if(dlgFolder.Run() == (int)ResponseType.Accept)
{
txtRepository.Text = dlgFolder.Filename;
}
dlgFolder.Destroy();
}
protected void OnBtnDatabaseClicked(object sender, EventArgs e)
{
FileChooserDialog dlgFile = new FileChooserDialog("Choose database to open/create", this, FileChooserAction.Save,
"Cancel", ResponseType.Cancel, "Choose", ResponseType.Accept);
dlgFile.SelectMultiple = false;
dlgFile.SetCurrentFolder(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments));
dlgFile.SetFilename("osrepodbmgr.db");
// TODO: Check it is really unarchiver
if(dlgFile.Run() == (int)ResponseType.Accept)
{
if(System.IO.File.Exists(dlgFile.Filename))
{
DBCore _dbCore = new SQLite();
bool notDb = false;
try
{
notDb |= !_dbCore.OpenDB(dlgFile.Filename, null, null, null);
}
catch
{
notDb = true;
}
if(notDb)
{
MessageDialog dlgMsg = new MessageDialog(this, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, "Cannot open specified file as a database, please choose another.");
dlgMsg.Run();
dlgMsg.Destroy();
dlgFile.Destroy();
return;
}
_dbCore.CloseDB();
}
else {
DBCore _dbCore = new SQLite();
bool notDb = false;
try
{
notDb |= !_dbCore.CreateDB(dlgFile.Filename, null, null, null);
}
catch
{
notDb = true;
}
if(notDb)
{
MessageDialog dlgMsg = new MessageDialog(this, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, "Cannot create a database in the specified file as a database.");
dlgMsg.Run();
dlgMsg.Destroy();
dlgFile.Destroy();
return;
}
_dbCore.CloseDB();
}
txtUnar.Text = dlgFile.Filename;
}
dlgFile.Destroy();
}
}
}

View File

@@ -0,0 +1,662 @@
// This file has been generated by the GUI designer. Do not modify.
public partial class MainWindow
{
private global::Gtk.VBox vbox1;
private global::Gtk.HBox hbox15;
private global::Gtk.Label lblDeveloper;
private global::Gtk.Entry txtDeveloper;
private global::Gtk.HBox hbox14;
private global::Gtk.Label lblProduct;
private global::Gtk.Entry txtProduct;
private global::Gtk.HBox hbox13;
private global::Gtk.Label lblVersion;
private global::Gtk.Entry txtVersion;
private global::Gtk.HBox hbox12;
private global::Gtk.Label lblLanguages;
private global::Gtk.Entry txtLanguages;
private global::Gtk.HBox hbox11;
private global::Gtk.Label lblArchitecture;
private global::Gtk.Entry txtArchitecture;
private global::Gtk.HBox hbox10;
private global::Gtk.Label lblMachine;
private global::Gtk.Entry txtMachine;
private global::Gtk.HBox hbox21;
private global::Gtk.Label lblFormat;
private global::Gtk.Entry txtFormat;
private global::Gtk.HBox hbox20;
private global::Gtk.Label lblDescription;
private global::Gtk.Entry txtDescription;
private global::Gtk.HBox hbox17;
private global::Gtk.VBox vbox3;
private global::Gtk.CheckButton chkOem;
private global::Gtk.CheckButton chkUpgrade;
private global::Gtk.CheckButton chkSource;
private global::Gtk.VBox vbox2;
private global::Gtk.CheckButton chkUpdate;
private global::Gtk.CheckButton chkFiles;
private global::Gtk.CheckButton chkNetinstall;
private global::Gtk.ScrolledWindow GtkScrolledWindow;
private global::Gtk.TreeView treeFiles;
private global::Gtk.HBox hbox2;
private global::Gtk.Label lblProgress;
private global::Gtk.ProgressBar prgProgress;
private global::Gtk.HBox hbox27;
private global::Gtk.Label lblProgress2;
private global::Gtk.ProgressBar prgProgress2;
private global::Gtk.HBox hbox1;
private global::Gtk.Button btnExit;
private global::Gtk.Button btnSettings;
private global::Gtk.Button btnHelp;
private global::Gtk.Button btnClose;
private global::Gtk.Button btnPack;
private global::Gtk.Button btnAdd;
private global::Gtk.Button btnArchive;
private global::Gtk.Button btnFolder;
private global::Gtk.Button btnStop;
protected virtual void Build()
{
global::Stetic.Gui.Initialize(this);
// Widget MainWindow
this.Name = "MainWindow";
this.Title = global::Mono.Unix.Catalog.GetString("MainWindow");
this.WindowPosition = ((global::Gtk.WindowPosition)(4));
// Container child MainWindow.Gtk.Container+ContainerChild
this.vbox1 = new global::Gtk.VBox();
this.vbox1.Name = "vbox1";
this.vbox1.Spacing = 6;
// Container child vbox1.Gtk.Box+BoxChild
this.hbox15 = new global::Gtk.HBox();
this.hbox15.Name = "hbox15";
this.hbox15.Spacing = 6;
// Container child hbox15.Gtk.Box+BoxChild
this.lblDeveloper = new global::Gtk.Label();
this.lblDeveloper.Name = "lblDeveloper";
this.lblDeveloper.LabelProp = global::Mono.Unix.Catalog.GetString("Developer");
this.hbox15.Add(this.lblDeveloper);
global::Gtk.Box.BoxChild w1 = ((global::Gtk.Box.BoxChild)(this.hbox15[this.lblDeveloper]));
w1.Position = 0;
w1.Expand = false;
w1.Fill = false;
// Container child hbox15.Gtk.Box+BoxChild
this.txtDeveloper = new global::Gtk.Entry();
this.txtDeveloper.CanFocus = true;
this.txtDeveloper.Name = "txtDeveloper";
this.txtDeveloper.IsEditable = false;
this.txtDeveloper.InvisibleChar = '●';
this.hbox15.Add(this.txtDeveloper);
global::Gtk.Box.BoxChild w2 = ((global::Gtk.Box.BoxChild)(this.hbox15[this.txtDeveloper]));
w2.Position = 1;
this.vbox1.Add(this.hbox15);
global::Gtk.Box.BoxChild w3 = ((global::Gtk.Box.BoxChild)(this.vbox1[this.hbox15]));
w3.Position = 0;
w3.Expand = false;
w3.Fill = false;
// Container child vbox1.Gtk.Box+BoxChild
this.hbox14 = new global::Gtk.HBox();
this.hbox14.Name = "hbox14";
this.hbox14.Spacing = 6;
// Container child hbox14.Gtk.Box+BoxChild
this.lblProduct = new global::Gtk.Label();
this.lblProduct.Name = "lblProduct";
this.lblProduct.LabelProp = global::Mono.Unix.Catalog.GetString("Product");
this.hbox14.Add(this.lblProduct);
global::Gtk.Box.BoxChild w4 = ((global::Gtk.Box.BoxChild)(this.hbox14[this.lblProduct]));
w4.Position = 0;
w4.Expand = false;
w4.Fill = false;
// Container child hbox14.Gtk.Box+BoxChild
this.txtProduct = new global::Gtk.Entry();
this.txtProduct.CanFocus = true;
this.txtProduct.Name = "txtProduct";
this.txtProduct.IsEditable = false;
this.txtProduct.InvisibleChar = '●';
this.hbox14.Add(this.txtProduct);
global::Gtk.Box.BoxChild w5 = ((global::Gtk.Box.BoxChild)(this.hbox14[this.txtProduct]));
w5.Position = 1;
this.vbox1.Add(this.hbox14);
global::Gtk.Box.BoxChild w6 = ((global::Gtk.Box.BoxChild)(this.vbox1[this.hbox14]));
w6.Position = 1;
w6.Expand = false;
w6.Fill = false;
// Container child vbox1.Gtk.Box+BoxChild
this.hbox13 = new global::Gtk.HBox();
this.hbox13.Name = "hbox13";
this.hbox13.Spacing = 6;
// Container child hbox13.Gtk.Box+BoxChild
this.lblVersion = new global::Gtk.Label();
this.lblVersion.Name = "lblVersion";
this.lblVersion.LabelProp = global::Mono.Unix.Catalog.GetString("Version");
this.hbox13.Add(this.lblVersion);
global::Gtk.Box.BoxChild w7 = ((global::Gtk.Box.BoxChild)(this.hbox13[this.lblVersion]));
w7.Position = 0;
w7.Expand = false;
w7.Fill = false;
// Container child hbox13.Gtk.Box+BoxChild
this.txtVersion = new global::Gtk.Entry();
this.txtVersion.CanFocus = true;
this.txtVersion.Name = "txtVersion";
this.txtVersion.IsEditable = false;
this.txtVersion.InvisibleChar = '●';
this.hbox13.Add(this.txtVersion);
global::Gtk.Box.BoxChild w8 = ((global::Gtk.Box.BoxChild)(this.hbox13[this.txtVersion]));
w8.Position = 1;
this.vbox1.Add(this.hbox13);
global::Gtk.Box.BoxChild w9 = ((global::Gtk.Box.BoxChild)(this.vbox1[this.hbox13]));
w9.Position = 2;
w9.Expand = false;
w9.Fill = false;
// Container child vbox1.Gtk.Box+BoxChild
this.hbox12 = new global::Gtk.HBox();
this.hbox12.Name = "hbox12";
this.hbox12.Spacing = 6;
// Container child hbox12.Gtk.Box+BoxChild
this.lblLanguages = new global::Gtk.Label();
this.lblLanguages.Name = "lblLanguages";
this.lblLanguages.LabelProp = global::Mono.Unix.Catalog.GetString("Languages");
this.hbox12.Add(this.lblLanguages);
global::Gtk.Box.BoxChild w10 = ((global::Gtk.Box.BoxChild)(this.hbox12[this.lblLanguages]));
w10.Position = 0;
w10.Expand = false;
w10.Fill = false;
// Container child hbox12.Gtk.Box+BoxChild
this.txtLanguages = new global::Gtk.Entry();
this.txtLanguages.CanFocus = true;
this.txtLanguages.Name = "txtLanguages";
this.txtLanguages.IsEditable = false;
this.txtLanguages.InvisibleChar = '●';
this.hbox12.Add(this.txtLanguages);
global::Gtk.Box.BoxChild w11 = ((global::Gtk.Box.BoxChild)(this.hbox12[this.txtLanguages]));
w11.Position = 1;
this.vbox1.Add(this.hbox12);
global::Gtk.Box.BoxChild w12 = ((global::Gtk.Box.BoxChild)(this.vbox1[this.hbox12]));
w12.Position = 3;
w12.Expand = false;
w12.Fill = false;
// Container child vbox1.Gtk.Box+BoxChild
this.hbox11 = new global::Gtk.HBox();
this.hbox11.Name = "hbox11";
this.hbox11.Spacing = 6;
// Container child hbox11.Gtk.Box+BoxChild
this.lblArchitecture = new global::Gtk.Label();
this.lblArchitecture.Name = "lblArchitecture";
this.lblArchitecture.LabelProp = global::Mono.Unix.Catalog.GetString("Architecture");
this.hbox11.Add(this.lblArchitecture);
global::Gtk.Box.BoxChild w13 = ((global::Gtk.Box.BoxChild)(this.hbox11[this.lblArchitecture]));
w13.Position = 0;
w13.Expand = false;
w13.Fill = false;
// Container child hbox11.Gtk.Box+BoxChild
this.txtArchitecture = new global::Gtk.Entry();
this.txtArchitecture.CanFocus = true;
this.txtArchitecture.Name = "txtArchitecture";
this.txtArchitecture.IsEditable = false;
this.txtArchitecture.InvisibleChar = '●';
this.hbox11.Add(this.txtArchitecture);
global::Gtk.Box.BoxChild w14 = ((global::Gtk.Box.BoxChild)(this.hbox11[this.txtArchitecture]));
w14.Position = 1;
this.vbox1.Add(this.hbox11);
global::Gtk.Box.BoxChild w15 = ((global::Gtk.Box.BoxChild)(this.vbox1[this.hbox11]));
w15.Position = 4;
w15.Expand = false;
w15.Fill = false;
// Container child vbox1.Gtk.Box+BoxChild
this.hbox10 = new global::Gtk.HBox();
this.hbox10.Name = "hbox10";
this.hbox10.Spacing = 6;
// Container child hbox10.Gtk.Box+BoxChild
this.lblMachine = new global::Gtk.Label();
this.lblMachine.Name = "lblMachine";
this.lblMachine.LabelProp = global::Mono.Unix.Catalog.GetString("Machine");
this.hbox10.Add(this.lblMachine);
global::Gtk.Box.BoxChild w16 = ((global::Gtk.Box.BoxChild)(this.hbox10[this.lblMachine]));
w16.Position = 0;
w16.Expand = false;
w16.Fill = false;
// Container child hbox10.Gtk.Box+BoxChild
this.txtMachine = new global::Gtk.Entry();
this.txtMachine.CanFocus = true;
this.txtMachine.Name = "txtMachine";
this.txtMachine.IsEditable = false;
this.txtMachine.InvisibleChar = '●';
this.hbox10.Add(this.txtMachine);
global::Gtk.Box.BoxChild w17 = ((global::Gtk.Box.BoxChild)(this.hbox10[this.txtMachine]));
w17.Position = 1;
this.vbox1.Add(this.hbox10);
global::Gtk.Box.BoxChild w18 = ((global::Gtk.Box.BoxChild)(this.vbox1[this.hbox10]));
w18.Position = 5;
w18.Expand = false;
w18.Fill = false;
// Container child vbox1.Gtk.Box+BoxChild
this.hbox21 = new global::Gtk.HBox();
this.hbox21.Name = "hbox21";
this.hbox21.Spacing = 6;
// Container child hbox21.Gtk.Box+BoxChild
this.lblFormat = new global::Gtk.Label();
this.lblFormat.Name = "lblFormat";
this.lblFormat.LabelProp = global::Mono.Unix.Catalog.GetString("Format");
this.hbox21.Add(this.lblFormat);
global::Gtk.Box.BoxChild w19 = ((global::Gtk.Box.BoxChild)(this.hbox21[this.lblFormat]));
w19.Position = 0;
w19.Expand = false;
w19.Fill = false;
// Container child hbox21.Gtk.Box+BoxChild
this.txtFormat = new global::Gtk.Entry();
this.txtFormat.CanFocus = true;
this.txtFormat.Name = "txtFormat";
this.txtFormat.IsEditable = false;
this.txtFormat.InvisibleChar = '●';
this.hbox21.Add(this.txtFormat);
global::Gtk.Box.BoxChild w20 = ((global::Gtk.Box.BoxChild)(this.hbox21[this.txtFormat]));
w20.Position = 1;
this.vbox1.Add(this.hbox21);
global::Gtk.Box.BoxChild w21 = ((global::Gtk.Box.BoxChild)(this.vbox1[this.hbox21]));
w21.Position = 6;
w21.Expand = false;
w21.Fill = false;
// Container child vbox1.Gtk.Box+BoxChild
this.hbox20 = new global::Gtk.HBox();
this.hbox20.Name = "hbox20";
this.hbox20.Spacing = 6;
// Container child hbox20.Gtk.Box+BoxChild
this.lblDescription = new global::Gtk.Label();
this.lblDescription.Name = "lblDescription";
this.lblDescription.LabelProp = global::Mono.Unix.Catalog.GetString("Description");
this.hbox20.Add(this.lblDescription);
global::Gtk.Box.BoxChild w22 = ((global::Gtk.Box.BoxChild)(this.hbox20[this.lblDescription]));
w22.Position = 0;
w22.Expand = false;
w22.Fill = false;
// Container child hbox20.Gtk.Box+BoxChild
this.txtDescription = new global::Gtk.Entry();
this.txtDescription.CanFocus = true;
this.txtDescription.Name = "txtDescription";
this.txtDescription.IsEditable = false;
this.txtDescription.InvisibleChar = '●';
this.hbox20.Add(this.txtDescription);
global::Gtk.Box.BoxChild w23 = ((global::Gtk.Box.BoxChild)(this.hbox20[this.txtDescription]));
w23.Position = 1;
this.vbox1.Add(this.hbox20);
global::Gtk.Box.BoxChild w24 = ((global::Gtk.Box.BoxChild)(this.vbox1[this.hbox20]));
w24.Position = 7;
w24.Expand = false;
w24.Fill = false;
// Container child vbox1.Gtk.Box+BoxChild
this.hbox17 = new global::Gtk.HBox();
this.hbox17.Name = "hbox17";
this.hbox17.Spacing = 6;
// Container child hbox17.Gtk.Box+BoxChild
this.vbox3 = new global::Gtk.VBox();
this.vbox3.Name = "vbox3";
this.vbox3.Spacing = 6;
// Container child vbox3.Gtk.Box+BoxChild
this.chkOem = new global::Gtk.CheckButton();
this.chkOem.Sensitive = false;
this.chkOem.CanFocus = true;
this.chkOem.Name = "chkOem";
this.chkOem.Label = global::Mono.Unix.Catalog.GetString("oem");
this.chkOem.DrawIndicator = true;
this.chkOem.UseUnderline = true;
this.vbox3.Add(this.chkOem);
global::Gtk.Box.BoxChild w25 = ((global::Gtk.Box.BoxChild)(this.vbox3[this.chkOem]));
w25.Position = 0;
w25.Expand = false;
w25.Fill = false;
// Container child vbox3.Gtk.Box+BoxChild
this.chkUpgrade = new global::Gtk.CheckButton();
this.chkUpgrade.Sensitive = false;
this.chkUpgrade.CanFocus = true;
this.chkUpgrade.Name = "chkUpgrade";
this.chkUpgrade.Label = global::Mono.Unix.Catalog.GetString("upgrade");
this.chkUpgrade.DrawIndicator = true;
this.chkUpgrade.UseUnderline = true;
this.vbox3.Add(this.chkUpgrade);
global::Gtk.Box.BoxChild w26 = ((global::Gtk.Box.BoxChild)(this.vbox3[this.chkUpgrade]));
w26.Position = 1;
w26.Expand = false;
w26.Fill = false;
// Container child vbox3.Gtk.Box+BoxChild
this.chkSource = new global::Gtk.CheckButton();
this.chkSource.Sensitive = false;
this.chkSource.CanFocus = true;
this.chkSource.Name = "chkSource";
this.chkSource.Label = global::Mono.Unix.Catalog.GetString("source");
this.chkSource.DrawIndicator = true;
this.chkSource.UseUnderline = true;
this.vbox3.Add(this.chkSource);
global::Gtk.Box.BoxChild w27 = ((global::Gtk.Box.BoxChild)(this.vbox3[this.chkSource]));
w27.Position = 2;
w27.Expand = false;
w27.Fill = false;
this.hbox17.Add(this.vbox3);
global::Gtk.Box.BoxChild w28 = ((global::Gtk.Box.BoxChild)(this.hbox17[this.vbox3]));
w28.Position = 0;
// Container child hbox17.Gtk.Box+BoxChild
this.vbox2 = new global::Gtk.VBox();
this.vbox2.Name = "vbox2";
this.vbox2.Spacing = 6;
// Container child vbox2.Gtk.Box+BoxChild
this.chkUpdate = new global::Gtk.CheckButton();
this.chkUpdate.Sensitive = false;
this.chkUpdate.CanFocus = true;
this.chkUpdate.Name = "chkUpdate";
this.chkUpdate.Label = global::Mono.Unix.Catalog.GetString("update");
this.chkUpdate.DrawIndicator = true;
this.chkUpdate.UseUnderline = true;
this.vbox2.Add(this.chkUpdate);
global::Gtk.Box.BoxChild w29 = ((global::Gtk.Box.BoxChild)(this.vbox2[this.chkUpdate]));
w29.Position = 0;
w29.Expand = false;
w29.Fill = false;
// Container child vbox2.Gtk.Box+BoxChild
this.chkFiles = new global::Gtk.CheckButton();
this.chkFiles.Sensitive = false;
this.chkFiles.CanFocus = true;
this.chkFiles.Name = "chkFiles";
this.chkFiles.Label = global::Mono.Unix.Catalog.GetString("files");
this.chkFiles.DrawIndicator = true;
this.chkFiles.UseUnderline = true;
this.vbox2.Add(this.chkFiles);
global::Gtk.Box.BoxChild w30 = ((global::Gtk.Box.BoxChild)(this.vbox2[this.chkFiles]));
w30.Position = 1;
w30.Expand = false;
w30.Fill = false;
// Container child vbox2.Gtk.Box+BoxChild
this.chkNetinstall = new global::Gtk.CheckButton();
this.chkNetinstall.Sensitive = false;
this.chkNetinstall.CanFocus = true;
this.chkNetinstall.Name = "chkNetinstall";
this.chkNetinstall.Label = global::Mono.Unix.Catalog.GetString("netinstall");
this.chkNetinstall.DrawIndicator = true;
this.chkNetinstall.UseUnderline = true;
this.vbox2.Add(this.chkNetinstall);
global::Gtk.Box.BoxChild w31 = ((global::Gtk.Box.BoxChild)(this.vbox2[this.chkNetinstall]));
w31.Position = 2;
w31.Expand = false;
w31.Fill = false;
this.hbox17.Add(this.vbox2);
global::Gtk.Box.BoxChild w32 = ((global::Gtk.Box.BoxChild)(this.hbox17[this.vbox2]));
w32.Position = 1;
this.vbox1.Add(this.hbox17);
global::Gtk.Box.BoxChild w33 = ((global::Gtk.Box.BoxChild)(this.vbox1[this.hbox17]));
w33.Position = 8;
w33.Expand = false;
w33.Fill = false;
// Container child vbox1.Gtk.Box+BoxChild
this.GtkScrolledWindow = new global::Gtk.ScrolledWindow();
this.GtkScrolledWindow.Name = "GtkScrolledWindow";
this.GtkScrolledWindow.ShadowType = ((global::Gtk.ShadowType)(1));
// Container child GtkScrolledWindow.Gtk.Container+ContainerChild
this.treeFiles = new global::Gtk.TreeView();
this.treeFiles.CanFocus = true;
this.treeFiles.Name = "treeFiles";
this.GtkScrolledWindow.Add(this.treeFiles);
this.vbox1.Add(this.GtkScrolledWindow);
global::Gtk.Box.BoxChild w35 = ((global::Gtk.Box.BoxChild)(this.vbox1[this.GtkScrolledWindow]));
w35.Position = 9;
// Container child vbox1.Gtk.Box+BoxChild
this.hbox2 = new global::Gtk.HBox();
this.hbox2.Name = "hbox2";
this.hbox2.Spacing = 6;
// Container child hbox2.Gtk.Box+BoxChild
this.lblProgress = new global::Gtk.Label();
this.lblProgress.Name = "lblProgress";
this.lblProgress.LabelProp = global::Mono.Unix.Catalog.GetString("label2");
this.hbox2.Add(this.lblProgress);
global::Gtk.Box.BoxChild w36 = ((global::Gtk.Box.BoxChild)(this.hbox2[this.lblProgress]));
w36.Position = 0;
w36.Expand = false;
w36.Fill = false;
// Container child hbox2.Gtk.Box+BoxChild
this.prgProgress = new global::Gtk.ProgressBar();
this.prgProgress.Name = "prgProgress";
this.hbox2.Add(this.prgProgress);
global::Gtk.Box.BoxChild w37 = ((global::Gtk.Box.BoxChild)(this.hbox2[this.prgProgress]));
w37.Position = 1;
this.vbox1.Add(this.hbox2);
global::Gtk.Box.BoxChild w38 = ((global::Gtk.Box.BoxChild)(this.vbox1[this.hbox2]));
w38.Position = 10;
w38.Expand = false;
w38.Fill = false;
// Container child vbox1.Gtk.Box+BoxChild
this.hbox27 = new global::Gtk.HBox();
this.hbox27.Name = "hbox27";
this.hbox27.Spacing = 6;
// Container child hbox27.Gtk.Box+BoxChild
this.lblProgress2 = new global::Gtk.Label();
this.lblProgress2.Name = "lblProgress2";
this.lblProgress2.LabelProp = global::Mono.Unix.Catalog.GetString("label22");
this.hbox27.Add(this.lblProgress2);
global::Gtk.Box.BoxChild w39 = ((global::Gtk.Box.BoxChild)(this.hbox27[this.lblProgress2]));
w39.Position = 0;
w39.Expand = false;
w39.Fill = false;
// Container child hbox27.Gtk.Box+BoxChild
this.prgProgress2 = new global::Gtk.ProgressBar();
this.prgProgress2.Name = "prgProgress2";
this.hbox27.Add(this.prgProgress2);
global::Gtk.Box.BoxChild w40 = ((global::Gtk.Box.BoxChild)(this.hbox27[this.prgProgress2]));
w40.Position = 1;
this.vbox1.Add(this.hbox27);
global::Gtk.Box.BoxChild w41 = ((global::Gtk.Box.BoxChild)(this.vbox1[this.hbox27]));
w41.Position = 11;
w41.Expand = false;
w41.Fill = false;
// Container child vbox1.Gtk.Box+BoxChild
this.hbox1 = new global::Gtk.HBox();
this.hbox1.Name = "hbox1";
this.hbox1.Spacing = 6;
// Container child hbox1.Gtk.Box+BoxChild
this.btnExit = new global::Gtk.Button();
this.btnExit.CanFocus = true;
this.btnExit.Name = "btnExit";
this.btnExit.UseStock = true;
this.btnExit.UseUnderline = true;
this.btnExit.Label = "gtk-quit";
this.hbox1.Add(this.btnExit);
global::Gtk.Box.BoxChild w42 = ((global::Gtk.Box.BoxChild)(this.hbox1[this.btnExit]));
w42.PackType = ((global::Gtk.PackType)(1));
w42.Position = 0;
w42.Expand = false;
w42.Fill = false;
// Container child hbox1.Gtk.Box+BoxChild
this.btnSettings = new global::Gtk.Button();
this.btnSettings.CanFocus = true;
this.btnSettings.Name = "btnSettings";
this.btnSettings.UseUnderline = true;
this.btnSettings.Label = global::Mono.Unix.Catalog.GetString("_Settings");
global::Gtk.Image w43 = new global::Gtk.Image();
w43.Pixbuf = global::Stetic.IconLoader.LoadIcon(this, "gtk-preferences", global::Gtk.IconSize.Menu);
this.btnSettings.Image = w43;
this.hbox1.Add(this.btnSettings);
global::Gtk.Box.BoxChild w44 = ((global::Gtk.Box.BoxChild)(this.hbox1[this.btnSettings]));
w44.PackType = ((global::Gtk.PackType)(1));
w44.Position = 1;
w44.Expand = false;
w44.Fill = false;
// Container child hbox1.Gtk.Box+BoxChild
this.btnHelp = new global::Gtk.Button();
this.btnHelp.CanFocus = true;
this.btnHelp.Name = "btnHelp";
this.btnHelp.UseStock = true;
this.btnHelp.UseUnderline = true;
this.btnHelp.Label = "gtk-help";
this.hbox1.Add(this.btnHelp);
global::Gtk.Box.BoxChild w45 = ((global::Gtk.Box.BoxChild)(this.hbox1[this.btnHelp]));
w45.PackType = ((global::Gtk.PackType)(1));
w45.Position = 2;
w45.Expand = false;
w45.Fill = false;
// Container child hbox1.Gtk.Box+BoxChild
this.btnClose = new global::Gtk.Button();
this.btnClose.CanFocus = true;
this.btnClose.Name = "btnClose";
this.btnClose.UseUnderline = true;
this.btnClose.Label = global::Mono.Unix.Catalog.GetString("_Close");
global::Gtk.Image w46 = new global::Gtk.Image();
w46.Pixbuf = global::Stetic.IconLoader.LoadIcon(this, "gtk-close", global::Gtk.IconSize.Menu);
this.btnClose.Image = w46;
this.hbox1.Add(this.btnClose);
global::Gtk.Box.BoxChild w47 = ((global::Gtk.Box.BoxChild)(this.hbox1[this.btnClose]));
w47.PackType = ((global::Gtk.PackType)(1));
w47.Position = 3;
w47.Expand = false;
w47.Fill = false;
// Container child hbox1.Gtk.Box+BoxChild
this.btnPack = new global::Gtk.Button();
this.btnPack.Sensitive = false;
this.btnPack.CanFocus = true;
this.btnPack.Name = "btnPack";
this.btnPack.UseUnderline = true;
this.btnPack.Label = global::Mono.Unix.Catalog.GetString("_Pack...");
global::Gtk.Image w48 = new global::Gtk.Image();
w48.Pixbuf = global::Stetic.IconLoader.LoadIcon(this, "gtk-save", global::Gtk.IconSize.Menu);
this.btnPack.Image = w48;
this.hbox1.Add(this.btnPack);
global::Gtk.Box.BoxChild w49 = ((global::Gtk.Box.BoxChild)(this.hbox1[this.btnPack]));
w49.PackType = ((global::Gtk.PackType)(1));
w49.Position = 4;
w49.Expand = false;
w49.Fill = false;
// Container child hbox1.Gtk.Box+BoxChild
this.btnAdd = new global::Gtk.Button();
this.btnAdd.CanFocus = true;
this.btnAdd.Name = "btnAdd";
this.btnAdd.UseUnderline = true;
this.btnAdd.Label = global::Mono.Unix.Catalog.GetString("Add to _DB");
global::Gtk.Image w50 = new global::Gtk.Image();
w50.Pixbuf = global::Stetic.IconLoader.LoadIcon(this, "gtk-add", global::Gtk.IconSize.Menu);
this.btnAdd.Image = w50;
this.hbox1.Add(this.btnAdd);
global::Gtk.Box.BoxChild w51 = ((global::Gtk.Box.BoxChild)(this.hbox1[this.btnAdd]));
w51.PackType = ((global::Gtk.PackType)(1));
w51.Position = 5;
w51.Expand = false;
w51.Fill = false;
// Container child hbox1.Gtk.Box+BoxChild
this.btnArchive = new global::Gtk.Button();
this.btnArchive.CanFocus = true;
this.btnArchive.Name = "btnArchive";
this.btnArchive.UseUnderline = true;
this.btnArchive.Label = global::Mono.Unix.Catalog.GetString("Open _archive");
global::Gtk.Image w52 = new global::Gtk.Image();
w52.Pixbuf = global::Stetic.IconLoader.LoadIcon(this, "gtk-open", global::Gtk.IconSize.Menu);
this.btnArchive.Image = w52;
this.hbox1.Add(this.btnArchive);
global::Gtk.Box.BoxChild w53 = ((global::Gtk.Box.BoxChild)(this.hbox1[this.btnArchive]));
w53.PackType = ((global::Gtk.PackType)(1));
w53.Position = 6;
w53.Expand = false;
w53.Fill = false;
// Container child hbox1.Gtk.Box+BoxChild
this.btnFolder = new global::Gtk.Button();
this.btnFolder.CanFocus = true;
this.btnFolder.Name = "btnFolder";
this.btnFolder.UseUnderline = true;
this.btnFolder.Label = global::Mono.Unix.Catalog.GetString("Open _folder");
global::Gtk.Image w54 = new global::Gtk.Image();
w54.Pixbuf = global::Stetic.IconLoader.LoadIcon(this, "gtk-open", global::Gtk.IconSize.Menu);
this.btnFolder.Image = w54;
this.hbox1.Add(this.btnFolder);
global::Gtk.Box.BoxChild w55 = ((global::Gtk.Box.BoxChild)(this.hbox1[this.btnFolder]));
w55.PackType = ((global::Gtk.PackType)(1));
w55.Position = 7;
w55.Expand = false;
w55.Fill = false;
// Container child hbox1.Gtk.Box+BoxChild
this.btnStop = new global::Gtk.Button();
this.btnStop.CanFocus = true;
this.btnStop.Name = "btnStop";
this.btnStop.UseStock = true;
this.btnStop.UseUnderline = true;
this.btnStop.Label = "gtk-stop";
this.hbox1.Add(this.btnStop);
global::Gtk.Box.BoxChild w56 = ((global::Gtk.Box.BoxChild)(this.hbox1[this.btnStop]));
w56.PackType = ((global::Gtk.PackType)(1));
w56.Position = 8;
w56.Expand = false;
w56.Fill = false;
this.vbox1.Add(this.hbox1);
global::Gtk.Box.BoxChild w57 = ((global::Gtk.Box.BoxChild)(this.vbox1[this.hbox1]));
w57.Position = 12;
w57.Expand = false;
w57.Fill = false;
this.Add(this.vbox1);
if((this.Child != null))
{
this.Child.ShowAll();
}
this.DefaultWidth = 771;
this.DefaultHeight = 544;
this.lblProgress.Hide();
this.prgProgress.Hide();
this.lblProgress2.Hide();
this.prgProgress2.Hide();
this.btnClose.Hide();
this.btnPack.Hide();
this.btnAdd.Hide();
this.btnStop.Hide();
this.Show();
this.DeleteEvent += new global::Gtk.DeleteEventHandler(this.OnDeleteEvent);
this.btnStop.Clicked += new global::System.EventHandler(this.OnBtnStopClicked);
this.btnFolder.Clicked += new global::System.EventHandler(this.OnBtnFolderClicked);
this.btnAdd.Clicked += new global::System.EventHandler(this.OnBtnAddClicked);
this.btnClose.Clicked += new global::System.EventHandler(this.OnBtnCloseClicked);
this.btnHelp.Clicked += new global::System.EventHandler(this.OnBtnHelpClicked);
this.btnSettings.Clicked += new global::System.EventHandler(this.OnBtnSettingsClicked);
this.btnExit.Clicked += new global::System.EventHandler(this.OnBtnExitClicked);
}
}

View File

@@ -0,0 +1,75 @@
// This file has been generated by the GUI designer. Do not modify.
namespace Stetic
{
internal class Gui
{
private static bool initialized;
internal static void Initialize(Gtk.Widget iconRenderer)
{
if((Stetic.Gui.initialized == false))
{
Stetic.Gui.initialized = true;
}
}
}
internal class IconLoader
{
public static Gdk.Pixbuf LoadIcon(Gtk.Widget widget, string name, Gtk.IconSize size)
{
Gdk.Pixbuf res = widget.RenderIcon(name, size, null);
if((res != null))
{
return res;
}
else {
int sz;
int sy;
global::Gtk.Icon.SizeLookup(size, out sz, out sy);
try
{
return Gtk.IconTheme.Default.LoadIcon(name, sz, 0);
}
catch(System.Exception)
{
if((name != "gtk-missing-image"))
{
return Stetic.IconLoader.LoadIcon(widget, "gtk-missing-image", size);
}
else {
Gdk.Pixmap pmap = new Gdk.Pixmap(Gdk.Screen.Default.RootWindow, sz, sz);
Gdk.GC gc = new Gdk.GC(pmap);
gc.RgbFgColor = new Gdk.Color(255, 255, 255);
pmap.DrawRectangle(gc, true, 0, 0, sz, sz);
gc.RgbFgColor = new Gdk.Color(0, 0, 0);
pmap.DrawRectangle(gc, false, 0, 0, (sz - 1), (sz - 1));
gc.SetLineAttributes(3, Gdk.LineStyle.Solid, Gdk.CapStyle.Round, Gdk.JoinStyle.Round);
gc.RgbFgColor = new Gdk.Color(255, 0, 0);
pmap.DrawLine(gc, (sz / 4), (sz / 4), ((sz - 1)
- (sz / 4)), ((sz - 1)
- (sz / 4)));
pmap.DrawLine(gc, ((sz - 1)
- (sz / 4)), (sz / 4), (sz / 4), ((sz - 1)
- (sz / 4)));
return Gdk.Pixbuf.FromDrawable(pmap, pmap.Colormap, 0, 0, 0, 0, sz, sz);
}
}
}
}
}
internal class ActionGroups
{
public static Gtk.ActionGroup GetActionGroup(System.Type type)
{
return Stetic.ActionGroups.GetActionGroup(type.FullName);
}
public static Gtk.ActionGroup GetActionGroup(string name)
{
return null;
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,272 @@
// This file has been generated by the GUI designer. Do not modify.
namespace osrepodbmgr
{
public partial class frmSettings
{
private global::Gtk.VBox vbox5;
private global::Gtk.HBox hbox26;
private global::Gtk.Label lblDatabase;
private global::Gtk.Entry txtDatabase;
private global::Gtk.Button btnDatabase;
private global::Gtk.HBox hbox25;
private global::Gtk.Label lblRepository;
private global::Gtk.Entry txtRepository;
private global::Gtk.Button btnRepository;
private global::Gtk.HBox hbox24;
private global::Gtk.Label lblTmp;
private global::Gtk.Entry txtTmp;
private global::Gtk.Button btnTmp;
private global::Gtk.HBox hbox23;
private global::Gtk.Label lblUnar;
private global::Gtk.Entry txtUnar;
private global::Gtk.Button btnUnar;
private global::Gtk.HBox hbox18;
private global::Gtk.Button btnCancel;
private global::Gtk.Button btnApply;
protected virtual void Build()
{
global::Stetic.Gui.Initialize(this);
// Widget osrepodbmgr.frmSettings
this.Name = "osrepodbmgr.frmSettings";
this.Title = global::Mono.Unix.Catalog.GetString("frmSettings");
this.WindowPosition = ((global::Gtk.WindowPosition)(4));
// Container child osrepodbmgr.frmSettings.Gtk.Container+ContainerChild
this.vbox5 = new global::Gtk.VBox();
this.vbox5.Name = "vbox5";
this.vbox5.Spacing = 6;
// Container child vbox5.Gtk.Box+BoxChild
this.hbox26 = new global::Gtk.HBox();
this.hbox26.Name = "hbox26";
this.hbox26.Spacing = 6;
// Container child hbox26.Gtk.Box+BoxChild
this.lblDatabase = new global::Gtk.Label();
this.lblDatabase.Name = "lblDatabase";
this.lblDatabase.LabelProp = global::Mono.Unix.Catalog.GetString("Database file");
this.hbox26.Add(this.lblDatabase);
global::Gtk.Box.BoxChild w1 = ((global::Gtk.Box.BoxChild)(this.hbox26[this.lblDatabase]));
w1.Position = 0;
w1.Expand = false;
w1.Fill = false;
// Container child hbox26.Gtk.Box+BoxChild
this.txtDatabase = new global::Gtk.Entry();
this.txtDatabase.CanFocus = true;
this.txtDatabase.Name = "txtDatabase";
this.txtDatabase.IsEditable = true;
this.txtDatabase.InvisibleChar = '●';
this.hbox26.Add(this.txtDatabase);
global::Gtk.Box.BoxChild w2 = ((global::Gtk.Box.BoxChild)(this.hbox26[this.txtDatabase]));
w2.Position = 1;
// Container child hbox26.Gtk.Box+BoxChild
this.btnDatabase = new global::Gtk.Button();
this.btnDatabase.CanFocus = true;
this.btnDatabase.Name = "btnDatabase";
this.btnDatabase.UseUnderline = true;
this.btnDatabase.Label = global::Mono.Unix.Catalog.GetString("Choose");
global::Gtk.Image w3 = new global::Gtk.Image();
w3.Pixbuf = global::Stetic.IconLoader.LoadIcon(this, "gtk-open", global::Gtk.IconSize.Menu);
this.btnDatabase.Image = w3;
this.hbox26.Add(this.btnDatabase);
global::Gtk.Box.BoxChild w4 = ((global::Gtk.Box.BoxChild)(this.hbox26[this.btnDatabase]));
w4.Position = 2;
w4.Expand = false;
w4.Fill = false;
this.vbox5.Add(this.hbox26);
global::Gtk.Box.BoxChild w5 = ((global::Gtk.Box.BoxChild)(this.vbox5[this.hbox26]));
w5.Position = 0;
w5.Expand = false;
w5.Fill = false;
// Container child vbox5.Gtk.Box+BoxChild
this.hbox25 = new global::Gtk.HBox();
this.hbox25.Name = "hbox25";
this.hbox25.Spacing = 6;
// Container child hbox25.Gtk.Box+BoxChild
this.lblRepository = new global::Gtk.Label();
this.lblRepository.Name = "lblRepository";
this.lblRepository.LabelProp = global::Mono.Unix.Catalog.GetString("Repository folder");
this.hbox25.Add(this.lblRepository);
global::Gtk.Box.BoxChild w6 = ((global::Gtk.Box.BoxChild)(this.hbox25[this.lblRepository]));
w6.Position = 0;
w6.Expand = false;
w6.Fill = false;
// Container child hbox25.Gtk.Box+BoxChild
this.txtRepository = new global::Gtk.Entry();
this.txtRepository.CanFocus = true;
this.txtRepository.Name = "txtRepository";
this.txtRepository.IsEditable = true;
this.txtRepository.InvisibleChar = '●';
this.hbox25.Add(this.txtRepository);
global::Gtk.Box.BoxChild w7 = ((global::Gtk.Box.BoxChild)(this.hbox25[this.txtRepository]));
w7.Position = 1;
// Container child hbox25.Gtk.Box+BoxChild
this.btnRepository = new global::Gtk.Button();
this.btnRepository.CanFocus = true;
this.btnRepository.Name = "btnRepository";
this.btnRepository.UseUnderline = true;
this.btnRepository.Label = global::Mono.Unix.Catalog.GetString("Choose");
global::Gtk.Image w8 = new global::Gtk.Image();
w8.Pixbuf = global::Stetic.IconLoader.LoadIcon(this, "gtk-open", global::Gtk.IconSize.Menu);
this.btnRepository.Image = w8;
this.hbox25.Add(this.btnRepository);
global::Gtk.Box.BoxChild w9 = ((global::Gtk.Box.BoxChild)(this.hbox25[this.btnRepository]));
w9.Position = 2;
w9.Expand = false;
w9.Fill = false;
this.vbox5.Add(this.hbox25);
global::Gtk.Box.BoxChild w10 = ((global::Gtk.Box.BoxChild)(this.vbox5[this.hbox25]));
w10.Position = 1;
w10.Expand = false;
w10.Fill = false;
// Container child vbox5.Gtk.Box+BoxChild
this.hbox24 = new global::Gtk.HBox();
this.hbox24.Name = "hbox24";
this.hbox24.Spacing = 6;
// Container child hbox24.Gtk.Box+BoxChild
this.lblTmp = new global::Gtk.Label();
this.lblTmp.Name = "lblTmp";
this.lblTmp.LabelProp = global::Mono.Unix.Catalog.GetString("Temporary folder");
this.hbox24.Add(this.lblTmp);
global::Gtk.Box.BoxChild w11 = ((global::Gtk.Box.BoxChild)(this.hbox24[this.lblTmp]));
w11.Position = 0;
w11.Expand = false;
w11.Fill = false;
// Container child hbox24.Gtk.Box+BoxChild
this.txtTmp = new global::Gtk.Entry();
this.txtTmp.CanFocus = true;
this.txtTmp.Name = "txtTmp";
this.txtTmp.IsEditable = true;
this.txtTmp.InvisibleChar = '●';
this.hbox24.Add(this.txtTmp);
global::Gtk.Box.BoxChild w12 = ((global::Gtk.Box.BoxChild)(this.hbox24[this.txtTmp]));
w12.Position = 1;
// Container child hbox24.Gtk.Box+BoxChild
this.btnTmp = new global::Gtk.Button();
this.btnTmp.CanFocus = true;
this.btnTmp.Name = "btnTmp";
this.btnTmp.UseUnderline = true;
this.btnTmp.Label = global::Mono.Unix.Catalog.GetString("Choose");
global::Gtk.Image w13 = new global::Gtk.Image();
w13.Pixbuf = global::Stetic.IconLoader.LoadIcon(this, "gtk-open", global::Gtk.IconSize.Menu);
this.btnTmp.Image = w13;
this.hbox24.Add(this.btnTmp);
global::Gtk.Box.BoxChild w14 = ((global::Gtk.Box.BoxChild)(this.hbox24[this.btnTmp]));
w14.Position = 2;
w14.Expand = false;
w14.Fill = false;
this.vbox5.Add(this.hbox24);
global::Gtk.Box.BoxChild w15 = ((global::Gtk.Box.BoxChild)(this.vbox5[this.hbox24]));
w15.Position = 2;
w15.Expand = false;
w15.Fill = false;
// Container child vbox5.Gtk.Box+BoxChild
this.hbox23 = new global::Gtk.HBox();
this.hbox23.Name = "hbox23";
this.hbox23.Spacing = 6;
// Container child hbox23.Gtk.Box+BoxChild
this.lblUnar = new global::Gtk.Label();
this.lblUnar.Name = "lblUnar";
this.lblUnar.LabelProp = global::Mono.Unix.Catalog.GetString("Path to unar");
this.hbox23.Add(this.lblUnar);
global::Gtk.Box.BoxChild w16 = ((global::Gtk.Box.BoxChild)(this.hbox23[this.lblUnar]));
w16.Position = 0;
w16.Expand = false;
w16.Fill = false;
// Container child hbox23.Gtk.Box+BoxChild
this.txtUnar = new global::Gtk.Entry();
this.txtUnar.CanFocus = true;
this.txtUnar.Name = "txtUnar";
this.txtUnar.IsEditable = true;
this.txtUnar.InvisibleChar = '●';
this.hbox23.Add(this.txtUnar);
global::Gtk.Box.BoxChild w17 = ((global::Gtk.Box.BoxChild)(this.hbox23[this.txtUnar]));
w17.Position = 1;
// Container child hbox23.Gtk.Box+BoxChild
this.btnUnar = new global::Gtk.Button();
this.btnUnar.CanFocus = true;
this.btnUnar.Name = "btnUnar";
this.btnUnar.UseUnderline = true;
this.btnUnar.Label = global::Mono.Unix.Catalog.GetString("Choose");
global::Gtk.Image w18 = new global::Gtk.Image();
w18.Pixbuf = global::Stetic.IconLoader.LoadIcon(this, "gtk-open", global::Gtk.IconSize.Menu);
this.btnUnar.Image = w18;
this.hbox23.Add(this.btnUnar);
global::Gtk.Box.BoxChild w19 = ((global::Gtk.Box.BoxChild)(this.hbox23[this.btnUnar]));
w19.Position = 2;
w19.Expand = false;
w19.Fill = false;
this.vbox5.Add(this.hbox23);
global::Gtk.Box.BoxChild w20 = ((global::Gtk.Box.BoxChild)(this.vbox5[this.hbox23]));
w20.Position = 3;
w20.Expand = false;
w20.Fill = false;
// Container child vbox5.Gtk.Box+BoxChild
this.hbox18 = new global::Gtk.HBox();
this.hbox18.Name = "hbox18";
this.hbox18.Spacing = 6;
// Container child hbox18.Gtk.Box+BoxChild
this.btnCancel = new global::Gtk.Button();
this.btnCancel.CanFocus = true;
this.btnCancel.Name = "btnCancel";
this.btnCancel.UseStock = true;
this.btnCancel.UseUnderline = true;
this.btnCancel.Label = "gtk-cancel";
this.hbox18.Add(this.btnCancel);
global::Gtk.Box.BoxChild w21 = ((global::Gtk.Box.BoxChild)(this.hbox18[this.btnCancel]));
w21.Position = 0;
w21.Expand = false;
w21.Fill = false;
// Container child hbox18.Gtk.Box+BoxChild
this.btnApply = new global::Gtk.Button();
this.btnApply.CanFocus = true;
this.btnApply.Name = "btnApply";
this.btnApply.UseStock = true;
this.btnApply.UseUnderline = true;
this.btnApply.Label = "gtk-apply";
this.hbox18.Add(this.btnApply);
global::Gtk.Box.BoxChild w22 = ((global::Gtk.Box.BoxChild)(this.hbox18[this.btnApply]));
w22.PackType = ((global::Gtk.PackType)(1));
w22.Position = 1;
w22.Expand = false;
w22.Fill = false;
this.vbox5.Add(this.hbox18);
global::Gtk.Box.BoxChild w23 = ((global::Gtk.Box.BoxChild)(this.vbox5[this.hbox18]));
w23.Position = 4;
w23.Expand = false;
w23.Fill = false;
this.Add(this.vbox5);
if((this.Child != null))
{
this.Child.ShowAll();
}
this.DefaultWidth = 400;
this.DefaultHeight = 194;
this.Show();
this.btnDatabase.Clicked += new global::System.EventHandler(this.OnBtnDatabaseClicked);
this.btnRepository.Clicked += new global::System.EventHandler(this.OnBtnRepositoryClicked);
this.btnTmp.Clicked += new global::System.EventHandler(this.OnBtnTmpClicked);
this.btnUnar.Clicked += new global::System.EventHandler(this.OnBtnUnarClicked);
this.btnCancel.Clicked += new global::System.EventHandler(this.OnBtnCancelClicked);
this.btnApply.Clicked += new global::System.EventHandler(this.OnBtnApplyClicked);
}
}
}

View File

@@ -0,0 +1,90 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProjectGuid>{19FB7436-031F-42B3-87F6-8508F63EDADA}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>osrepodbmgr</RootNamespace>
<AssemblyName>osrepodbmgr</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="gtk-sharp, Version=2.4.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="gdk-sharp, Version=2.4.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="glib-sharp, Version=2.4.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="glade-sharp, Version=2.4.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="pango-sharp, Version=2.4.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="atk-sharp, Version=2.4.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="Mono.Posix" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Data.SQLite">
<HintPath>..\packages\System.Data.SQLite.Core.1.0.105.0\lib\net45\System.Data.SQLite.dll</HintPath>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="plist-cil">
<HintPath>..\packages\plist-cil.1.15.0\lib\net40\plist-cil.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="gtk-gui\gui.stetic">
<LogicalName>gui.stetic</LogicalName>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Compile Include="gtk-gui\generated.cs" />
<Compile Include="MainWindow.cs" />
<Compile Include="gtk-gui\MainWindow.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="frmHelp.cs" />
<Compile Include="gtk-gui\osrepodbmgr.frmHelp.cs" />
<Compile Include="frmSettings.cs" />
<Compile Include="gtk-gui\osrepodbmgr.frmSettings.cs" />
<Compile Include="Core.cs" />
<Compile Include="SHA256Context.cs" />
<Compile Include="DBCore.cs" />
<Compile Include="SQLite.cs" />
<Compile Include="DBEntries.cs" />
<Compile Include="Schema.cs" />
<Compile Include="Settings.cs" />
<Compile Include="PlatformID.cs" />
<Compile Include="DetectOS.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\System.Data.SQLite.Core.1.0.105.0\build\net45\System.Data.SQLite.Core.targets" Condition="Exists('..\packages\System.Data.SQLite.Core.1.0.105.0\build\net45\System.Data.SQLite.Core.targets')" />
</Project>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="plist-cil" version="1.15.0" targetFramework="net45" />
<package id="System.Data.SQLite.Core" version="1.0.105.0" targetFramework="net45" />
</packages>