Skip to content

Commit

Permalink
Release version 1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
AshtonMemer committed Jan 11, 2024
1 parent 6c6a347 commit 361b0b4
Show file tree
Hide file tree
Showing 16 changed files with 373 additions and 348 deletions.
97 changes: 28 additions & 69 deletions Cinema.csproj
Original file line number Diff line number Diff line change
@@ -1,89 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{3B129F05-563F-4460-AF9B-16E5D1C689B2}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Cinema</RootNamespace>
<AssemblyName>Cinema</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>disable</Nullable>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>

<Target Name="CopyDLLs" AfterTargets="Build">
<Copy SourceFiles="$(TargetDir)$(ProjectName).dll" DestinationFolder="C:\Users\Ashton\Desktop\MDNET6\MuseDashNET6\Mods" />
<Message Text="Copied DLL -&gt; C:\Users\Ashton\Desktop\MDNET6\MuseDashNET6\Mods\$(ProjectName).dll" Importance="High" />
</Target>

<ItemGroup>
<Reference Include="0Harmony">
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Muse Dash\MelonLoader\0Harmony.dll</HintPath>
<HintPath>C:\Users\Ashton\Desktop\MDNET6\MuseDashNET6\MelonLoader\net6\0Harmony.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp">
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Muse Dash\MelonLoader\Managed\Assembly-CSharp.dll</HintPath>
<HintPath>C:\Users\Ashton\Desktop\MDNET6\MuseDashNET6\MelonLoader\Il2CppAssemblies\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="CustomAlbums">
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Muse Dash\Mods\CustomAlbums.dll</HintPath>
<HintPath>C:\Users\Ashton\Desktop\MDNET6\MuseDashNET6\Mods\CustomAlbums.dll</HintPath>
</Reference>
<Reference Include="Il2CppInterop.Generator">
<HintPath>C:\Users\Ashton\Desktop\MDNET6\MuseDashNET6\MelonLoader\net6\Il2CppInterop.Generator.dll</HintPath>
</Reference>
<Reference Include="Il2CppInterop.Runtime">
<HintPath>C:\Users\Ashton\Desktop\MDNET6\MuseDashNET6\MelonLoader\net6\Il2CppInterop.Runtime.dll</HintPath>
</Reference>
<Reference Include="Il2Cppmscorlib">
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Muse Dash\MelonLoader\Managed\Il2Cppmscorlib.dll</HintPath>
<HintPath>C:\Users\Ashton\Desktop\MDNET6\MuseDashNET6\MelonLoader\Il2CppAssemblies\Il2Cppmscorlib.dll</HintPath>
</Reference>
<Reference Include="Il2CppSystem">
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Muse Dash\MelonLoader\Managed\Il2CppSystem.dll</HintPath>
<HintPath>C:\Users\Ashton\Desktop\MDNET6\MuseDashNET6\MelonLoader\Il2CppAssemblies\Il2CppSystem.dll</HintPath>
</Reference>
<Reference Include="MelonLoader">
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Muse Dash\MelonLoader\MelonLoader.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Muse Dash\MelonLoader\Managed\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="Sirenix.Serialization">
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Muse Dash\MelonLoader\Managed\Sirenix.Serialization.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="UnhollowerBaseLib">
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Muse Dash\MelonLoader\Managed\UnhollowerBaseLib.dll</HintPath>
</Reference>
<Reference Include="UnityEngine">
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Muse Dash\MelonLoader\Managed\UnityEngine.dll</HintPath>
<HintPath>C:\Users\Ashton\Desktop\MDNET6\MuseDashNET6\MelonLoader\net6\MelonLoader.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Muse Dash\MelonLoader\Managed\UnityEngine.CoreModule.dll</HintPath>
<HintPath>C:\Users\Ashton\Desktop\MDNET6\MuseDashNET6\MelonLoader\Il2CppAssemblies\UnityEngine.CoreModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.VideoModule">
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Muse Dash\MelonLoader\Managed\UnityEngine.VideoModule.dll</HintPath>
<HintPath>C:\Users\Ashton\Desktop\MDNET6\MuseDashNET6\MelonLoader\Il2CppAssemblies\UnityEngine.VideoModule.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="CinemaInfo.cs" />
<Compile Include="Main.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="CopyDLLs" AfterTargets="Build">
<Copy SourceFiles="$(TargetDir)$(ProjectName).dll" DestinationFolder="C:\Program Files (x86)\Steam\steamapps\common\Muse Dash\Mods" />
<Message Text="Copied DLL -&gt; C:\Program Files (x86)\Steam\steamapps\common\Muse Dash\Mods\$(ProjectName).dll" Importance="High" />
</Target>
</Project>

</Project>
14 changes: 7 additions & 7 deletions Cinema.sln
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.1.32210.238
VisualStudioVersion = 17.8.34330.188
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cinema", "Cinema.csproj", "{3B129F05-563F-4460-AF9B-16E5D1C689B2}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cinema", "Cinema.csproj", "{5EFDECD1-8A64-42C1-9193-9DDA0029C7F7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3B129F05-563F-4460-AF9B-16E5D1C689B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3B129F05-563F-4460-AF9B-16E5D1C689B2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3B129F05-563F-4460-AF9B-16E5D1C689B2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3B129F05-563F-4460-AF9B-16E5D1C689B2}.Release|Any CPU.Build.0 = Release|Any CPU
{5EFDECD1-8A64-42C1-9193-9DDA0029C7F7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5EFDECD1-8A64-42C1-9193-9DDA0029C7F7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5EFDECD1-8A64-42C1-9193-9DDA0029C7F7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5EFDECD1-8A64-42C1-9193-9DDA0029C7F7}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A139BFC5-C513-495A-BEB3-A725EA5256E9}
SolutionGuid = {9F2ABFC2-49F8-4F6D-AAA2-080D58927022}
EndGlobalSection
EndGlobal
90 changes: 0 additions & 90 deletions CinemaInfo.cs

This file was deleted.

75 changes: 75 additions & 0 deletions Data/CinemaInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
using System.IO.Compression;
using System.Text;
using System.Text.Json.Nodes;
using CustomAlbums.Data;
using CustomAlbums.Utilities;
using Il2CppAssets.Scripts.Database;

namespace Cinema.Data
{
public class CinemaInfo
{
private readonly List<int> _activatedDifficulties = new() { 1, 2, 3, 4, 5 };

private readonly Album _album;
private readonly string _fileName;
private readonly string _filePath;

public CinemaInfo(Album album)
{
_album = album;
var jsonData = album.IsPackaged ? LoadFromArchive(album.Path) : LoadFromFolder(album.Path);

if (jsonData == null) return;

Opacity = jsonData["opacity"]?.GetValue<float>() ?? 0f;
_fileName = jsonData["file_name"]?.GetValue<string>() ?? string.Empty;
_filePath = _fileName != null && _album != null ? $"{_album.Path}\\{_fileName}" : null;

if (jsonData["difficulties"] == null) return;

_activatedDifficulties = new List<int>();
var array = jsonData["difficulties"].AsArray();
foreach (var node in array) _activatedDifficulties.Add(node.GetValue<int>());
}

public float Opacity { get; private set; }

public bool Enabled => !string.IsNullOrEmpty(_fileName) &&
_activatedDifficulties.Contains(GlobalDataBase.s_DbBattleStage.selectedDifficulty);

public byte[] GetVideo()
{
if (!_album.IsPackaged) return File.ReadAllBytes(_filePath);

using var zip = ZipFile.OpenRead(_album.Path);
var videoFile = zip.GetEntry(_fileName);

if (videoFile == null) return null;

using var ms = new MemoryStream();
videoFile.Open().CopyTo(ms);
return ms.ToArray();
}

private static JsonObject LoadFromArchive(string archivePath)
{
using var zip = ZipFile.OpenRead(archivePath);
var cinema = zip.GetEntry("cinema.json");

if (cinema == null) return null;

using var reader = new StreamReader(cinema.Open(), Encoding.UTF8);
var jsonString = reader.ReadToEnd();

return Json.Deserialize<JsonObject>(jsonString);
}

public static JsonObject LoadFromFolder(string folderPath)
{
return !File.Exists($"{folderPath}\\cinema.json")
? null
: Json.Deserialize<JsonObject>(File.ReadAllText($"{folderPath}\\cinema.json"));
}
}
}
Loading

0 comments on commit 361b0b4

Please sign in to comment.