This commit is contained in:
2021-11-26 16:03:06 +00:00
parent f74f397a31
commit 50249ede6e
8 changed files with 168 additions and 0 deletions

26
.vscode/launch.json vendored Normal file
View File

@@ -0,0 +1,26 @@
{
"version": "0.2.0",
"configurations": [
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/bin/Debug/net6.0/raven-launcher.dll",
"args": [],
"cwd": "${workspaceFolder}",
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
"console": "integratedTerminal",
"stopAtEntry": false
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach"
}
]
}

42
.vscode/tasks.json vendored Normal file
View File

@@ -0,0 +1,42 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/raven-launcher.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/raven-launcher.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"${workspaceFolder}/raven-launcher.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
}
]
}

59
Program.cs Normal file
View File

@@ -0,0 +1,59 @@
global using System.Text.Json;
global using System.Text.Json.Serialization;
// Prevent from ending if CTL+C is pressed.
Console.TreatControlCAsInput = true;
Console.WriteLine($"AyaNova server launcher {AyaNovaVersion.VersionString}");
AyConfig cfg = null;
var ConfigFileName = @"config.json";
var json = string.Empty;
bool FirstTime=false;
//Read configuration or create if not exist
if (File.Exists(ConfigFileName))
{
json = File.ReadAllText(ConfigFileName);
cfg = JsonSerializer.Deserialize<AyConfig>(json);
}
else
{
cfg = new AyConfig();
FirstTime=true;
}
if(FirstTime){
Console.WriteLine("Configuration file not found; using default values");
}
Console.WriteLine("Current configuration:");
//iterate / prompt for each value
//write configuration
cfg = new AyConfig();
json = JsonSerializer.Serialize(cfg);
File.WriteAllText(ConfigFileName, json);
Console.WriteLine("Press CTL-C keys to shut down AyaNova Server");
bool Quit = false;
ConsoleKeyInfo cki;
do
{
cki = Console.ReadKey(false);
if (cki.Key == ConsoleKey.C && (cki.Modifiers & ConsoleModifiers.Control) != 0)
{
Quit = true;
}
else
{
Console.WriteLine("Press CTL-C keys to shut down AyaNova Server");
}
//Console.WriteLine(cki.Key.ToString());
} while (!Quit);

9
appsettings.json Normal file
View File

@@ -0,0 +1,9 @@
{
"AYANOVA_USE_URLS": "http://*:7575",
"AYANOVA_DB_CONNECTION":"Server=localhost;Username=postgres;Password=mypasswordforpostgres;Database=AyaNova;",
"AYANOVA_DEFAULT_TRANSLATION":"en",
"AYANOVA_BACKUP_PG_DUMP_PATH":"postgres\\bin\\",
"AYANOVA_FOLDER_USER_FILES":"%programdata\\ayanova\\userfiles",
"AYANOVA_FOLDER_BACKUP_FILES":"%programdata\\ayanova\\backupfiles",
"AYANOVA_LOG_PATH":"%programdata\\ayanova\\"
}

9
ayanova-version.cs Normal file
View File

@@ -0,0 +1,9 @@
/// <summary>
/// Version strings centrally located for convenience
/// </summary>
internal static class AyaNovaVersion
{
public const string VersionString = "8.0.0-alpha.141";
public const string FullNameAndVersion = "AyaNova server " + VersionString;
}//eoc

5
ayconfig.cs Normal file
View File

@@ -0,0 +1,5 @@
public class AyConfig
{
public bool AllowScheduleConflicts { get; set; } = true;
public string Test { get; set; } = "AyaNova server ";
}

1
config.json Normal file
View File

@@ -0,0 +1 @@
{"AllowScheduleConflicts":true,"Test":"AyaNova server "}

17
raven-launcher.csproj Normal file
View File

@@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>raven_launcher</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<ApplicationIcon>ayanova.ico</ApplicationIcon>
<AssemblyName>ayanova-launcher</AssemblyName>
</PropertyGroup>
<ItemGroup>
<Content Include="appsettings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Project>