2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2025-06-28 07:11:52 +00:00

Import code from previous AssetBuilder version

This commit is contained in:
Jan
2019-09-24 10:45:09 +02:00
parent 5609557516
commit 0d8432d4f7
919 changed files with 154412 additions and 26 deletions

View File

@ -0,0 +1,15 @@
namespace ZoneCodeGenerator.Utils
{
static class AlignmentExtension
{
public static int Align(this int valueToAlign, int alignment)
{
return (valueToAlign + alignment - 1) / alignment * alignment;
}
public static long Align(this long valueToAlign, long alignment)
{
return (valueToAlign + alignment - 1) / alignment * alignment;
}
}
}

View File

@ -0,0 +1,13 @@
using System.Collections.Generic;
namespace ZoneCodeGenerator.Utils
{
public static class KeyValueExtension
{
public static void Deconstruct<T1, T2>(this KeyValuePair<T1, T2> keyValuePair, out T1 m1, out T2 m2)
{
m1 = keyValuePair.Key;
m2 = keyValuePair.Value;
}
}
}

View File

@ -0,0 +1,23 @@
using System;
namespace ZoneCodeGenerator.Utils
{
static class RandomName
{
private const int NameLen = 32;
private static readonly Random random = new Random();
private static readonly char[] generatorChars = {
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'
};
public static string GenerateName()
{
var name = "";
for (var i = 0; i < NameLen; i++)
name += generatorChars[random.Next(generatorChars.Length)];
return name;
}
}
}