Skip to content

Commit

Permalink
Some refactoring, improved build process.
Browse files Browse the repository at this point in the history
  • Loading branch information
KirovAir committed Sep 27, 2019
1 parent 22faf4d commit 6d2c27b
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion TwilightBoxart.CLI/Properties/PublishProfiles/MacOS.pubxml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<Configuration>Release</Configuration>
<Platform>Any CPU</Platform>
<TargetFramework>netcoreapp3.0</TargetFramework>
<PublishDir>bin\Release\macos-x64</PublishDir>
<PublishDir>bin\Release\TwilightBoxart-MacOS.CLI</PublishDir>
<RuntimeIdentifier>osx-x64</RuntimeIdentifier>
<SelfContained>true</SelfContained>
</PropertyGroup>
Expand Down
11 changes: 6 additions & 5 deletions TwilightBoxart.UX/TwilightBoxart.UX.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,13 @@
<PropertyGroup>
<PostBuildEvent>goto :$(ConfigurationName)
:Release
echo Cleaning xml/pdb..
del $(TargetDir)\*.xml /Q
del $(TargetDir)\*.pdb /Q
del $(TargetDir)\*.config /Q
del $(TargetDir)\TwilightBoxart.exe /Q
echo Cleaning..
IF EXIST $(TargetDir)\TwilightBoxart.exe del $(TargetDir)\TwilightBoxart.exe /Q
IF EXIST $(ProjectDir)\bin\TwilightBoxart-Windows.UX.zip del $(ProjectDir)\bin\TwilightBoxart-Windows.UX.zip /Q
echo Zipping..
ren $(TargetPath) TwilightBoxart.exe
powershell Compress-Archive -Path '$(TargetDir)*.exe','$(TargetDir)*.db','$(TargetDir)*.ini' -DestinationPath '$(ProjectDir)\bin\TwilightBoxart-Windows.UX.zip' -Force
ren $(TargetDir)\TwilightBoxart.exe TwilightBoxart.UX.exe
goto :exit
:Debug
:exit</PostBuildEvent>
Expand Down
2 changes: 1 addition & 1 deletion TwilightBoxart/BoxartCrawler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public void DownloadArt(string romsPath, string boxArtPath, int defaultWidth, in
if (rom.ConsoleType == ConsoleType.SuperNintendoEntertainmentSystem)
{
if ((rom.NoIntroName?.ToLower().EndsWith("(japan)") ?? false) ||
(rom.Name?.ToLower().EndsWith("(japan)") ?? false))
(rom.SearchName?.ToLower().EndsWith("(japan)") ?? false))
{
size = new Size(84, 115);
}
Expand Down
2 changes: 1 addition & 1 deletion TwilightBoxart/Models/Base/IRom.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace TwilightBoxart.Models.Base
public interface IRom
{
string FileName { get; set; }
string Name { get; }
string SearchName { get; }
string Sha1 { get; set; }
string Title { get; set; }
string TitleId { get; set; }
Expand Down
7 changes: 6 additions & 1 deletion TwilightBoxart/Models/Base/LibRetroRom.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ private void DownloadByName(string targetFile)

try
{
DownloadWithRetry(Name, targetFile);
DownloadWithRetry(SearchName, targetFile);
}
catch
{
Expand All @@ -44,6 +44,11 @@ private void DownloadByName(string targetFile)

private void DownloadWithRetry(string name, string targetFile)
{
if (string.IsNullOrEmpty(name))
{
throw new NoMatchException("Invalid filename.");
}

try
{
Download(ConsoleType, name, targetFile);
Expand Down
2 changes: 1 addition & 1 deletion TwilightBoxart/Models/Base/Rom.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ public class Rom : IRom
public virtual ConsoleType ConsoleType { get; set; }
public string NoIntroName { get; set; }
public ConsoleType NoIntroConsoleType { get; set; }
public string SearchName => !string.IsNullOrEmpty(FileName) ? Path.GetFileNameWithoutExtension(FileName?.Replace(".lz77", "")) : null;
internal ImgDownloader ImgDownloader { get; set; }
public string Name => Path.GetFileNameWithoutExtension(FileName.Replace(".lz77", ""));

public static IRom FromStream(Stream stream, string filename)
{
Expand Down

0 comments on commit 6d2c27b

Please sign in to comment.