Skip to content

Commit

Permalink
Merge pull request #1 from DeathWeasel1337/master
Browse files Browse the repository at this point in the history
Support for studio sideloader mods
  • Loading branch information
DeathWeasel1337 authored Sep 8, 2019
2 parents 8230a15 + 1be5595 commit a640d05
Show file tree
Hide file tree
Showing 21 changed files with 496 additions and 233 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
# ZipStudio
Zip mod tool
A tool for converting Koikatsu mods to sideloader.

Uses parts of AssetStudio
Copyright (c) 2016-2018 Perfare
https://github.com/Perfare/AssetStudio
Binary file removed ZipStudio.7z
Binary file not shown.
48 changes: 23 additions & 25 deletions ZipStudio.Core/Manifest.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Linq;
using System.IO;
using System.Xml.Schema;
using System.Xml;

namespace ZipStudio.Core
{
Expand Down Expand Up @@ -37,40 +35,40 @@ protected void SetContents(string xpath, string value)
}
}

public string Guid
public string Guid
{
get { return GetContents("guid"); }
set { SetContents("guid", value); }
get => GetContents("guid");
set => SetContents("guid", value);
}

public string Name
public string Name
{
get { return GetContents("name"); }
set { SetContents("name", value); }
get => GetContents("name");
set => SetContents("name", value);
}

public string Version
public string Version
{
get { return GetContents("version"); }
set { SetContents("version", value); }
get => GetContents("version");
set => SetContents("version", value);
}

public string Author
public string Author
{
get { return GetContents("author"); }
set { SetContents("author", value); }
get => GetContents("author");
set => SetContents("author", value);
}

public string Description
public string Description
{
get { return GetContents("description"); }
set { SetContents("description", value); }
get => GetContents("description");
set => SetContents("description", value);
}

public string Website
public string Website
{
get { return GetContents("website"); }
set { SetContents("website", value); }
get => GetContents("website");
set => SetContents("website", value);
}

#endregion
Expand All @@ -79,8 +77,8 @@ public Manifest()
{
xmlDocument = XDocument.Parse(Properties.Resources.manifest_template);

XmlSchemaSet schemas = new XmlSchemaSet();
schemas.Add("", XmlReader.Create(new StringReader(Properties.Resources.manifest_schema)));
XmlSchemaSet schemas = new XmlSchemaSet();
schemas.Add("", XmlReader.Create(new StringReader(Properties.Resources.manifest_schema)));
}

public Manifest(string xml)
Expand All @@ -105,7 +103,7 @@ public string Export()
{
return xmlDocument.ToString();
}

public byte[] ExportAsBytes()
{
return utfEncoding.GetBytes(Export());
Expand Down
20 changes: 4 additions & 16 deletions ZipStudio.Core/Mod.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
using System;
using System.Collections.Generic;
using Ionic.Zip;
using System;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Ionic.Zip;

namespace ZipStudio.Core
{
public class Mod : IDisposable
{
public string Filename { get; protected set; }

public ZipFile ZipFile { get; protected set; }

public Manifest Manifest { get; protected set; }
public Manifest Manifest { get; protected set; }

public Mod(string filename)
{
Expand All @@ -22,14 +17,7 @@ public Mod(string filename)

var manifestentry = ZipFile.Entries.FirstOrDefault(x => x.FileName == "manifest.xml");

if (manifestentry != null)
{
Manifest = new Manifest(manifestentry.ExtractToMemory());
}
else
{
Manifest = new Manifest();
}
Manifest = manifestentry == null ? new Manifest() : new Manifest(manifestentry.ExtractToMemory());
}

public void Save()
Expand Down
7 changes: 2 additions & 5 deletions ZipStudio.Core/Utility.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
using System;
using System.Collections.Generic;
using Ionic.Zip;
using System;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Ionic.Zip;

namespace ZipStudio.Core
{
Expand Down
10 changes: 7 additions & 3 deletions ZipStudio.Core/ZipStudio.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="DotNetZip, Version=1.10.1.0, Culture=neutral, PublicKeyToken=6583c7c814667745, processorArchitecture=MSIL">
<HintPath>..\packages\DotNetZip.1.10.1\lib\net20\DotNetZip.dll</HintPath>
<Reference Include="DotNetZip, Version=1.12.0.0, Culture=neutral, PublicKeyToken=6583c7c814667745, processorArchitecture=MSIL">
<HintPath>..\packages\DotNetZip.1.12.0\lib\net20\DotNetZip.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand All @@ -58,13 +58,17 @@
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="packages.config" />
<EmbeddedResource Include="manifest schema.xsd">
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="manifest template.xml" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
2 changes: 1 addition & 1 deletion ZipStudio.Core/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="DotNetZip" version="1.10.1" targetFramework="net462" />
<package id="DotNetZip" version="1.12.0" targetFramework="net462" />
</packages>
54 changes: 12 additions & 42 deletions ZipStudio/ChaListData.cs
Original file line number Diff line number Diff line change
@@ -1,56 +1,26 @@
using MessagePack;
using System.Collections.Generic;
using System.IO;

[MessagePackObject(true)]
public class ChaListData
{
[IgnoreMember]
public static readonly string ChaListDataMark = "【ChaListData】";

public string mark
{
get;
set;
}

public int categoryNo
{
get;
set;
}

public int distributionNo
{
get;
set;
}

public string filePath
{
get;
set;
}

public List<string> lstKey
{
get;
set;
}

public Dictionary<int, List<string>> dictList
{
get;
set;
}
public string mark { get; set; }
public int categoryNo { get; set; }
public int distributionNo { get; set; }
public string filePath { get; set; }
public List<string> lstKey { get; set; }
public Dictionary<int, List<string>> dictList { get; set; }

public ChaListData()
{
this.mark = string.Empty;
this.categoryNo = 0;
this.distributionNo = 0;
this.filePath = string.Empty;
this.lstKey = new List<string>();
this.dictList = new Dictionary<int, List<string>>();
mark = string.Empty;
categoryNo = 0;
distributionNo = 0;
filePath = string.Empty;
lstKey = new List<string>();
dictList = new Dictionary<int, List<string>>();
}
}
4 changes: 2 additions & 2 deletions ZipStudio/FodyWeavers.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Weavers>
<Costura DisableCleanup='false' />
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<Costura DisableCleanup="false" />
</Weavers>
106 changes: 106 additions & 0 deletions ZipStudio/FodyWeavers.xsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuild. -->
<xs:element name="Weavers">
<xs:complexType>
<xs:all>
<xs:element name="Costura" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:all>
<xs:element minOccurs="0" maxOccurs="1" name="ExcludeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="IncludeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="Unmanaged32Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged 32 bit assembly names to include, delimited with line breaks.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="Unmanaged64Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged 64 bit assembly names to include, delimited with line breaks.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="PreloadOrder" type="xs:string">
<xs:annotation>
<xs:documentation>The order of preloaded assemblies, delimited with line breaks.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:all>
<xs:attribute name="CreateTemporaryAssemblies" type="xs:boolean">
<xs:annotation>
<xs:documentation>This will copy embedded files to disk before loading them into memory. This is helpful for some scenarios that expected an assembly to be loaded from a physical file.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="IncludeDebugSymbols" type="xs:boolean">
<xs:annotation>
<xs:documentation>Controls if .pdbs for reference assemblies are also embedded.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="DisableCompression" type="xs:boolean">
<xs:annotation>
<xs:documentation>Embedded assemblies are compressed by default, and uncompressed when they are loaded. You can turn compression off with this option.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="DisableCleanup" type="xs:boolean">
<xs:annotation>
<xs:documentation>As part of Costura, embedded assemblies are no longer included as part of the build. This cleanup can be turned off.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="LoadAtModuleInit" type="xs:boolean">
<xs:annotation>
<xs:documentation>Costura by default will load as part of the module initialization. This flag disables that behavior. Make sure you call CosturaUtility.Initialize() somewhere in your code.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="IgnoreSatelliteAssemblies" type="xs:boolean">
<xs:annotation>
<xs:documentation>Costura will by default use assemblies with a name like 'resources.dll' as a satellite resource and prepend the output path. This flag disables that behavior.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="ExcludeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with |</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="IncludeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of assembly names to include from the default action of "embed all Copy Local references", delimited with |.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Unmanaged32Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged 32 bit assembly names to include, delimited with |.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Unmanaged64Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged 64 bit assembly names to include, delimited with |.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="PreloadOrder" type="xs:string">
<xs:annotation>
<xs:documentation>The order of preloaded assemblies, delimited with |.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="VerifyAssembly" type="xs:boolean">
<xs:annotation>
<xs:documentation>'true' to run assembly verification on the target assembly after all weavers have been finished.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
<xs:annotation>
<xs:documentation>A comma separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>
Loading

0 comments on commit a640d05

Please sign in to comment.