mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 18:57:03 +02:00
feat: enable commiting
This commit is contained in:
1 parent
553c9d552b
commit
9fbdaaf87f
5 files changed
+51
-53
No files matched your search
@@ -32,7 +32,7 @@ namespace BlitzKit.CLI.Functions
|
||||
{
|
||||
await FetchStrings();
|
||||
MangleNations();
|
||||
// await BlitzKitAssets.CommitAssets("ue assets", changes);
|
||||
await BlitzKitAssets.CommitAssets("ue assets", changes);
|
||||
}
|
||||
|
||||
I18n GetString(string name)
|
||||
@@ -127,20 +127,20 @@ namespace BlitzKit.CLI.Functions
|
||||
|
||||
var name = GetString($"{id}_SHORT_NAME");
|
||||
|
||||
var seoId = Diacritics.Remove(name.Locales["en"]).ToLower();
|
||||
seoId = Regex.Replace(seoId, "[^a-z0-9]", "-");
|
||||
seoId = Regex.Replace(seoId, "--+", "-");
|
||||
seoId = Regex.Replace(seoId, "-$", "");
|
||||
var slug = Diacritics.Remove(name.Locales["en"]).ToLower();
|
||||
slug = Regex.Replace(slug, "[^a-z0-9]", "-");
|
||||
slug = Regex.Replace(slug, "--+", "-");
|
||||
slug = Regex.Replace(slug, "-$", "");
|
||||
|
||||
// MangleHull(id, pda);
|
||||
|
||||
Console.WriteLine(seoId);
|
||||
Console.WriteLine(slug);
|
||||
|
||||
Tank tank = new()
|
||||
{
|
||||
Id = id,
|
||||
Name = name,
|
||||
SeoId = seoId,
|
||||
Slug = slug,
|
||||
};
|
||||
|
||||
changes.Add(new($"definitions/tanks/{id}.pb", tank.ToByteArray()));
|
||||
|
||||
@@ -13,7 +13,9 @@ namespace BlitzKit.CLI.Models
|
||||
|
||||
public static async Task CommitAssets(string message, List<FileChange> changes)
|
||||
{
|
||||
Console.WriteLine($"Committing \"{message}\"... with {changes.Count} proposed changes");
|
||||
Console.WriteLine(
|
||||
$"Committing \"{message}\"... with {changes.Count} proposed changes to the \"{Env.GetString("PUBLIC_ASSET_BRANCH")}\" branch"
|
||||
);
|
||||
|
||||
if (changes.Count == 0)
|
||||
return;
|
||||
@@ -62,11 +64,7 @@ namespace BlitzKit.CLI.Models
|
||||
{
|
||||
var bytes = await response.Content.ReadAsByteArrayAsync();
|
||||
|
||||
// we discard blob if they're the same size; it's unlikely their
|
||||
// contents will be different; I love playing russian roulette!
|
||||
var equal =
|
||||
bytes.Length == change.Content.Count || bytes.SequenceEqual([.. change.Content]);
|
||||
if (!equal)
|
||||
if (!bytes.SequenceEqual([.. change.Content]))
|
||||
{
|
||||
var diff = change.Content.Count - bytes.Length;
|
||||
|
||||
|
||||
@@ -25,13 +25,13 @@ namespace Blitzkit {
|
||||
byte[] descriptorData = global::System.Convert.FromBase64String(
|
||||
string.Concat(
|
||||
"CiNwYWNrYWdlcy9jb3JlL3NyYy9wcm90b3MvdGFuay5wcm90bxIIYmxpdHpr",
|
||||
"aXQaI3BhY2thZ2VzL2NvcmUvc3JjL3Byb3Rvcy9pMThuLnByb3RvIkAKBFRh",
|
||||
"bmsSCgoCaWQYASACKAkSDgoGc2VvX2lkGAIgAigJEhwKBG5hbWUYAyACKAsy",
|
||||
"Di5ibGl0emtpdC5JMThu"));
|
||||
"aXQaI3BhY2thZ2VzL2NvcmUvc3JjL3Byb3Rvcy9pMThuLnByb3RvIj4KBFRh",
|
||||
"bmsSCgoCaWQYASACKAkSDAoEc2x1ZxgCIAIoCRIcCgRuYW1lGAMgAigLMg4u",
|
||||
"YmxpdHpraXQuSTE4bg=="));
|
||||
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
|
||||
new pbr::FileDescriptor[] { global::Blitzkit.I18NReflection.Descriptor, },
|
||||
new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] {
|
||||
new pbr::GeneratedClrTypeInfo(typeof(global::Blitzkit.Tank), global::Blitzkit.Tank.Parser, new[]{ "Id", "SeoId", "Name" }, null, null, null, null)
|
||||
new pbr::GeneratedClrTypeInfo(typeof(global::Blitzkit.Tank), global::Blitzkit.Tank.Parser, new[]{ "Id", "Slug", "Name" }, null, null, null, null)
|
||||
}));
|
||||
}
|
||||
#endregion
|
||||
@@ -74,7 +74,7 @@ namespace Blitzkit {
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public Tank(Tank other) : this() {
|
||||
id_ = other.id_;
|
||||
seoId_ = other.seoId_;
|
||||
slug_ = other.slug_;
|
||||
name_ = other.name_ != null ? other.name_.Clone() : null;
|
||||
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
|
||||
}
|
||||
@@ -111,30 +111,30 @@ namespace Blitzkit {
|
||||
id_ = null;
|
||||
}
|
||||
|
||||
/// <summary>Field number for the "seo_id" field.</summary>
|
||||
public const int SeoIdFieldNumber = 2;
|
||||
private readonly static string SeoIdDefaultValue = "";
|
||||
/// <summary>Field number for the "slug" field.</summary>
|
||||
public const int SlugFieldNumber = 2;
|
||||
private readonly static string SlugDefaultValue = "";
|
||||
|
||||
private string seoId_;
|
||||
private string slug_;
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public string SeoId {
|
||||
get { return seoId_ ?? SeoIdDefaultValue; }
|
||||
public string Slug {
|
||||
get { return slug_ ?? SlugDefaultValue; }
|
||||
set {
|
||||
seoId_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
|
||||
slug_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
|
||||
}
|
||||
}
|
||||
/// <summary>Gets whether the "seo_id" field is set</summary>
|
||||
/// <summary>Gets whether the "slug" field is set</summary>
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public bool HasSeoId {
|
||||
get { return seoId_ != null; }
|
||||
public bool HasSlug {
|
||||
get { return slug_ != null; }
|
||||
}
|
||||
/// <summary>Clears the value of the "seo_id" field</summary>
|
||||
/// <summary>Clears the value of the "slug" field</summary>
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
|
||||
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
|
||||
public void ClearSeoId() {
|
||||
seoId_ = null;
|
||||
public void ClearSlug() {
|
||||
slug_ = null;
|
||||
}
|
||||
|
||||
/// <summary>Field number for the "name" field.</summary>
|
||||
@@ -165,7 +165,7 @@ namespace Blitzkit {
|
||||
return true;
|
||||
}
|
||||
if (Id != other.Id) return false;
|
||||
if (SeoId != other.SeoId) return false;
|
||||
if (Slug != other.Slug) return false;
|
||||
if (!object.Equals(Name, other.Name)) return false;
|
||||
return Equals(_unknownFields, other._unknownFields);
|
||||
}
|
||||
@@ -175,7 +175,7 @@ namespace Blitzkit {
|
||||
public override int GetHashCode() {
|
||||
int hash = 1;
|
||||
if (HasId) hash ^= Id.GetHashCode();
|
||||
if (HasSeoId) hash ^= SeoId.GetHashCode();
|
||||
if (HasSlug) hash ^= Slug.GetHashCode();
|
||||
if (name_ != null) hash ^= Name.GetHashCode();
|
||||
if (_unknownFields != null) {
|
||||
hash ^= _unknownFields.GetHashCode();
|
||||
@@ -199,9 +199,9 @@ namespace Blitzkit {
|
||||
output.WriteRawTag(10);
|
||||
output.WriteString(Id);
|
||||
}
|
||||
if (HasSeoId) {
|
||||
if (HasSlug) {
|
||||
output.WriteRawTag(18);
|
||||
output.WriteString(SeoId);
|
||||
output.WriteString(Slug);
|
||||
}
|
||||
if (name_ != null) {
|
||||
output.WriteRawTag(26);
|
||||
@@ -221,9 +221,9 @@ namespace Blitzkit {
|
||||
output.WriteRawTag(10);
|
||||
output.WriteString(Id);
|
||||
}
|
||||
if (HasSeoId) {
|
||||
if (HasSlug) {
|
||||
output.WriteRawTag(18);
|
||||
output.WriteString(SeoId);
|
||||
output.WriteString(Slug);
|
||||
}
|
||||
if (name_ != null) {
|
||||
output.WriteRawTag(26);
|
||||
@@ -242,8 +242,8 @@ namespace Blitzkit {
|
||||
if (HasId) {
|
||||
size += 1 + pb::CodedOutputStream.ComputeStringSize(Id);
|
||||
}
|
||||
if (HasSeoId) {
|
||||
size += 1 + pb::CodedOutputStream.ComputeStringSize(SeoId);
|
||||
if (HasSlug) {
|
||||
size += 1 + pb::CodedOutputStream.ComputeStringSize(Slug);
|
||||
}
|
||||
if (name_ != null) {
|
||||
size += 1 + pb::CodedOutputStream.ComputeMessageSize(Name);
|
||||
@@ -263,8 +263,8 @@ namespace Blitzkit {
|
||||
if (other.HasId) {
|
||||
Id = other.Id;
|
||||
}
|
||||
if (other.HasSeoId) {
|
||||
SeoId = other.SeoId;
|
||||
if (other.HasSlug) {
|
||||
Slug = other.Slug;
|
||||
}
|
||||
if (other.name_ != null) {
|
||||
if (name_ == null) {
|
||||
@@ -296,7 +296,7 @@ namespace Blitzkit {
|
||||
break;
|
||||
}
|
||||
case 18: {
|
||||
SeoId = input.ReadString();
|
||||
Slug = input.ReadString();
|
||||
break;
|
||||
}
|
||||
case 26: {
|
||||
@@ -330,7 +330,7 @@ namespace Blitzkit {
|
||||
break;
|
||||
}
|
||||
case 18: {
|
||||
SeoId = input.ReadString();
|
||||
Slug = input.ReadString();
|
||||
break;
|
||||
}
|
||||
case 26: {
|
||||
|
||||
Reference in new issue
Block a user