Source code cleanup.
parent
24e7674f57
commit
567f8b7e4a
|
@ -1,4 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<configuration>
|
||||
<solution>
|
||||
<add key="disableSourceControlIntegration" value="true" />
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=ID/@EntryIndexedValue">ID</s:String></wpf:ResourceDictionary>
|
|
@ -67,10 +67,6 @@ namespace GarrysMod.AddonCreator.Addon
|
|||
/// </summary>
|
||||
public List<string> RequiredContent { get; private set; }
|
||||
|
||||
public static void CreateFromFolder()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Imports a gmod addon into this instance.
|
||||
/// </summary>
|
||||
|
|
|
@ -5,10 +5,10 @@ namespace GarrysMod.AddonCreator.Addon
|
|||
{
|
||||
public class SegmentedAddonFileInfo : AddonFileInfo
|
||||
{
|
||||
private readonly int _hash;
|
||||
private readonly long _len;
|
||||
private readonly long _pos;
|
||||
private readonly Stream _stream;
|
||||
private int _hash;
|
||||
|
||||
public SegmentedAddonFileInfo(Stream stream, long pos, long len, int fileHash)
|
||||
{
|
||||
|
@ -20,10 +20,7 @@ namespace GarrysMod.AddonCreator.Addon
|
|||
|
||||
public override long Size
|
||||
{
|
||||
get
|
||||
{
|
||||
return _len;
|
||||
}
|
||||
get { return _len; }
|
||||
}
|
||||
|
||||
public override int Crc32Hash
|
||||
|
|
|
@ -47,11 +47,6 @@
|
|||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Addon\AddonFile.cs" />
|
||||
|
|
|
@ -19,14 +19,14 @@ namespace GarrysMod.AddonCreator.Hashing
|
|||
uint i;
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
uint r = i;
|
||||
for (int j = 0; j < 8; j++)
|
||||
var r = i;
|
||||
for (var j = 0; j < 8; j++)
|
||||
r = (r >> 1) ^ (kCrcPoly & ~((r & 1) - 1));
|
||||
Table[i] = r;
|
||||
}
|
||||
for (; i < 256*CRC_NUM_TABLES; i++)
|
||||
{
|
||||
uint r = Table[i - 256];
|
||||
var r = Table[i - 256];
|
||||
Table[i] = Table[r & 0xFF] ^ (r >> 8);
|
||||
}
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ namespace GarrysMod.AddonCreator.Hashing
|
|||
|
||||
var table = Table; // important for performance!
|
||||
|
||||
uint crc = value;
|
||||
var crc = value;
|
||||
|
||||
for (; (offset & 7) != 0 && count != 0; count--)
|
||||
crc = (crc >> 8) ^ table[(byte) crc ^ data[offset++]];
|
||||
|
@ -73,7 +73,7 @@ namespace GarrysMod.AddonCreator.Hashing
|
|||
* Idea from 7-zip project sources (http://7-zip.org/sdk.html)
|
||||
*/
|
||||
|
||||
int to = (count - 8) & ~7;
|
||||
var to = (count - 8) & ~7;
|
||||
count -= to;
|
||||
to += offset;
|
||||
|
||||
|
|
|
@ -25,13 +25,13 @@ namespace GarrysMod.AddonCreator.Hashing
|
|||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
var r = (uint) i;
|
||||
for (int j = 0; j < 8; j++)
|
||||
for (var j = 0; j < 8; j++)
|
||||
r = (r >> 1) ^ (kCrcPoly & ~((r & 1) - 1));
|
||||
Table[i] = r;
|
||||
}
|
||||
for (; i < 256*CRC_NUM_TABLES; i++)
|
||||
{
|
||||
uint r = Table[i - 256];
|
||||
var r = Table[i - 256];
|
||||
Table[i] = Table[r & 0xFF] ^ (r >> 8);
|
||||
}
|
||||
}
|
||||
|
@ -72,9 +72,9 @@ namespace GarrysMod.AddonCreator.Hashing
|
|||
|
||||
// choose optimal number of threads to use
|
||||
|
||||
int threadCount = ThreadCount;
|
||||
var threadCount = ThreadCount;
|
||||
L0:
|
||||
int bytesPerThread = (count + threadCount - 1)/threadCount;
|
||||
var bytesPerThread = (count + threadCount - 1)/threadCount;
|
||||
if (bytesPerThread < ThreadCost >> 1)
|
||||
{
|
||||
threadCount--;
|
||||
|
@ -115,7 +115,7 @@ namespace GarrysMod.AddonCreator.Hashing
|
|||
|
||||
if (count >= 8)
|
||||
{
|
||||
int to = (count - 8) & ~7;
|
||||
var to = (count - 8) & ~7;
|
||||
count -= to;
|
||||
to += offset;
|
||||
|
||||
|
@ -188,8 +188,8 @@ namespace GarrysMod.AddonCreator.Hashing
|
|||
Prepare_even_odd_Cache();
|
||||
}
|
||||
|
||||
uint[] even = CopyArray(even_cache);
|
||||
uint[] odd = CopyArray(odd_cache);
|
||||
var even = CopyArray(even_cache);
|
||||
var odd = CopyArray(odd_cache);
|
||||
|
||||
crc1 = ~crc1;
|
||||
crc2 = ~crc2;
|
||||
|
@ -225,7 +225,7 @@ namespace GarrysMod.AddonCreator.Hashing
|
|||
|
||||
// put operator for one zero bit in odd
|
||||
odd[0] = kCrcPoly; // the CRC-32 polynomial
|
||||
for (int i = 1; i < 32; i++) odd[i] = 1U << (i - 1);
|
||||
for (var i = 1; i < 32; i++) odd[i] = 1U << (i - 1);
|
||||
|
||||
// put operator for two zero bits in even
|
||||
gf2_matrix_square(even, odd);
|
||||
|
@ -241,7 +241,7 @@ namespace GarrysMod.AddonCreator.Hashing
|
|||
private static uint gf2_matrix_times(uint[] matrix, uint vec)
|
||||
{
|
||||
uint sum = 0;
|
||||
int i = 0;
|
||||
var i = 0;
|
||||
while (vec != 0)
|
||||
{
|
||||
if ((vec & 1) != 0) sum ^= matrix[i];
|
||||
|
@ -255,7 +255,7 @@ namespace GarrysMod.AddonCreator.Hashing
|
|||
/// <param name="mat">will not be modified</param>
|
||||
private static void gf2_matrix_square(uint[] square, uint[] mat)
|
||||
{
|
||||
for (int i = 0; i < 32; i++)
|
||||
for (var i = 0; i < 32; i++)
|
||||
square[i] = gf2_matrix_times(mat, mat[i]);
|
||||
}
|
||||
|
||||
|
|
|
@ -17,8 +17,8 @@ namespace GarrysMod.AddonCreator.Hashing
|
|||
Table = new uint[256];
|
||||
for (uint i = 0; i < 256; i++)
|
||||
{
|
||||
uint r = i;
|
||||
for (int j = 0; j < 8; j++)
|
||||
var r = i;
|
||||
for (var j = 0; j < 8; j++)
|
||||
r = (r >> 1) ^ (kCrcPoly & ~((r & 1) - 1));
|
||||
Table[i] = r;
|
||||
}
|
||||
|
|
|
@ -25,7 +25,8 @@ namespace GarrysMod.AddonCreator
|
|||
|
||||
if (!folder.Exists)
|
||||
{
|
||||
Console.Error.WriteLine("ERROR: Input folder needs to exist and needs to contain appropriate data.");
|
||||
Console.Error.WriteLine(
|
||||
"ERROR: Input folder needs to exist and needs to contain appropriate data.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -67,7 +68,7 @@ namespace GarrysMod.AddonCreator
|
|||
{
|
||||
addon.Import(gma);
|
||||
}
|
||||
catch(Exception err)
|
||||
catch (Exception err)
|
||||
{
|
||||
Console.Error.WriteLine("ERROR: Input GMA file could not be read - {0}", err.Message);
|
||||
#if DEBUG
|
||||
|
|
Loading…
Reference in New Issue