Removed useless files

master
1987kostya 4 years ago
parent 5ed4b148e0
commit 97771e366a

@ -31,7 +31,7 @@ namespace DotNetCTFDumper.GUI
{ {
setLineFormat(1,1); setLineFormat(1,1);
textBox1.SelectionStart = textBox1.Text.Length; textBox1.SelectionStart = textBox1.Text.Length;
// scroll it automatically
textBox1.ScrollToCaret(); textBox1.ScrollToCaret();
} }

@ -1,4 +1,5 @@
using System; using System;
using System.Diagnostics;
using System.Drawing; using System.Drawing;
using System.IO; using System.IO;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
@ -89,8 +90,11 @@ namespace DotNetCTFDumper
var exeReader = new ByteReader(path, FileMode.Open); var exeReader = new ByteReader(path, FileMode.Open);
var currentExe = new Exe(); var currentExe = new Exe();
Exe.Instance = currentExe; Exe.Instance = currentExe;
var stopWatch = new Stopwatch();
stopWatch.Start();
currentExe.ParseExe(exeReader); currentExe.ParseExe(exeReader);
Logger.Log("Finished!", true, ConsoleColor.Yellow); stopWatch.Stop();
Logger.Log("Finished in "+stopWatch.Elapsed.ToString("g"), true, ConsoleColor.Yellow);
return; return;
if (File.Exists(path)) if (File.Exists(path))
{ {

@ -1,226 +0,0 @@
using NetMFAPatcher.Utils;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
namespace NetMFAPatcher.Chunks
{
class ImageBank:ChunkLoader
{
public override void Print()
{
}
public override void Read()
{
reader = new ByteIO(chunk.chunk_data);
var number_of_items = reader.ReadUInt32();
Console.WriteLine("Total images: "+number_of_items);
Console.WriteLine("OnImageBankStart: " + reader.Tell());
for (int i = 0; i < number_of_items; i++)
{
var item = new ImageItem();
item.reader = reader;
item.Read();
item.Save(i.ToString()+".raw");
}
}
}
class ImageItem:ChunkLoader
{
int handle;
int position;
int checksum;
int references;
int width;
int height;
int graphic_mode;
int x_hotspot;
int y_hotspot;
int action_x;
int action_y;
//tranparent,add later
int indexed;
byte[] image;
byte[] alpha;
private int currentSize;
private byte[] currentImage;
private byte[] curPoints;
private int currentN;
public void ReadRGB(byte[] data,int width,int heigth,TestPoint pointClass)
{
var n = 0;
var i = 0;
List<byte> points = new List<byte>();
var pad = GetPadding(width, 3);
for (int y = 0; y < heigth; y++)
{
for (int x = 0; x < width; x++)
{
points.AddRange(pointClass.Read(data, n));
n += 3;//pointClass.size;
i += 1;
}
n += 3;//(int)pad + pointClass.size;
}
curPoints = points.ToArray();
currentN = n;
}
public void ReadAlpha(byte[] data, int width, int heigth, int position)
{
var n = 0;
var i = 0;
List<byte> points = new List<byte>();
var pad = GetPadding(width, 1, 4);
for (int y = 0; y < heigth; y++)
{
for (int x = 0; x < heigth; x++)
{
points[i] = data[n + position];
n++;
i++;
}
n += (int)pad;
}
curPoints = points.ToArray();
}
public double GetPadding(int width,int classSize,int bytes=2)
{
var pad = bytes - ((width * classSize) % bytes);
if (pad == bytes) pad = 0;
var padding = Math.Ceiling((float)(pad / classSize));
return padding;//Correct
}
public override void Read()
{
handle = reader.ReadInt32();
position = (int)reader.Tell();
Load();
}
public void Load()
{
reader.Seek(position);
var decompressedImg = Decompressor.Decompress(reader);
var image_data = new ByteIO(decompressedImg);
var start = image_data.Tell();
checksum = image_data.ReadInt32();
references = image_data.ReadInt32();
var size = image_data.ReadUInt32();
width = image_data.ReadInt16();
height = image_data.ReadInt16();
graphic_mode = image_data.ReadByte();//Graphic mode is always 4 for SL
var flags = image_data.ReadSByte();
image_data.Skip(2);
x_hotspot = image_data.ReadInt16();
y_hotspot = image_data.ReadInt16();
action_x = image_data.ReadInt16();
action_y = image_data.ReadInt16();
Logger.Log($"Size: {width}x{height}");
for (int i = 0; i < 4; i++)
{
image_data.ReadByte();
//transparence
}
int alpha_size=0;
byte[] data;
if (false)//lzx flag
{
var decompressed_size = image_data.ReadUInt32();
image_data = Decompressor.decompress_asReader(image_data, (int)(image_data.Size() - image_data.Tell()), (int)decompressed_size);
}
else
{
//image_data = image_data.ReadBytes(-1)
data = image_data.ReadBytes((int)reader.Size());
var curPoint = new TestPoint();
ReadRGB(data,width,height,curPoint);
var image = curPoints;
var image_size = currentN;
this.image = image;
alpha_size = (int)(size - image_size);
}
var pad = (alpha_size - width * height) / height;
//ReadAlpha(data, width, height, (int)(size - alpha_size));
//alpha = curPoints;
}
public void Save(string filename)
{
File.WriteAllBytes(filename,image);
}
public override void Print()
{
}
}
public class TestPoint
{
public int size = 3;
public byte[] Read(byte[]data,int position)
{
byte r=0;
byte g=0;
byte b=0;
try
{
b = data[position];
g = data[position + 1];
r = data[position + 2];
}
catch
{
Console.WriteLine(position);
}
return (new List<byte>() { r, g, b }).ToArray();
}
}
}

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>

@ -1,71 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.IO.Compression;
namespace TestDecompressor
{
public class Program
{
static string directoryPath = @"c:\temp";
public static void Main()
{
DirectoryInfo directorySelected = new DirectoryInfo(directoryPath);
Compress(directorySelected);
foreach (FileInfo fileToDecompress in directorySelected.GetFiles("*.chunk"))
{
Decompress(fileToDecompress);
}
Console.ReadKey();
}
public static void Compress(DirectoryInfo directorySelected)
{
foreach (FileInfo file in directorySelected.GetFiles("*.xml"))
using (FileStream originalFileStream = file.OpenRead())
{
if ((File.GetAttributes(file.FullName) & FileAttributes.Hidden)
!= FileAttributes.Hidden & file.Extension != ".cmp")
{
using (FileStream compressedFileStream = File.Create(file.FullName + ".cmp"))
{
using (DeflateStream compressionStream = new DeflateStream(compressedFileStream, CompressionMode.Compress))
{
originalFileStream.CopyTo(compressionStream);
}
}
FileInfo info = new FileInfo(directoryPath + "\\" + file.Name + ".cmp");
Console.WriteLine("Compressed {0} from {1} to {2} bytes.", file.Name, file.Length, info.Length);
}
}
}
public static void Decompress(FileInfo fileToDecompress)
{
using (FileStream originalFileStream = fileToDecompress.OpenRead())
{
string currentFileName = fileToDecompress.FullName;
string newFileName = currentFileName.Remove(currentFileName.Length - fileToDecompress.Extension.Length);
using (FileStream decompressedFileStream = File.Create(newFileName))
{
using (DeflateStream decompressionStream = new DeflateStream(originalFileStream, CompressionMode.Decompress))
{
decompressionStream.CopyTo(decompressedFileStream);
Console.WriteLine("Decompressed: {0}", fileToDecompress.Name);
}
}
}
}
}
}

@ -1,36 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Общие сведения об этой сборке предоставляются следующим набором
// набора атрибутов. Измените значения этих атрибутов для изменения сведений,
// связанные с этой сборкой.
[assembly: AssemblyTitle("TestDecompressor")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TestDecompressor")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Установка значения False для параметра ComVisible делает типы в этой сборке невидимыми
// для компонентов COM. Если необходимо обратиться к типу в этой сборке через
// из модели COM задайте для атрибута ComVisible этого типа значение true.
[assembly: ComVisible(false)]
// Следующий GUID представляет идентификатор typelib, если этот проект доступен из модели COM
[assembly: Guid("3d4c851a-8c6b-4898-a766-b1364937f695")]
// Сведения о версии сборки состоят из указанных ниже четырех значений:
//
// Основной номер версии
// Дополнительный номер версии
// Номер сборки
// Номер редакции
//
// Можно задать все значения или принять номера сборки и редакции по умолчанию
// используя "*", как показано ниже:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

@ -1,53 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{3D4C851A-8C6B-4898-A766-B1364937F695}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>TestDecompressor</RootNamespace>
<AssemblyName>TestDecompressor</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
Loading…
Cancel
Save