Refactoring, especially namespaces just to keep it easy for myself.
parent
9917ac4f9f
commit
d39fe89337
|
@ -4,12 +4,12 @@ using System.Diagnostics;
|
|||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using CRC32;
|
||||
using GarrysMod.AddonCreator.Hashing;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace GarrysMod.AddonCreator
|
||||
namespace GarrysMod.AddonCreator.Addon
|
||||
{
|
||||
public class Addon
|
||||
public class AddonFile
|
||||
{
|
||||
private const byte FormatVersion = 3;
|
||||
private const uint AppID = 4000;
|
||||
|
@ -17,9 +17,9 @@ namespace GarrysMod.AddonCreator
|
|||
private static readonly byte[] FormatIdent = Encoding.ASCII.GetBytes("GMAD");
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of <see cref="Addon" />
|
||||
/// Initializes a new instance of <see cref="AddonFile" />
|
||||
/// </summary>
|
||||
public Addon()
|
||||
public AddonFile()
|
||||
{
|
||||
Files = new Dictionary<string, AddonFileInfo>();
|
||||
RequiredContent = new List<string>();
|
|
@ -1,6 +1,6 @@
|
|||
using CRC32;
|
||||
using GarrysMod.AddonCreator.Hashing;
|
||||
|
||||
namespace GarrysMod.AddonCreator
|
||||
namespace GarrysMod.AddonCreator.Addon
|
||||
{
|
||||
public abstract class AddonFileInfo
|
||||
{
|
|
@ -4,7 +4,7 @@ using System.IO;
|
|||
using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace GarrysMod.AddonCreator
|
||||
namespace GarrysMod.AddonCreator.Addon
|
||||
{
|
||||
public class AddonJson
|
||||
{
|
|
@ -2,7 +2,7 @@
|
|||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace GarrysMod.AddonCreator
|
||||
namespace GarrysMod.AddonCreator.Addon
|
||||
{
|
||||
public static class AddonWhitelist
|
||||
{
|
|
@ -1,7 +1,7 @@
|
|||
using System.Text;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace GarrysMod.AddonCreator
|
||||
namespace GarrysMod.AddonCreator.Addon
|
||||
{
|
||||
public class JsonAddonFileInfo : AddonFileInfo
|
||||
{
|
|
@ -1,6 +1,6 @@
|
|||
using System.IO;
|
||||
|
||||
namespace GarrysMod.AddonCreator
|
||||
namespace GarrysMod.AddonCreator.Addon
|
||||
{
|
||||
public class PhysicalAddonFileInfo : AddonFileInfo
|
||||
{
|
|
@ -1,7 +1,7 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace GarrysMod.AddonCreator
|
||||
namespace GarrysMod.AddonCreator.Addon
|
||||
{
|
||||
public class SegmentedAddonFileInfo : AddonFileInfo
|
||||
{
|
|
@ -52,19 +52,19 @@
|
|||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Addon.cs" />
|
||||
<Compile Include="AddonFileInfo.cs" />
|
||||
<Compile Include="AddonJson.cs" />
|
||||
<Compile Include="AddonWhitelist.cs" />
|
||||
<Compile Include="Addon\AddonFile.cs" />
|
||||
<Compile Include="Addon\AddonFileInfo.cs" />
|
||||
<Compile Include="Addon\AddonJson.cs" />
|
||||
<Compile Include="Addon\AddonWhitelist.cs" />
|
||||
<Compile Include="Extensions.cs" />
|
||||
<Compile Include="JsonAddonFileInfo.cs" />
|
||||
<Compile Include="OptimizedCRC.cs" />
|
||||
<Compile Include="ParallelCRC.cs" />
|
||||
<Compile Include="PhysicalAddonFileInfo.cs" />
|
||||
<Compile Include="Addon\JsonAddonFileInfo.cs" />
|
||||
<Compile Include="Hashing\OptimizedCRC.cs" />
|
||||
<Compile Include="Hashing\ParallelCRC.cs" />
|
||||
<Compile Include="Addon\PhysicalAddonFileInfo.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="SegmentedAddonFileInfo.cs" />
|
||||
<Compile Include="TraditionalCRC.cs" />
|
||||
<Compile Include="Addon\SegmentedAddonFileInfo.cs" />
|
||||
<Compile Include="Hashing\TraditionalCRC.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
using System;
|
||||
|
||||
namespace CRC32
|
||||
namespace GarrysMod.AddonCreator.Hashing
|
||||
{
|
||||
public class OptimizedCRC
|
||||
{
|
|
@ -1,7 +1,7 @@
|
|||
using System;
|
||||
using System.Threading;
|
||||
|
||||
namespace CRC32
|
||||
namespace GarrysMod.AddonCreator.Hashing
|
||||
{
|
||||
public class ParallelCRC
|
||||
{
|
|
@ -1,6 +1,6 @@
|
|||
using System;
|
||||
|
||||
namespace CRC32
|
||||
namespace GarrysMod.AddonCreator.Hashing
|
||||
{
|
||||
public class TraditionalCRC
|
||||
{
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using GarrysMod.AddonCreator.Addon;
|
||||
|
||||
namespace GarrysMod.AddonCreator
|
||||
{
|
||||
|
@ -14,7 +15,7 @@ namespace GarrysMod.AddonCreator
|
|||
{
|
||||
var folder = new DirectoryInfo(args[1]);
|
||||
var output = args[2];
|
||||
var addon = new Addon();
|
||||
var addon = new AddonFile();
|
||||
|
||||
// recursively add files
|
||||
foreach (var file in folder.EnumerateFiles("*", SearchOption.AllDirectories))
|
||||
|
@ -37,7 +38,7 @@ namespace GarrysMod.AddonCreator
|
|||
{
|
||||
var gma = args[1];
|
||||
var folder = new DirectoryInfo(args[2]);
|
||||
var addon = new Addon();
|
||||
var addon = new AddonFile();
|
||||
addon.Import(gma);
|
||||
|
||||
Console.WriteLine("Loaded addon {0} by {1}, Version {2}", addon.Title, addon.Author, addon.Version);
|
||||
|
|
Loading…
Reference in New Issue