diff --git a/RZ.OneGetProvider/RZRestAPI.cs b/RZ.OneGetProvider/RZRestAPI.cs
index 1fb0cd4..1d00ffb 100644
--- a/RZ.OneGetProvider/RZRestAPI.cs
+++ b/RZ.OneGetProvider/RZRestAPI.cs
@@ -358,6 +358,7 @@ public static bool UploadSWEntry(AddSoftware lSoftware)
public static async void TrackDownloads(string contentID)
{
+ contentID.ToString();
//depreciated
}
@@ -511,7 +512,8 @@ public string IconURL
{
if (SWId > 0)
{
- return RZRestAPI.sURL + "/rest/GetIcon?id=" + SWId.ToString();
+ string sURL = RZRestAPI.sURL + "/rest/GetIcon?id=" + SWId.ToString();
+ return sURL;
}
return "";
}
diff --git a/RZ.OneGetProvider/RZScan.cs b/RZ.OneGetProvider/RZScan.cs
index 289e80c..eef06e4 100644
--- a/RZ.OneGetProvider/RZScan.cs
+++ b/RZ.OneGetProvider/RZScan.cs
@@ -276,60 +276,6 @@ private void RZScan_OnSWScanCompleted(object sender, EventArgs e)
}
}
- ///
- /// Check for updated Version in the RuckZuck Repository
- ///
- /// null = all Installed SW
- internal void CheckUpdatesOld(List aSWCheck)
- {
- var tCheckUpd = Task.Run(() =>
- {
- try
- {
- if (aSWCheck == null || aSWCheck.Count() == 0)
- aSWCheck = InstalledSoftware.Select(t => new AddSoftware() { ProductName = t.ProductName, ProductVersion = t.ProductVersion, Manufacturer = t.Manufacturer }).ToList();
-
- var vSWCheck = aSWCheck.Select(t => new AddSoftware() { ProductName = t.ProductName, ProductVersion = t.ProductVersion, Manufacturer = t.Manufacturer }).ToList();
- List lCheckResult = RZRestAPI.CheckForUpdate(vSWCheck).ToList();
-
- var lResult = lCheckResult.Select(item => new AddSoftware()
- {
- Architecture = item.Architecture,
- Category = item.Category,
- Description = item.Description,
- Image = item.Image,
- Manufacturer = item.Manufacturer,
- ProductName = item.ProductName,
- ProductURL = item.ProductURL,
- ProductVersion = item.ProductVersion,
- MSIProductID = item.MSIProductID,
- Shortname = item.Shortname
- }).ToList();
-
- //Only take updated Versions
- var lNew = lResult.Where(t => t.Shortname != "new").ToList();
-
-
- lock (NewSoftwareVersions)
- {
- //Store new Versions of existing SW
- NewSoftwareVersions.AddRange(lNew);
-
- //Remove duplicates
- NewSoftwareVersions = NewSoftwareVersions.GroupBy(x => x.Shortname).Select(y => y.First()).ToList();
- }
- if (lNew.Count > 0)
- OnUpdatesDetected(lNew, new EventArgs());
- }
- catch (Exception ex)
- {
- ex.ToString();
- }
-
- OnUpdScanCompleted(this, new EventArgs());
- });
- }
-
///
/// Check for updated Version in the RuckZuck Repository
///
@@ -347,20 +293,25 @@ internal void _CheckUpdates(List aSWCheck)
aSWCheck = InstalledSoftware.Select(t => new AddSoftware() { ProductName = t.ProductName, ProductVersion = t.ProductVersion, Manufacturer = t.Manufacturer }).ToList();
var vSWCheck = aSWCheck.Select(t => new AddSoftware() { ProductName = t.ProductName, ProductVersion = t.ProductVersion, Manufacturer = t.Manufacturer }).ToList();
- List lCheckResult = RZRestAPI.CheckForUpdate(vSWCheck).ToList();
+
+ //we do not have to check for updates if it's in the Catalog
+ List tRes = vSWCheck.Where(t => SoftwareRepository.FirstOrDefault(r => r.ProductName == t.ProductName & r.ProductVersion == t.ProductVersion & r.Manufacturer == t.Manufacturer) == null).ToList();
+
+ List lCheckResult = RZRestAPI.CheckForUpdate(tRes).ToList();
var lResult = lCheckResult.Select(item => new AddSoftware()
{
Architecture = item.Architecture,
Category = item.Category,
Description = item.Description,
- Image = item.Image,
+ //Image = item.Image,
Manufacturer = item.Manufacturer,
ProductName = item.ProductName,
ProductURL = item.ProductURL,
ProductVersion = item.ProductVersion,
MSIProductID = item.MSIProductID,
- Shortname = item.Shortname
+ Shortname = item.Shortname,
+ SWId = item.SWId
}).ToList();
//Only take updated Versions
@@ -483,7 +434,7 @@ internal AddSoftware GetSWProperties(RegistryKey oRegkey)
if (bIsMSI)
{
oResult.MSIProductID = sMSI;
- oResult.PSUninstall = "$proc = (Start-Process -FilePath \"msiexec.exe\" -ArgumentList \"/x " + sMSI + " /qb! \" -PassThru);$proc.WaitForExit();$ExitCode = $proc.ExitCode";
+ oResult.PSUninstall = "$proc = (Start-Process -FilePath \"msiexec.exe\" -ArgumentList \"/x " + sMSI + " /qb! REBOOT=REALLYSUPPRESS \" -Wait -PassThru);$proc.WaitForExit();$ExitCode = $proc.ExitCode";
oResult.PSDetection = @"Test-Path 'HKLM:\SOFTWARE\Classes\Installer\Products\" + EncKey + "'";
@@ -493,7 +444,7 @@ internal AddSoftware GetSWProperties(RegistryKey oRegkey)
RegistryKey oSource = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Classes\Installer\Products\" + EncKey + "\\SourceList");
if (oSource != null)
{
- oResult.PSInstall = "$proc = (Start-Process -FilePath \"msiexec.exe\" -ArgumentList \"/i `\"" + oSource.GetValue("PackageName") + "`\" /qb! ALLUSERS=2 REBOOT=REALLYSUPPRESS\" -Wait -PassThru);$proc.WaitForExit();$ExitCode = $proc.ExitCode";
+ oResult.PSInstall = "$proc = (Start-Process -FilePath \"msiexec.exe\" -ArgumentList \"/i `\"" + oSource.GetValue("PackageName") + "`\" /qn ALLUSERS=2 REBOOT=REALLYSUPPRESS\" -Wait -PassThru);$proc.WaitForExit();$ExitCode = $proc.ExitCode";
}
}
catch
@@ -504,7 +455,7 @@ internal AddSoftware GetSWProperties(RegistryKey oRegkey)
}
catch { }
- oResult.PSInstall = "$proc = (Start-Process -FilePath \"msiexec.exe\" -ArgumentList \"/i `\"`\" /qb! ALLUSERS=2 REBOOT=REALLYSUPPRESS\" -Wait -PassThru);$proc.WaitForExit();$ExitCode = $proc.ExitCode";
+ oResult.PSInstall = "$proc = (Start-Process -FilePath \"msiexec.exe\" -ArgumentList \"/i `\"`\" /qn ALLUSERS=2 REBOOT=REALLYSUPPRESS\" -Wait -PassThru);$proc.WaitForExit();$ExitCode = $proc.ExitCode";
}
}
else
diff --git a/RZ.OneGetProvider/RZUpdate.cs b/RZ.OneGetProvider/RZUpdate.cs
index 7efb526..80f1659 100644
--- a/RZ.OneGetProvider/RZUpdate.cs
+++ b/RZ.OneGetProvider/RZUpdate.cs
@@ -64,7 +64,7 @@ public RZUpdater(string sSWFile)
/// Name of the Software Product (must be in the RuckZuck Repository !)
/// >Current Version of the Software
/// SWUpdate if an Update is available otherwise null
- public SWUpdate CheckForUpdate(string ProductName, string Version)
+ public SWUpdate CheckForUpdate(string ProductName, string Version, string Manufacturer = "")
{
try
{
@@ -72,6 +72,7 @@ public SWUpdate CheckForUpdate(string ProductName, string Version)
oSW.ProductName = ProductName; // ;
oSW.ProductVersion = Version; // ;
+ oSW.Manufacturer = Manufacturer ?? "";
List oResult = RZRestAPI.CheckForUpdate(new List() { oSW }).ToList();
if (oResult.Count > 0)
diff --git a/RZUpdate/RZRestAPI.cs b/RZUpdate/RZRestAPI.cs
index 1fb0cd4..1d00ffb 100644
--- a/RZUpdate/RZRestAPI.cs
+++ b/RZUpdate/RZRestAPI.cs
@@ -358,6 +358,7 @@ public static bool UploadSWEntry(AddSoftware lSoftware)
public static async void TrackDownloads(string contentID)
{
+ contentID.ToString();
//depreciated
}
@@ -511,7 +512,8 @@ public string IconURL
{
if (SWId > 0)
{
- return RZRestAPI.sURL + "/rest/GetIcon?id=" + SWId.ToString();
+ string sURL = RZRestAPI.sURL + "/rest/GetIcon?id=" + SWId.ToString();
+ return sURL;
}
return "";
}
diff --git a/RZUpdate/RZScan.cs b/RZUpdate/RZScan.cs
index a02670d..eef06e4 100644
--- a/RZUpdate/RZScan.cs
+++ b/RZUpdate/RZScan.cs
@@ -276,60 +276,6 @@ private void RZScan_OnSWScanCompleted(object sender, EventArgs e)
}
}
- ///
- /// Check for updated Version in the RuckZuck Repository
- ///
- /// null = all Installed SW
- internal void CheckUpdatesOld(List aSWCheck)
- {
- var tCheckUpd = Task.Run(() =>
- {
- try
- {
- if (aSWCheck == null || aSWCheck.Count() == 0)
- aSWCheck = InstalledSoftware.Select(t => new AddSoftware() { ProductName = t.ProductName, ProductVersion = t.ProductVersion, Manufacturer = t.Manufacturer }).ToList();
-
- var vSWCheck = aSWCheck.Select(t => new AddSoftware() { ProductName = t.ProductName, ProductVersion = t.ProductVersion, Manufacturer = t.Manufacturer }).ToList();
- List lCheckResult = RZRestAPI.CheckForUpdate(vSWCheck).ToList();
-
- var lResult = lCheckResult.Select(item => new AddSoftware()
- {
- Architecture = item.Architecture,
- Category = item.Category,
- Description = item.Description,
- Image = item.Image,
- Manufacturer = item.Manufacturer,
- ProductName = item.ProductName,
- ProductURL = item.ProductURL,
- ProductVersion = item.ProductVersion,
- MSIProductID = item.MSIProductID,
- Shortname = item.Shortname
- }).ToList();
-
- //Only take updated Versions
- var lNew = lResult.Where(t => t.Shortname != "new").ToList();
-
-
- lock (NewSoftwareVersions)
- {
- //Store new Versions of existing SW
- NewSoftwareVersions.AddRange(lNew);
-
- //Remove duplicates
- NewSoftwareVersions = NewSoftwareVersions.GroupBy(x => x.Shortname).Select(y => y.First()).ToList();
- }
- if (lNew.Count > 0)
- OnUpdatesDetected(lNew, new EventArgs());
- }
- catch (Exception ex)
- {
- ex.ToString();
- }
-
- OnUpdScanCompleted(this, new EventArgs());
- });
- }
-
///
/// Check for updated Version in the RuckZuck Repository
///
@@ -347,20 +293,25 @@ internal void _CheckUpdates(List aSWCheck)
aSWCheck = InstalledSoftware.Select(t => new AddSoftware() { ProductName = t.ProductName, ProductVersion = t.ProductVersion, Manufacturer = t.Manufacturer }).ToList();
var vSWCheck = aSWCheck.Select(t => new AddSoftware() { ProductName = t.ProductName, ProductVersion = t.ProductVersion, Manufacturer = t.Manufacturer }).ToList();
- List lCheckResult = RZRestAPI.CheckForUpdate(vSWCheck).ToList();
+
+ //we do not have to check for updates if it's in the Catalog
+ List tRes = vSWCheck.Where(t => SoftwareRepository.FirstOrDefault(r => r.ProductName == t.ProductName & r.ProductVersion == t.ProductVersion & r.Manufacturer == t.Manufacturer) == null).ToList();
+
+ List lCheckResult = RZRestAPI.CheckForUpdate(tRes).ToList();
var lResult = lCheckResult.Select(item => new AddSoftware()
{
Architecture = item.Architecture,
Category = item.Category,
Description = item.Description,
- Image = item.Image,
+ //Image = item.Image,
Manufacturer = item.Manufacturer,
ProductName = item.ProductName,
ProductURL = item.ProductURL,
ProductVersion = item.ProductVersion,
MSIProductID = item.MSIProductID,
- Shortname = item.Shortname
+ Shortname = item.Shortname,
+ SWId = item.SWId
}).ToList();
//Only take updated Versions
diff --git a/RZUpdate/RZUpdate.cs b/RZUpdate/RZUpdate.cs
index 7efb526..80f1659 100644
--- a/RZUpdate/RZUpdate.cs
+++ b/RZUpdate/RZUpdate.cs
@@ -64,7 +64,7 @@ public RZUpdater(string sSWFile)
/// Name of the Software Product (must be in the RuckZuck Repository !)
/// >Current Version of the Software
/// SWUpdate if an Update is available otherwise null
- public SWUpdate CheckForUpdate(string ProductName, string Version)
+ public SWUpdate CheckForUpdate(string ProductName, string Version, string Manufacturer = "")
{
try
{
@@ -72,6 +72,7 @@ public SWUpdate CheckForUpdate(string ProductName, string Version)
oSW.ProductName = ProductName; // ;
oSW.ProductVersion = Version; // ;
+ oSW.Manufacturer = Manufacturer ?? "";
List oResult = RZRestAPI.CheckForUpdate(new List() { oSW }).ToList();
if (oResult.Count > 0)
diff --git a/RuckZuck_Tool/NewSWPanelxaml.xaml.cs b/RuckZuck_Tool/NewSWPanelxaml.xaml.cs
index 814a337..caee0fd 100644
--- a/RuckZuck_Tool/NewSWPanelxaml.xaml.cs
+++ b/RuckZuck_Tool/NewSWPanelxaml.xaml.cs
@@ -97,68 +97,69 @@ private void btOpenMSI_Click(object sender, RoutedEventArgs e)
{
// Open document
string sMSIfilename = dlg.FileName;
- MSInstaller iMSI = new MSInstaller(sMSIfilename);
- tbMSIId.Text = iMSI.Property("ProductCode");
- string sHashType = "";
- string sFileHash = "";
- //Try to get File Signature...
- try
+ using (MSInstaller iMSI = new MSInstaller(sMSIfilename))
{
- var Cert = X509Certificate.CreateFromSignedFile(dlg.FileName);
+ tbMSIId.Text = iMSI.Property("ProductCode");
+ string sHashType = "";
+ string sFileHash = "";
+ //Try to get File Signature...
+ try
+ {
+ var Cert = X509Certificate.CreateFromSignedFile(dlg.FileName);
- sFileHash = Cert.GetCertHashString().ToLower().Replace(" ", "");
- sHashType = "X509";
- }
- catch
- {
- sFileHash = GetMD5Hash(dlg.FileName);
- sHashType = "MD5";
- }
+ sFileHash = Cert.GetCertHashString().ToLower().Replace(" ", "");
+ sHashType = "X509";
+ }
+ catch
+ {
+ sFileHash = GetMD5Hash(dlg.FileName);
+ sHashType = "MD5";
+ }
- lFiles.Add(new contentFiles() { FileName = iMSI.FileName, FileHash = sFileHash, HashType = sHashType });
- dgSourceFiles.ItemsSource = lFiles.ToList();
- dgSourceFiles.Items.Refresh();
+ lFiles.Add(new contentFiles() { FileName = iMSI.FileName, FileHash = sFileHash, HashType = sHashType });
+ dgSourceFiles.ItemsSource = lFiles.ToList();
+ dgSourceFiles.Items.Refresh();
- if (tbPSDetection.Text.Contains("\\Classes\\Installer\\Products"))
- tbPSDetection.Text = "";
- if (tbPSInstall.Text.Contains("-FilePath \"msiexec.exe\""))
- tbPSInstall.Text = "";
- if (tbPSUnInstall.Text.Contains("-FilePath \"msiexec.exe\""))
- tbPSUnInstall.Text = "";
+ if (tbPSDetection.Text.Contains("\\Classes\\Installer\\Products"))
+ tbPSDetection.Text = "";
+ if (tbPSInstall.Text.Contains("-FilePath \"msiexec.exe\""))
+ tbPSInstall.Text = "";
+ if (tbPSUnInstall.Text.Contains("-FilePath \"msiexec.exe\""))
+ tbPSUnInstall.Text = "";
- tbMSIId_LostFocus(this, e);
+ tbMSIId_LostFocus(this, e);
- tbProductName.Text = iMSI.Property("ProductName");
- tbVersion.Text = iMSI.Property("ProductVersion");
- tbManufacturer.Text = iMSI.Property("Manufacturer");
- tbArchitecture.Text = iMSI.MSIArchitecture.ToUpper();
+ tbProductName.Text = iMSI.Property("ProductName");
+ tbVersion.Text = iMSI.Property("ProductVersion");
+ tbManufacturer.Text = iMSI.Property("Manufacturer");
+ tbArchitecture.Text = iMSI.MSIArchitecture.ToUpper();
- if (string.IsNullOrEmpty(tbArchitecture.Text))
- tbArchitecture.Text = "X86";
- if (tbArchitecture.Text == "INTEL")
- tbArchitecture.Text = "X86";
+ if (string.IsNullOrEmpty(tbArchitecture.Text))
+ tbArchitecture.Text = "X86";
- if (tbArchitecture.Text == "X64")
- {
- tbPSPrereq.Text = "[Environment]::Is64BitProcess";
- }
- else
- {
- tbPSPrereq.Text = "$true";
- }
+ if (tbArchitecture.Text == "INTEL")
+ tbArchitecture.Text = "X86";
+
+ if (tbArchitecture.Text == "X64")
+ {
+ tbPSPrereq.Text = "[Environment]::Is64BitProcess";
+ }
+ else
+ {
+ tbPSPrereq.Text = "$true";
+ }
- tbPSInstall.Text = tbPSInstall.Text.Replace("", iMSI.FileName);
- tbContentId.Text = Guid.NewGuid().ToString();
+ tbPSInstall.Text = tbPSInstall.Text.Replace("", iMSI.FileName);
+ tbContentId.Text = Guid.NewGuid().ToString();
- try
- {
- if(!string.IsNullOrEmpty(iMSI.Property("ARPURLINFOABOUT")))
- tbProductURL.Text = iMSI.Property("ARPURLINFOABOUT");
+ try
+ {
+ if (!string.IsNullOrEmpty(iMSI.Property("ARPURLINFOABOUT")))
+ tbProductURL.Text = iMSI.Property("ARPURLINFOABOUT");
+ }
+ catch { }
}
- catch { }
-
- iMSI.Dispose();
}
catch { }
}
@@ -751,10 +752,15 @@ public MSInstaller(string path)
///
public void Dispose()
{
+ try
+ {
+ Marshal.FinalReleaseComObject(msiDatabase);
+ Marshal.FinalReleaseComObject(msiInstaller);
+ }
+ catch { }
msiDatabase = null;
msiInstaller = null;
GC.Collect();
- GC.WaitForPendingFinalizers();
}
#region MSI Functions
diff --git a/RuckZuck_Tool/RZRestAPI.cs b/RuckZuck_Tool/RZRestAPI.cs
index 1fb0cd4..1d00ffb 100644
--- a/RuckZuck_Tool/RZRestAPI.cs
+++ b/RuckZuck_Tool/RZRestAPI.cs
@@ -358,6 +358,7 @@ public static bool UploadSWEntry(AddSoftware lSoftware)
public static async void TrackDownloads(string contentID)
{
+ contentID.ToString();
//depreciated
}
@@ -511,7 +512,8 @@ public string IconURL
{
if (SWId > 0)
{
- return RZRestAPI.sURL + "/rest/GetIcon?id=" + SWId.ToString();
+ string sURL = RZRestAPI.sURL + "/rest/GetIcon?id=" + SWId.ToString();
+ return sURL;
}
return "";
}
diff --git a/RuckZuck_Tool/RZUpdate.cs b/RuckZuck_Tool/RZUpdate.cs
index 7efb526..c0b3feb 100644
--- a/RuckZuck_Tool/RZUpdate.cs
+++ b/RuckZuck_Tool/RZUpdate.cs
@@ -64,7 +64,7 @@ public RZUpdater(string sSWFile)
/// Name of the Software Product (must be in the RuckZuck Repository !)
/// >Current Version of the Software
/// SWUpdate if an Update is available otherwise null
- public SWUpdate CheckForUpdate(string ProductName, string Version)
+ public SWUpdate CheckForUpdate(string ProductName, string Version, string Manufacturer = "")
{
try
{
@@ -72,6 +72,7 @@ public SWUpdate CheckForUpdate(string ProductName, string Version)
oSW.ProductName = ProductName; // ;
oSW.ProductVersion = Version; // ;
+ oSW.Manufacturer = Manufacturer ?? "";
List oResult = RZRestAPI.CheckForUpdate(new List() { oSW }).ToList();
if (oResult.Count > 0)
@@ -604,7 +605,7 @@ private bool _Download(bool Enforce, string DLPath)
else
{
//Depreciated
- //RZRestAPI.TrackDownloads(SW.ContentID);
+ //RZRestAPI.TrackDownloads(SW.ContentID);
}
}
}