Projektdateien hinzufügen.

This commit is contained in:
2024-05-05 15:59:49 +02:00
parent 74da0c6962
commit 7c28a6ee17
242 changed files with 23697 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
using global::System;
using global::System.Reflection;
using global::System.Runtime.InteropServices;
[assembly: ComVisible(false)]
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird.
[assembly: Guid("245f4730-1df1-43f7-8bef-9626648c4204")]

View File

@@ -0,0 +1,62 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<MyType>Windows</MyType>
<TargetFramework>net8.0</TargetFramework>
<DefaultItemExcludes>$(DefaultItemExcludes);$(ProjectDir)**\*.vb</DefaultItemExcludes>
<LangVersion>latest</LangVersion>
<AssemblyTitle>TextValueConverter</AssemblyTitle>
<Company>DRSN</Company>
<Product>TextValueConverter</Product>
<Copyright>Copyright © Pilzinsel64 2018 - 2020</Copyright>
<DocumentationFile>SM64Lib.TextValueConverter.xml</DocumentationFile>
<DefineTrace>true</DefineTrace>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022,CS1591,CS0168</NoWarn>
<Platforms>AnyCPU</Platforms>
<Configurations>Debug;Release;ReleaseBundle;ReleaseStandalone</Configurations>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineDebug>true</DefineDebug>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DefineDebug>false</DefineDebug>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseStandalone|AnyCPU'">
<DefineDebug>false</DefineDebug>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseBundle|AnyCPU'">
<DefineDebug>false</DefineDebug>
</PropertyGroup>
<PropertyGroup>
<OptionExplicit>On</OptionExplicit>
</PropertyGroup>
<PropertyGroup>
<OptionCompare>Binary</OptionCompare>
</PropertyGroup>
<PropertyGroup>
<OptionStrict>Off</OptionStrict>
</PropertyGroup>
<PropertyGroup>
<OptionInfer>On</OptionInfer>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.VisualBasic" Version="10.3.0" />
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
</ItemGroup>
<ItemGroup>
<Import Include="Microsoft.VisualBasic" />
<Import Include="System" />
<Import Include="System.Collections" />
<Import Include="System.Collections.Generic" />
<Import Include="System.Data" />
<Import Include="System.Diagnostics" />
<Import Include="System.Linq" />
<Import Include="System.Xml.Linq" />
<Import Include="System.Threading.Tasks" />
</ItemGroup>
<ItemGroup>
<Compile Remove="obj\RelMono\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs" />
<Compile Remove="obj\RelMono\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs" />
<Compile Remove="obj\RelMono\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>SM64Lib.TextValueConverter</name>
</assembly>
<members>
</members>
</doc>

View File

@@ -0,0 +1,89 @@
using System;
using Microsoft.VisualBasic.CompilerServices;
namespace SM64Lib.TextValueConverter
{
public static class TextValueConverter
{
public static event WantIntegerValueModeEventHandler WantIntegerValueMode;
public delegate void WantIntegerValueModeEventHandler(WantIntegerValueModeEventArgs e);
public static int ValueFromText(string Text, int DefaultValue = 0, int useIVM = -1)
{
return Convert.ToInt32(LongFromText(Text, DefaultValue, useIVM));
}
public static long LongFromText(string Text, long DefaultValue = 0, int useIVM = -1)
{
try
{
int IVM = useIVM > -1 ? useIVM : GetIntegerValueMode();
Text = Text?.ToLower()?.Trim();
if (string.IsNullOrWhiteSpace(Text))
return 0;
switch (true)
{
case object _ when Text.StartsWith("0x"):
case object _ when Text.StartsWith("&h"):
return Convert.ToInt32(Text.Substring(2), 16);
case object _ when Text.StartsWith("$"):
return Convert.ToInt32(Text.Substring(1), 16);
case object _ when Text.StartsWith("0b"):
case object _ when Text.StartsWith("&b"):
return Convert.ToInt32(Text.Substring(2), 2);
default:
return Convert.ToInt32(Text);
}
}
catch (Exception)
{
return DefaultValue;
}
}
public static string TextFromValue(long Value, int IVM = -1, int charCount = 0)
{
if (IVM == -1)
{
IVM = GetIntegerValueMode();
}
switch (IVM)
{
case 0:
return Value.ToString(GetCharCountAsZeroString(charCount));
case 1:
return "0x" + Value.ToString("X" + (charCount > 0 ? charCount.ToString() : ""));
case 2:
return "&H" + Value.ToString("X" + (charCount > 0 ? charCount.ToString() : ""));
case 3:
return "$" + Value.ToString("X" + (charCount > 0 ? charCount.ToString() : ""));
default:
return string.Empty;
}
}
private static string GetCharCountAsZeroString(int charCount)
{
string GetCharCountAsZeroStringRet = default;
GetCharCountAsZeroStringRet = "";
while (GetCharCountAsZeroStringRet.Length < charCount)
GetCharCountAsZeroStringRet += "0";
return GetCharCountAsZeroStringRet;
}
private static int GetIntegerValueMode()
{
var e = new WantIntegerValueModeEventArgs();
WantIntegerValueMode?.Invoke(e);
return e.IntegerValueMode;
}
}
public class WantIntegerValueModeEventArgs : EventArgs
{
public int IntegerValueMode { get; set; }
}
}