From de5ac2a3bd89099bb39c7a809047a8729abaf206 Mon Sep 17 00:00:00 2001 From: BahaBulle Date: Wed, 18 May 2016 16:48:39 +0200 Subject: [PATCH] Use new log system from Hack.Tools --- Hack.Xenosaga/Common/Variables.cs | 7 ++++++- Hack.Xenosaga/Process/Unpack.cs | 31 ++++++++++++++++--------------- Hack.Xenosaga/Xenosaga.cs | 4 +++- 3 files changed, 25 insertions(+), 17 deletions(-) diff --git a/Hack.Xenosaga/Common/Variables.cs b/Hack.Xenosaga/Common/Variables.cs index 84265e5..734786c 100644 --- a/Hack.Xenosaga/Common/Variables.cs +++ b/Hack.Xenosaga/Common/Variables.cs @@ -1,4 +1,5 @@ using System.Text; +using Hack.Tools.TraceLog; namespace Hack.Xenosaga.Common { @@ -12,6 +13,8 @@ namespace Hack.Xenosaga.Common public bool regroup; } + public static TraceLog traceLog; + public const string dirUnpack = "01-UNPACK/"; public const string dirExtract = "02-EXTRACT/"; public const string dirInsert = "03-INSERT/"; @@ -19,6 +22,8 @@ namespace Hack.Xenosaga.Common public const string dirFinal = "05-FINAL/"; public const string tblCard = "TABLES/card_ANSI.tbl"; - public const string tblEvt = "TABLES/evt_ANSI.tbl"; + public const string tblEvtBox = "TABLES/evt_box_ANSI.tbl"; + public const string tblEvtVideo = "TABLES/evt_video_ANSI.tbl"; + public const string tblEvtItem = "TABLES/evtitem_ANSI.tbl"; } } diff --git a/Hack.Xenosaga/Process/Unpack.cs b/Hack.Xenosaga/Process/Unpack.cs index 6c4ed92..f0cffe7 100644 --- a/Hack.Xenosaga/Process/Unpack.cs +++ b/Hack.Xenosaga/Process/Unpack.cs @@ -3,6 +3,7 @@ using System.IO; using System.Diagnostics; using System.Text; using Hack.Xenosaga.Common; +using Hack.Tools.TraceLog; namespace Hack.Xenosaga.Process { @@ -506,28 +507,28 @@ namespace Hack.Xenosaga.Process Directory.CreateDirectory(Variables.dirUnpack); outputName = string.Format("{0}{1}{2}", Variables.dirUnpack, indexName, _listExtension); - using (StreamWriter sw = new StreamWriter(outputName)) - { - Functions.ManageListener(false, true, sw); + Variables.traceLog.Off(typeTraceListeners.CONSOLE); + Variables.traceLog.On(typeTraceListeners.FILE, outputName); - bIndexNbSector = readIndex(indexName, index); - index.SortBySector(); - iIndexSize = bIndexNbSector * _sectorSize; + bIndexNbSector = readIndex(indexName, index); + index.SortBySector(); + iIndexSize = bIndexNbSector * _sectorSize; - foreach (pathElement entryPath in index.getEntries()) + foreach (pathElement entryPath in index.getEntries()) + { + if (!entryPath.IsDirectory) { - if (!entryPath.IsDirectory) - { - double d = (entryPath.Position - iIndexSize) / _maxSizeFile; - int id = (int)Math.Floor(d) + 1; + double d = (entryPath.Position - iIndexSize) / _maxSizeFile; + int id = (int)Math.Floor(d) + 1; - Trace.WriteLine(string.Format("{0,-36}Sector={1,-15}SizeIn={2,-15}SizeOut={3,-15}File=xenosaga.{4:D2}", entryPath.FullPath, entryPath.Sector, entryPath.SizeIn, entryPath.SizeOut, id + numFile)); - } + Trace.WriteLine(string.Format("{0,-36}Sector={1,-15}SizeIn={2,-15}SizeOut={3,-15}File=xenosaga.{4:D2}", entryPath.FullPath, entryPath.Sector, entryPath.SizeIn, entryPath.SizeOut, id + numFile)); } - - Functions.ManageListener(true, false); } + Variables.traceLog.On(typeTraceListeners.CONSOLE); + Variables.traceLog.Off(typeTraceListeners.FILE, outputName); + Variables.traceLog.Close(outputName); + Trace.WriteLine("OK"); } catch (Exception ex) diff --git a/Hack.Xenosaga/Xenosaga.cs b/Hack.Xenosaga/Xenosaga.cs index 5cfabd1..40a26b4 100644 --- a/Hack.Xenosaga/Xenosaga.cs +++ b/Hack.Xenosaga/Xenosaga.cs @@ -1,6 +1,7 @@ using System.Diagnostics; using Hack.Xenosaga.Common; using Hack.Xenosaga.Process; +using Hack.Tools.TraceLog; namespace Hack.Xenosaga { @@ -9,7 +10,8 @@ namespace Hack.Xenosaga public static void Main(string[] args) { Variables.stArgs listArgs; - Functions.ManageListener(true); + Variables.traceLog = new TraceLog(); + Variables.traceLog.On(typeTraceListeners.CONSOLE); Trace.WriteLine("Hack.Xenosaga - (c) 2016 BahaBulle\n");