Fixed some strings
This commit is contained in:
@ -20,7 +20,8 @@ namespace PMF.Managers
|
|||||||
validateManifestFile();
|
validateManifestFile();
|
||||||
var json = File.ReadAllText(Config.ManifestFileName);
|
var json = File.ReadAllText(Config.ManifestFileName);
|
||||||
PackageManager.PackageList = JsonConvert.DeserializeObject<List<Package>>(json);
|
PackageManager.PackageList = JsonConvert.DeserializeObject<List<Package>>(json);
|
||||||
PMF.InvokePackageMessageEvent("Initialized PMF successfully");
|
|
||||||
|
//PMF.InvokePackageMessageEvent("Initialized PMF successfully");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -34,14 +35,15 @@ namespace PMF.Managers
|
|||||||
var json = JsonConvert.SerializeObject(PackageManager.PackageList);
|
var json = JsonConvert.SerializeObject(PackageManager.PackageList);
|
||||||
File.WriteAllText(Config.ManifestFileName, json);
|
File.WriteAllText(Config.ManifestFileName, json);
|
||||||
Directory.Delete(Config.TemporaryFolder, true);
|
Directory.Delete(Config.TemporaryFolder, true);
|
||||||
PMF.InvokePackageMessageEvent("Successfully cleaned PMF");
|
|
||||||
|
//PMF.InvokePackageMessageEvent("Successfully cleaned PMF");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void validateManifestFile()
|
private static void validateManifestFile()
|
||||||
{
|
{
|
||||||
PMF.InvokePackageMessageEvent("Validating manifest file");
|
PMF.InvokePackageMessageEvent("Validating manifest file");
|
||||||
if (string.IsNullOrEmpty(Config.ManifestFileName))
|
if (string.IsNullOrEmpty(Config.ManifestFileName))
|
||||||
throw new ArgumentNullException("Manifest file name needs to be defined");
|
throw new ArgumentNullException("");
|
||||||
|
|
||||||
if (!File.Exists(Config.ManifestFileName))
|
if (!File.Exists(Config.ManifestFileName))
|
||||||
File.Create(Config.ManifestFileName).Close();
|
File.Create(Config.ManifestFileName).Close();
|
||||||
@ -56,7 +58,7 @@ namespace PMF.Managers
|
|||||||
/// <param name="package">This value is defined if the package exists, its contents will be the actual package</param>
|
/// <param name="package">This value is defined if the package exists, its contents will be the actual package</param>
|
||||||
/// <param name="packageDirectory">The directory in which the package is installed</param>
|
/// <param name="packageDirectory">The directory in which the package is installed</param>
|
||||||
/// <returns>True if package is installed, false otherwise</returns>
|
/// <returns>True if package is installed, false otherwise</returns>
|
||||||
public static bool IsPackageInstalled(string id, bool reportInexistence, out Package package, out string packageDirectory)
|
public static bool IsPackageInstalled(string id, out Package package, out string packageDirectory)
|
||||||
{
|
{
|
||||||
PMF.InvokePackageMessageEvent($"Checking if {id} is installed");
|
PMF.InvokePackageMessageEvent($"Checking if {id} is installed");
|
||||||
package = null;
|
package = null;
|
||||||
@ -73,8 +75,7 @@ namespace PMF.Managers
|
|||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
if (reportInexistence)
|
PMF.InvokePackageMessageEvent($"Couldn't find {id}");
|
||||||
PMF.InvokePackageMessageEvent($"Couldn't find {id}");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -86,9 +87,13 @@ namespace PMF.Managers
|
|||||||
/// <returns>True if uninstalled correctly, false otherwise</returns>
|
/// <returns>True if uninstalled correctly, false otherwise</returns>
|
||||||
public static bool RemovePackage(string id)
|
public static bool RemovePackage(string id)
|
||||||
{
|
{
|
||||||
PMF.InvokePackageMessageEvent($"Removing {id}");
|
|
||||||
if (string.IsNullOrEmpty(id))
|
if (string.IsNullOrEmpty(id))
|
||||||
throw new ArgumentNullException("Package id must be defined");
|
{
|
||||||
|
PMF.InvokePackageMessageEvent("Package id must be defined");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
PMF.InvokePackageMessageEvent($"Removing {id}");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -161,12 +166,16 @@ namespace PMF.Managers
|
|||||||
|
|
||||||
PackageManager.PackageList.Add(remotePackage);
|
PackageManager.PackageList.Add(remotePackage);
|
||||||
|
|
||||||
string errorMsg = "";
|
|
||||||
if (error)
|
if (error)
|
||||||
errorMsg = " with errors. See above";
|
{
|
||||||
|
PMF.InvokePackageMessageEvent($"Couldn't install {remotePackage.ID}@{asset.Version}. See above");
|
||||||
PMF.InvokePackageMessageEvent($"Successfully installed {remotePackage.ID}@{asset.Version} {errorMsg}");
|
return PackageState.NotInstalled;
|
||||||
return PackageState.Installed;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PMF.InvokePackageMessageEvent($"Successfully installed {remotePackage.ID}@{asset.Version}");
|
||||||
|
return PackageState.Installed;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -50,7 +50,7 @@ namespace PMF.Managers
|
|||||||
message = ex.InnerException.Message;
|
message = ex.InnerException.Message;
|
||||||
else
|
else
|
||||||
message = ex.Message;
|
message = ex.Message;
|
||||||
PMF.InvokePackageMessageEvent($"Something failed while cleaning up PMF - \n{message}");
|
PMF.InvokePackageMessageEvent($"Something failed while cleaning up PMF\n{message}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ namespace PMF.Managers
|
|||||||
{
|
{
|
||||||
if (!initialized)
|
if (!initialized)
|
||||||
{
|
{
|
||||||
PMF.InvokePackageMessageEvent("You must initialize PMF first before using it.\nClosing");
|
PMF.InvokePackageMessageEvent("You must initialize PMF first.\nClosing");
|
||||||
Environment.Exit(0);
|
Environment.Exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -74,8 +74,7 @@ namespace PMF.Managers
|
|||||||
checkInitialization();
|
checkInitialization();
|
||||||
|
|
||||||
string zipFile = RemotePackageManager.DownloadAsset(package.ID, asset);
|
string zipFile = RemotePackageManager.DownloadAsset(package.ID, asset);
|
||||||
LocalPackageManager.InstallPackage(package, asset, zipFile);
|
return LocalPackageManager.InstallPackage(package, asset, zipFile);
|
||||||
return PackageState.Installed;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -92,7 +91,7 @@ namespace PMF.Managers
|
|||||||
checkInitialization();
|
checkInitialization();
|
||||||
|
|
||||||
// check if is already installed
|
// check if is already installed
|
||||||
if (!LocalPackageManager.IsPackageInstalled(id, false, out Package localPackage, out string packageDirectory))
|
if (!LocalPackageManager.IsPackageInstalled(id, out Package localPackage, out string packageDirectory))
|
||||||
{
|
{
|
||||||
Package remotePackage = RemotePackageManager.GetPackageInfo(id);
|
Package remotePackage = RemotePackageManager.GetPackageInfo(id);
|
||||||
|
|
||||||
@ -127,7 +126,7 @@ namespace PMF.Managers
|
|||||||
checkInitialization();
|
checkInitialization();
|
||||||
|
|
||||||
// check if is already installed
|
// check if is already installed
|
||||||
if (!LocalPackageManager.IsPackageInstalled(id, false, out Package localPackage, out string packageDirectory))
|
if (!LocalPackageManager.IsPackageInstalled(id, out Package localPackage, out string packageDirectory))
|
||||||
{
|
{
|
||||||
// get package info for version
|
// get package info for version
|
||||||
Package remotePackage = RemotePackageManager.GetPackageInfo(id);
|
Package remotePackage = RemotePackageManager.GetPackageInfo(id);
|
||||||
@ -163,7 +162,7 @@ namespace PMF.Managers
|
|||||||
checkInitialization();
|
checkInitialization();
|
||||||
|
|
||||||
// check if is already installed
|
// check if is already installed
|
||||||
if (!LocalPackageManager.IsPackageInstalled(id, false, out Package localPackage, out string packageDirectory))
|
if (!LocalPackageManager.IsPackageInstalled(id, out Package localPackage, out string packageDirectory))
|
||||||
{
|
{
|
||||||
Package remotePackage = RemotePackageManager.GetPackageInfo(id);
|
Package remotePackage = RemotePackageManager.GetPackageInfo(id);
|
||||||
|
|
||||||
@ -210,7 +209,7 @@ namespace PMF.Managers
|
|||||||
checkInitialization();
|
checkInitialization();
|
||||||
|
|
||||||
// check if is already installed
|
// check if is already installed
|
||||||
if (LocalPackageManager.IsPackageInstalled(id, true, out Package localPackage, out string packageDirectory))
|
if (LocalPackageManager.IsPackageInstalled(id, out Package localPackage, out string packageDirectory))
|
||||||
{
|
{
|
||||||
var remotePackage = RemotePackageManager.GetPackageInfo(id);
|
var remotePackage = RemotePackageManager.GetPackageInfo(id);
|
||||||
|
|
||||||
@ -246,7 +245,7 @@ namespace PMF.Managers
|
|||||||
checkInitialization();
|
checkInitialization();
|
||||||
|
|
||||||
// check if is already installed
|
// check if is already installed
|
||||||
if (LocalPackageManager.IsPackageInstalled(id, true, out Package localPackage, out string packageDirectory))
|
if (LocalPackageManager.IsPackageInstalled(id, out Package localPackage, out string packageDirectory))
|
||||||
{
|
{
|
||||||
// Up to date
|
// Up to date
|
||||||
if (localPackage.Assets[0].Version == version)
|
if (localPackage.Assets[0].Version == version)
|
||||||
@ -286,7 +285,7 @@ namespace PMF.Managers
|
|||||||
|
|
||||||
checkInitialization();
|
checkInitialization();
|
||||||
|
|
||||||
if (!LocalPackageManager.IsPackageInstalled(id, true, out Package localPackage, out string pd))
|
if (!LocalPackageManager.IsPackageInstalled(id, out Package localPackage, out string pd))
|
||||||
{
|
{
|
||||||
PMF.InvokePackageMessageEvent("Already up to date");
|
PMF.InvokePackageMessageEvent("Already up to date");
|
||||||
return PackageState.NotInstalled;
|
return PackageState.NotInstalled;
|
||||||
|
|||||||
@ -52,7 +52,7 @@ namespace PMF.Managers
|
|||||||
client.DownloadFile(dependency.Url, Path.Combine(zipPath, dependency.FileName));
|
client.DownloadFile(dependency.Url, Path.Combine(zipPath, dependency.FileName));
|
||||||
}
|
}
|
||||||
|
|
||||||
PMF.InvokePackageMessageEvent("Finished downloading all required files");
|
PMF.InvokePackageMessageEvent("Finished downloading required files");
|
||||||
|
|
||||||
return zipPath;
|
return zipPath;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user