1
0
Fork 0
mirror of https://github.com/fiso64/slsk-batchdl.git synced 2025-01-07 05:52:44 +00:00

publish pdb

This commit is contained in:
fiso64 2024-12-24 18:19:31 +01:00
parent 15a8f0604e
commit 42de8d3ab4
3 changed files with 30 additions and 15 deletions

View file

@ -15,7 +15,6 @@ exit /b
:publish_and_zip
dotnet publish -c Release -r %1 -p:PublishSingleFile=true -p:PublishTrimmed=%2 -p:DefineConstants=WINDOWS --self-contained=%2
if exist slsk-batchdl\bin\Release\%FRAMEWORK%\%1\publish\*.pdb del /F /Q slsk-batchdl\bin\Release\%FRAMEWORK%\%1\publish\*.pdb
if exist slsk-batchdl\bin\zips\%3 del /F /Q slsk-batchdl\bin\zips\%3
powershell.exe -nologo -noprofile -command "& { Add-Type -A 'System.IO.Compression.FileSystem'; [IO.Compression.ZipFile]::CreateFromDirectory('slsk-batchdl\bin\Release\%FRAMEWORK%\%1\publish', 'slsk-batchdl\bin\zips\%3'); }"
exit /b

View file

@ -289,7 +289,7 @@ public class Config
int idx = l.IndexOf('=');
if (idx <= 0 || idx == l.Length - 1)
throw new ArgumentException($"Error parsing config '{path}' at line {i}");
InputError($"Error parsing config '{path}' at line {i}");
var x = l.Split('=', 2, StringSplitOptions.TrimEntries);
string key = x[0];
@ -443,7 +443,7 @@ public class Config
"interactive" => interactiveMode,
"album" => album,
"aggregate" => aggregate,
_ => throw new ArgumentException($"Unrecognized profile condition variable {var}")
_ => InputError<object>($"Unrecognized profile condition variable {var}")
};
}
@ -507,7 +507,7 @@ public class Config
return !ParsePrimaryExpression();
if (token.StartsWith("\""))
throw new ArgumentException("Invalid token at this position: " + token);
InputError("Invalid token at this position: " + token);
if (tokens.Count > 0 && (tokens.Peek() == "==" || tokens.Peek() == "!="))
{
@ -633,7 +633,8 @@ public class Config
UpdateMinMax2(value, condition, ref track.MinAlbumTrackCount, ref track.MaxAlbumTrackCount);
break;
default:
throw new ArgumentException($"Unknown condition '{condition}'");
InputError($"Unknown condition '{condition}'");
break;
}
}
@ -691,7 +692,7 @@ public class Config
{
i++;
if (i < 0 || i >= args.Count)
throw new ArgumentException("Option requires parameter");
InputError("Option requires parameter");
return args[i];
}
@ -718,7 +719,7 @@ public class Config
"bandcamp" => InputType.Bandcamp,
"string" => InputType.String,
"list" => InputType.List,
_ => throw new ArgumentException($"Invalid input type '{args[i]}'"),
_ => InputError<InputType>($"Invalid input type '{args[i]}'"),
};
break;
case "-p":
@ -846,7 +847,7 @@ public class Config
"results" => PrintOption.Results,
"tracks-full" => PrintOption.Tracks | PrintOption.Full,
"results-full" => PrintOption.Results | PrintOption.Full,
_ => throw new ArgumentException($"Invalid print option '{args[i]}'"),
_ => InputError<PrintOption>($"Invalid print option '{args[i]}'"),
};
break;
case "--pt":
@ -1037,7 +1038,7 @@ public class Config
"default" => AlbumArtOption.Default,
"largest" => AlbumArtOption.Largest,
"most" => AlbumArtOption.Most,
_ => throw new ArgumentException($"Invalid album art download mode '{args[i]}'"),
_ => InputError<AlbumArtOption>($"Invalid album art download mode '{args[i]}'"),
};
break;
case "--aao":
@ -1195,7 +1196,7 @@ public class Config
"name" => SkipMode.Name,
"tag" => SkipMode.Tag,
"index" => SkipMode.Index,
_ => throw new ArgumentException($"Invalid output dir skip mode '{args[i]}'"),
_ => InputError<SkipMode>($"Invalid output dir skip mode '{args[i]}'"),
};
break;
case "--smmd":
@ -1204,7 +1205,7 @@ public class Config
{
"name" => SkipMode.Name,
"tag" => SkipMode.Tag,
_ => throw new ArgumentException($"Invalid music dir skip mode '{args[i]}'"),
_ => InputError<SkipMode>($"Invalid music dir skip mode '{args[i]}'"),
};
break;
case "--nrsc":
@ -1288,7 +1289,8 @@ public class Config
parallelAlbumSearchProcesses = int.Parse(getParameter(ref i));
break;
default:
throw new ArgumentException($"Unknown argument: {args[i]}");
InputError($"Unknown argument: {args[i]}");
break;
}
}
else
@ -1299,7 +1301,7 @@ public class Config
inputSet = true;
}
else
throw new ArgumentException($"Invalid argument \'{args[i]}\'. Input is already set to \'{input}\'");
InputError($"Invalid argument \'{args[i]}\'. Input is already set to \'{input}\'");
}
}
}
@ -1340,4 +1342,18 @@ public class Config
return args.ToArray();
}
public static void InputError(string message)
{
Printing.WriteLine($"Input error: {message}", ConsoleColor.Red);
Environment.Exit(1);
}
public static T InputError<T>(string message)
{
InputError(message);
return default;
}
}

View file

@ -42,7 +42,7 @@ static partial class Program
var config = new Config(args);
if (config.input.Length == 0)
throw new ArgumentException($"No input provided");
Config.InputError($"No input provided");
(config.inputType, extractor) = ExtractorRegistry.GetMatchingExtractor(config.input, config.inputType);
@ -90,7 +90,7 @@ static partial class Program
client = new SoulseekClient(clientOptions);
if (!config.useRandomLogin && (string.IsNullOrEmpty(config.username) || string.IsNullOrEmpty(config.password)))
throw new ArgumentException("No soulseek username or password");
Config.InputError("No soulseek username or password");
await Login(config, config.useRandomLogin);