commit c3ed2192b8b081e8a32fff9e0315692eb79ffe2e Author: Natalia Portillo Date: Thu Apr 20 06:56:49 2017 +0100 Initial version. diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4e82d27 --- /dev/null +++ b/.gitignore @@ -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 diff --git a/osrepodbmgr.sln b/osrepodbmgr.sln new file mode 100644 index 0000000..669c080 --- /dev/null +++ b/osrepodbmgr.sln @@ -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 diff --git a/osrepodbmgr/ChangeLog b/osrepodbmgr/ChangeLog new file mode 100644 index 0000000..0a7538d --- /dev/null +++ b/osrepodbmgr/ChangeLog @@ -0,0 +1,25 @@ +2017-04-20 Natalia Portillo + + * 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. + diff --git a/osrepodbmgr/Core.cs b/osrepodbmgr/Core.cs new file mode 100644 index 0000000..fdd51d9 --- /dev/null +++ b/osrepodbmgr/Core.cs @@ -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(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(); + 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 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 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(); + } + } +} diff --git a/osrepodbmgr/DBCore.cs b/osrepodbmgr/DBCore.cs new file mode 100644 index 0000000..ae46b9e --- /dev/null +++ b/osrepodbmgr/DBCore.cs @@ -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(); + } +} \ No newline at end of file diff --git a/osrepodbmgr/DBEntries.cs b/osrepodbmgr/DBEntries.cs new file mode 100644 index 0000000..87a8afc --- /dev/null +++ b/osrepodbmgr/DBEntries.cs @@ -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 entries) + { + entries = new List(); + + 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; + } + } +} + diff --git a/osrepodbmgr/DetectOS.cs b/osrepodbmgr/DetectOS.cs new file mode 100644 index 0000000..6c10da3 --- /dev/null +++ b/osrepodbmgr/DetectOS.cs @@ -0,0 +1,217 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : DetectOS.cs +// Author(s) : Natalia Portillo +// +// 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 + { + /// + /// POSIX uname structure, size from OSX, big enough to handle extra fields + /// + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + struct utsname + { + /// + /// System name + /// + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] + public string sysname; + /// + /// Node name + /// + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] + public string nodename; + /// + /// Release level + /// + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] + public string release; + /// + /// Version level + /// + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] + public string version; + /// + /// Hardware level + /// + [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; + } + } + } + + /// + /// Checks if the underlying runtime runs in 64-bit mode + /// + public static bool Is64Bit() + { + return IntPtr.Size == 8; + } + + /// + /// Checks if the underlying runtime runs in 32-bit mode + /// + public static bool Is32Bit() + { + return IntPtr.Size == 4; + } + } +} \ No newline at end of file diff --git a/osrepodbmgr/MainWindow.cs b/osrepodbmgr/MainWindow.cs new file mode 100644 index 0000000..fd1266a --- /dev/null +++ b/osrepodbmgr/MainWindow.cs @@ -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 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(); + } +} diff --git a/osrepodbmgr/PlatformID.cs b/osrepodbmgr/PlatformID.cs new file mode 100644 index 0000000..9c2bde5 --- /dev/null +++ b/osrepodbmgr/PlatformID.cs @@ -0,0 +1,189 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : PlatformID.cs +// Author(s) : Natalia Portillo +// +// 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 + { + /// + /// Win32s + /// + Win32S = 0, + /// + /// Win32 (Windows 9x) + /// + Win32Windows = 1, + /// + /// Windows NT + /// + Win32NT = 2, + /// + /// Windows Mobile + /// + WinCE = 3, + /// + /// UNIX (do not use, too generic) + /// + Unix = 4, + /// + /// Xbox 360 + /// + Xbox = 5, + /// + /// OS X + /// + MacOSX = 6, + /// + /// iOS is not OS X + /// + iOS = 7, + /// + /// Linux + /// + Linux = 8, + /// + /// Sun Solaris + /// + Solaris = 9, + /// + /// NetBSD + /// + NetBSD = 10, + /// + /// OpenBSD + /// + OpenBSD = 11, + /// + /// FreeBSD + /// + FreeBSD = 12, + /// + /// DragonFly BSD + /// + DragonFly = 13, + /// + /// Nintendo Wii + /// + Wii = 14, + /// + /// Nintendo Wii U + /// + WiiU = 15, + /// + /// Sony PlayStation 3 + /// + PlayStation3 = 16, + /// + /// Sony Playstation 4 + /// + PlayStation4 = 17, + /// + /// Google Android + /// + Android = 18, + /// + /// Samsung Tizen + /// + Tizen = 19, + /// + /// Windows Phone + /// + WindowsPhone = 20, + /// + /// GNU/Hurd + /// + Hurd = 21, + /// + /// Haiku + /// + Haiku = 22, + /// + /// HP-UX + /// + HPUX = 23, + /// + /// AIX + /// + AIX = 24, + /// + /// OS/400 + /// + OS400 = 25, + /// + /// IRIX + /// + IRIX = 26, + /// + /// Minix + /// + Minix = 27, + /// + /// NonStop + /// + NonStop = 28, + /// + /// QNX + /// + QNX = 29, + /// + /// SINIX + /// + SINIX = 30, + /// + /// Tru64 UNIX + /// + Tru64 = 31, + /// + /// Ultrix + /// + Ultrix = 32, + /// + /// SCO OpenServer / SCO UNIX + /// + OpenServer = 33, + /// + /// SCO UnixWare + /// + UnixWare = 34, + /// + /// IBM z/OS + /// + zOS = 35, + Unknown = -1 + } +} \ No newline at end of file diff --git a/osrepodbmgr/Program.cs b/osrepodbmgr/Program.cs new file mode 100644 index 0000000..5727117 --- /dev/null +++ b/osrepodbmgr/Program.cs @@ -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 files; + public static Dictionary 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(); + } + } +} diff --git a/osrepodbmgr/Properties/AssemblyInfo.cs b/osrepodbmgr/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..8a9a1ff --- /dev/null +++ b/osrepodbmgr/Properties/AssemblyInfo.cs @@ -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("")] diff --git a/osrepodbmgr/SHA256Context.cs b/osrepodbmgr/SHA256Context.cs new file mode 100644 index 0000000..6a4976a --- /dev/null +++ b/osrepodbmgr/SHA256Context.cs @@ -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 +{ + /// + /// Provides a UNIX similar API to .NET SHA256. + /// + public class SHA256Context + { + SHA256 _sha256Provider; + + /// + /// Initializes the SHA256 hash provider + /// + public void Init() + { + _sha256Provider = SHA256.Create(); + } + + /// + /// Updates the hash with data. + /// + /// Data buffer. + /// Length of buffer to hash. + public void Update(byte[] data, uint len) + { + _sha256Provider.TransformBlock(data, 0, (int)len, data, 0); + } + + /// + /// Updates the hash with data. + /// + /// Data buffer. + public void Update(byte[] data) + { + Update(data, (uint)data.Length); + } + + /// + /// Returns a byte array of the hash value. + /// + public byte[] Final() + { + _sha256Provider.TransformFinalBlock(new byte[0], 0, 0); + return _sha256Provider.Hash; + } + + /// + /// Returns a hexadecimal representation of the hash value. + /// + 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(); + } + + /// + /// Gets the hash of a file + /// + /// File path. + public byte[] File(string filename) + { + FileStream fileStream = new FileStream(filename, FileMode.Open); + return _sha256Provider.ComputeHash(fileStream); + } + + /// + /// Gets the hash of a file in hexadecimal and as a byte array. + /// + /// File path. + /// Byte array of the hash value. + 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(); + } + + /// + /// Gets the hash of the specified data buffer. + /// + /// Data buffer. + /// Length of the data buffer to hash. + /// Byte array of the hash value. + 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(); + } + + /// + /// Gets the hash of the specified data buffer. + /// + /// Data buffer. + /// Byte array of the hash value. + public string Data(byte[] data, out byte[] hash) + { + return Data(data, (uint)data.Length, out hash); + } + } +} + diff --git a/osrepodbmgr/SQLite.cs b/osrepodbmgr/SQLite.cs new file mode 100644 index 0000000..19710a3 --- /dev/null +++ b/osrepodbmgr/SQLite.cs @@ -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 + } +} + diff --git a/osrepodbmgr/Schema.cs b/osrepodbmgr/Schema.cs new file mode 100644 index 0000000..ab749b8 --- /dev/null +++ b/osrepodbmgr/Schema.cs @@ -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);"; + } +} + diff --git a/osrepodbmgr/Settings.cs b/osrepodbmgr/Settings.cs new file mode 100644 index 0000000..0701c5f --- /dev/null +++ b/osrepodbmgr/Settings.cs @@ -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; + } + } +} + diff --git a/osrepodbmgr/frmHelp.cs b/osrepodbmgr/frmHelp.cs new file mode 100644 index 0000000..d998972 --- /dev/null +++ b/osrepodbmgr/frmHelp.cs @@ -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(); + } + } +} diff --git a/osrepodbmgr/frmSettings.cs b/osrepodbmgr/frmSettings.cs new file mode 100644 index 0000000..55c0f29 --- /dev/null +++ b/osrepodbmgr/frmSettings.cs @@ -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(); + } + } +} diff --git a/osrepodbmgr/gtk-gui/MainWindow.cs b/osrepodbmgr/gtk-gui/MainWindow.cs new file mode 100644 index 0000000..cd49a6b --- /dev/null +++ b/osrepodbmgr/gtk-gui/MainWindow.cs @@ -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); + } +} diff --git a/osrepodbmgr/gtk-gui/generated.cs b/osrepodbmgr/gtk-gui/generated.cs new file mode 100644 index 0000000..f916e7a --- /dev/null +++ b/osrepodbmgr/gtk-gui/generated.cs @@ -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; + } + } +} diff --git a/osrepodbmgr/gtk-gui/gui.stetic b/osrepodbmgr/gtk-gui/gui.stetic new file mode 100644 index 0000000..f46562c --- /dev/null +++ b/osrepodbmgr/gtk-gui/gui.stetic @@ -0,0 +1,1150 @@ + + + + .. + + + + + + + + MainWindow + CenterOnParent + + + + + 6 + + + + 6 + + + + Developer + + + 0 + True + False + False + + + + + + True + False + + + + 1 + True + + + + + 0 + True + False + False + + + + + + 6 + + + + Product + + + 0 + True + False + False + + + + + + True + False + + + + 1 + True + + + + + 1 + True + False + False + + + + + + 6 + + + + Version + + + 0 + True + False + False + + + + + + True + False + + + + 1 + True + + + + + 2 + True + False + False + + + + + + 6 + + + + Languages + + + 0 + True + False + False + + + + + + True + False + + + + 1 + True + + + + + 3 + True + False + False + + + + + + 6 + + + + Architecture + + + 0 + True + False + False + + + + + + True + False + + + + 1 + True + + + + + 4 + True + False + False + + + + + + 6 + + + + Machine + + + 0 + True + False + False + + + + + + True + False + + + + 1 + True + + + + + 5 + True + False + False + + + + + + 6 + + + + Format + + + 0 + True + False + False + + + + + + True + False + + + + 1 + True + + + + + 6 + True + False + False + + + + + + 6 + + + + Description + + + 0 + True + False + False + + + + + + True + False + + + + 1 + True + + + + + 7 + True + False + False + + + + + + 6 + + + + 6 + + + + False + True + oem + True + True + True + + + 0 + True + False + False + + + + + + False + True + upgrade + True + True + True + + + 1 + True + False + False + + + + + + False + True + source + True + True + True + + + 2 + True + False + False + + + + + 0 + True + + + + + + 6 + + + + False + True + update + True + True + True + + + 0 + True + False + False + + + + + + False + True + files + True + True + True + + + 1 + True + False + False + + + + + + False + True + netinstall + True + True + True + + + 2 + True + False + False + + + + + 1 + True + + + + + 8 + True + False + False + + + + + + In + + + + True + True + + + + + 9 + True + + + + + + 6 + + + + False + label2 + + + 0 + True + False + False + + + + + + False + + + 1 + True + + + + + 10 + True + False + False + + + + + + 6 + + + + False + label22 + + + 0 + True + False + False + + + + + + False + + + 1 + True + + + + + 11 + True + False + False + + + + + + 6 + + + + True + True + StockItem + gtk-quit + + gtk-quit + + + End + 0 + True + False + False + + + + + + True + TextAndIcon + stock:gtk-preferences Menu + _Settings + True + + + + End + 1 + True + False + False + + + + + + True + True + StockItem + gtk-help + + gtk-help + + + End + 2 + True + False + False + + + + + + False + True + TextAndIcon + stock:gtk-close Menu + _Close + True + + + + End + 3 + True + False + False + + + + + + False + False + True + TextAndIcon + stock:gtk-save Menu + _Pack... + True + + + End + 4 + True + False + False + + + + + + False + True + TextAndIcon + stock:gtk-add Menu + Add to _DB + True + + + + End + 5 + True + False + False + + + + + + True + TextAndIcon + stock:gtk-open Menu + Open _archive + True + + + End + 6 + True + False + False + + + + + + True + TextAndIcon + stock:gtk-open Menu + Open _folder + True + + + + End + 7 + True + False + False + + + + + + False + True + True + StockItem + gtk-stop + + gtk-stop + + + End + 8 + True + False + False + + + + + 12 + True + False + False + + + + + + + + Help + Dialog + CenterOnParent + True + + + + 6 + + + + In + + + + True + True + False + This is the naming scheme and folder organization conventions for the Operating System Repository. + +The basic layout is as follows: + +<Developer>/<Product>/<Version>/<Language>/<Architecture>/oem/for <Machine>/<[format]_update/upgrade/files/source/netinstall/description>.zip +All fields should contain only 7-bit ASCII. + +<Developer> +----------- +This is the main developer of the operating system or associated software. e.g. Microsoft + +<Product> +--------- +This is the name of the operating system or associated software. e.g. Windows NT + +<Version> +--------- +This is the version of the operating system or associated software. e.g. 6.00.6000.16386 +Service pack and release markers should be appended. e.g. 6.10.7601.16385 (RTM) +Build can be specified by appending "build". e.g. 10.2.7 build 6S80 +And combined. e.g. 10.5 build 9A581 (Server) +Version with same version number but different build date should have it appended. Date format should be YYYYmm[dd]. e.g. 10 201009 + +<Language> +---------- +This specifies the language localization and translation: +xxx: Language variation, e.g. German = deu +xxx_yy: Country specific language variation. e.g. Swiss German = deu_ch +multi: The only known variation of the product that contains more than a language +xxx,xxx,xxx and xxx_yy,xxx_yy,xxx_yy: The variation contains more than a single language +Where xxx is the ISO-639-2/T language code and yy is the ISO-3166-1 alpha-2 country code. +https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes +https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 +If the product has ever been only released in one language variation, being it English (like CP/M) or multilanguage (like Mac OS X and Linux), this field should be omitted. + +<Architecture> +-------------- +The processor architecture the product is compiled for. +Omitted if it has only ever been compiled for a single one, contains all supported ones in same files, or it is source code containing support for several of them. +Exact one depends on the product (that is, the one that the product uses to identify itself, should be used). Examples: +* x86, i86, i386, i486, i586, i686, ia32: Intel Architecture 32 aka 8086 aka iAPX86 +* x64, amd64, x86_64: AMD64 aka x86_64 aka EM64T +* ia64: Intel Architecture 64 aka Itanium +* sparc: SPARC +* sun4u, sun4m, sun1, sun2, sun3: Specific Sun architectures that specify not only the processor architecture but the whole system one. +* 68k, ppc, fat: For products that run under Mac OS indicate they require a Macintosh, a Power Macintosh, or can run on both, respectively. +* rpi, rpi2, beaglebone, bananapi: Specific whole systems that share a processor architecture but require a completely different variant. + +oem +--- +Present if the variant is OEM. Omitted otherwise. + +for <Machine> +------------- +Present if the variant requires a specific computer to run. +Useful for computer restoration variants. +e.g. for Power Mac 5200 +e.g. for Tandy 1000 + +<[format]/update/upgrade/files/source/netinstall/description>.zip +----------------------------------------------------------------- +This is the file containing the product itself. +It should be compressed using ZIP with certain parameters (see below). +Several of them can be combined separated with underscores. +Naming as following: +* [format]: If the variation is encoded in a disk image format that's neither a simple dump of sectors (.iso/.dsk/.xdf) or a BinCue/BinToc (.bin+.cue/.bin+.toc) format should be substituted to a descriptive name for the format. e.g.: [Nero], [CloneCD] +* update: Should be used when the product requires and updates a previous point release or build to the new one. Product version should be the updated, not the required, one. e.g.: 1.3 updates to 1.3.1 or 2.0 updates to 2.5 +* upgrade: Should be used when the product requires and updates a previous version to the new one. Product version should be the updated, not the required, one. e.g.: 2.0 updates to 3.0 or MS-DOS updates to Windows 95. +* files: Should be used when the contents of the product disks are dumped as is (copied from the media) or it contains already installed files. +* source: Should be used when it contains the source code for the product. +* netinstall: Similar to files except that the files are designed to be put in a network share for remote installation of the product. +* description: Free form description or product part number if it is known. + +Compression +----------- +The product should be compressed using ZIP with Deflate algorithm and UTF-8 headers. Zip64 extensions may be used. UNIX extensions MUST be used for products that require them (e.g. it contains softlinks). +In the doubt, use Info-ZIP with following parameters: +zip -9ry -dd archive.zip . +If the product requires Acorn, BeOS or OS/2 extended attributes it should be compressed using the corresponding Info-ZIP version under that operating system so the required extension is used. +DO NOT recompress archives in an operating system which zip product doesn't support all already present headers. +DO NOT use TorrentZip. It discards all headers as well as date stamps. +DO NOT use Mac OS headers. For conserving FinderInfo and Resource Fork see below. + +FinderInfo and Resource Fork +---------------------------- +FinderInfo and Resource Fork should be stored as Mac OS X AppleDouble format: file and ._file +This format is understand by all Mac OS X versions under any filesystem or a CIFS/SMB network share. +Also mkisofs recognizes it and is able to create an HFS partition with them correctly set. +Other formats should be converted to this one. + +Metadata +-------- +Each archive should be accompanied with a JSON metadata file using the CICM Metadata format. Name for metadata sidecar should be same as the archive changing the extension to .json. +If the archive can be modified (doesn't contain ZIP headers you would lose) the metadata should be put inside the archive as a file named metadata.json. + +Recovery +-------- +Disks fail, bit rot happens, so every archive as well as the metadata file should have a PAR2 recovery set created. +Example command line (with 5% redundancy): +par2 c -r5 archive.par2 archive.zip archive.json + +Result +------ +In the end you get something like this: +Apple/Mac OS/9.1/eng/for iMac (Early 2001) v1.1/archive.json +Apple/Mac OS/9.1/eng/for iMac (Early 2001) v1.1/archive.par2 +Apple/Mac OS/9.1/eng/for iMac (Early 2001) v1.1/archive.vol000+01.par2 +Apple/Mac OS/9.1/eng/for iMac (Early 2001) v1.1/archive.vol001+02.par2 +Apple/Mac OS/9.1/eng/for iMac (Early 2001) v1.1/archive.vol003+04.par2 +Apple/Mac OS/9.1/eng/for iMac (Early 2001) v1.1/archive.vol007+08.par2 +Apple/Mac OS/9.1/eng/for iMac (Early 2001) v1.1/archive.vol015+16.par2 +Apple/Mac OS/9.1/eng/for iMac (Early 2001) v1.1/archive.vol031+32.par2 +Apple/Mac OS/9.1/eng/for iMac (Early 2001) v1.1/archive.vol063+37.par2 +Apple/Mac OS/9.1/eng/for iMac (Early 2001) v1.1/archive.zip +QNX/QNX/20090229/source.json +QNX/QNX/20090229/source.par2 +QNX/QNX/20090229/source.vol000+01.par2 +QNX/QNX/20090229/source.vol001+02.par2 +QNX/QNX/20090229/source.vol003+04.par2 +QNX/QNX/20090229/source.vol007+08.par2 +QNX/QNX/20090229/source.vol015+16.par2 +QNX/QNX/20090229/source.vol031+32.par2 +QNX/QNX/20090229/source.vol063+37.par2 +QNX/QNX/20090229/source.zip + + + + + 0 + True + + + + + + True + True + StockItem + gtk-ok + + gtk-ok + + + 1 + True + False + False + + + + + + + + frmSettings + CenterOnParent + + + + 6 + + + + 6 + + + + Database file + + + 0 + True + False + False + + + + + + True + True + + + + 1 + True + + + + + + True + TextAndIcon + stock:gtk-open Menu + Choose + True + + + + 2 + True + False + False + + + + + 0 + True + False + False + + + + + + 6 + + + + Repository folder + + + 0 + True + False + False + + + + + + True + True + + + + 1 + True + + + + + + True + TextAndIcon + stock:gtk-open Menu + Choose + True + + + + 2 + True + False + False + + + + + 1 + True + False + False + + + + + + 6 + + + + Temporary folder + + + 0 + True + False + False + + + + + + True + True + + + + 1 + True + + + + + + True + TextAndIcon + stock:gtk-open Menu + Choose + True + + + + 2 + True + False + False + + + + + 2 + True + False + False + + + + + + 6 + + + + Path to unar + + + 0 + True + False + False + + + + + + True + True + + + + 1 + True + + + + + + True + TextAndIcon + stock:gtk-open Menu + Choose + True + + + + 2 + True + False + False + + + + + 3 + True + False + False + + + + + + 6 + + + + True + True + StockItem + gtk-cancel + + gtk-cancel + + + 0 + True + False + False + + + + + + True + True + StockItem + gtk-apply + + gtk-apply + + + End + 1 + True + False + False + + + + + 4 + True + False + False + + + + + + \ No newline at end of file diff --git a/osrepodbmgr/gtk-gui/osrepodbmgr.frmHelp.cs b/osrepodbmgr/gtk-gui/osrepodbmgr.frmHelp.cs new file mode 100644 index 0000000..8c277ee --- /dev/null +++ b/osrepodbmgr/gtk-gui/osrepodbmgr.frmHelp.cs @@ -0,0 +1,65 @@ + +// This file has been generated by the GUI designer. Do not modify. +namespace osrepodbmgr +{ + public partial class frmHelp + { + private global::Gtk.VBox vbox4; + + private global::Gtk.ScrolledWindow GtkScrolledWindow; + + private global::Gtk.TextView txtHelp; + + private global::Gtk.Button btnOK; + + protected virtual void Build() + { + global::Stetic.Gui.Initialize(this); + // Widget osrepodbmgr.frmHelp + this.Name = "osrepodbmgr.frmHelp"; + this.Title = global::Mono.Unix.Catalog.GetString("Help"); + this.TypeHint = ((global::Gdk.WindowTypeHint)(1)); + this.WindowPosition = ((global::Gtk.WindowPosition)(4)); + this.Modal = true; + // Container child osrepodbmgr.frmHelp.Gtk.Container+ContainerChild + this.vbox4 = new global::Gtk.VBox(); + this.vbox4.Name = "vbox4"; + this.vbox4.Spacing = 6; + // Container child vbox4.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.txtHelp = new global::Gtk.TextView(); + this.txtHelp.Buffer.Text = "This is the naming scheme and folder organization conventions for the Operating System Repository.\n\nThe basic layout is as follows:\n\n/////oem/for /<[format]_update/upgrade/files/source/netinstall/description>.zip\nAll fields should contain only 7-bit ASCII.\n\n\n-----------\nThis is the main developer of the operating system or associated software. e.g. Microsoft\n\n\n---------\nThis is the name of the operating system or associated software. e.g. Windows NT\n\n\n---------\nThis is the version of the operating system or associated software. e.g. 6.00.6000.16386\nService pack and release markers should be appended. e.g. 6.10.7601.16385 (RTM)\nBuild can be specified by appending \"build\". e.g. 10.2.7 build 6S80\nAnd combined. e.g. 10.5 build 9A581 (Server)\nVersion with same version number but different build date should have it appended. Date format should be YYYYmm[dd]. e.g. 10 201009\n\n\n----------\nThis specifies the language localization and translation:\nxxx: Language variation, e.g. German = deu\nxxx_yy: Country specific language variation. e.g. Swiss German = deu_ch\nmulti: The only known variation of the product that contains more than a language\nxxx,xxx,xxx and xxx_yy,xxx_yy,xxx_yy: The variation contains more than a single language\nWhere xxx is the ISO-639-2/T language code and yy is the ISO-3166-1 alpha-2 country code.\nhttps://en.wikipedia.org/wiki/List_of_ISO_639-1_codes\nhttps://en.wikipedia.org/wiki/ISO_3166-1_alpha-2\nIf the product has ever been only released in one language variation, being it English (like CP/M) or multilanguage (like Mac OS X and Linux), this field should be omitted.\n\n\n--------------\nThe processor architecture the product is compiled for.\nOmitted if it has only ever been compiled for a single one, contains all supported ones in same files, or it is source code containing support for several of them.\nExact one depends on the product (that is, the one that the product uses to identify itself, should be used). Examples:\n* x86, i86, i386, i486, i586, i686, ia32: Intel Architecture 32 aka 8086 aka iAPX86\n* x64, amd64, x86_64: AMD64 aka x86_64 aka EM64T\n* ia64: Intel Architecture 64 aka Itanium\n* sparc: SPARC\n* sun4u, sun4m, sun1, sun2, sun3: Specific Sun architectures that specify not only the processor architecture but the whole system one.\n* 68k, ppc, fat: For products that run under Mac OS indicate they require a Macintosh, a Power Macintosh, or can run on both, respectively.\n* rpi, rpi2, beaglebone, bananapi: Specific whole systems that share a processor architecture but require a completely different variant.\n\noem\n---\nPresent if the variant is OEM. Omitted otherwise.\n\nfor \n-------------\nPresent if the variant requires a specific computer to run.\nUseful for computer restoration variants.\ne.g. for Power Mac 5200\ne.g. for Tandy 1000\n\n<[format]/update/upgrade/files/source/netinstall/description>.zip\n-----------------------------------------------------------------\nThis is the file containing the product itself.\nIt should be compressed using ZIP with certain parameters (see below).\nSeveral of them can be combined separated with underscores.\nNaming as following:\n* [format]: If the variation is encoded in a disk image format that's neither a simple dump of sectors (.iso/.dsk/.xdf) or a BinCue/BinToc (.bin+.cue/.bin+.toc) format should be substituted to a descriptive name for the format. e.g.: [Nero], [CloneCD]\n* update: Should be used when the product requires and updates a previous point release or build to the new one. Product version should be the updated, not the required, one. e.g.: 1.3 updates to 1.3.1 or 2.0 updates to 2.5\n* upgrade: Should be used when the product requires and updates a previous version to the new one. Product version should be the updated, not the required, one. e.g.: 2.0 updates to 3.0 or MS-DOS updates to Windows 95.\n* files: Should be used when the contents of the product disks are dumped as is (copied from the media) or it contains already installed files.\n* source: Should be used when it contains the source code for the product.\n* netinstall: Similar to files except that the files are designed to be put in a network share for remote installation of the product.\n* description: Free form description or product part number if it is known.\n\nCompression\n-----------\nThe product should be compressed using ZIP with Deflate algorithm and UTF-8 headers. Zip64 extensions may be used. UNIX extensions MUST be used for products that require them (e.g. it contains softlinks).\nIn the doubt, use Info-ZIP with following parameters:\nzip -9ry -dd archive.zip .\nIf the product requires Acorn, BeOS or OS/2 extended attributes it should be compressed using the corresponding Info-ZIP version under that operating system so the required extension is used.\nDO NOT recompress archives in an operating system which zip product doesn't support all already present headers.\nDO NOT use TorrentZip. It discards all headers as well as date stamps.\nDO NOT use Mac OS headers. For conserving FinderInfo and Resource Fork see below.\n\nFinderInfo and Resource Fork\n----------------------------\nFinderInfo and Resource Fork should be stored as Mac OS X AppleDouble format: file and ._file\nThis format is understand by all Mac OS X versions under any filesystem or a CIFS/SMB network share.\nAlso mkisofs recognizes it and is able to create an HFS partition with them correctly set.\nOther formats should be converted to this one.\n\nMetadata\n--------\nEach archive should be accompanied with a JSON metadata file using the CICM Metadata format. Name for metadata sidecar should be same as the archive changing the extension to .json.\nIf the archive can be modified (doesn't contain ZIP headers you would lose) the metadata should be put inside the archive as a file named metadata.json.\n\nRecovery\n--------\nDisks fail, bit rot happens, so every archive as well as the metadata file should have a PAR2 recovery set created.\nExample command line (with 5% redundancy):\npar2 c -r5 archive.par2 archive.zip archive.json\n\nResult\n------\nIn the end you get something like this:\nApple/Mac OS/9.1/eng/for iMac (Early 2001) v1.1/archive.json\nApple/Mac OS/9.1/eng/for iMac (Early 2001) v1.1/archive.par2\nApple/Mac OS/9.1/eng/for iMac (Early 2001) v1.1/archive.vol000+01.par2\nApple/Mac OS/9.1/eng/for iMac (Early 2001) v1.1/archive.vol001+02.par2\nApple/Mac OS/9.1/eng/for iMac (Early 2001) v1.1/archive.vol003+04.par2\nApple/Mac OS/9.1/eng/for iMac (Early 2001) v1.1/archive.vol007+08.par2\nApple/Mac OS/9.1/eng/for iMac (Early 2001) v1.1/archive.vol015+16.par2\nApple/Mac OS/9.1/eng/for iMac (Early 2001) v1.1/archive.vol031+32.par2\nApple/Mac OS/9.1/eng/for iMac (Early 2001) v1.1/archive.vol063+37.par2\nApple/Mac OS/9.1/eng/for iMac (Early 2001) v1.1/archive.zip\nQNX/QNX/20090229/source.json\nQNX/QNX/20090229/source.par2\nQNX/QNX/20090229/source.vol000+01.par2\nQNX/QNX/20090229/source.vol001+02.par2\nQNX/QNX/20090229/source.vol003+04.par2\nQNX/QNX/20090229/source.vol007+08.par2\nQNX/QNX/20090229/source.vol015+16.par2\nQNX/QNX/20090229/source.vol031+32.par2\nQNX/QNX/20090229/source.vol063+37.par2\nQNX/QNX/20090229/source.zip"; + this.txtHelp.CanFocus = true; + this.txtHelp.Name = "txtHelp"; + this.txtHelp.Editable = false; + this.GtkScrolledWindow.Add(this.txtHelp); + this.vbox4.Add(this.GtkScrolledWindow); + global::Gtk.Box.BoxChild w2 = ((global::Gtk.Box.BoxChild)(this.vbox4[this.GtkScrolledWindow])); + w2.Position = 0; + // Container child vbox4.Gtk.Box+BoxChild + this.btnOK = new global::Gtk.Button(); + this.btnOK.CanFocus = true; + this.btnOK.Name = "btnOK"; + this.btnOK.UseStock = true; + this.btnOK.UseUnderline = true; + this.btnOK.Label = "gtk-ok"; + this.vbox4.Add(this.btnOK); + global::Gtk.Box.BoxChild w3 = ((global::Gtk.Box.BoxChild)(this.vbox4[this.btnOK])); + w3.Position = 1; + w3.Expand = false; + w3.Fill = false; + this.Add(this.vbox4); + if((this.Child != null)) + { + this.Child.ShowAll(); + } + this.DefaultWidth = 400; + this.DefaultHeight = 300; + this.Show(); + this.btnOK.Clicked += new global::System.EventHandler(this.OnBtnOKClicked); + } + } +} diff --git a/osrepodbmgr/gtk-gui/osrepodbmgr.frmSettings.cs b/osrepodbmgr/gtk-gui/osrepodbmgr.frmSettings.cs new file mode 100644 index 0000000..6f2804b --- /dev/null +++ b/osrepodbmgr/gtk-gui/osrepodbmgr.frmSettings.cs @@ -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); + } + } +} diff --git a/osrepodbmgr/osrepodbmgr.csproj b/osrepodbmgr/osrepodbmgr.csproj new file mode 100644 index 0000000..3366fdf --- /dev/null +++ b/osrepodbmgr/osrepodbmgr.csproj @@ -0,0 +1,90 @@ + + + + Debug + x86 + {19FB7436-031F-42B3-87F6-8508F63EDADA} + WinExe + osrepodbmgr + osrepodbmgr + v4.5 + + + true + full + false + bin\Debug + DEBUG; + prompt + 4 + x86 + + + true + bin\Release + prompt + 4 + x86 + + + + + False + + + False + + + False + + + False + + + False + + + False + + + + + ..\packages\System.Data.SQLite.Core.1.0.105.0\lib\net45\System.Data.SQLite.dll + + + + + ..\packages\plist-cil.1.15.0\lib\net40\plist-cil.dll + + + + + gui.stetic + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/osrepodbmgr/packages.config b/osrepodbmgr/packages.config new file mode 100644 index 0000000..e2cc649 --- /dev/null +++ b/osrepodbmgr/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file