Skip to content

Commit

Permalink
PUSH
Browse files Browse the repository at this point in the history
  • Loading branch information
NaysKutzu committed Aug 21, 2023
1 parent 0759d72 commit 63a1bb4
Show file tree
Hide file tree
Showing 19 changed files with 379 additions and 0 deletions.
Binary file added cli/.vs/MythicalDash/DesignTimeBuild/.dtbcache.v2
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Empty file.
Binary file added cli/.vs/MythicalDash/v17/.suo
Binary file not shown.
3 changes: 3 additions & 0 deletions cli/FodyWeavers.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<Costura />
</Weavers>
141 changes: 141 additions & 0 deletions cli/FodyWeavers.xsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
<xs:element name="Weavers">
<xs:complexType>
<xs:all>
<xs:element name="Costura" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:all>
<xs:element minOccurs="0" maxOccurs="1" name="ExcludeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="IncludeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="ExcludeRuntimeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of runtime assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="IncludeRuntimeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of runtime assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="Unmanaged32Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged 32 bit assembly names to include, delimited with line breaks.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="Unmanaged64Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged 64 bit assembly names to include, delimited with line breaks.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="PreloadOrder" type="xs:string">
<xs:annotation>
<xs:documentation>The order of preloaded assemblies, delimited with line breaks.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:all>
<xs:attribute name="CreateTemporaryAssemblies" type="xs:boolean">
<xs:annotation>
<xs:documentation>This will copy embedded files to disk before loading them into memory. This is helpful for some scenarios that expected an assembly to be loaded from a physical file.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="IncludeDebugSymbols" type="xs:boolean">
<xs:annotation>
<xs:documentation>Controls if .pdbs for reference assemblies are also embedded.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="IncludeRuntimeReferences" type="xs:boolean">
<xs:annotation>
<xs:documentation>Controls if runtime assemblies are also embedded.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="UseRuntimeReferencePaths" type="xs:boolean">
<xs:annotation>
<xs:documentation>Controls whether the runtime assemblies are embedded with their full path or only with their assembly name.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="DisableCompression" type="xs:boolean">
<xs:annotation>
<xs:documentation>Embedded assemblies are compressed by default, and uncompressed when they are loaded. You can turn compression off with this option.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="DisableCleanup" type="xs:boolean">
<xs:annotation>
<xs:documentation>As part of Costura, embedded assemblies are no longer included as part of the build. This cleanup can be turned off.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="LoadAtModuleInit" type="xs:boolean">
<xs:annotation>
<xs:documentation>Costura by default will load as part of the module initialization. This flag disables that behavior. Make sure you call CosturaUtility.Initialize() somewhere in your code.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="IgnoreSatelliteAssemblies" type="xs:boolean">
<xs:annotation>
<xs:documentation>Costura will by default use assemblies with a name like 'resources.dll' as a satellite resource and prepend the output path. This flag disables that behavior.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="ExcludeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with |</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="IncludeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of assembly names to include from the default action of "embed all Copy Local references", delimited with |.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="ExcludeRuntimeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of runtime assembly names to exclude from the default action of "embed all Copy Local references", delimited with |</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="IncludeRuntimeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of runtime assembly names to include from the default action of "embed all Copy Local references", delimited with |.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Unmanaged32Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged 32 bit assembly names to include, delimited with |.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Unmanaged64Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged 64 bit assembly names to include, delimited with |.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="PreloadOrder" type="xs:string">
<xs:annotation>
<xs:documentation>The order of preloaded assemblies, delimited with |.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="VerifyAssembly" type="xs:boolean">
<xs:annotation>
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
<xs:annotation>
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="GenerateXsd" type="xs:boolean">
<xs:annotation>
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>
94 changes: 94 additions & 0 deletions cli/Logger.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
namespace MythicalDash
{
public enum LogType
{
Info,
Warning,
Error
}

public class Logger
{
private string logFilePath;

public Logger()
{
string logDirectory = "logs";
string logFileName = "log.txt";
string logDirectoryPath = Path.Combine(Directory.GetCurrentDirectory(), logDirectory);
logFilePath = Path.Combine(logDirectoryPath, logFileName);
Directory.CreateDirectory(logDirectoryPath);
RenameLogFile();
}

public void Log(LogType type, string message)
{
string timestamp = DateTime.Now.ToString("HH:mm:ss");
string logText = $"[{timestamp}] [{type.ToString()}] {message}";

ConsoleColor color = ConsoleColor.White;
switch (type)
{
case LogType.Info:
color = ConsoleColor.Blue;
break;
case LogType.Warning:
color = ConsoleColor.Yellow;
break;
case LogType.Error:
color = ConsoleColor.Red;
break;
}
Console.ForegroundColor = color;
Console.WriteLine(logText);
Console.ResetColor();

AppendToFile(logText);
}

private void AppendToFile(string logText)
{
try
{
using (StreamWriter writer = File.AppendText(logFilePath))
{
writer.WriteLine(logText);
}
}
catch (Exception ex)
{
Console.WriteLine($"Error writing to log file: {ex.Message}");
}
}

private void RenameLogFile()
{
if (File.Exists(logFilePath))
{
string logFileNameWithoutExtension = Path.GetFileNameWithoutExtension(logFilePath);
string logFileExtension = Path.GetExtension(logFilePath);
#pragma warning disable
string logDirectoryPath = Path.GetDirectoryName(logFilePath);
string newLogFileName = GetUniqueLogFileName(logDirectoryPath, logFileNameWithoutExtension, logFileExtension);
#pragma warning restore
string newLogFilePath = Path.Combine(logDirectoryPath, newLogFileName);
File.Move(logFilePath, newLogFilePath);
}
}

private string GetUniqueLogFileName(string directoryPath, string fileNameWithoutExtension, string fileExtension)
{
string uniqueFileName = $"{fileNameWithoutExtension}-{DateTime.Now:yyyy-MM-dd}{fileExtension}";
string uniqueFilePath = Path.Combine(directoryPath, uniqueFileName);

int counter = 1;
while (File.Exists(uniqueFilePath))
{
uniqueFileName = $"{fileNameWithoutExtension}-{counter++}-{DateTime.Now:yyyy-MM-dd}{fileExtension}";
uniqueFilePath = Path.Combine(directoryPath, uniqueFileName);
}

return uniqueFileName;
}
}
}
23 changes: 23 additions & 0 deletions cli/MythicalDash.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<ApplicationIcon>logo.ico</ApplicationIcon>
<SignAssembly>False</SignAssembly>
</PropertyGroup>

<ItemGroup>
<Content Include="logo.ico" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Costura.Fody" Version="5.7.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

</Project>
25 changes: 25 additions & 0 deletions cli/MythicalDash.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.6.33815.320
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MythicalDash", "MythicalDash.csproj", "{92A04E13-F64C-4CEE-99DD-328A38609A90}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{92A04E13-F64C-4CEE-99DD-328A38609A90}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{92A04E13-F64C-4CEE-99DD-328A38609A90}.Debug|Any CPU.Build.0 = Debug|Any CPU
{92A04E13-F64C-4CEE-99DD-328A38609A90}.Release|Any CPU.ActiveCfg = Release|Any CPU
{92A04E13-F64C-4CEE-99DD-328A38609A90}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {57EF9787-8693-492E-99E9-26F919158E9D}
EndGlobalSection
EndGlobal
48 changes: 48 additions & 0 deletions cli/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using System;

namespace MythicalDash
{
public class Program
{
public static string ascii = @"
__ __ _ _ _ _ _____ _
| \/ | | | | | (_) | | __ \ | |
| \ / |_ _| |_| |__ _ ___ __ _| | | | | __ _ ___| |__
| |\/| | | | | __| '_ \| |/ __/ _` | | | | |/ _` / __| '_ \
| | | | |_| | |_| | | | | (_| (_| | | |__| | (_| \__ \ | | |
|_| |_|\__, |\__|_| |_|_|\___\__,_|_|_____/ \__,_|___/_| |_|
__/ |
|___/
";
public static string version = "1.0.0";
public static bool skiposcheck = true;
public static Logger logger = new Logger();
public static void Main(string[] args)
{
Console.Clear();
Console.WriteLine(ascii);
if (skiposcheck == false) {
if (!System.OperatingSystem.IsLinux())
{
logger.Log(LogType.Error, "Sorry but this app runs on linux!");
Environment.Exit(0x0);
}
}
if (args.Contains("-version"))
{
logger.Log(LogType.Info, "You are running version: " + version);
Environment.Exit(0x0);
}
else if (args.Length > 0)
{
logger.Log(LogType.Error, "This is an invalid startup argument. Please use '-help' to get more information");
Environment.Exit(0x0);
} else
{
logger.Log(LogType.Error, "This is an invalid startup argument. Please use '-help' to get more information");
Environment.Exit(0x0);
}
}
}

}
Binary file added cli/logo.ico
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v7.0", FrameworkDisplayName = "")]
22 changes: 22 additions & 0 deletions cli/obj/Debug/net7.0/MythicalDash.AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

using System;
using System.Reflection;

[assembly: System.Reflection.AssemblyCompanyAttribute("MythicalDash")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("MythicalDash")]
[assembly: System.Reflection.AssemblyTitleAttribute("MythicalDash")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

// Generated by the MSBuild WriteCodeFragment class.

1 change: 1 addition & 0 deletions cli/obj/Debug/net7.0/MythicalDash.AssemblyInfoInputs.cache
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ff5325278ff6efc3cd9e5ee59b264a000d7532b9
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
is_global = true
build_property.TargetFramework = net7.0
build_property.TargetPlatformMinVersion =
build_property.UsingMicrosoftNETSdkWeb =
build_property.ProjectTypeGuids =
build_property.InvariantGlobalization =
build_property.PlatformNeutralAssembly =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = MythicalDash
build_property.ProjectDir = /var/www/client/cli/
8 changes: 8 additions & 0 deletions cli/obj/Debug/net7.0/MythicalDash.GlobalUsings.g.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// <auto-generated/>
global using global::System;
global using global::System.Collections.Generic;
global using global::System.IO;
global using global::System.Linq;
global using global::System.Net.Http;
global using global::System.Threading;
global using global::System.Threading.Tasks;

0 comments on commit 63a1bb4

Please sign in to comment.