Add project files.
This commit is contained in:
parent
bc700f32ec
commit
00b7f9adaa
15 changed files with 315 additions and 0 deletions
18
Directory.build.props
Normal file
18
Directory.build.props
Normal file
|
@ -0,0 +1,18 @@
|
|||
<Project>
|
||||
<!-- StyleCop Analyzers configuration -->
|
||||
<PropertyGroup>
|
||||
<CodeAnalysisRuleSet>$(SolutionDir)StyleCop.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="StyleCop.Analyzers.Error" Version="1.0.2" />
|
||||
<PackageReference Include="StyleCop.CSharp.Async.Rules" Version="6.1.41">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<AdditionalFiles Include="$(SolutionDir)stylecop.json" Link="stylecop.json" />
|
||||
</ItemGroup>
|
||||
</Project>
|
55
EDNA.sln
Normal file
55
EDNA.sln
Normal file
|
@ -0,0 +1,55 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.31402.337
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EDNA", "EDNA\EDNA.csproj", "{544D0ACE-C5B9-47A3-88F8-F81B248FF399}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EDSM", "EDSM\EDSM.csproj", "{00E28477-4EDC-4721-ABCC-BFEC346CDEF6}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Spansh", "Spansh\Spansh.csproj", "{CDC9A6DB-B36C-448A-B34A-7654DD14278D}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Test", "Test\Test.csproj", "{335007EA-EC9B-43DC-9912-CC4AE955FB65}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EDTS", "EDTS\EDTS.csproj", "{113052DF-7F72-4302-8F92-4D9521D72E94}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{6155D836-CDE8-41B8-A12A-7628E6BA20DE}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
Directory.build.props = Directory.build.props
|
||||
stylecop.json = stylecop.json
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{544D0ACE-C5B9-47A3-88F8-F81B248FF399}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{544D0ACE-C5B9-47A3-88F8-F81B248FF399}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{544D0ACE-C5B9-47A3-88F8-F81B248FF399}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{544D0ACE-C5B9-47A3-88F8-F81B248FF399}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{00E28477-4EDC-4721-ABCC-BFEC346CDEF6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{00E28477-4EDC-4721-ABCC-BFEC346CDEF6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{00E28477-4EDC-4721-ABCC-BFEC346CDEF6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{00E28477-4EDC-4721-ABCC-BFEC346CDEF6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{CDC9A6DB-B36C-448A-B34A-7654DD14278D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{CDC9A6DB-B36C-448A-B34A-7654DD14278D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{CDC9A6DB-B36C-448A-B34A-7654DD14278D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{CDC9A6DB-B36C-448A-B34A-7654DD14278D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{335007EA-EC9B-43DC-9912-CC4AE955FB65}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{335007EA-EC9B-43DC-9912-CC4AE955FB65}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{335007EA-EC9B-43DC-9912-CC4AE955FB65}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{335007EA-EC9B-43DC-9912-CC4AE955FB65}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{113052DF-7F72-4302-8F92-4D9521D72E94}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{113052DF-7F72-4302-8F92-4D9521D72E94}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{113052DF-7F72-4302-8F92-4D9521D72E94}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{113052DF-7F72-4302-8F92-4D9521D72E94}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {78C4BF41-7FAF-4183-A6A4-0B563F5A5C2A}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
12
EDNA/Commander.cs
Normal file
12
EDNA/Commander.cs
Normal file
|
@ -0,0 +1,12 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace alterNERDtive.Edna
|
||||
{
|
||||
public class Commander
|
||||
{
|
||||
}
|
||||
}
|
17
EDNA/EDNA.csproj
Normal file
17
EDNA/EDNA.csproj
Normal file
|
@ -0,0 +1,17 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net48;net5.0</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\EDSM\EDSM.csproj" />
|
||||
<ProjectReference Include="..\EDTS\EDTS.csproj" />
|
||||
<ProjectReference Include="..\Spansh\Spansh.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
12
EDNA/StarSystem.cs
Normal file
12
EDNA/StarSystem.cs
Normal file
|
@ -0,0 +1,12 @@
|
|||
namespace alterNERDtive.Edna
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
class StarSystem
|
||||
{
|
||||
}
|
||||
}
|
12
EDNA/StarSystems.cs
Normal file
12
EDNA/StarSystems.cs
Normal file
|
@ -0,0 +1,12 @@
|
|||
namespace alterNERDtive.Edna
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
class StarSystems
|
||||
{
|
||||
}
|
||||
}
|
15
EDSM/EDSM.csproj
Normal file
15
EDSM/EDSM.csproj
Normal file
|
@ -0,0 +1,15 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net48;net5.0</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.7" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
12
EDSM/EdsmApi.cs
Normal file
12
EDSM/EdsmApi.cs
Normal file
|
@ -0,0 +1,12 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EDSM
|
||||
{
|
||||
public class EdsmApi
|
||||
{
|
||||
}
|
||||
}
|
15
EDTS/EDTS.csproj
Normal file
15
EDTS/EDTS.csproj
Normal file
|
@ -0,0 +1,15 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net48;net5.0</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.7" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
63
EDTS/EdtsApi.cs
Normal file
63
EDTS/EdtsApi.cs
Normal file
|
@ -0,0 +1,63 @@
|
|||
using System;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
|
||||
namespace alterNERDtive.Edna.Edts
|
||||
{
|
||||
public struct StarSystem
|
||||
{
|
||||
public string Name { get; set; }
|
||||
|
||||
public Location Coordinates { get; set; }
|
||||
}
|
||||
|
||||
public struct Location
|
||||
{
|
||||
public int X { get; set; }
|
||||
|
||||
public int Y { get; set; }
|
||||
|
||||
public int Z { get; set; }
|
||||
|
||||
public int Precision { get; set; }
|
||||
}
|
||||
|
||||
public class EdtsApi
|
||||
{
|
||||
private static readonly string ApiUrl = "http://edts.thargoid.space/api/v1/";
|
||||
private static readonly HttpClient ApiClient;
|
||||
|
||||
static EdtsApi()
|
||||
{
|
||||
ApiClient = new HttpClient
|
||||
{
|
||||
BaseAddress = new Uri(ApiUrl)
|
||||
};
|
||||
ApiClient.DefaultRequestHeaders.Accept.Clear();
|
||||
ApiClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
|
||||
}
|
||||
|
||||
public static StarSystem Find_System(string name)
|
||||
{
|
||||
HttpResponseMessage response = ApiClient.GetAsync($"system_position/{name}").Result;
|
||||
|
||||
if (response.StatusCode == System.Net.HttpStatusCode.BadRequest) // 400
|
||||
{
|
||||
throw new ArgumentException($"“{name}” is not a valid proc gen system name.", "~system");
|
||||
}
|
||||
|
||||
response.EnsureSuccessStatusCode();
|
||||
dynamic json = response.Content.ReadAsAsync<dynamic>().Result["result"];
|
||||
|
||||
return new StarSystem {
|
||||
Name = name,
|
||||
Coordinates = new Location {
|
||||
X = json["position"]["x"],
|
||||
Y = json["position"]["y"],
|
||||
Z = json["position"]["z"],
|
||||
Precision = json["uncertainty"]
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
15
Spansh/Spansh.csproj
Normal file
15
Spansh/Spansh.csproj
Normal file
|
@ -0,0 +1,15 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net48;net5.0</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.7" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
12
Spansh/SpanshApi.cs
Normal file
12
Spansh/SpanshApi.cs
Normal file
|
@ -0,0 +1,12 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Spansh
|
||||
{
|
||||
public class SpanshApi
|
||||
{
|
||||
}
|
||||
}
|
23
Test/EDTS/LocationTest.cs
Normal file
23
Test/EDTS/LocationTest.cs
Normal file
|
@ -0,0 +1,23 @@
|
|||
using System;
|
||||
using alterNERDtive.Edna.Edts;
|
||||
using Xunit;
|
||||
|
||||
namespace Test.Edts
|
||||
{
|
||||
public class LocationTest
|
||||
{
|
||||
[Theory]
|
||||
[InlineData("Oevasy SG-Y D0")]
|
||||
public void ProcGen_Valid(string name)
|
||||
{
|
||||
EdtsApi.Find_System(name: name);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("just a test name")]
|
||||
public void ProcGen_Invalid(string name)
|
||||
{
|
||||
Assert.Throws<ArgumentException>(() => EdtsApi.Find_System(name: name));
|
||||
}
|
||||
}
|
||||
}
|
26
Test/Test.csproj
Normal file
26
Test/Test.csproj
Normal file
|
@ -0,0 +1,26 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net48;net5.0</TargetFrameworks>
|
||||
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.7" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.10.0" />
|
||||
<PackageReference Include="xunit" Version="2.4.1" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\EDNA\EDNA.csproj" />
|
||||
<ProjectReference Include="..\EDSM\EDSM.csproj" />
|
||||
<ProjectReference Include="..\EDTS\EDTS.csproj" />
|
||||
<ProjectReference Include="..\Spansh\Spansh.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
8
stylecop.json
Normal file
8
stylecop.json
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json",
|
||||
"settings": {
|
||||
"orderingRules": {
|
||||
"usingDirectivesPlacement": "outsideNamespace"
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue