Skip to content

Commit

Permalink
Pushing before playing with the database reader library. Im gonna try…
Browse files Browse the repository at this point in the history
… and parse the image file name that way (should be wayyy faster than before [txt parsed again by the form])
  • Loading branch information
Luciano Godoy committed Apr 9, 2020
1 parent 7c663f8 commit 33fb998
Show file tree
Hide file tree
Showing 19 changed files with 545 additions and 180 deletions.
12 changes: 6 additions & 6 deletions ClassLibrary/ClassLibrary.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,6 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="osu-database-reader, Version=2.1.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\HoLLy.osu.DatabaseReader.2.1.1\lib\net40\osu-database-reader.dll</HintPath>
</Reference>
<Reference Include="osu.Shared, Version=1.0.3.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\osu.Shared.1.0.3\lib\net20\osu.Shared.dll</HintPath>
</Reference>
<Reference Include="policy.2.0.taglib-sharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=db62eba44689b5b0, processorArchitecture=MSIL">
<HintPath>..\packages\taglib.2.1.0.0\lib\policy.2.0.taglib-sharp.dll</HintPath>
</Reference>
Expand All @@ -61,5 +55,11 @@
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\LIBRARIES\osu-database-reader-master\osu-database-reader-master\osu-database-reader\osu-database-reader.csproj">
<Project>{41df5448-1519-4ad9-8d26-cf8ec1a6469c}</Project>
<Name>osu-database-reader</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
61 changes: 43 additions & 18 deletions ClassLibrary/Configurations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,15 @@ public Configurations(string appPathIn)

Cfg = new Dictionary<string, string>() //Generate default settings dictionary
{
{"output path", ""},
{"osu! path", ""},
{"include image", ""}
{"output path", string.Empty},
{"osu! path", string.Empty},
{"include image", string.Empty},
{"overwrite album", string.Empty},
{"overwrite artist", string.Empty},
{"overwrite title", string.Empty},
{"force album", string.Empty},
{"force artist", string.Empty},
{"force title", string.Empty}
};
}

Expand Down Expand Up @@ -53,19 +59,23 @@ public Configurations(string appPathIn)
{
if (line.Contains('='))
{
//Exclude " = " from the dictionary
int j = line.IndexOf('=');
string key = line.Substring(0, j - 1);
string value = line.Substring(j + 2);

foreach (System.Collections.Generic.KeyValuePair<string, string> item in Cfg)
try
{
if (item.Key == key && value != "" && value != null)
//Exclude " = " from the dictionary
int j = line.IndexOf('=');
string key = line.Substring(0, j - 1);
string value = line.Substring(j + 2);

foreach (System.Collections.Generic.KeyValuePair<string, string> item in Cfg)
{
cfgCopy[key] = value;
i++;
if (item.Key == key && value != string.Empty && value != null)
{
cfgCopy[key] = value;
i++;
}
}
}
catch (Exception) { };
}
}
}
Expand Down Expand Up @@ -101,7 +111,7 @@ private void saveConfigurations()
private bool checkOutPath(string outPath)
{
bool result = false;
if (outPath == "")
if (outPath == string.Empty)
MessageBox.Show("Opps!, output path seems to be invalid, please select a new one...", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
else
if (Directory.Exists(outPath))
Expand All @@ -111,13 +121,13 @@ private bool checkOutPath(string outPath)
private bool checkOsuPath(string osuPath)
{
bool result = false;
if (osuPath == "")
if (osuPath == string.Empty)
MessageBox.Show("Opps!, osu path seems to be invalid, please select a new one...", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
else
{
string osuDb = "";
string collectionDb = "";
string songsPath = "";
string osuDb = string.Empty;
string collectionDb = string.Empty;
string songsPath = string.Empty;

if (!Directory.Exists(osuPath)) //Error no osu! folder
MessageBox.Show("It seems like your osu! folder has been renamed, moved or deleted. Please restore it or select a new one", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
Expand All @@ -139,7 +149,7 @@ private bool checkOsuPath(string osuPath)
collectionDb = subfile;
}

if (osuDb == "" && collectionDb == "")
if (osuDb == string.Empty && collectionDb == string.Empty)
MessageBox.Show("That was really weird. Your osu! folder doesnt contain neither osu!.db or collections.db files, try selecting another osu! installation or getting yourself a new one. Opening the game should fix it tho LOL", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
else if (osuDb == "")
MessageBox.Show("That was really weird. Your osu! folder doesnt contain osu!.db file, try selecting another osu! installation or getting yourself a new one. Opening the game should fix it tho LOL", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
Expand All @@ -153,9 +163,17 @@ private bool checkOsuPath(string osuPath)

return result;
}

private void updatePublicProperties()
{
if (Cfg["include image"] == "true") IncludeThumbnails = true; else IncludeThumbnails = false;
if (Cfg["overwrite album"] == "true") OverwriteAlbum = true; else OverwriteAlbum = false;
if (Cfg["overwrite artist"] == "true") OverwriteArtist = true; else OverwriteArtist = false;
if (Cfg["overwrite title"] == "true") OverwriteTitle = true; else OverwriteTitle = false;
if (Cfg["force album"] == "true") ForceAlbum = true; else ForceAlbum = false;
if (Cfg["force artist"] == "true") ForceArtist = true; else ForceArtist = false;
if (Cfg["force title"] == "true") ForceTitle = true; else ForceTitle = false;

OutPath = Cfg["output path"];
OsuPath = Cfg["osu! path"];
OsuDbPath = Path.Combine(Cfg["osu! path"], "osu!.db");
Expand All @@ -174,6 +192,13 @@ private void updatePublicProperties()
public string SongsPath { get; set; }
public string OsuPath { get; set; }
public string OutPath { get; set; }

public bool IncludeThumbnails { get; set; }
public bool OverwriteAlbum { get; set; }
public bool OverwriteArtist { get; set; }
public bool OverwriteTitle { get; set; }
public bool ForceAlbum { get; set; }
public bool ForceArtist { get; set; }
public bool ForceTitle { get; set; }
}
}
Loading

0 comments on commit 33fb998

Please sign in to comment.