New custom console

master
1987kostya 4 years ago
parent 148bdf0682
commit 87e3174ffa

@ -149,6 +149,12 @@
<Compile Include="GUI\HexViewForm.Designer.cs">
<DependentUpon>HexViewForm.cs</DependentUpon>
</Compile>
<Compile Include="GUI\MainConsole.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="GUI\MainConsole.Designer.cs">
<DependentUpon>MainConsole.cs</DependentUpon>
</Compile>
<Compile Include="GUI\MainForm.cs">
<SubType>Form</SubType>
</Compile>
@ -263,6 +269,9 @@
<EmbeddedResource Include="GUI\HexViewForm.resx">
<DependentUpon>HexViewForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="GUI\MainConsole.resx">
<DependentUpon>MainConsole.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="GUI\MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource>

@ -0,0 +1,28 @@
using System;
using System.Runtime.CompilerServices;
using System.Windows.Forms;
namespace DotNetCTFDumper.GUI
{
public partial class MainConsole : Form
{
public static MainConsole inst;
public MainConsole()
{
inst = this;
InitializeComponent();
this.Closing += (a,b) =>
{
Environment.Exit(0);
};
}
public static void Message(string msg)
{
var date = DateTime.Now;
inst.textBox1.AppendText(msg.Length > 0
? $"[{date.Hour,2}:{date.Minute,2}:{date.Second,2}:{date.Millisecond,3}] {msg}\r\n"
: "\r\n");
}
}
}

@ -24,10 +24,7 @@ namespace DotNetCTFDumper.MMFParser.EXE
chunk.Read(exeReader);
chunk.Loader = LoadChunk(chunk);
Chunks.Add(chunk);
if (chunk.Id == 8750)
{
chunk.BuildKey();
}
if (chunk.Id == 8750) chunk.BuildKey();
if (exeReader.Tell() >= exeReader.Size()) break;
if (chunk.Id == 32639) break; //LAST chunkID
}
@ -132,14 +129,13 @@ namespace DotNetCTFDumper.MMFParser.EXE
Settings.AppName=_chunkList.GetChunk<AppName>()?.Value;
Settings.Copyright = _chunkList.GetChunk<Copyright>()?.Value;
Settings.ProjectPath = _chunkList.GetChunk<EditorFilename>()?.Value;
Settings.AppName=_chunkList.GetChunk<AppName>()?.Value??"";
Settings.Copyright = _chunkList.GetChunk<Copyright>()?.Value??"";
Settings.ProjectPath = _chunkList.GetChunk<EditorFilename>()?.Value??"";
if (Exe.Instance.GameData.ProductBuild > 284)Decryption.MakeKey(Settings.AppName,Settings.Copyright,Settings.ProjectPath);
else Decryption.MakeKey(Settings.ProjectPath, Settings.AppName, Settings.Copyright);
Logger.Log("New Key!");
@ -255,12 +251,7 @@ namespace DotNetCTFDumper.MMFParser.EXE
}
if (loader != null)
{
//Logger.Log($"Reading {loader.GetType().Name}...",true,ConsoleColor.Yellow);
loader.Read();
}
if (loader != null) loader.Read();
return loader;
}

@ -1,6 +1,7 @@
using System;
using System.Data.OleDb;
using System.IO;
using DotNetCTFDumper.GUI;
using DotNetCTFDumper.Utils;
namespace DotNetCTFDumper.MMFParser.EXE
@ -73,6 +74,7 @@ namespace DotNetCTFDumper.MMFParser.EXE
{
PackData = new PackData();
PackData.Read(exeReader);
GameData = new GameData();
GameData.Read(exeReader);
Console.ForegroundColor = ConsoleColor.DarkGreen;

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using DotNetCTFDumper.GUI;
using DotNetCTFDumper.MMFParser.EXE.Loaders;
using DotNetCTFDumper.MMFParser.EXE.Loaders.Banks;
using DotNetCTFDumper.Utils;

@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using DotNetCTFDumper.GUI;
using DotNetCTFDumper.Utils;
namespace DotNetCTFDumper.MMFParser.EXE.Loaders

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using DotNetCTFDumper.GUI;
using DotNetCTFDumper.Utils;
namespace DotNetCTFDumper.MMFParser.EXE

@ -253,14 +253,6 @@ namespace DotNetCTFDumper.MMFParser.Translation
}
}
}
newFrame.Items = newFrameItems;
newFrame.Instances = newInstances;
newFrame.Folders=new List<ItemFolder>();

@ -39,9 +39,12 @@ namespace DotNetCTFDumper
Settings.UseGUI = true;
MyForm = new MainForm();
var console = new MainConsole();
console.Show();
Application.Run(MyForm);
}

@ -1,13 +1,14 @@
using System;
using System.IO;
using System.Web.UI.WebControls;
using DotNetCTFDumper.GUI;
namespace DotNetCTFDumper.Utils
{
public static class Logger
{
static StreamWriter _writer;
public static void Log(string text, bool logToScreen = true,ConsoleColor color = ConsoleColor.White)
public static void Log(string text, bool logToScreen = true,ConsoleColor color = ConsoleColor.White, bool logToConsole=true)
{
if (_writer == null)
{
@ -24,6 +25,8 @@ namespace DotNetCTFDumper.Utils
Console.WriteLine(Helper.GetCurrentTime()+text);
Console.ForegroundColor = ConsoleColor.White;
}
if(logToConsole) MainConsole.Message(text);
}

Loading…
Cancel
Save