From a7c360bdd996bfc135be8918dc03733c1bb9d503 Mon Sep 17 00:00:00 2001 From: Ben Barrett Date: Sun, 5 Jan 2020 11:09:02 -0800 Subject: [PATCH] Use .net standard, set up versioning and nuget variables --- ...tcore.csproj => ConsoleApplication.csproj} | 2 +- ...on1.netcore.sln => ConsoleApplication.sln} | 6 +- .../ConsoleApplication1/App.config | 6 - .../ConsoleApplication1.csproj | 70 ---------- .../ConsoleApplication1.sln | 46 ------- .../ConsoleApplication1/Program.cs | 61 --------- .../ConsoleApplication1/nuget.config | 5 - .../NuGet.Config | 6 + .../Program.cs | 38 ++++++ .../Heroes.ReplayParser.csproj | 125 +++--------------- .../Heroes.ReplayParser.netstandard.csproj | 15 --- .../Properties/AssemblyInfo.cs | 11 -- MpqTool/Foole.Mpq/MpqStream.cs | 2 +- MpqTool/MpqTool.csproj | 77 ++--------- MpqTool/MpqTool.netstandard.csproj | 15 --- MpqTool/Properties/AssemblyInfo.cs | 33 ----- README.md | 2 +- 17 files changed, 80 insertions(+), 440 deletions(-) rename Heroes.ReplayParser.ConsoleApplication/{ConsoleApplication1/ConsoleApplication1.netcore.csproj => ConsoleApplication.csproj} (66%) rename Heroes.ReplayParser.ConsoleApplication/{ConsoleApplication1/ConsoleApplication1.netcore.sln => ConsoleApplication.sln} (86%) delete mode 100644 Heroes.ReplayParser.ConsoleApplication/ConsoleApplication1/App.config delete mode 100644 Heroes.ReplayParser.ConsoleApplication/ConsoleApplication1/ConsoleApplication1.csproj delete mode 100644 Heroes.ReplayParser.ConsoleApplication/ConsoleApplication1/ConsoleApplication1.sln delete mode 100644 Heroes.ReplayParser.ConsoleApplication/ConsoleApplication1/Program.cs delete mode 100644 Heroes.ReplayParser.ConsoleApplication/ConsoleApplication1/nuget.config create mode 100644 Heroes.ReplayParser.ConsoleApplication/NuGet.Config create mode 100644 Heroes.ReplayParser.ConsoleApplication/Program.cs delete mode 100644 Heroes.ReplayParser/Heroes.ReplayParser.netstandard.csproj delete mode 100644 Heroes.ReplayParser/Properties/AssemblyInfo.cs delete mode 100644 MpqTool/MpqTool.netstandard.csproj delete mode 100644 MpqTool/Properties/AssemblyInfo.cs diff --git a/Heroes.ReplayParser.ConsoleApplication/ConsoleApplication1/ConsoleApplication1.netcore.csproj b/Heroes.ReplayParser.ConsoleApplication/ConsoleApplication.csproj similarity index 66% rename from Heroes.ReplayParser.ConsoleApplication/ConsoleApplication1/ConsoleApplication1.netcore.csproj rename to Heroes.ReplayParser.ConsoleApplication/ConsoleApplication.csproj index 1ad0b94..4652565 100644 --- a/Heroes.ReplayParser.ConsoleApplication/ConsoleApplication1/ConsoleApplication1.netcore.csproj +++ b/Heroes.ReplayParser.ConsoleApplication/ConsoleApplication.csproj @@ -6,7 +6,7 @@ - + diff --git a/Heroes.ReplayParser.ConsoleApplication/ConsoleApplication1/ConsoleApplication1.netcore.sln b/Heroes.ReplayParser.ConsoleApplication/ConsoleApplication.sln similarity index 86% rename from Heroes.ReplayParser.ConsoleApplication/ConsoleApplication1/ConsoleApplication1.netcore.sln rename to Heroes.ReplayParser.ConsoleApplication/ConsoleApplication.sln index 0008787..4587ed9 100644 --- a/Heroes.ReplayParser.ConsoleApplication/ConsoleApplication1/ConsoleApplication1.netcore.sln +++ b/Heroes.ReplayParser.ConsoleApplication/ConsoleApplication.sln @@ -3,11 +3,11 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.26730.16 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleApplication1.netcore", "ConsoleApplication1.netcore.csproj", "{861DB181-6C12-48CB-AA2A-19B374ECA319}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleApplication", "ConsoleApplication.csproj", "{861DB181-6C12-48CB-AA2A-19B374ECA319}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Heroes.ReplayParser.netstandard", "..\..\Heroes.ReplayParser\Heroes.ReplayParser.netstandard.csproj", "{AAF78D53-A1DA-424A-B1AA-09895EAB3B2B}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Heroes.ReplayParser", "..\Heroes.ReplayParser\Heroes.ReplayParser.csproj", "{AAF78D53-A1DA-424A-B1AA-09895EAB3B2B}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MpqTool.netstandard", "..\..\MpqTool\MpqTool.netstandard.csproj", "{FA50E172-836B-47BB-8745-60595E4FB12A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MpqTool", "..\MpqTool\MpqTool.csproj", "{FA50E172-836B-47BB-8745-60595E4FB12A}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/Heroes.ReplayParser.ConsoleApplication/ConsoleApplication1/App.config b/Heroes.ReplayParser.ConsoleApplication/ConsoleApplication1/App.config deleted file mode 100644 index 8e15646..0000000 --- a/Heroes.ReplayParser.ConsoleApplication/ConsoleApplication1/App.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/Heroes.ReplayParser.ConsoleApplication/ConsoleApplication1/ConsoleApplication1.csproj b/Heroes.ReplayParser.ConsoleApplication/ConsoleApplication1/ConsoleApplication1.csproj deleted file mode 100644 index 47fdf6b..0000000 --- a/Heroes.ReplayParser.ConsoleApplication/ConsoleApplication1/ConsoleApplication1.csproj +++ /dev/null @@ -1,70 +0,0 @@ - - - - - Debug - AnyCPU - {861DB181-6C12-48CB-AA2A-19B374ECA319} - Exe - Properties - ConsoleApplication1 - ConsoleApplication1 - v4.5 - 512 - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - - {aaf78d53-a1da-424a-b1aa-09895eab3b2b} - Heroes.ReplayParser - - - {fa50e172-836b-47bb-8745-60595e4fb12a} - MpqTool - - - - - - - - \ No newline at end of file diff --git a/Heroes.ReplayParser.ConsoleApplication/ConsoleApplication1/ConsoleApplication1.sln b/Heroes.ReplayParser.ConsoleApplication/ConsoleApplication1/ConsoleApplication1.sln deleted file mode 100644 index 93a977f..0000000 --- a/Heroes.ReplayParser.ConsoleApplication/ConsoleApplication1/ConsoleApplication1.sln +++ /dev/null @@ -1,46 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.23107.0 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApplication1", "ConsoleApplication1.csproj", "{861DB181-6C12-48CB-AA2A-19B374ECA319}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Heroes.ReplayParser", "..\..\Heroes.ReplayParser\Heroes.ReplayParser.csproj", "{AAF78D53-A1DA-424A-B1AA-09895EAB3B2B}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MpqTool", "..\..\MpqTool\MpqTool.csproj", "{FA50E172-836B-47BB-8745-60595E4FB12A}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Debug|x86 = Debug|x86 - Release|Any CPU = Release|Any CPU - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {861DB181-6C12-48CB-AA2A-19B374ECA319}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {861DB181-6C12-48CB-AA2A-19B374ECA319}.Debug|Any CPU.Build.0 = Debug|Any CPU - {861DB181-6C12-48CB-AA2A-19B374ECA319}.Debug|x86.ActiveCfg = Debug|Any CPU - {861DB181-6C12-48CB-AA2A-19B374ECA319}.Release|Any CPU.ActiveCfg = Release|Any CPU - {861DB181-6C12-48CB-AA2A-19B374ECA319}.Release|Any CPU.Build.0 = Release|Any CPU - {861DB181-6C12-48CB-AA2A-19B374ECA319}.Release|x86.ActiveCfg = Release|Any CPU - {AAF78D53-A1DA-424A-B1AA-09895EAB3B2B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {AAF78D53-A1DA-424A-B1AA-09895EAB3B2B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {AAF78D53-A1DA-424A-B1AA-09895EAB3B2B}.Debug|x86.ActiveCfg = Debug|x86 - {AAF78D53-A1DA-424A-B1AA-09895EAB3B2B}.Debug|x86.Build.0 = Debug|x86 - {AAF78D53-A1DA-424A-B1AA-09895EAB3B2B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {AAF78D53-A1DA-424A-B1AA-09895EAB3B2B}.Release|Any CPU.Build.0 = Release|Any CPU - {AAF78D53-A1DA-424A-B1AA-09895EAB3B2B}.Release|x86.ActiveCfg = Release|x86 - {AAF78D53-A1DA-424A-B1AA-09895EAB3B2B}.Release|x86.Build.0 = Release|x86 - {FA50E172-836B-47BB-8745-60595E4FB12A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {FA50E172-836B-47BB-8745-60595E4FB12A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FA50E172-836B-47BB-8745-60595E4FB12A}.Debug|x86.ActiveCfg = Debug|Any CPU - {FA50E172-836B-47BB-8745-60595E4FB12A}.Debug|x86.Build.0 = Debug|Any CPU - {FA50E172-836B-47BB-8745-60595E4FB12A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {FA50E172-836B-47BB-8745-60595E4FB12A}.Release|Any CPU.Build.0 = Release|Any CPU - {FA50E172-836B-47BB-8745-60595E4FB12A}.Release|x86.ActiveCfg = Release|Any CPU - {FA50E172-836B-47BB-8745-60595E4FB12A}.Release|x86.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/Heroes.ReplayParser.ConsoleApplication/ConsoleApplication1/Program.cs b/Heroes.ReplayParser.ConsoleApplication/ConsoleApplication1/Program.cs deleted file mode 100644 index bed17f4..0000000 --- a/Heroes.ReplayParser.ConsoleApplication/ConsoleApplication1/Program.cs +++ /dev/null @@ -1,61 +0,0 @@ -using System.IO; -using System; -using System.Collections.Generic; -using System.Linq; -using Heroes.ReplayParser; -using Foole.Mpq; - -namespace ConsoleApplication1 -{ - class Program - { - static void Main(string[] args) - { - var heroesAccountsFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), @"Heroes of the Storm\Accounts"); - var randomReplayFileName = Directory.GetFiles(heroesAccountsFolder, "*.StormReplay", SearchOption.AllDirectories).OrderBy(i => Guid.NewGuid()).First(); - - // Use temp directory for MpqLib directory permissions requirements - var tmpPath = Path.GetTempFileName(); - File.Copy(randomReplayFileName, tmpPath, overwrite: true); - - try - { - // Attempt to parse the replay - // Ignore errors can be set to true if you want to attempt to parse currently unsupported replays, such as 'VS AI' or 'PTR Region' replays - var replayParseResult = DataParser.ParseReplay(tmpPath, ignoreErrors: false, deleteFile: false); - - // If successful, the Replay object now has all currently available information - if (replayParseResult.Item1 == DataParser.ReplayParseResult.Success) - { - var replay = replayParseResult.Item2; - - Console.WriteLine("Replay Build: " + replay.ReplayBuild); - Console.WriteLine("Map: " + replay.Map); - foreach (var player in replay.Players.OrderByDescending(i => i.IsWinner)) - Console.WriteLine("Player: " + player.Name + ", Win: " + player.IsWinner + ", Hero: " + player.Character + ", Lvl: " + player.CharacterLevel + ", Talents: " + string.Join(",", player.Talents.Select(i => i.TalentID + ":" + i.TalentName))); - - Console.WriteLine("Press Any Key to Close"); - } - else - Console.WriteLine("Failed to Parse Replay: " + replayParseResult.Item1); - - Console.Read(); - } - finally - { - if (File.Exists(tmpPath)) - File.Delete(tmpPath); - } - } - - private static byte[] GetMpqArchiveFileBytes(MpqArchive archive, string fileName) - { - using (var mpqStream = archive.OpenFile(archive.Single(i => i.Filename == fileName))) - { - var buffer = new byte[mpqStream.Length]; - mpqStream.Read(buffer, 0, buffer.Length); - return buffer; - } - } - } -} diff --git a/Heroes.ReplayParser.ConsoleApplication/ConsoleApplication1/nuget.config b/Heroes.ReplayParser.ConsoleApplication/ConsoleApplication1/nuget.config deleted file mode 100644 index 92d951e..0000000 --- a/Heroes.ReplayParser.ConsoleApplication/ConsoleApplication1/nuget.config +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/Heroes.ReplayParser.ConsoleApplication/NuGet.Config b/Heroes.ReplayParser.ConsoleApplication/NuGet.Config new file mode 100644 index 0000000..3f0e003 --- /dev/null +++ b/Heroes.ReplayParser.ConsoleApplication/NuGet.Config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Heroes.ReplayParser.ConsoleApplication/Program.cs b/Heroes.ReplayParser.ConsoleApplication/Program.cs new file mode 100644 index 0000000..fe937c1 --- /dev/null +++ b/Heroes.ReplayParser.ConsoleApplication/Program.cs @@ -0,0 +1,38 @@ +using System.IO; +using System; +using System.Collections.Generic; +using System.Linq; +using Heroes.ReplayParser; + +namespace ConsoleApplication1 +{ + class Program + { + static void Main(string[] args) + { + var heroesAccountsFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), @"Heroes of the Storm\Accounts"); + var randomReplayFileName = Directory.GetFiles(heroesAccountsFolder, "*.StormReplay", SearchOption.AllDirectories).OrderBy(i => Guid.NewGuid()).First(); + + // Attempt to parse the replay + // Ignore errors can be set to true if you want to attempt to parse currently unsupported replays, such as 'VS AI' or 'PTR Region' replays + var replayParseResult = DataParser.ParseReplay(randomReplayFileName, ignoreErrors: false, deleteFile: false); + + // If successful, the Replay object now has all currently available information + if (replayParseResult.Item1 == DataParser.ReplayParseResult.Success) + { + var replay = replayParseResult.Item2; + + Console.WriteLine("Replay Build: " + replay.ReplayBuild); + Console.WriteLine("Map: " + replay.Map); + foreach (var player in replay.Players.OrderByDescending(i => i.IsWinner)) + Console.WriteLine("Player: " + player.Name + ", Win: " + player.IsWinner + ", Hero: " + player.Character + ", Lvl: " + player.CharacterLevel + ", Talents: " + string.Join(",", player.Talents.Select(i => i.TalentID + ":" + i.TalentName))); + + Console.WriteLine("Press Any Key to Close"); + } + else + Console.WriteLine("Failed to Parse Replay: " + replayParseResult.Item1); + + Console.Read(); + } + } +} diff --git a/Heroes.ReplayParser/Heroes.ReplayParser.csproj b/Heroes.ReplayParser/Heroes.ReplayParser.csproj index 33602de..d5b2923 100644 --- a/Heroes.ReplayParser/Heroes.ReplayParser.csproj +++ b/Heroes.ReplayParser/Heroes.ReplayParser.csproj @@ -1,104 +1,23 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {AAF78D53-A1DA-424A-B1AA-09895EAB3B2B} - Library - Properties - Heroes.ReplayParser - Heroes.ReplayParser - v4.5 - 512 - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - AnyCPU - false - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - AnyCPU - false - - - false - - - - - - - true - bin\x86\Debug\ - DEBUG;TRACE - full - x86 - prompt - MinimumRecommendedRules.ruleset - - - bin\x86\Release\ - TRACE - true - pdbonly - x86 - prompt - MinimumRecommendedRules.ruleset - - - - - - - - - - - - - - - - - - Code - - - - - - - - - - - - {fa50e172-836b-47bb-8745-60595e4fb12a} - MpqTool - - - - + + + + netstandard2.0 + Heroes.ReplayParser + Ben Barrett + barrett777 + A library for parsing Heroes of the Storm replay files (.StormReplay) + https://github.com/barrett777/Heroes.ReplayParser + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + \ No newline at end of file diff --git a/Heroes.ReplayParser/Heroes.ReplayParser.netstandard.csproj b/Heroes.ReplayParser/Heroes.ReplayParser.netstandard.csproj deleted file mode 100644 index 927857c..0000000 --- a/Heroes.ReplayParser/Heroes.ReplayParser.netstandard.csproj +++ /dev/null @@ -1,15 +0,0 @@ - - - - netstandard2.0 - - - - - - - - - - - diff --git a/Heroes.ReplayParser/Properties/AssemblyInfo.cs b/Heroes.ReplayParser/Properties/AssemblyInfo.cs deleted file mode 100644 index d7d970e..0000000 --- a/Heroes.ReplayParser/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("Heroes.ReplayParser")] -[assembly: AssemblyDescription("Library for parsing information from a Heroes replay file.")] -[assembly: AssemblyConfiguration("Release")] -[assembly: AssemblyProduct("Heroes.ReplayParser")] -[assembly: ComVisible(false)] -[assembly: Guid("ab85402d-b34a-42ed-b74e-02c2656896d8")] -[assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyFileVersion("1.0.0.0")] \ No newline at end of file diff --git a/MpqTool/Foole.Mpq/MpqStream.cs b/MpqTool/Foole.Mpq/MpqStream.cs index 8e2ea02..f766f9b 100644 --- a/MpqTool/Foole.Mpq/MpqStream.cs +++ b/MpqTool/Foole.Mpq/MpqStream.cs @@ -408,7 +408,7 @@ private static byte[] BZip2Decompress(Stream data, int expectedLength) stream.CopyTo(output); } #elif WITH_SHARPCOMPRESS - using (var stream = new SharpCompress.Compressors.BZip2.BZip2Stream(data, SharpCompress.Compressors.CompressionMode.Decompress)) + using (var stream = new SharpCompress.Compressors.BZip2.BZip2Stream(data, SharpCompress.Compressors.CompressionMode.Decompress, false)) { stream.CopyTo(output); } diff --git a/MpqTool/MpqTool.csproj b/MpqTool/MpqTool.csproj index f985403..b5f1219 100644 --- a/MpqTool/MpqTool.csproj +++ b/MpqTool/MpqTool.csproj @@ -1,73 +1,12 @@ - - + + - Debug - AnyCPU - 9.0.30729 - 2.0 - {FA50E172-836B-47BB-8745-60595E4FB12A} - Library - Properties - MpqTool - MpqTool - - - 3.5 - v4.5 - - - + netstandard2.0 + WITH_SHARPCOMPRESS - - true - full - false - bin\Debug\ - DEBUG;TRACE;WITH_DOTNETZIP - prompt - 4 - false - - - pdbonly - true - bin\Release\ - TRACE;WITH_DOTNETZIP - prompt - 4 - AnyCPU - false - - - - - - - - - - - - - - - - - - - - + - - 1.13.3 - + - - - \ No newline at end of file + + diff --git a/MpqTool/MpqTool.netstandard.csproj b/MpqTool/MpqTool.netstandard.csproj deleted file mode 100644 index f9e8f1b..0000000 --- a/MpqTool/MpqTool.netstandard.csproj +++ /dev/null @@ -1,15 +0,0 @@ - - - - netstandard2.0 - WITH_SHARPCOMPRESS - - - - - - - - - - diff --git a/MpqTool/Properties/AssemblyInfo.cs b/MpqTool/Properties/AssemblyInfo.cs deleted file mode 100644 index 32ca6d8..0000000 --- a/MpqTool/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("MpqTool")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("MpqTool")] -[assembly: AssemblyCopyright("Copyright © 2006")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("b8df44d0-07d9-4abd-9c4a-cf51f15c7a95")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/README.md b/README.md index 05638af..b622752 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Heroes.ReplayParser -A C# library for parsing Heroes of the Storm replay files (.StormReplay), currently developed and used by HOTSLogs.com +A C# library for parsing Heroes of the Storm replay files (.StormReplay) Explanation ================