Binary support

This commit is contained in:
twoischnig committed 2023-12-01 22:58:44 +01:00
1 parent 840218f119
commit 97df572f1e
21 files changed
+310 -45

No files matched your search

@@ -158,7 +158,7 @@ using System.Text;
s.Append($@"
if ({name} != null)
{{
int maxLength = Math.Min(PasswordHash.Length, {maxLength});
int maxLength = Math.Min({name}.Length, {maxLength});
uint v = (uint)maxLength;
while (v >= 0x80)
{{
@@ -167,7 +167,7 @@ using System.Text;
}}
buffer[offset++] = (byte)v;
Buffer.BlockCopy(PasswordHash, 0, buffer, offset, maxLength);
Buffer.BlockCopy({name}, 0, buffer, offset, maxLength);
offset += maxLength;
}}
else
@@ -237,7 +237,7 @@ using System.Text;
case "Guid":
s.Append($@"
{{
ret.{name} = new Guid(buffer.Slice(offset, 16));
ret.{name} = new Guid(buffer.Slice(offset, 16).ToArray());
offset+=16;
}}");
break;
@@ -262,7 +262,7 @@ using System.Text;
if(strLen > 0)
{{
ret.{name} = Encoding.UTF8.GetString(buffer.Slice(offset, strLen));
ret.{name} = Encoding.UTF8.GetString(buffer.Slice(offset, strLen).ToArray());
offset += strLen;
}}
}}");
@@ -334,9 +334,4 @@ using System.Text;
return obj.Item1.GetHashCode();
}
}
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface, AllowMultiple = false, Inherited = false)]
public class LobbyMessageAttribute : Attribute
{
}
}
@@ -15,6 +15,10 @@
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.7.0" />
</ItemGroup>
<ItemGroup>
<None Remove="bin\Release\netstandard2.0\\LobbyServerSourceGenerator.dll" />
</ItemGroup>
<ItemGroup>
<None Include="$(OutputPath)\$(AssemblyName).dll" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" />