Skip to content

Commit 4809d94

Browse files
authored
Add files via upload
1 parent 6ba1b67 commit 4809d94

File tree

11 files changed

+306
-15
lines changed

11 files changed

+306
-15
lines changed

Configs.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ public class Configs: IConfig
6060
public MeowHintSettings MeowHintSettings { get; set; } = new MeowHintSettings();
6161
[Description("What text will the user see when hovering over a question mark in the settings?")]
6262
public string EnabledDisplayDescription { get; set; } = "Determines whether the display of enabled effects is enabled, replaces .display in the console";
63+
[Description("Will the plugin notify you of a new update")]
64+
public bool CheckForUpdate { get; set; } = true;
6365
/// <summary>
6466
/// Return effect name from <see cref="EffectTranslation"/> if not found return <see cref="EffectType"/> as <see cref="string"></see>
6567
/// </summary>

EffectDisplay.csproj

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="..\packages\Costura.Fody.6.0.0\build\Costura.Fody.props" Condition="Exists('..\packages\Costura.Fody.6.0.0\build\Costura.Fody.props')" />
34
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
45
<PropertyGroup>
56
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -12,6 +13,15 @@
1213
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
1314
<FileAlignment>512</FileAlignment>
1415
<Deterministic>true</Deterministic>
16+
<NuGetPackageImportStamp>
17+
</NuGetPackageImportStamp>
18+
<WeaverConfiguration>
19+
<Costura>
20+
<IncludeAssemblies>
21+
LiteDB
22+
</IncludeAssemblies>
23+
</Costura>
24+
</WeaverConfiguration>
1525
</PropertyGroup>
1626
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
1727
<DebugSymbols>true</DebugSymbols>
@@ -62,6 +72,9 @@
6272
<Reference Include="CommandSystem.Core, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
6373
<HintPath>..\packages\ExMod.Exiled.9.0.1\lib\net48\CommandSystem.Core.dll</HintPath>
6474
</Reference>
75+
<Reference Include="Costura, Version=6.0.0.0, Culture=neutral, PublicKeyToken=9919ef960d84173d, processorArchitecture=MSIL">
76+
<HintPath>..\packages\Costura.Fody.6.0.0\lib\netstandard2.0\Costura.dll</HintPath>
77+
</Reference>
6578
<Reference Include="Exiled.API, Version=9.0.1.0, Culture=neutral, processorArchitecture=AMD64">
6679
<HintPath>..\packages\ExMod.Exiled.9.0.1\lib\net48\Exiled.API.dll</HintPath>
6780
</Reference>
@@ -83,9 +96,9 @@
8396
<Reference Include="Exiled.Permissions, Version=9.0.1.0, Culture=neutral, processorArchitecture=AMD64">
8497
<HintPath>..\packages\ExMod.Exiled.9.0.1\lib\net48\Exiled.Permissions.dll</HintPath>
8598
</Reference>
86-
<Reference Include="LiteDB, Version=5.0.16.0, Culture=neutral, PublicKeyToken=4ee40123013c9f27, processorArchitecture=MSIL">
99+
<Reference Include="LiteDB, Version=5.0.16.0, Culture=neutral, processorArchitecture=MSIL">
87100
<HintPath>..\packages\LiteDB.5.0.16\lib\net45\LiteDB.dll</HintPath>
88-
<EmbedInteropTypes>False</EmbedInteropTypes>
101+
<SpecificVersion>False</SpecificVersion>
89102
</Reference>
90103
<Reference Include="Mirror">
91104
<HintPath>D:\SteamLibrary\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\Mirror.dll</HintPath>
@@ -125,6 +138,7 @@
125138
<Compile Include="EventHandler\PlayerEvent.cs" />
126139
<Compile Include="Extensions\PlayerExtensions.cs" />
127140
<Compile Include="Features\DataBase.cs" />
141+
<Compile Include="Features\GitHubUpdater.cs" />
128142
<Compile Include="Features\MeowHintManager.cs" />
129143
<Compile Include="Features\Sereliazer\MeowHintSettings.cs" />
130144
<Compile Include="Features\Sereliazer\NativeHintSettings.cs" />
@@ -137,4 +151,14 @@
137151
<None Include="packages.config" />
138152
</ItemGroup>
139153
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
154+
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
155+
<PropertyGroup>
156+
<ErrorText>Данный проект ссылается на пакеты NuGet, отсутствующие на этом компьютере. Используйте восстановление пакетов NuGet, чтобы скачать их. Дополнительную информацию см. по адресу: http://go.microsoft.com/fwlink/?LinkID=322105. Отсутствует следующий файл: {0}.</ErrorText>
157+
</PropertyGroup>
158+
<Error Condition="!Exists('..\packages\Costura.Fody.6.0.0\build\Costura.Fody.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Costura.Fody.6.0.0\build\Costura.Fody.props'))" />
159+
<Error Condition="!Exists('..\packages\Costura.Fody.6.0.0\build\Costura.Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Costura.Fody.6.0.0\build\Costura.Fody.targets'))" />
160+
<Error Condition="!Exists('..\packages\Fody.6.9.1\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.6.9.1\build\Fody.targets'))" />
161+
</Target>
162+
<Import Project="..\packages\Costura.Fody.6.0.0\build\Costura.Fody.targets" Condition="Exists('..\packages\Costura.Fody.6.0.0\build\Costura.Fody.targets')" />
163+
<Import Project="..\packages\Fody.6.9.1\build\Fody.targets" Condition="Exists('..\packages\Fody.6.9.1\build\Fody.targets')" />
140164
</Project>

EffectDisplay.sln

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,24 @@
1-
21
Microsoft Visual Studio Solution File, Format Version 12.00
32
# Visual Studio Version 17
4-
VisualStudioVersion = 17.6.33829.357
3+
VisualStudioVersion = 17.5.2.0
54
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EffectDisplay", "EffectDisplay\EffectDisplay.csproj", "{859B2CE7-9C9C-4CDA-B2D1-6AFAB4724063}"
5+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EffectDisplay", "EffectDisplay.csproj", "{7B9E9E25-73F0-5B6D-EBCF-26EAA67FC230}"
76
EndProject
87
Global
98
GlobalSection(SolutionConfigurationPlatforms) = preSolution
109
Debug|Any CPU = Debug|Any CPU
1110
Release|Any CPU = Release|Any CPU
1211
EndGlobalSection
1312
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14-
{859B2CE7-9C9C-4CDA-B2D1-6AFAB4724063}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15-
{859B2CE7-9C9C-4CDA-B2D1-6AFAB4724063}.Debug|Any CPU.Build.0 = Debug|Any CPU
16-
{859B2CE7-9C9C-4CDA-B2D1-6AFAB4724063}.Release|Any CPU.ActiveCfg = Release|Any CPU
17-
{859B2CE7-9C9C-4CDA-B2D1-6AFAB4724063}.Release|Any CPU.Build.0 = Release|Any CPU
13+
{7B9E9E25-73F0-5B6D-EBCF-26EAA67FC230}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
14+
{7B9E9E25-73F0-5B6D-EBCF-26EAA67FC230}.Debug|Any CPU.Build.0 = Debug|Any CPU
15+
{7B9E9E25-73F0-5B6D-EBCF-26EAA67FC230}.Release|Any CPU.ActiveCfg = Release|Any CPU
16+
{7B9E9E25-73F0-5B6D-EBCF-26EAA67FC230}.Release|Any CPU.Build.0 = Release|Any CPU
1817
EndGlobalSection
1918
GlobalSection(SolutionProperties) = preSolution
2019
HideSolutionNode = FALSE
2120
EndGlobalSection
2221
GlobalSection(ExtensibilityGlobals) = postSolution
23-
SolutionGuid = {1622DD29-C77E-41CB-A064-E6C10C3A1D86}
22+
SolutionGuid = {C1114C6A-16A4-4266-B01C-187B8BC38A81}
2423
EndGlobalSection
2524
EndGlobal

EventHandler/PlayerEvent.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,21 @@ namespace EffectDisplay.EventHandler
1010
{
1111
public class PlayerEvent
1212
{
13+
public static HeaderSetting Header { get; private set; }
1314
public static TwoButtonsSetting UpdateEnabler { get; private set; }
1415

1516
public PlayerEvent()
1617
{
18+
Header = new HeaderSetting(
19+
"Effect display setting",
20+
"Provides settings for Effect Display"
21+
);
1722
UpdateEnabler = new TwoButtonsSetting(
18-
1,
23+
2309,
1924
"Effect display",
2025
"ON",
2126
"OFF",
27+
header: Header,
2228
hintDescription: Plugin.Instance.Config.EnabledDisplayDescription,
2329
onChanged: OnUpdateSetting
2430
);

Features/GitHubUpdater.cs

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
using System;
2+
using System.Net.Http;
3+
using System.Threading.Tasks;
4+
5+
namespace EffectDisplay.Features
6+
{
7+
public class GithubUpdater
8+
{
9+
private const string LatestString = "/releases/latest";
10+
private string _ProjectLink { get; set; }
11+
private Version CurrentVersion { get; set; }
12+
public bool IsLatest { get
13+
{
14+
return !UpdateAvalaible();
15+
} }
16+
public GithubUpdater(string ProjectLink, Version MyFileVersion)
17+
{
18+
_ProjectLink = ProjectLink;
19+
CurrentVersion = MyFileVersion;
20+
}
21+
public bool UpdateAvalaible()
22+
{
23+
Version latest = GetUpdate().Result;
24+
return (latest > CurrentVersion);
25+
}
26+
private async Task<Version> GetUpdate()
27+
{
28+
using (HttpClient client = new HttpClient())
29+
{
30+
try
31+
{
32+
client.DefaultRequestHeaders.Add("User-Agent", $"C# Update finder");
33+
HttpResponseMessage response = await client.GetAsync($"{_ProjectLink}{LatestString}", HttpCompletionOption.ResponseHeadersRead);
34+
string link = response.RequestMessage?.RequestUri?.ToString();
35+
link = link.Replace(_ProjectLink, "").Replace("/releases/tag/", "").Replace("version-", "");
36+
Version LatestDetected = Version.Parse(link);
37+
return LatestDetected;
38+
}
39+
catch (Exception ex)
40+
{
41+
return null;
42+
}
43+
}
44+
}
45+
}
46+
}

FodyWeavers.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
2+
<Costura>
3+
<IncludeAssemblies>
4+
LiteDB
5+
</IncludeAssemblies>
6+
</Costura>
7+
</Weavers>

0 commit comments

Comments
 (0)