mirror of
https://git.tonybark.com/tonytins/CyberBits.git
synced 2026-05-12 05:23:34 -04:00
Moved a lot of core functionality into new Common library
- Remove System.IO from Implicit Usings.
This commit is contained in:
parent
1f2032dcf8
commit
fb013f2b15
18 changed files with 169 additions and 14 deletions
6
CyberBits.Common/Addon.cs
Normal file
6
CyberBits.Common/Addon.cs
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
namespace CyberBits.Common;
|
||||
|
||||
public record Addon(
|
||||
[property: JsonPropertyName("cyberware")]
|
||||
string[] Cyberware
|
||||
);
|
||||
12
CyberBits.Common/Bits.cs
Normal file
12
CyberBits.Common/Bits.cs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
namespace CyberBits.Common;
|
||||
|
||||
public record Bits(
|
||||
[property: JsonPropertyName("image")]
|
||||
string Image,
|
||||
[property: JsonPropertyName("feat")]
|
||||
string Feat,
|
||||
[property: JsonPropertyName("base")]
|
||||
string[] Base,
|
||||
[property: JsonPropertyName("style")]
|
||||
string[] Style
|
||||
);
|
||||
8
CyberBits.Common/CBConsts.cs
Normal file
8
CyberBits.Common/CBConsts.cs
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
namespace CyberBits.Common;
|
||||
|
||||
public struct CBConsts
|
||||
{
|
||||
// Ignore VSCode if it complains about "ThisAssembly" not being found.
|
||||
public const string VERSION =
|
||||
$"{ThisAssembly.Git.SemVer.Major}.{ThisAssembly.Git.SemVer.Minor}.{ThisAssembly.Git.SemVer.Patch}";
|
||||
}
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
namespace CyberBits.Common;
|
||||
|
||||
public class Class1
|
||||
{
|
||||
|
||||
}
|
||||
|
|
@ -1,16 +1,22 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<RollForward>LatestMajor</RollForward>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Using Remove="System.IO" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="GitInfo" Version="3.6.0">
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="GodotSharp" Version="4.6.2" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
|||
31
CyberBits.Common/FileFetcher.cs
Normal file
31
CyberBits.Common/FileFetcher.cs
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
namespace CyberBits.Common;
|
||||
|
||||
public static class FileFetcher
|
||||
{
|
||||
public static string LoadTextFile(string filename, bool userDir = false)
|
||||
{
|
||||
var location = "res";
|
||||
|
||||
if (userDir)
|
||||
location = "user";
|
||||
|
||||
using var file = FileAccess.Open($"{location}://{filename}", FileAccess.ModeFlags.Read);
|
||||
var contents = file.GetAsText();
|
||||
|
||||
file.Close();
|
||||
return contents;
|
||||
}
|
||||
|
||||
public static ConfigFile LoadConfig(string filename, bool userDir = false)
|
||||
{
|
||||
var config = new ConfigFile();
|
||||
|
||||
// Load data from a file.
|
||||
var err = config.Load(LoadTextFile(filename, userDir));
|
||||
|
||||
if (err != Error.Ok)
|
||||
sys.Environment.Exit(sys.Environment.ExitCode);
|
||||
|
||||
return config;
|
||||
}
|
||||
}
|
||||
6
CyberBits.Common/GlobalUsing.cs
Normal file
6
CyberBits.Common/GlobalUsing.cs
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
// System
|
||||
global using sys = System;
|
||||
global using System.Text.Json.Serialization;
|
||||
|
||||
// Godot
|
||||
global using Godot;
|
||||
8
CyberBits.Common/ResourceFiles.cs
Normal file
8
CyberBits.Common/ResourceFiles.cs
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
namespace CyberBits.Common;
|
||||
|
||||
public struct ResourceFiles
|
||||
{
|
||||
public const string COCK_JSON = "resources/cock.json";
|
||||
public const string PUSSY_JSON = "resources/pussy.json";
|
||||
public const string ADDONS_JSON = "resources/addons.json";
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue