CLI mode (hide window)

This commit is contained in:
N00MKRAD
2024-09-28 21:33:36 +02:00
parent 76defc4c19
commit 8a3b4ebd80
7 changed files with 79 additions and 23 deletions

View File

@@ -3,11 +3,14 @@
<Import Project="packages\ILRepack.MSBuild.Task.2.0.13\build\ILRepack.MSBuild.Task.props" Condition="Exists('packages\ILRepack.MSBuild.Task.2.0.13\build\ILRepack.MSBuild.Task.props')" /> <Import Project="packages\ILRepack.MSBuild.Task.2.0.13\build\ILRepack.MSBuild.Task.props" Condition="Exists('packages\ILRepack.MSBuild.Task.2.0.13\build\ILRepack.MSBuild.Task.props')" />
<Import Project="packages\ILRepack.2.0.34\build\ILRepack.props" Condition="Exists('packages\ILRepack.2.0.34\build\ILRepack.props')" /> <Import Project="packages\ILRepack.2.0.34\build\ILRepack.props" Condition="Exists('packages\ILRepack.2.0.34\build\ILRepack.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<DefineConstants>WINDOWS_APP</DefineConstants>
</PropertyGroup>
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{389E42DD-A163-49D7-9E0A-AE41090A07B3}</ProjectGuid> <ProjectGuid>{389E42DD-A163-49D7-9E0A-AE41090A07B3}</ProjectGuid>
<OutputType>WinExe</OutputType> <OutputType>Exe</OutputType>
<RootNamespace>Flowframes</RootNamespace> <RootNamespace>Flowframes</RootNamespace>
<AssemblyName>Flowframes</AssemblyName> <AssemblyName>Flowframes</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
@@ -66,10 +69,11 @@
<LangVersion>7.3</LangVersion> <LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit> <Prefer32Bit>false</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath> <OutputPath>bin\RelGui</OutputPath>
<OutputType>WinExe</OutputType>
<DefineConstants>DEBUG;TRACE</DefineConstants> <DefineConstants>DEBUG;TRACE</DefineConstants>
<Optimize>false</Optimize> <Optimize>false</Optimize>
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
@@ -77,8 +81,22 @@
<LangVersion>7.3</LangVersion> <LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit> <Prefer32Bit>false</Prefer32Bit>
<DebugSymbols>true</DebugSymbols> <DebugSymbols>false</DebugSymbols>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ConsoleRelease|x64'">
<OutputPath>bin\RelCmd</OutputPath>
<OutputType>Exe</OutputType>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<Optimize>false</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
<DebugSymbols>false</DebugSymbols>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies> <GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
@@ -645,7 +663,7 @@
<Error Condition="!Exists('packages\ILRepack.MSBuild.Task.2.0.13\build\ILRepack.MSBuild.Task.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\ILRepack.MSBuild.Task.2.0.13\build\ILRepack.MSBuild.Task.props'))" /> <Error Condition="!Exists('packages\ILRepack.MSBuild.Task.2.0.13\build\ILRepack.MSBuild.Task.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\ILRepack.MSBuild.Task.2.0.13\build\ILRepack.MSBuild.Task.props'))" />
<Error Condition="!Exists('packages\Magick.NET-Q8-x64.13.10.0\build\netstandard20\Magick.NET-Q8-x64.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Magick.NET-Q8-x64.13.10.0\build\netstandard20\Magick.NET-Q8-x64.targets'))" /> <Error Condition="!Exists('packages\Magick.NET-Q8-x64.13.10.0\build\netstandard20\Magick.NET-Q8-x64.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Magick.NET-Q8-x64.13.10.0\build\netstandard20\Magick.NET-Q8-x64.targets'))" />
</Target> </Target>
<Target Name="ILRepack" AfterTargets="Build" Condition="'$(Configuration)' == 'Release'"> <Target Name="ILRepack" AfterTargets="Build" Condition="'$(Configuration)' == 'ReleaseRepack'">
<PropertyGroup> <PropertyGroup>
<WorkingDirectory>$(MSBuildThisFileDirectory)bin\x64\Release</WorkingDirectory> <WorkingDirectory>$(MSBuildThisFileDirectory)bin\x64\Release</WorkingDirectory>
</PropertyGroup> </PropertyGroup>

View File

@@ -1,18 +1,24 @@
 
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16 # Visual Studio Version 17
VisualStudioVersion = 16.0.30413.136 VisualStudioVersion = 17.11.35303.130
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Flowframes", "Flowframes.csproj", "{389E42DD-A163-49D7-9E0A-AE41090A07B3}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Flowframes", "Flowframes.csproj", "{389E42DD-A163-49D7-9E0A-AE41090A07B3}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
ConsoleRelease|Any CPU = ConsoleRelease|Any CPU
ConsoleRelease|x64 = ConsoleRelease|x64
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64 Debug|x64 = Debug|x64
Release|Any CPU = Release|Any CPU Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64 Release|x64 = Release|x64
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{389E42DD-A163-49D7-9E0A-AE41090A07B3}.ConsoleRelease|Any CPU.ActiveCfg = ConsoleRelease|Any CPU
{389E42DD-A163-49D7-9E0A-AE41090A07B3}.ConsoleRelease|Any CPU.Build.0 = ConsoleRelease|Any CPU
{389E42DD-A163-49D7-9E0A-AE41090A07B3}.ConsoleRelease|x64.ActiveCfg = ConsoleRelease|x64
{389E42DD-A163-49D7-9E0A-AE41090A07B3}.ConsoleRelease|x64.Build.0 = ConsoleRelease|x64
{389E42DD-A163-49D7-9E0A-AE41090A07B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {389E42DD-A163-49D7-9E0A-AE41090A07B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{389E42DD-A163-49D7-9E0A-AE41090A07B3}.Debug|Any CPU.Build.0 = Debug|Any CPU {389E42DD-A163-49D7-9E0A-AE41090A07B3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{389E42DD-A163-49D7-9E0A-AE41090A07B3}.Debug|x64.ActiveCfg = Debug|x64 {389E42DD-A163-49D7-9E0A-AE41090A07B3}.Debug|x64.ActiveCfg = Debug|x64

View File

@@ -34,9 +34,31 @@ namespace Flowframes.Forms.Main
public bool ShowModelDownloader = false; public bool ShowModelDownloader = false;
protected override CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;
if (Program.CmdMode)
{
const int WS_EX_TOOLWINDOW = 0x80;
cp.ExStyle |= WS_EX_TOOLWINDOW; // Makes the window not appear in Alt-Tab
}
return cp;
}
}
public Form1() public Form1()
{ {
InitializeComponent(); InitializeComponent();
new SplashForm().Show();
if (Program.CmdMode)
{
ShowInTaskbar = false;
Opacity = 0;
}
} }
private async void Form1_Load(object sender, EventArgs e) private async void Form1_Load(object sender, EventArgs e)
@@ -47,7 +69,6 @@ namespace Flowframes.Forms.Main
private async void Form1_Shown(object sender, EventArgs e) private async void Form1_Shown(object sender, EventArgs e)
{ {
new SplashForm().Show();
Refresh(); Refresh();
await Task.Delay(1); await Task.Delay(1);
@@ -439,7 +460,10 @@ namespace Flowframes.Forms.Main
public void Initialized() public void Initialized()
{ {
Application.OpenForms.OfType<SplashForm>().ToList().ForEach(f => f.Close()); Application.OpenForms.OfType<SplashForm>().ToList().ForEach(f => f.Close());
Opacity = 1.0f;
if (!Program.CmdMode)
Opacity = 1.0f;
_initialized = true; _initialized = true;
runBtn.Enabled = true; runBtn.Enabled = true;
SetStatus("Ready"); SetStatus("Ready");
@@ -852,7 +876,7 @@ namespace Flowframes.Forms.Main
float inFps = fpsInTbox.GetFloat(); float inFps = fpsInTbox.GetFloat();
float outFps = fpsOutTbox.GetFloat(); float outFps = fpsOutTbox.GetFloat();
if(inFps == 0 || outFps == 0) if (inFps == 0 || outFps == 0)
return; return;
var targetFactorRounded = Math.Round((Decimal)(outFps / inFps), 3, MidpointRounding.AwayFromZero); var targetFactorRounded = Math.Round((Decimal)(outFps / inFps), 3, MidpointRounding.AwayFromZero);

View File

@@ -53,14 +53,19 @@
this.ClientSize = new System.Drawing.Size(480, 220); this.ClientSize = new System.Drawing.Size(480, 220);
this.Controls.Add(this.loadingTextLabel); this.Controls.Add(this.loadingTextLabel);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.MaximizeBox = false;
this.MaximumSize = new System.Drawing.Size(480, 220); this.MaximumSize = new System.Drawing.Size(480, 220);
this.MinimizeBox = false;
this.MinimumSize = new System.Drawing.Size(480, 220); this.MinimumSize = new System.Drawing.Size(480, 220);
this.Name = "SplashForm"; this.Name = "SplashForm";
this.Opacity = 0D;
this.ShowIcon = false; this.ShowIcon = false;
this.ShowInTaskbar = false; this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "SplashForm"; this.Text = "Flowframes";
this.TopMost = true;
this.UseWaitCursor = true; this.UseWaitCursor = true;
this.Load += new System.EventHandler(this.SplashForm_Load);
this.ResumeLayout(false); this.ResumeLayout(false);
} }

View File

@@ -1,12 +1,4 @@
using System; using System.Windows.Forms;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Flowframes.Forms namespace Flowframes.Forms
{ {
@@ -16,5 +8,13 @@ namespace Flowframes.Forms
{ {
InitializeComponent(); InitializeComponent();
} }
private void SplashForm_Load(object sender, System.EventArgs e)
{
if (!Program.CmdMode)
{
Opacity = 1f;
}
}
} }
} }

View File

@@ -28,10 +28,13 @@ namespace Flowframes
public static bool lastInputPathIsSsd; public static bool lastInputPathIsSsd;
public static Queue<InterpSettings> batchQueue = new Queue<InterpSettings>(); public static Queue<InterpSettings> batchQueue = new Queue<InterpSettings>();
public static bool CmdMode = false;
[STAThread] [STAThread]
static void Main() static void Main()
{ {
CmdMode = new FileInfo(Paths.GetExe()).Name.Contains("Cmd");
// Force culture to en-US across entire application (to avoid number parsing issues etc) // Force culture to en-US across entire application (to avoid number parsing issues etc)
var culture = new CultureInfo("en-US"); var culture = new CultureInfo("en-US");
Thread.CurrentThread.CurrentCulture = culture; Thread.CurrentThread.CurrentCulture = culture;

View File

@@ -43,7 +43,7 @@ namespace Flowframes.Ui
{ {
try try
{ {
Logger.Log("Parsing Patrons from CSV...", true); // Logger.Log("Parsing Patrons from CSV...", true);
List<string> goldPatrons = new List<string>(); List<string> goldPatrons = new List<string>();
List<string> silverPatrons = new List<string>(); List<string> silverPatrons = new List<string>();
string str = "Gold:\n"; string str = "Gold:\n";
@@ -68,7 +68,7 @@ namespace Flowframes.Ui
} }
} }
Logger.Log($"Found {goldPatrons.Count} Gold Patrons, {silverPatrons.Count} Silver Patrons", true); // Logger.Log($"Found {goldPatrons.Count} Gold Patrons, {silverPatrons.Count} Silver Patrons", true);
foreach (string pat in goldPatrons) foreach (string pat in goldPatrons)
str += pat + "\n"; str += pat + "\n";