Skip to content
This repository has been archived by the owner on Aug 24, 2023. It is now read-only.

Commit

Permalink
backup 0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
wetor committed Jul 23, 2019
1 parent 1d7bac7 commit dae8bb1
Show file tree
Hide file tree
Showing 14 changed files with 2,552 additions and 0 deletions.
63 changes: 63 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto

###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp

###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary

###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary

###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain
25 changes: 25 additions & 0 deletions PrototypeTools/PrototypeTools.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29025.244
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PrototypeTools", "PrototypeTools\PrototypeTools.csproj", "{E8893CB9-32BB-46F6-B0EF-6FA497C6ADA8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E8893CB9-32BB-46F6-B0EF-6FA497C6ADA8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E8893CB9-32BB-46F6-B0EF-6FA497C6ADA8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E8893CB9-32BB-46F6-B0EF-6FA497C6ADA8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E8893CB9-32BB-46F6-B0EF-6FA497C6ADA8}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {151D76FF-82BA-4423-B8EF-FA2099F03AB9}
EndGlobalSection
EndGlobal
6 changes: 6 additions & 0 deletions PrototypeTools/PrototypeTools/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>
65 changes: 65 additions & 0 deletions PrototypeTools/PrototypeTools/CZ0Parser.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
using AdvancedBinary;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;

namespace ProtImage
{
public class CZ0Parser
{
byte[] Texture;
public CZ0Parser(byte[] Texture)
{
this.Texture = Texture;
}

public Bitmap Import()
{
StructReader Reader = new StructReader(new MemoryStream(Texture));
CZ0Header Header = new CZ0Header();
Reader.ReadStruct(ref Header);

if (Header.Signature != "CZ0\x0")
throw new BadImageFormatException();

Reader.Seek(Header.HeaderLength, SeekOrigin.Begin);

Bitmap Picture = new Bitmap(Header.Width, Header.Heigth, System.Drawing.Imaging.PixelFormat.Format32bppArgb);

for (int y = 0; y < Header.Heigth; y++)
for (int x = 0; x < Header.Width; x++)
{
Pixel Pixel = new Pixel();
Reader.ReadStruct(ref Pixel);
Picture.SetPixel(x, y, Color.FromArgb(Pixel.A, Pixel.R, Pixel.G, Pixel.B));
}

Reader.Close();

return Picture;
}



}
public struct CZ0Header
{
[FString(Length = 4)]
public string Signature;
public uint HeaderLength;
public ushort Width;
public ushort Heigth;
//dynamic length
}
public struct Pixel32
{
public byte B, G, R, A;
}
public struct Pixel
{
public byte R, G, B, A;
}
}
Loading

0 comments on commit dae8bb1

Please sign in to comment.