cleanupAdd project files.
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<PublishAot>true</PublishAot>
|
||||
<InvariantGlobalization>true</InvariantGlobalization>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Svg" Version="3.4.7" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.14.37216.2 d17.14
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "McsrGraphImageDownloader", "McsrGraphImageDownloader.csproj", "{A8D4F4FE-B5EA-48CA-98D4-337C666053F4}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{A8D4F4FE-B5EA-48CA-98D4-337C666053F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{A8D4F4FE-B5EA-48CA-98D4-337C666053F4}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A8D4F4FE-B5EA-48CA-98D4-337C666053F4}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A8D4F4FE-B5EA-48CA-98D4-337C666053F4}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {A55629BA-B519-4788-B13B-55C88DD1B069}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
using Svg;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace McsrGraphImageDownloader;
|
||||
|
||||
internal class Program {
|
||||
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
|
||||
public static extern int SystemParametersInfo(int uAction, int uParam, string lpvParam, int fuWinIni);
|
||||
public const int SPI_SETDESKWALLPAPER = 20;
|
||||
public const int SPIF_UPDATEINIFILE = 1;
|
||||
public const int SPIF_SENDCHANGE = 2;
|
||||
private const string outputFilename = "mcsrChart.png";
|
||||
|
||||
private static async Task Main(string[] args) {
|
||||
using var hc = new HttpClient();
|
||||
while (true) {
|
||||
var svgJson = await hc.GetStringAsync("https://mcsr.ghxx.dev/api/chart");
|
||||
var svgText = JsonDocument.Parse(svgJson).RootElement.GetProperty("data").GetString();
|
||||
var svg = SvgDocument.Open<SvgDocument>(new MemoryStream(Encoding.UTF8.GetBytes(svgText!)));
|
||||
using (var bitmap = svg.Draw(1920, 1080)) {
|
||||
bitmap.Save(outputFilename);
|
||||
}
|
||||
SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, Path.GetFullPath(outputFilename), SPIF_UPDATEINIFILE | SPIF_SENDCHANGE);
|
||||
|
||||
await Task.Delay(TimeSpan.FromMinutes(15));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user