Skip to content

Commit

Permalink
migrate to .NET 5, other improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Rcmcpe committed Mar 26, 2020
1 parent 7abf0e1 commit 4ff9115
Show file tree
Hide file tree
Showing 8 changed files with 79 additions and 105 deletions.
20 changes: 10 additions & 10 deletions Arknights Automation Library/Arknights Automation Library.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>netcoreapp5.0</TargetFramework>
<RootNamespace>REVUnit.AutoArknights.Core</RootNamespace>
<AssemblyName>REVUnit.AutoArknights.Core</AssemblyName>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Flurl" Version="3.0.0-pre3"/>
<PackageReference Include="Flurl.Http" Version="3.0.0-pre3"/>
<PackageReference Include="Newtonsoft.Json" Version="12.0.3"/>
<PackageReference Include="System.Drawing.Common" Version="4.7.0"/>
<PackageReference Include="System.Reactive" Version="4.3.2"/>
<PackageReference Include="Flurl" Version="3.0.0-pre3" />
<PackageReference Include="Flurl.Http" Version="3.0.0-pre3" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="System.Drawing.Common" Version="4.7.0" />
<PackageReference Include="System.Reactive" Version="4.3.2" />
</ItemGroup>
<ItemGroup>
<None Update="adb\**">
Expand All @@ -18,13 +18,13 @@
<None Update="Assets\**">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<Compile Remove="Automation Script\**"/>
<Compile Remove="Automation Script\**" />
</ItemGroup>
<ItemGroup>
<Folder Include="Assets\Cache"/>
<Folder Include="Assets\Cache" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Crlib\Crlib\Crlib.csproj"/>
<ProjectReference Include="..\REVUnit.ImageLocator\REVUnit.ImageLocator\REVUnit.ImageLocator.csproj"/>
<ProjectReference Include="..\Crlib\Crlib\Crlib.csproj" />
<ProjectReference Include="..\REVUnit.ImageLocator\REVUnit.ImageLocator\REVUnit.ImageLocator.csproj" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion Auto Arknights CLI/Auto Arknights CLI.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>netcoreapp5.0</TargetFramework>
<RootNamespace>REVUnit.AutoArknights.CLI</RootNamespace>
<UseWindowsForms>true</UseWindowsForms>
<UseWPF>true</UseWPF>
Expand Down
14 changes: 7 additions & 7 deletions Auto Arknights CLI/AutoArknights.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,22 @@ public AutoArknights()
Console.ReadKey(true);
return;
}

IConfiguration config = new ConfigurationBuilder().AddJsonFile(".\\Config.json").Build();
_automation = new Automation(config["Adb:Path"], config["Adb:Remote"]);
}

public void Dispose()
{
Console.WriteLine("Disposing!");
_automation.Dispose();
}

public void Run()
{
var cin = new Cin();
_automation.Schedule.Add(new RepeatLevelJob(RepeatLevelJob.Mode.SpecifiedTimes, cin.Get<int>("输入刷关次数")));
_automation.Schedule.ExecuteAll();
}

public void Dispose()
{
Console.WriteLine("Disposing!");
_automation.Dispose();
}
}
}
42 changes: 19 additions & 23 deletions Auto Arknights CLI/Entry.cs
Original file line number Diff line number Diff line change
@@ -1,31 +1,27 @@
using System;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Configuration;
using REVUnit.AutoArknights.Core;
using REVUnit.Crlib.Extension;
using REVUnit.Crlib.Input;

namespace REVUnit.AutoArknights.CLI
namespace REVUnit.AutoArknights.CLI
{
public static class Entry
{
public static void Main()
{
var src = new CancellationTokenSource();
var task = new Task(() =>
{
using var app = new AutoArknights();
app.Run();
}, src.Token, TaskCreationOptions.LongRunning);
XConsole.Exiting += () =>
{
src.Cancel();
Console.WriteLine("已释放非托管资源。");
Environment.Exit(0);
};
task.Start();
task.Wait(src.Token);
using var app = new AutoArknights();
app.Run();
// 经过实验,并不能释放非托管资源。
// TODO See https://github.com/CCRcmcpe/Auto-Arknights/issues/1
// var src = new CancellationTokenSource();
// var task = new Task(() =>
// {
// using var app = new AutoArknights();
// app.Run();
// }, src.Token, TaskCreationOptions.LongRunning);
// XConsole.Exiting += () =>
// {
// src.Cancel();
// Console.WriteLine("已释放非托管资源。");
// Environment.Exit(0);
// };
// task.Start();
// task.Wait(src.Token);
}
}
}
78 changes: 39 additions & 39 deletions Auto Arknights GUI/Auto Arknights GUI.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>netcoreapp5.0</TargetFramework>
<OutputType>WinExe</OutputType>
<RootNamespace>REVUnit.AutoArknights.GUI</RootNamespace>
<UseWindowsForms>true</UseWindowsForms>
Expand All @@ -24,50 +24,50 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\Roboto\Roboto-Black.ttf"/>
<Resource Include="Resources\Roboto\Roboto-BlackItalic.ttf"/>
<Resource Include="Resources\Roboto\Roboto-Bold.ttf"/>
<Resource Include="Resources\Roboto\Roboto-BoldItalic.ttf"/>
<Resource Include="Resources\Roboto\Roboto-Italic.ttf"/>
<Resource Include="Resources\Roboto\Roboto-Light.ttf"/>
<Resource Include="Resources\Roboto\Roboto-LightItalic.ttf"/>
<Resource Include="Resources\Roboto\Roboto-Medium.ttf"/>
<Resource Include="Resources\Roboto\Roboto-MediumItalic.ttf"/>
<Resource Include="Resources\Roboto\Roboto-Regular.ttf"/>
<Resource Include="Resources\Roboto\Roboto-Thin.ttf"/>
<Resource Include="Resources\Roboto\Roboto-ThinItalic.ttf"/>
<Resource Include="Resources\Roboto\RobotoCondensed-Bold.ttf"/>
<Resource Include="Resources\Roboto\RobotoCondensed-BoldItalic.ttf"/>
<Resource Include="Resources\Roboto\RobotoCondensed-Italic.ttf"/>
<Resource Include="Resources\Roboto\RobotoCondensed-Light.ttf"/>
<Resource Include="Resources\Roboto\RobotoCondensed-LightItalic.ttf"/>
<Resource Include="Resources\Roboto\RobotoCondensed-Regular.ttf"/>
<Resource Include="Resources\Roboto\Roboto-Black.ttf" />
<Resource Include="Resources\Roboto\Roboto-BlackItalic.ttf" />
<Resource Include="Resources\Roboto\Roboto-Bold.ttf" />
<Resource Include="Resources\Roboto\Roboto-BoldItalic.ttf" />
<Resource Include="Resources\Roboto\Roboto-Italic.ttf" />
<Resource Include="Resources\Roboto\Roboto-Light.ttf" />
<Resource Include="Resources\Roboto\Roboto-LightItalic.ttf" />
<Resource Include="Resources\Roboto\Roboto-Medium.ttf" />
<Resource Include="Resources\Roboto\Roboto-MediumItalic.ttf" />
<Resource Include="Resources\Roboto\Roboto-Regular.ttf" />
<Resource Include="Resources\Roboto\Roboto-Thin.ttf" />
<Resource Include="Resources\Roboto\Roboto-ThinItalic.ttf" />
<Resource Include="Resources\Roboto\RobotoCondensed-Bold.ttf" />
<Resource Include="Resources\Roboto\RobotoCondensed-BoldItalic.ttf" />
<Resource Include="Resources\Roboto\RobotoCondensed-Italic.ttf" />
<Resource Include="Resources\Roboto\RobotoCondensed-Light.ttf" />
<Resource Include="Resources\Roboto\RobotoCondensed-LightItalic.ttf" />
<Resource Include="Resources\Roboto\RobotoCondensed-Regular.ttf" />
</ItemGroup>
<ItemGroup>
<Resource Include="FodyWeavers.xml"/>
<Resource Include="FodyWeavers.xml" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="ControlzEx" Version="4.2.2"/>
<PackageReference Include="DynamicData" Version="6.14.3"/>
<PackageReference Include="Fody" Version="6.0.8"/>
<PackageReference Include="MahApps.Metro" Version="1.6.5"/>
<PackageReference Include="Microsoft.CSharp" Version="4.7.0"/>
<PackageReference Include="Newtonsoft.Json" Version="12.0.3"/>
<PackageReference Include="Pharmacist.Common" Version="1.5.3"/>
<PackageReference Include="ReactiveUI" Version="11.1.23"/>
<PackageReference Include="ReactiveUI.Events.WPF" Version="11.1.23"/>
<PackageReference Include="ReactiveUI.Fody" Version="11.1.23"/>
<PackageReference Include="ReactiveUI.WPF" Version="11.1.23"/>
<PackageReference Include="Splat" Version="9.3.11"/>
<PackageReference Include="Splat.Drawing" Version="9.3.11"/>
<PackageReference Include="System.Drawing.Primitives" Version="4.3.0"/>
<PackageReference Include="System.Reactive" Version="4.3.2"/>
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.7.0"/>
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.3"/>
<PackageReference Include="System.ValueTuple" Version="4.5.0"/>
<PackageReference Include="ControlzEx" Version="4.2.2" />
<PackageReference Include="DynamicData" Version="6.14.3" />
<PackageReference Include="Fody" Version="6.0.8" />
<PackageReference Include="MahApps.Metro" Version="1.6.5" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="Pharmacist.Common" Version="1.5.3" />
<PackageReference Include="ReactiveUI" Version="11.1.23" />
<PackageReference Include="ReactiveUI.Events.WPF" Version="11.1.23" />
<PackageReference Include="ReactiveUI.Fody" Version="11.1.23" />
<PackageReference Include="ReactiveUI.WPF" Version="11.1.23" />
<PackageReference Include="Splat" Version="9.3.11" />
<PackageReference Include="Splat.Drawing" Version="9.3.11" />
<PackageReference Include="System.Drawing.Primitives" Version="4.3.0" />
<PackageReference Include="System.Reactive" Version="4.3.2" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.7.0" />
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.3" />
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Arknights Automation Library\Arknights Automation Library.csproj"/>
<ProjectReference Include="..\Arknights Automation Library\Arknights Automation Library.csproj" />
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Settings.Designer.cs">
Expand Down
24 changes: 1 addition & 23 deletions Auto Arknights GUI/Properties/Annotations.cs
Original file line number Diff line number Diff line change
@@ -1,26 +1,4 @@
/* MIT License
Copyright (c) 2016 JetBrains http://www.jetbrains.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. */

using System;
using System;

// ReSharper disable InheritdocConsiderUsage

Expand Down
2 changes: 1 addition & 1 deletion Crlib
Submodule Crlib updated from 9d24ec to 807c91
2 changes: 1 addition & 1 deletion REVUnit.ImageLocator

0 comments on commit 4ff9115

Please sign in to comment.