Refactor: Separate engine code from GUI.

This commit is contained in:
2017-05-10 21:04:42 +01:00
parent 96e277615c
commit 17b464012c
28 changed files with 602 additions and 397 deletions

View File

@@ -25,68 +25,21 @@
// 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 System.Diagnostics;
using System.Threading;
using Gtk;
using Schemas;
using osrepodbmgr.Core;
namespace osrepodbmgr
{
static class MainClass
{
public static List<string> files;
public static Dictionary<string, DBFile> hashes;
public static string path;
public static DBEntry dbInfo;
public static bool unarUsable;
public delegate void UnarChangeStatusDelegate();
public static event UnarChangeStatusDelegate UnarChangeStatus;
public static string tmpFolder;
public static long noFilesInArchive;
public static string archiveFormat;
public static Process unarProcess;
public static bool copyArchive;
public static string selectedFile;
public static OpticalDiscType workingDisc;
public static BlockMediaType workingDisk;
public static CICMMetadataType metadata;
public static void Main(string[] args)
{
Settings.LoadSettings();
CheckUnar();
Core.Settings.LoadSettings();
Context.CheckUnar();
Application.Init();
frmAdd win = new frmAdd();
win.Show();
Application.Run();
}
public static void CheckUnar()
{
Core.Finished += CheckUnarFinished;
Core.Failed += CheckUnarFailed;
Thread thdCheckUnar = new Thread(Core.CheckUnar);
thdCheckUnar.Start();
}
static void CheckUnarFinished()
{
unarUsable = true;
if(UnarChangeStatus != null)
UnarChangeStatus();
Core.Finished -= CheckUnarFinished;
Core.Failed -= CheckUnarFailed;
}
static void CheckUnarFailed(string text)
{
unarUsable = false;
if(UnarChangeStatus != null)
UnarChangeStatus();
Core.Finished -= CheckUnarFinished;
Core.Failed -= CheckUnarFailed;
}
}
}