-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
06d61f3
commit 5b89fb9
Showing
1 changed file
with
6 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,14 +18,17 @@ namespace VSProjNuGetVersionUpdater | |
/// It also updates packages.config files. | ||
/// </summary> | ||
/// <remarks> | ||
/// <para> | ||
/// Written by Matthew Monroe for the Department of Energy (PNNL, Richland, WA) | ||
/// | ||
/// </para> | ||
/// <para> | ||
/// E-mail: [email protected] or [email protected] | ||
/// Website: https://github.com/PNNL-Comp-Mass-Spec/ or https://panomics.pnnl.gov/ or https://www.pnnl.gov/integrative-omics | ||
/// </para> | ||
/// </remarks> | ||
internal static class Program | ||
{ | ||
public const string PROGRAM_DATE = "May 9, 2019"; | ||
public const string PROGRAM_DATE = "October 6, 2021"; | ||
|
||
private struct PackageUpdateOptions | ||
{ | ||
|
@@ -48,8 +51,7 @@ private struct PackageUpdateOptions | |
|
||
private static bool mProgressNewlineRequired; | ||
|
||
|
||
static int Main(string[] args) | ||
private static int Main() | ||
{ | ||
var commandLineParse = new clsParseCommandLine(); | ||
|
||
|
@@ -68,7 +70,6 @@ static int Main(string[] args) | |
|
||
try | ||
{ | ||
|
||
var success = false; | ||
|
||
if (commandLineParse.ParseCommandLine()) | ||
|
@@ -89,7 +90,6 @@ static int Main(string[] args) | |
mSearchDirectoryPath = "."; | ||
} | ||
|
||
|
||
if (string.IsNullOrWhiteSpace(mUpdateOptions.NuGetPackageName)) | ||
{ | ||
ShowErrorMessage("NuGet package must be defined using /P or /Package"); | ||
|
@@ -114,7 +114,6 @@ static int Main(string[] args) | |
Console.WriteLine("Search complete"); | ||
|
||
Thread.Sleep(250); | ||
|
||
} | ||
catch (Exception ex) | ||
{ | ||
|
@@ -124,7 +123,6 @@ static int Main(string[] args) | |
} | ||
|
||
return 0; | ||
|
||
} | ||
|
||
private static bool IsUpdateRequired(string currentVersion, PackageUpdateOptions updateOptions, out Version parsedVersion) | ||
|
@@ -272,7 +270,6 @@ private static void ProcessProjectFile(FileSystemInfo projectFile, string baseDi | |
var versionAttribute = packageRef.Attribute("Version"); | ||
if (versionAttribute != null) | ||
{ | ||
|
||
// Found XML like this: | ||
// <PackageReference Include="PRISM-Library" Version="2.4.93" /> | ||
|
||
|
@@ -315,7 +312,6 @@ private static void ShowUpdateInfo(PackageUpdateOptions updateOptions, Version p | |
/// <param name="xmlFile"></param> | ||
private static void UpdateEmptyXMLTagFormatting(FileSystemInfo xmlFile) | ||
{ | ||
|
||
try | ||
{ | ||
// Reopen the file and add back line feeds to pairs of XML tags | ||
|
@@ -373,13 +369,11 @@ private static void UpdateEmptyXMLTagFormatting(FileSystemInfo xmlFile) | |
{ | ||
tempFile.Delete(); | ||
} | ||
|
||
} | ||
catch (Exception ex) | ||
{ | ||
ShowErrorMessage("Error updating XML tag formatting in file " + xmlFile.FullName + ": " + ex.Message); | ||
} | ||
|
||
} | ||
|
||
private static bool UpdateVersionAttributeIfRequired(XAttribute versionAttribute, PackageUpdateOptions updateOptions) | ||
|
@@ -419,7 +413,6 @@ private static bool SearchForProjectFiles( | |
bool recurse, | ||
PackageUpdateOptions updateOptions) | ||
{ | ||
|
||
try | ||
{ | ||
var newPackageVersion = Version.Parse(updateOptions.NuGetPackageVersion); | ||
|
@@ -474,7 +467,6 @@ private static bool SearchForProjectFiles( | |
|
||
try | ||
{ | ||
|
||
var projectFiles = searchDirectory.GetFiles("*.csproj").ToList(); | ||
projectFiles.AddRange(searchDirectory.GetFiles("*.vbproj")); | ||
|
||
|
@@ -619,7 +611,6 @@ private static bool SetOptionsUsingCommandLineParameters(clsParseCommandLine com | |
mSearchDirectoryPath = commandLineParse.RetrieveNonSwitchParameter(0); | ||
} | ||
|
||
|
||
if (commandLineParse.RetrieveValueForParameter("I", out var paramValue)) | ||
{ | ||
mSearchDirectoryPath = string.Copy(paramValue); | ||
|
@@ -685,7 +676,6 @@ private static void ShowErrorMessage(string title, IEnumerable<string> errorMess | |
|
||
private static void ShowProcessingFileMessage(FileSystemInfo projectFile, string baseDirectoryPath) | ||
{ | ||
|
||
string projectFilePath; | ||
|
||
if (!string.IsNullOrWhiteSpace(baseDirectoryPath)) | ||
|
@@ -743,19 +733,16 @@ private static void ShowProgramHelp() | |
|
||
// Delay for 750 msec in case the user double clicked this file from within Windows Explorer (or started the program via a shortcut) | ||
Thread.Sleep(750); | ||
|
||
} | ||
catch (Exception ex) | ||
{ | ||
Console.WriteLine("Error displaying the program syntax: " + ex.Message); | ||
} | ||
|
||
} | ||
|
||
private static void ShowWarning(string message, int emptyLinesBeforeMessage = 1) | ||
{ | ||
ConsoleMsgUtils.ShowWarningCustom(message, emptyLinesBeforeMessage); | ||
} | ||
|
||
} | ||
} |