Skip to content

Commit

Permalink
BeatSyncConsole: Started paths stuff, added unit test project
Browse files Browse the repository at this point in the history
  • Loading branch information
Zingabopp committed Aug 2, 2020
1 parent bf8eb1a commit a3ce611
Show file tree
Hide file tree
Showing 4 changed files with 140 additions and 0 deletions.
46 changes: 46 additions & 0 deletions BeatSync.sln
Original file line number Diff line number Diff line change
Expand Up @@ -21,82 +21,128 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BeatSyncLibTests", "BeatSyn
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BeatSaberPlaylistsLib", "Libs\BeatSaberPlaylistsLib\BeatSaberPlaylistsLib\BeatSaberPlaylistsLib.csproj", "{E58D6EC9-193F-4328-BB11-86EC2A8AD1FA}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BeatSyncConsoleTests", "BeatSyncConsoleTests\BeatSyncConsoleTests.csproj", "{51698714-9658-49D5-9658-9C2CEE10B772}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
ConsoleDebug|Any CPU = ConsoleDebug|Any CPU
ConsoleRelease|Any CPU = ConsoleRelease|Any CPU
Debug|Any CPU = Debug|Any CPU
ModDebug|Any CPU = ModDebug|Any CPU
ModRelease|Any CPU = ModRelease|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E9536F87-B2DE-423A-95A5-C1E35B1B0DD5}.ConsoleDebug|Any CPU.ActiveCfg = Debug|Any CPU
{E9536F87-B2DE-423A-95A5-C1E35B1B0DD5}.ConsoleRelease|Any CPU.ActiveCfg = Release|Any CPU
{E9536F87-B2DE-423A-95A5-C1E35B1B0DD5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E9536F87-B2DE-423A-95A5-C1E35B1B0DD5}.ModDebug|Any CPU.ActiveCfg = Debug|Any CPU
{E9536F87-B2DE-423A-95A5-C1E35B1B0DD5}.ModDebug|Any CPU.Build.0 = Debug|Any CPU
{E9536F87-B2DE-423A-95A5-C1E35B1B0DD5}.ModRelease|Any CPU.ActiveCfg = Release|Any CPU
{E9536F87-B2DE-423A-95A5-C1E35B1B0DD5}.ModRelease|Any CPU.Build.0 = Release|Any CPU
{E9536F87-B2DE-423A-95A5-C1E35B1B0DD5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{34E8F435-5C5A-4971-8D6C-173E027E17CA}.ConsoleDebug|Any CPU.ActiveCfg = Debug|Any CPU
{34E8F435-5C5A-4971-8D6C-173E027E17CA}.ConsoleDebug|Any CPU.Build.0 = Debug|Any CPU
{34E8F435-5C5A-4971-8D6C-173E027E17CA}.ConsoleRelease|Any CPU.ActiveCfg = Release|Any CPU
{34E8F435-5C5A-4971-8D6C-173E027E17CA}.ConsoleRelease|Any CPU.Build.0 = Release|Any CPU
{34E8F435-5C5A-4971-8D6C-173E027E17CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{34E8F435-5C5A-4971-8D6C-173E027E17CA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{34E8F435-5C5A-4971-8D6C-173E027E17CA}.ModDebug|Any CPU.ActiveCfg = Debug|Any CPU
{34E8F435-5C5A-4971-8D6C-173E027E17CA}.ModDebug|Any CPU.Build.0 = Debug|Any CPU
{34E8F435-5C5A-4971-8D6C-173E027E17CA}.ModRelease|Any CPU.ActiveCfg = Release|Any CPU
{34E8F435-5C5A-4971-8D6C-173E027E17CA}.ModRelease|Any CPU.Build.0 = Release|Any CPU
{34E8F435-5C5A-4971-8D6C-173E027E17CA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{34E8F435-5C5A-4971-8D6C-173E027E17CA}.Release|Any CPU.Build.0 = Release|Any CPU
{23477327-6D58-4775-AF9B-D89E8B8BB11F}.ConsoleDebug|Any CPU.ActiveCfg = Debug|Any CPU
{23477327-6D58-4775-AF9B-D89E8B8BB11F}.ConsoleDebug|Any CPU.Build.0 = Debug|Any CPU
{23477327-6D58-4775-AF9B-D89E8B8BB11F}.ConsoleRelease|Any CPU.ActiveCfg = Release|Any CPU
{23477327-6D58-4775-AF9B-D89E8B8BB11F}.ConsoleRelease|Any CPU.Build.0 = Release|Any CPU
{23477327-6D58-4775-AF9B-D89E8B8BB11F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{23477327-6D58-4775-AF9B-D89E8B8BB11F}.ModDebug|Any CPU.ActiveCfg = Debug|Any CPU
{23477327-6D58-4775-AF9B-D89E8B8BB11F}.ModDebug|Any CPU.Build.0 = Debug|Any CPU
{23477327-6D58-4775-AF9B-D89E8B8BB11F}.ModRelease|Any CPU.ActiveCfg = Release|Any CPU
{23477327-6D58-4775-AF9B-D89E8B8BB11F}.ModRelease|Any CPU.Build.0 = Release|Any CPU
{23477327-6D58-4775-AF9B-D89E8B8BB11F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{460A61BC-C89A-433D-A9E2-37447694D76C}.ConsoleDebug|Any CPU.ActiveCfg = Debug|Any CPU
{460A61BC-C89A-433D-A9E2-37447694D76C}.ConsoleDebug|Any CPU.Build.0 = Debug|Any CPU
{460A61BC-C89A-433D-A9E2-37447694D76C}.ConsoleRelease|Any CPU.ActiveCfg = Release|Any CPU
{460A61BC-C89A-433D-A9E2-37447694D76C}.ConsoleRelease|Any CPU.Build.0 = Release|Any CPU
{460A61BC-C89A-433D-A9E2-37447694D76C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{460A61BC-C89A-433D-A9E2-37447694D76C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{460A61BC-C89A-433D-A9E2-37447694D76C}.ModDebug|Any CPU.ActiveCfg = Debug|Any CPU
{460A61BC-C89A-433D-A9E2-37447694D76C}.ModDebug|Any CPU.Build.0 = Debug|Any CPU
{460A61BC-C89A-433D-A9E2-37447694D76C}.ModRelease|Any CPU.ActiveCfg = Release|Any CPU
{460A61BC-C89A-433D-A9E2-37447694D76C}.ModRelease|Any CPU.Build.0 = Release|Any CPU
{460A61BC-C89A-433D-A9E2-37447694D76C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{460A61BC-C89A-433D-A9E2-37447694D76C}.Release|Any CPU.Build.0 = Release|Any CPU
{EB4FAB34-2596-4640-AF08-9DD5558877CE}.ConsoleDebug|Any CPU.ActiveCfg = Debug|Any CPU
{EB4FAB34-2596-4640-AF08-9DD5558877CE}.ConsoleDebug|Any CPU.Build.0 = Debug|Any CPU
{EB4FAB34-2596-4640-AF08-9DD5558877CE}.ConsoleRelease|Any CPU.ActiveCfg = Release|Any CPU
{EB4FAB34-2596-4640-AF08-9DD5558877CE}.ConsoleRelease|Any CPU.Build.0 = Release|Any CPU
{EB4FAB34-2596-4640-AF08-9DD5558877CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EB4FAB34-2596-4640-AF08-9DD5558877CE}.ModDebug|Any CPU.ActiveCfg = Debug|Any CPU
{EB4FAB34-2596-4640-AF08-9DD5558877CE}.ModDebug|Any CPU.Build.0 = Debug|Any CPU
{EB4FAB34-2596-4640-AF08-9DD5558877CE}.ModRelease|Any CPU.ActiveCfg = Release|Any CPU
{EB4FAB34-2596-4640-AF08-9DD5558877CE}.ModRelease|Any CPU.Build.0 = Release|Any CPU
{EB4FAB34-2596-4640-AF08-9DD5558877CE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AF36D218-6A12-455D-86CC-4E7921535E34}.ConsoleDebug|Any CPU.ActiveCfg = Debug|Any CPU
{AF36D218-6A12-455D-86CC-4E7921535E34}.ConsoleDebug|Any CPU.Build.0 = Debug|Any CPU
{AF36D218-6A12-455D-86CC-4E7921535E34}.ConsoleRelease|Any CPU.ActiveCfg = Release|Any CPU
{AF36D218-6A12-455D-86CC-4E7921535E34}.ConsoleRelease|Any CPU.Build.0 = Release|Any CPU
{AF36D218-6A12-455D-86CC-4E7921535E34}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AF36D218-6A12-455D-86CC-4E7921535E34}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AF36D218-6A12-455D-86CC-4E7921535E34}.ModDebug|Any CPU.ActiveCfg = Debug|Any CPU
{AF36D218-6A12-455D-86CC-4E7921535E34}.ModRelease|Any CPU.ActiveCfg = Release|Any CPU
{AF36D218-6A12-455D-86CC-4E7921535E34}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AF36D218-6A12-455D-86CC-4E7921535E34}.Release|Any CPU.Build.0 = Release|Any CPU
{E2A07BDB-7085-48A3-AA50-B6E0856A7CCA}.ConsoleDebug|Any CPU.ActiveCfg = Debug|Any CPU
{E2A07BDB-7085-48A3-AA50-B6E0856A7CCA}.ConsoleDebug|Any CPU.Build.0 = Debug|Any CPU
{E2A07BDB-7085-48A3-AA50-B6E0856A7CCA}.ConsoleRelease|Any CPU.ActiveCfg = Release|Any CPU
{E2A07BDB-7085-48A3-AA50-B6E0856A7CCA}.ConsoleRelease|Any CPU.Build.0 = Release|Any CPU
{E2A07BDB-7085-48A3-AA50-B6E0856A7CCA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E2A07BDB-7085-48A3-AA50-B6E0856A7CCA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E2A07BDB-7085-48A3-AA50-B6E0856A7CCA}.ModDebug|Any CPU.ActiveCfg = Release-BeatSaber|Any CPU
{E2A07BDB-7085-48A3-AA50-B6E0856A7CCA}.ModDebug|Any CPU.Build.0 = Release-BeatSaber|Any CPU
{E2A07BDB-7085-48A3-AA50-B6E0856A7CCA}.ModRelease|Any CPU.ActiveCfg = Release-BeatSaber|Any CPU
{E2A07BDB-7085-48A3-AA50-B6E0856A7CCA}.ModRelease|Any CPU.Build.0 = Release-BeatSaber|Any CPU
{E2A07BDB-7085-48A3-AA50-B6E0856A7CCA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E2A07BDB-7085-48A3-AA50-B6E0856A7CCA}.Release|Any CPU.Build.0 = Release|Any CPU
{8BA75F87-831D-4420-915E-D7EC5F8953D3}.ConsoleDebug|Any CPU.ActiveCfg = Debug|Any CPU
{8BA75F87-831D-4420-915E-D7EC5F8953D3}.ConsoleDebug|Any CPU.Build.0 = Debug|Any CPU
{8BA75F87-831D-4420-915E-D7EC5F8953D3}.ConsoleRelease|Any CPU.ActiveCfg = Release|Any CPU
{8BA75F87-831D-4420-915E-D7EC5F8953D3}.ConsoleRelease|Any CPU.Build.0 = Release|Any CPU
{8BA75F87-831D-4420-915E-D7EC5F8953D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8BA75F87-831D-4420-915E-D7EC5F8953D3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8BA75F87-831D-4420-915E-D7EC5F8953D3}.ModDebug|Any CPU.ActiveCfg = Debug|Any CPU
{8BA75F87-831D-4420-915E-D7EC5F8953D3}.ModDebug|Any CPU.Build.0 = Debug|Any CPU
{8BA75F87-831D-4420-915E-D7EC5F8953D3}.ModRelease|Any CPU.ActiveCfg = Release|Any CPU
{8BA75F87-831D-4420-915E-D7EC5F8953D3}.ModRelease|Any CPU.Build.0 = Release|Any CPU
{8BA75F87-831D-4420-915E-D7EC5F8953D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8BA75F87-831D-4420-915E-D7EC5F8953D3}.Release|Any CPU.Build.0 = Release|Any CPU
{E58D6EC9-193F-4328-BB11-86EC2A8AD1FA}.ConsoleDebug|Any CPU.ActiveCfg = Debug|Any CPU
{E58D6EC9-193F-4328-BB11-86EC2A8AD1FA}.ConsoleDebug|Any CPU.Build.0 = Debug|Any CPU
{E58D6EC9-193F-4328-BB11-86EC2A8AD1FA}.ConsoleRelease|Any CPU.ActiveCfg = Release|Any CPU
{E58D6EC9-193F-4328-BB11-86EC2A8AD1FA}.ConsoleRelease|Any CPU.Build.0 = Release|Any CPU
{E58D6EC9-193F-4328-BB11-86EC2A8AD1FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E58D6EC9-193F-4328-BB11-86EC2A8AD1FA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E58D6EC9-193F-4328-BB11-86EC2A8AD1FA}.ModDebug|Any CPU.ActiveCfg = Release-BeatSaber|Any CPU
{E58D6EC9-193F-4328-BB11-86EC2A8AD1FA}.ModDebug|Any CPU.Build.0 = Release-BeatSaber|Any CPU
{E58D6EC9-193F-4328-BB11-86EC2A8AD1FA}.ModRelease|Any CPU.ActiveCfg = Release-BeatSaber|Any CPU
{E58D6EC9-193F-4328-BB11-86EC2A8AD1FA}.ModRelease|Any CPU.Build.0 = Release-BeatSaber|Any CPU
{E58D6EC9-193F-4328-BB11-86EC2A8AD1FA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E58D6EC9-193F-4328-BB11-86EC2A8AD1FA}.Release|Any CPU.Build.0 = Release|Any CPU
{51698714-9658-49D5-9658-9C2CEE10B772}.ConsoleDebug|Any CPU.ActiveCfg = Debug|Any CPU
{51698714-9658-49D5-9658-9C2CEE10B772}.ConsoleDebug|Any CPU.Build.0 = Debug|Any CPU
{51698714-9658-49D5-9658-9C2CEE10B772}.ConsoleRelease|Any CPU.ActiveCfg = Release|Any CPU
{51698714-9658-49D5-9658-9C2CEE10B772}.ConsoleRelease|Any CPU.Build.0 = Release|Any CPU
{51698714-9658-49D5-9658-9C2CEE10B772}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{51698714-9658-49D5-9658-9C2CEE10B772}.Debug|Any CPU.Build.0 = Debug|Any CPU
{51698714-9658-49D5-9658-9C2CEE10B772}.ModDebug|Any CPU.ActiveCfg = Debug|Any CPU
{51698714-9658-49D5-9658-9C2CEE10B772}.ModDebug|Any CPU.Build.0 = Debug|Any CPU
{51698714-9658-49D5-9658-9C2CEE10B772}.ModRelease|Any CPU.ActiveCfg = Release|Any CPU
{51698714-9658-49D5-9658-9C2CEE10B772}.ModRelease|Any CPU.Build.0 = Release|Any CPU
{51698714-9658-49D5-9658-9C2CEE10B772}.Release|Any CPU.ActiveCfg = Release|Any CPU
{51698714-9658-49D5-9658-9C2CEE10B772}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
55 changes: 55 additions & 0 deletions BeatSyncConsole/Utilities/Paths.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,63 @@
using BeatSyncConsole.Configs;
using BeatSyncConsole.Loggers;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

namespace BeatSyncConsole.Utilities
{
public enum OperatingSystem
{
Unknown,
Windows,
Linux,
OSX,
FreeBSD
}
public static class Paths
{
private static bool OsDetected = false;
private static OperatingSystem _operatingSystem;
public static OperatingSystem OperatingSystem
{
get
{
if (OsDetected)
return _operatingSystem;
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
_operatingSystem = OperatingSystem.Windows;
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
_operatingSystem = OperatingSystem.Linux;
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
_operatingSystem = OperatingSystem.OSX;
else if (RuntimeInformation.IsOSPlatform(OSPlatform.FreeBSD))
_operatingSystem = OperatingSystem.FreeBSD;
else
{
Logger.log?.Warn($"Operating system not recognized: {RuntimeInformation.OSDescription}");
_operatingSystem = OperatingSystem.Unknown;
}
OsDetected = true;
return _operatingSystem;
}
}

private static string? _assemblyDirectory;
public static string AssemblyDirectory
{
get
{
if (_assemblyDirectory == null)
_assemblyDirectory = Assembly.GetExecutingAssembly().Location;
return _assemblyDirectory;
}
}

public const string Path_CustomLevels = @"Beat Saber_Data\CustomLevels";
public const string Path_Playlists = @"Playlists";
public const string Path_History = @"UserData\BeatSyncHistory.json";
Expand All @@ -19,5 +67,12 @@ public static BeatSaberInstallLocation ToSongLocation(this BeatSaberInstall inst
}

public static string ReplaceWorkingDirectory(string fullPath) => fullPath.Replace(Directory.GetCurrentDirectory(), ".");

public static string GetFullPath(string path)
{
string fullPathStr = path;

return fullPathStr;
}
}
}
24 changes: 24 additions & 0 deletions BeatSyncConsoleTests/BeatSyncConsoleTests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
<PackageReference Include="MSTest.TestAdapter" Version="2.1.0" />
<PackageReference Include="MSTest.TestFramework" Version="2.1.0" />
<PackageReference Include="coverlet.collector" Version="1.2.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\BeatSyncConsole\BeatSyncConsole.csproj" />
<ProjectReference Include="..\BeatSyncLib\BeatSyncLib.csproj" />
<ProjectReference Include="..\Libs\BeatSaberDataProvider\SongFeedReaders\SongFeedReaders.csproj" />
<ProjectReference Include="..\Libs\BeatSaberDataProvider\WebUtilities\WebUtilities.csproj" />
<ProjectReference Include="..\Libs\BeatSaberPlaylistsLib\BeatSaberPlaylistsLib\BeatSaberPlaylistsLib.csproj" />
</ItemGroup>

</Project>
15 changes: 15 additions & 0 deletions BeatSyncConsoleTests/PathTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using BeatSyncConsole.Utilities;

namespace BeatSyncConsoleTests
{
[TestClass]
public class PathTests
{
[TestMethod]
public void TestMethod1()
{
Assert.AreEqual(OperatingSystem.Windows, Paths.OperatingSystem);
}
}
}

0 comments on commit a3ce611

Please sign in to comment.