Skip to content

Commit

Permalink
Merge pull request #8 from CreativeMD/master
Browse files Browse the repository at this point in the history
Update v1.3.2
  • Loading branch information
CreativeMD authored Sep 13, 2018
2 parents bd56878 + 3aabe9d commit 31bf830
Show file tree
Hide file tree
Showing 11 changed files with 20,207 additions and 10 deletions.
Binary file added packages/SharpZipLib.1.0.0/.signature.p7s
Binary file not shown.
Binary file not shown.
Binary file not shown.
10,082 changes: 10,082 additions & 0 deletions packages/SharpZipLib.1.0.0/lib/net45/ICSharpCode.SharpZipLib.xml

Large diffs are not rendered by default.

Binary file not shown.
10,082 changes: 10,082 additions & 0 deletions packages/SharpZipLib.1.0.0/lib/netstandard2.0/ICSharpCode.SharpZipLib.xml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion vsmodtools/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Program
internal static List<Command> commands = new List<Command>();
internal static Command currentCommand;

public const string version = "1.3";
public const string version = "1.3.2";

static void Init()
{
Expand Down
29 changes: 23 additions & 6 deletions vsmodtools/Tools.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
using Newtonsoft.Json.Linq;
using ICSharpCode.SharpZipLib.Core;
using ICSharpCode.SharpZipLib.Zip;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
Expand Down Expand Up @@ -152,6 +153,7 @@ public override bool Run(string[] args)
Console.WriteLine("Detecting Linux ...");

possiblePaths.Add(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "ApplicationData", "Vintagestory"));
possiblePaths.Add(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "ApplicationData", "vintagestory"));
possiblePaths.Add(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory), "Vintagestory"));
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
Expand Down Expand Up @@ -605,7 +607,8 @@ public override bool Run(string[] args, string vspath)
string zipFilePath = releaseFolder + modid + "_v" + version + ".zip";
if (File.Exists(zipFilePath))
File.Delete(zipFilePath);
ZipArchive archive = ZipFile.Open(zipFilePath, ZipArchiveMode.Create);
ZipOutputStream archive = new ZipOutputStream(File.Create(zipFilePath));
archive.SetLevel(3);
List<string> files = new List<string>();
files.AddRange(Directory.GetFiles(modFolder, "*.dll", SearchOption.TopDirectoryOnly));
files.AddRange(Directory.GetFiles(modFolder + "assets", "*", SearchOption.AllDirectories));
Expand All @@ -620,12 +623,26 @@ public override bool Run(string[] args, string vspath)
Console.WriteLine("Creating zip archive ...");
foreach (var file in files)
{
string filename = file.Replace(modFolder, "").ToLower();
string filename = ZipEntry.CleanName(file.Replace(modFolder, "").ToLower());
Console.WriteLine("Adding '{0}' ...", filename);
archive.CreateEntryFromFile(file, filename);

FileInfo fi = new FileInfo(file);
ZipEntry newEntry = new ZipEntry(filename);
newEntry.DateTime = fi.LastWriteTime;
newEntry.Size = fi.Length;

archive.PutNextEntry(newEntry);

byte[] buffer = new byte[4096];
using (FileStream streamReader = File.OpenRead(file))
{
StreamUtils.Copy(streamReader, archive, buffer);
}
archive.CloseEntry();
}

archive.Dispose();
archive.IsStreamOwner = true;
archive.Close();

Console.WriteLine("Release of '{0}' has been created successfully in '/releases/" + modid + "/" + modid + "_v" + version + ".zip'", modid);
return true;
Expand Down
1 change: 1 addition & 0 deletions vsmodtools/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="11.0.2" targetFramework="net452" />
<package id="SharpZipLib" version="1.0.0" targetFramework="net471" />
</packages>
9 changes: 7 additions & 2 deletions vsmodtools/project.template
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,17 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<OutputPath>..\..\bin\Debug\$(modid)\</OutputPath>
<IntermediateOutputPath>..\..\obj\Debug\$(modid)\</IntermediateOutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<OutputPath>..\..\bin\Release\$(modid)\</OutputPath>
<IntermediateOutputPath>..\..\obj\Release\$(modid)\</IntermediateOutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
Expand Down Expand Up @@ -68,4 +70,7 @@
<Content Include="modinfo.json" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>rd "$(ProjectDir)obj" /S /Q</PostBuildEvent>
</PropertyGroup>
</Project>
12 changes: 11 additions & 1 deletion vsmodtools/vsmodtools.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="ICSharpCode.SharpZipLib, Version=1.0.0.999, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
<HintPath>..\packages\SharpZipLib.1.0.0\lib\net45\ICSharpCode.SharpZipLib.dll</HintPath>
<EmbedInteropTypes>False</EmbedInteropTypes>
</Reference>
<Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
<EmbedInteropTypes>False</EmbedInteropTypes>
Expand Down Expand Up @@ -77,8 +81,14 @@
<ItemGroup>
<None Include="App.config" />
<EmbeddedResource Include="modinfo.template" />
<EmbeddedResource Include="project.template" />
<EmbeddedResource Include="project.template">
<SubType>Designer</SubType>
</EmbeddedResource>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
</Project>

0 comments on commit 31bf830

Please sign in to comment.