diff --git a/RZ.Bot/Properties/AssemblyInfo.cs b/RZ.Bot/Properties/AssemblyInfo.cs
index 26f1eb7..c8418dd 100644
--- a/RZ.Bot/Properties/AssemblyInfo.cs
+++ b/RZ.Bot/Properties/AssemblyInfo.cs
@@ -8,9 +8,9 @@
[assembly: AssemblyTitle("RuckZuck LogConsole")]
[assembly: AssemblyDescription("LogConsole show status changes")]
[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Zander Tools")]
+[assembly: AssemblyCompany("Zander - Tools")]
[assembly: AssemblyProduct("RuckZuck LogConsole")]
-[assembly: AssemblyCopyright("Copyright © 2019 by Roger Zander")]
+[assembly: AssemblyCopyright("Copyright © 2020 by Roger Zander")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@@ -33,4 +33,4 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.7.1.*")]
-[assembly: AssemblyFileVersion("1.7.1.3")]
+[assembly: AssemblyFileVersion("1.7.1.5")]
diff --git a/RuckZuck_Tool/App.config b/RuckZuck_Tool/App.config
index 4b5f77e..76f31ab 100644
--- a/RuckZuck_Tool/App.config
+++ b/RuckZuck_Tool/App.config
@@ -6,7 +6,7 @@
-
+
diff --git a/RuckZuck_Tool/InstallSwPanel.xaml.cs b/RuckZuck_Tool/InstallSwPanel.xaml.cs
index 8a39871..80243d2 100644
--- a/RuckZuck_Tool/InstallSwPanel.xaml.cs
+++ b/RuckZuck_Tool/InstallSwPanel.xaml.cs
@@ -23,23 +23,12 @@ namespace RuckZuck_Tool
///
public partial class InstallSwPanel : UserControl
{
- public string sAuthToken;
- //public string sInternalURL;
- //public List lAllSoftware;
+ public DownloadMonitor dm = new DownloadMonitor();
public List lAllSoftware;
+ public List lDLTasks = new List();
public List lSoftware = new List();
+ public string sAuthToken;
public System.Timers.Timer tSearch = new System.Timers.Timer(1000);
- delegate void AnonymousDelegate();
- public event EventHandler OnSWUpdated = delegate { };
-
- public List lDLTasks = new List();
-
- public DownloadMonitor dm = new DownloadMonitor();
-
-
- public delegate void ChangedEventHandler(object sender, EventArgs e);
- public event ChangedEventHandler onEdit;
-
public InstallSwPanel()
{
InitializeComponent();
@@ -49,151 +38,12 @@ public InstallSwPanel()
tSearch.AutoReset = false;
}
- private void TSearch_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
- {
-
- AnonymousDelegate update = delegate ()
- {
- if (tbSearch.IsFocused)
- tbSearch_Search(sender, null);
- else
- tSearch.Stop();
- };
- Dispatcher.Invoke(update);
-
- }
-
- private void Hyperlink_RequestNavigate(object sender, RequestNavigateEventArgs e)
- {
- try
- {
- Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri));
- e.Handled = true;
- }
- catch { }
- }
-
- private void tbSearch_GotFocus(object sender, RoutedEventArgs e)
- {
- tSearch.Stop();
- tbSearch.Foreground = new SolidColorBrush(Colors.Black);
- if (tbSearch.Tag != null)
- tbSearch.Text = "";
- }
-
- private void tbSearch_LostFocus(object sender, RoutedEventArgs e)
- {
- Mouse.OverrideCursor = Cursors.Wait;
- if (string.IsNullOrEmpty(tbSearch.Text))
- {
- tbSearch.Foreground = new SolidColorBrush(Colors.LightGray);
- tbSearch.Tag = "Search";
- tbSearch.Text = "Search...";
- }
- else
- {
- tbSearch.Foreground = new SolidColorBrush(Colors.Black);
- tbSearch.Tag = null;
-
- try
- {
- var vResult = lAllSoftware.FindAll(t => t.ShortName.IndexOf(tbSearch.Text, 0, StringComparison.InvariantCultureIgnoreCase) >= 0).ToList();
- vResult.AddRange(lAllSoftware.FindAll(t => t.ProductName.IndexOf(tbSearch.Text, 0, StringComparison.InvariantCultureIgnoreCase) >= 0).ToList());
- vResult.AddRange(lAllSoftware.FindAll(t => t.Manufacturer.IndexOf(tbSearch.Text, 0, StringComparison.InvariantCultureIgnoreCase) >= 0).ToList());
- if (vResult.Count <= 15)
- {
- vResult.AddRange(lAllSoftware.FindAll(t => (t.Description ?? "").IndexOf(tbSearch.Text, 0, StringComparison.InvariantCultureIgnoreCase) >= 0).ToList());
- }
-
- lvSW.ItemsSource = vResult.Distinct().OrderBy(t => t.ShortName).ThenByDescending(t => t.ProductVersion).ThenByDescending(t => t.ProductName);
- }
- catch { }
- }
- Mouse.OverrideCursor = null;
- }
-
- private void tbSearch_Search(object sender, RoutedEventArgs e)
- {
-
- Mouse.OverrideCursor = Cursors.Wait;
- if (string.IsNullOrEmpty(tbSearch.Text))
- {
- tbSearch.Foreground = new SolidColorBrush(Colors.LightGray);
- tbSearch.Tag = "Search";
- tbSearch.Text = "Search...";
-
-
- ListCollectionView lcv = new ListCollectionView(lAllSoftware.Distinct().OrderBy(t => t.ShortName).ThenByDescending(t => t.ProductVersion).ThenByDescending(t => t.ProductName).ToList());
-
- //ListCollectionView lcv = new ListCollectionView(oAPI.SWResults("", "").Distinct().OrderBy(t => t.ShortName).ThenByDescending(t => t.ProductVersion).ThenByDescending(t => t.ProductName).ToList());
- PropertyGroupDescription PGD = new PropertyGroupDescription("", new ShortNameToCategory());
-
- //PGD.GroupNames.Add(RZRestAPI.GetCategories(lAllSoftware));
- foreach (var o in RZRestAPIv2.GetCategories(lAllSoftware))
- {
- PGD.GroupNames.Add(o);
- }
-
-
- lcv.GroupDescriptions.Add(PGD);
-
- lvSW.ItemsSource = lcv;
- }
- else
- {
- tbSearch.Foreground = new SolidColorBrush(Colors.Black);
- tbSearch.Tag = null;
-
- try
- {
- var vResult = lAllSoftware.FindAll(t => t.ShortName.IndexOf(tbSearch.Text, 0, StringComparison.InvariantCultureIgnoreCase) >= 0).ToList();
- vResult.AddRange(lAllSoftware.FindAll(t => t.ProductName.IndexOf(tbSearch.Text, 0, StringComparison.InvariantCultureIgnoreCase) >= 0).ToList());
- vResult.AddRange(lAllSoftware.FindAll(t => t.Manufacturer.IndexOf(tbSearch.Text, 0, StringComparison.InvariantCultureIgnoreCase) >= 0).ToList());
- if (vResult.Count <= 15)
- {
- vResult.AddRange(lAllSoftware.FindAll(t => (t.Description ?? "").IndexOf(tbSearch.Text, 0, StringComparison.InvariantCultureIgnoreCase) >= 0).ToList());
- }
-
- lvSW.ItemsSource = vResult.Distinct().OrderBy(t => t.ShortName).ThenByDescending(t => t.ProductVersion).ThenByDescending(t => t.ProductName);
- }
- catch { }
- }
- Mouse.OverrideCursor = null;
- }
-
- public class ShortNameToCategory : IValueConverter
- {
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- if (value.GetType() == typeof(GetSoftware))
- {
- GetSoftware oSW = (GetSoftware)value;
-
- return oSW.Categories[0];
- }
-
- return null;
-
- }
+ public delegate void ChangedEventHandler(object sender, EventArgs e);
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
+ delegate void AnonymousDelegate();
+ public event ChangedEventHandler onEdit;
- private void lvSW_SelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- tSearch.Stop();
- if (lvSW.SelectedItems.Count > 0)
- {
- btInstall.IsEnabled = true;
- }
- else
- {
- btInstall.IsEnabled = false;
- }
- }
+ public event EventHandler OnSWUpdated = delegate { };
private void btInstall_Click(object sender, RoutedEventArgs e)
{
@@ -299,68 +149,125 @@ private void btInstall_Click(object sender, RoutedEventArgs e)
}
}
- private void OSW_ProgressDetails(object sender, EventArgs e)
+ private void btNew_Click(object sender, RoutedEventArgs e)
{
- dm.RefreshData();
+ Mouse.OverrideCursor = Cursors.Wait;
+ try
+ {
+ tSearch.Stop();
+ var badSW = RZRestAPIv2.GetCatalog("--new--");
+ tbSearch.Text = "";
+
+ //Mark all installed...
+ badSW.ForEach(x => { if (lSoftware.FirstOrDefault(t => (t.ProductName == x.ProductName && t.ProductVersion == x.ProductVersion)) != null) { x.isInstalled = true; } });
+
+
+ ListCollectionView lcv = new ListCollectionView(badSW.ToList());
+
+ lvSW.ItemsSource = lcv;
+ }
+ finally
+ {
+ Mouse.OverrideCursor = null;
+ }
}
- private void tbSearch_KeyDown(object sender, KeyEventArgs e)
+ private void btOldFeedback_Click(object sender, RoutedEventArgs e)
{
- if (e.Key == Key.Return)
+ Mouse.OverrideCursor = Cursors.Wait;
+ try
{
- lvSW.Focus();
- tSearch.Stop();
- tSearch.Enabled = false;
- tSearch.Interval = 1000;
+ var oldSW = RZRestAPIv2.GetCatalog("--old--"); //.Distinct().Select(x => new GetSoftware() { Categories = x.Categories.ToList(), Description = x.Description, Downloads = x.Downloads, IconId = x.IconId, Image = x.Image, Manufacturer = x.Manufacturer, ProductName = x.ProductName, ProductURL = x.ProductURL, ProductVersion = x.ProductVersion, Quality = x.Quality, ShortName = x.ShortName, isInstalled = false }).ToList();
+ tbSearch.Text = "";
+
+ //Mark all installed...
+ oldSW.ForEach(x => { if (lSoftware.FirstOrDefault(t => (t.ProductName == x.ProductName && t.ProductVersion == x.ProductVersion)) != null) { x.isInstalled = true; } });
+
+ ListCollectionView lcv = new ListCollectionView(oldSW.ToList());
+
+ lvSW.ItemsSource = lcv;
+
}
- else
+ finally
{
- tSearch.Interval = 1000;
- tSearch.Enabled = true;
- tSearch.Start();
+ Mouse.OverrideCursor = null;
}
}
- private void miOpenPage_Click(object sender, RoutedEventArgs e)
+ private void Hyperlink_RequestNavigate(object sender, RequestNavigateEventArgs e)
{
try
{
- if (lvSW.SelectedItems.Count > 0)
- {
- Process.Start(((GetSoftware)lvSW.SelectedItem).ProductURL.ToString());
- }
+ Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri));
+ e.Handled = true;
}
catch { }
}
- private void miSendFeedback_Click(object sender, RoutedEventArgs e)
+ private void lvSW_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
+ tSearch.Stop();
if (lvSW.SelectedItems.Count > 0)
{
- try
+ btInstall.IsEnabled = true;
+ }
+ else
+ {
+ btInstall.IsEnabled = false;
+ }
+ }
+
+ private void miCreateExe_Click(object sender, RoutedEventArgs e)
+ {
+ Mouse.OverrideCursor = Cursors.Wait;
+ try
+ {
+ foreach (var oItem in lvSW.SelectedItems)
{
- GetSoftware oSelectedItem = ((GetSoftware)lvSW.SelectedItem);
- var vDB = Task.Run(() =>
+ try
{
- try
+ SWUpdate oSW = null;
+ if (oItem.GetType() == typeof(GetSoftware))
{
- AnonymousDelegate update = delegate ()
- {
- FeedbackForm oFeedBack = new FeedbackForm();
- oFeedBack.Title = oSelectedItem.ProductName + " " + oSelectedItem.ProductVersion;
- oFeedBack.ShowDialog();
+ GetSoftware dgr = oItem as GetSoftware;
+ //sPS = GetSWInstallPS(dgr.ProductName, dgr.ProductVersion, "");
+ oSW = new SWUpdate(dgr.ProductName, dgr.ProductVersion, dgr.Manufacturer);
+ }
- if (oFeedBack.hasFeedback)
- {
- RZRestAPIv2.Feedback(oSelectedItem.ProductName, oSelectedItem.ProductVersion, oSelectedItem.Manufacturer, oFeedBack.isWorking.ToString(), System.Reflection.Assembly.GetExecutingAssembly().GetName().Name, oFeedBack.tbFeedback.Text, RZRestAPIv2.CustomerID).ConfigureAwait(false); ;
- }
- };
- Dispatcher.Invoke(update);
+ if (oItem.GetType() == typeof(AddSoftware))
+ {
+ AddSoftware dgr = oItem as AddSoftware;
+ //sPS = GetSWInstallPS(dgr.ProductName, dgr.ProductVersion, "");
+ oSW = new SWUpdate(dgr);
}
- catch { }
- });
+
+ CreateExe oExe = new CreateExe(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, oSW.SW.ShortName + "_setup.exe"));
+
+ //Get Icon if missing
+ if (oSW.SW.Image == null)
+ oSW.SW.Image = RZRestAPIv2.GetIcon(oSW.SW.IconHash, "", 48);
+
+ oExe.Icon = oSW.SW.Image;
+ oExe.Sources.Add(Properties.Resources.Source.Replace("RZRZRZ", oSW.SW.ShortName));
+ oExe.Sources.Add(Properties.Resources.RZUpdate);
+ oExe.Sources.Add(Properties.Resources.RZRestApi);
+ oExe.Sources.Add(Properties.Resources.Assembly.Replace("RZRZRZ", oSW.SW.ShortName));
+
+ if (!oExe.Compile())
+ {
+ MessageBox.Show("Failed to create .Exe", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
+ }
+ else
+ {
+ MessageBox.Show(oSW.SW.ShortName + "_setup.exe" + " created in: " + AppDomain.CurrentDomain.BaseDirectory, "EXE created", MessageBoxButton.OK, MessageBoxImage.Information);
+ }
+ }
+ catch { }
}
- catch { }
+ }
+ finally
+ {
+ Mouse.OverrideCursor = null;
}
}
@@ -396,7 +303,7 @@ private void miDownloadFiles_Click(object sender, RoutedEventArgs e)
//oSW.Downloaded += OSW_Downloaded;
oSW.ProgressDetails += OSW_ProgressDetails;
oSW.downloadTask.AutoInstall = false;
- oSW.Download(false).ConfigureAwait(false);
+ oSW.Download(false).ConfigureAwait(false);
dm.lDLTasks.Add(oSW.downloadTask);
}
@@ -432,49 +339,15 @@ private void miEdit_Click(object sender, RoutedEventArgs e)
}
}
- private void btOldFeedback_Click(object sender, RoutedEventArgs e)
- {
- Mouse.OverrideCursor = Cursors.Wait;
- try
- {
- var oldSW = RZRestAPIv2.GetCatalog("--old--"); //.Distinct().Select(x => new GetSoftware() { Categories = x.Categories.ToList(), Description = x.Description, Downloads = x.Downloads, IconId = x.IconId, Image = x.Image, Manufacturer = x.Manufacturer, ProductName = x.ProductName, ProductURL = x.ProductURL, ProductVersion = x.ProductVersion, Quality = x.Quality, ShortName = x.ShortName, isInstalled = false }).ToList();
- tbSearch.Text = "";
-
- //Mark all installed...
- oldSW.ForEach(x => { if (lSoftware.FirstOrDefault(t => (t.ProductName == x.ProductName && t.ProductVersion == x.ProductVersion)) != null) { x.isInstalled = true; } });
-
- ListCollectionView lcv = new ListCollectionView(oldSW.ToList());
-
- lvSW.ItemsSource = lcv;
-
- }
- finally
- {
- Mouse.OverrideCursor = null;
- }
- }
-
- private void btNew_Click(object sender, RoutedEventArgs e)
+ private void miInstall_Click(object sender, RoutedEventArgs e)
{
- Mouse.OverrideCursor = Cursors.Wait;
- try
- {
- tSearch.Stop();
- var badSW = RZRestAPIv2.GetCatalog("--new--");
- tbSearch.Text = "";
-
- //Mark all installed...
- badSW.ForEach(x => { if (lSoftware.FirstOrDefault(t => (t.ProductName == x.ProductName && t.ProductVersion == x.ProductVersion)) != null) { x.isInstalled = true; } });
-
+ tSearch.Stop();
+ lvSW.ContextMenu.IsOpen = false;
+ Thread.Sleep(200);
- ListCollectionView lcv = new ListCollectionView(badSW.ToList());
+ Dispatcher.Invoke(new Action(() => { }), System.Windows.Threading.DispatcherPriority.ContextIdle, null);
- lvSW.ItemsSource = lcv;
- }
- finally
- {
- Mouse.OverrideCursor = null;
- }
+ btInstall_Click(sender, e);
}
private void miOpenFolders_Click(object sender, RoutedEventArgs e)
@@ -496,15 +369,47 @@ private void miOpenFolders_Click(object sender, RoutedEventArgs e)
}
}
- private void miInstall_Click(object sender, RoutedEventArgs e)
+ private void miOpenPage_Click(object sender, RoutedEventArgs e)
{
- tSearch.Stop();
- lvSW.ContextMenu.IsOpen = false;
- Thread.Sleep(200);
+ try
+ {
+ if (lvSW.SelectedItems.Count > 0)
+ {
+ Process.Start(((GetSoftware)lvSW.SelectedItem).ProductURL.ToString());
+ }
+ }
+ catch { }
+ }
- Dispatcher.Invoke(new Action(() => { }), System.Windows.Threading.DispatcherPriority.ContextIdle, null);
+ private void miSendFeedback_Click(object sender, RoutedEventArgs e)
+ {
+ if (lvSW.SelectedItems.Count > 0)
+ {
+ try
+ {
+ GetSoftware oSelectedItem = ((GetSoftware)lvSW.SelectedItem);
+ var vDB = Task.Run(() =>
+ {
+ try
+ {
+ AnonymousDelegate update = delegate ()
+ {
+ FeedbackForm oFeedBack = new FeedbackForm();
+ oFeedBack.Title = oSelectedItem.ProductName + " " + oSelectedItem.ProductVersion;
+ oFeedBack.ShowDialog();
- btInstall_Click(sender, e);
+ if (oFeedBack.hasFeedback)
+ {
+ RZRestAPIv2.Feedback(oSelectedItem.ProductName, oSelectedItem.ProductVersion, oSelectedItem.Manufacturer, oFeedBack.isWorking.ToString(), System.Reflection.Assembly.GetExecutingAssembly().GetName().Name, oFeedBack.tbFeedback.Text, RZRestAPIv2.CustomerID).ConfigureAwait(false); ;
+ }
+ };
+ Dispatcher.Invoke(update);
+ }
+ catch { }
+ });
+ }
+ catch { }
+ }
}
private void miUninstall_Click(object sender, RoutedEventArgs e)
@@ -576,57 +481,147 @@ private void miUninstall_Click(object sender, RoutedEventArgs e)
}
}
- private void miCreateExe_Click(object sender, RoutedEventArgs e)
+ private void OSW_ProgressDetails(object sender, EventArgs e)
+ {
+ dm.RefreshData();
+ }
+
+ private void tbSearch_GotFocus(object sender, RoutedEventArgs e)
+ {
+ tSearch.Stop();
+ tbSearch.Foreground = new SolidColorBrush(Colors.Black);
+ if (tbSearch.Tag != null)
+ tbSearch.Text = "";
+ }
+
+ private void tbSearch_KeyDown(object sender, KeyEventArgs e)
+ {
+ if (e.Key == Key.Return)
+ {
+ lvSW.Focus();
+ tSearch.Stop();
+ tSearch.Enabled = false;
+ tSearch.Interval = 1000;
+ }
+ else
+ {
+ tSearch.Interval = 1000;
+ tSearch.Enabled = true;
+ tSearch.Start();
+ }
+ }
+
+ private void tbSearch_LostFocus(object sender, RoutedEventArgs e)
{
Mouse.OverrideCursor = Cursors.Wait;
- try
+ if (string.IsNullOrEmpty(tbSearch.Text))
{
- foreach (var oItem in lvSW.SelectedItems)
+ tbSearch.Foreground = new SolidColorBrush(Colors.LightGray);
+ tbSearch.Tag = "Search";
+ tbSearch.Text = "Search...";
+ }
+ else
+ {
+ tbSearch.Foreground = new SolidColorBrush(Colors.Black);
+ tbSearch.Tag = null;
+
+ try
{
- try
+ var vResult = lAllSoftware.FindAll(t => t.ShortName.IndexOf(tbSearch.Text, 0, StringComparison.InvariantCultureIgnoreCase) >= 0).ToList();
+ vResult.AddRange(lAllSoftware.FindAll(t => t.ProductName.IndexOf(tbSearch.Text, 0, StringComparison.InvariantCultureIgnoreCase) >= 0).ToList());
+ vResult.AddRange(lAllSoftware.FindAll(t => t.Manufacturer.IndexOf(tbSearch.Text, 0, StringComparison.InvariantCultureIgnoreCase) >= 0).ToList());
+ if (vResult.Count <= 15)
{
- SWUpdate oSW = null;
- if (oItem.GetType() == typeof(GetSoftware))
- {
- GetSoftware dgr = oItem as GetSoftware;
- //sPS = GetSWInstallPS(dgr.ProductName, dgr.ProductVersion, "");
- oSW = new SWUpdate(dgr.ProductName, dgr.ProductVersion, dgr.Manufacturer);
- }
+ vResult.AddRange(lAllSoftware.FindAll(t => (t.Description ?? "").IndexOf(tbSearch.Text, 0, StringComparison.InvariantCultureIgnoreCase) >= 0).ToList());
+ }
- if (oItem.GetType() == typeof(AddSoftware))
- {
- AddSoftware dgr = oItem as AddSoftware;
- //sPS = GetSWInstallPS(dgr.ProductName, dgr.ProductVersion, "");
- oSW = new SWUpdate(dgr);
- }
+ lvSW.ItemsSource = vResult.Distinct().OrderBy(t => t.ShortName).ThenByDescending(t => t.ProductVersion).ThenByDescending(t => t.ProductName);
+ }
+ catch { }
+ }
+ Mouse.OverrideCursor = null;
+ }
- CreateExe oExe = new CreateExe(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, oSW.SW.ShortName + "_setup.exe"));
+ private void tbSearch_Search(object sender, RoutedEventArgs e)
+ {
- //Get Icon if missing
- if (oSW.SW.Image == null)
- oSW.SW.Image = RZRestAPIv2.GetIcon(oSW.SW.IconHash, "", 48);
+ Mouse.OverrideCursor = Cursors.Wait;
+ if (string.IsNullOrEmpty(tbSearch.Text))
+ {
+ tbSearch.Foreground = new SolidColorBrush(Colors.LightGray);
+ tbSearch.Tag = "Search";
+ tbSearch.Text = "Search...";
- oExe.Icon = oSW.SW.Image;
- oExe.Sources.Add(Properties.Resources.Source.Replace("RZRZRZ", oSW.SW.ShortName));
- oExe.Sources.Add(Properties.Resources.RZUpdate);
- oExe.Sources.Add(Properties.Resources.RZRestApi);
- oExe.Sources.Add(Properties.Resources.Assembly.Replace("RZRZRZ", oSW.SW.ShortName));
- if (!oExe.Compile())
- {
- MessageBox.Show("Failed to create .Exe", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
- }
- else
- {
- MessageBox.Show(oSW.SW.ShortName + "_setup.exe" + " created in: " + AppDomain.CurrentDomain.BaseDirectory, "EXE created", MessageBoxButton.OK, MessageBoxImage.Information);
- }
+ ListCollectionView lcv = new ListCollectionView(lAllSoftware.Distinct().OrderBy(t => t.ShortName).ThenByDescending(t => t.ProductVersion).ThenByDescending(t => t.ProductName).ToList());
+
+ //ListCollectionView lcv = new ListCollectionView(oAPI.SWResults("", "").Distinct().OrderBy(t => t.ShortName).ThenByDescending(t => t.ProductVersion).ThenByDescending(t => t.ProductName).ToList());
+ PropertyGroupDescription PGD = new PropertyGroupDescription("", new ShortNameToCategory());
+
+ //PGD.GroupNames.Add(RZRestAPI.GetCategories(lAllSoftware));
+ foreach (var o in RZRestAPIv2.GetCategories(lAllSoftware))
+ {
+ PGD.GroupNames.Add(o);
+ }
+
+
+ lcv.GroupDescriptions.Add(PGD);
+
+ lvSW.ItemsSource = lcv;
+ }
+ else
+ {
+ tbSearch.Foreground = new SolidColorBrush(Colors.Black);
+ tbSearch.Tag = null;
+
+ try
+ {
+ var vResult = lAllSoftware.FindAll(t => t.ShortName.IndexOf(tbSearch.Text, 0, StringComparison.InvariantCultureIgnoreCase) >= 0).ToList();
+ vResult.AddRange(lAllSoftware.FindAll(t => t.ProductName.IndexOf(tbSearch.Text, 0, StringComparison.InvariantCultureIgnoreCase) >= 0).ToList());
+ vResult.AddRange(lAllSoftware.FindAll(t => t.Manufacturer.IndexOf(tbSearch.Text, 0, StringComparison.InvariantCultureIgnoreCase) >= 0).ToList());
+ if (vResult.Count <= 15)
+ {
+ vResult.AddRange(lAllSoftware.FindAll(t => (t.Description ?? "").IndexOf(tbSearch.Text, 0, StringComparison.InvariantCultureIgnoreCase) >= 0).ToList());
}
- catch { }
+
+ lvSW.ItemsSource = vResult.Distinct().OrderBy(t => t.ShortName).ThenByDescending(t => t.ProductVersion).ThenByDescending(t => t.ProductName);
}
+ catch { }
}
- finally
+ Mouse.OverrideCursor = null;
+ }
+
+ private void TSearch_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
+ {
+
+ AnonymousDelegate update = delegate ()
{
- Mouse.OverrideCursor = null;
+ if (tbSearch.IsFocused)
+ tbSearch_Search(sender, null);
+ else
+ tSearch.Stop();
+ };
+ Dispatcher.Invoke(update);
+
+ }
+ public class ShortNameToCategory : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ if (value.GetType() == typeof(GetSoftware))
+ {
+ GetSoftware oSW = (GetSoftware)value;
+
+ return oSW.Categories[0];
+ }
+
+ return null;
+
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
}
}
}
diff --git a/RuckZuck_Tool/MainWindow.xaml.cs b/RuckZuck_Tool/MainWindow.xaml.cs
index 66104bc..6a36bc3 100644
--- a/RuckZuck_Tool/MainWindow.xaml.cs
+++ b/RuckZuck_Tool/MainWindow.xaml.cs
@@ -31,10 +31,16 @@ namespace RuckZuck_Tool
///
public partial class MainWindow : Window
{
- delegate void AnonymousDelegate();
- List CommandArgs = new List();
+ public List lNewVersion = new List();
+
+ public List lSoftware = new List();
+
+ public List lUnknownSoftware = new List();
+
internal RZScan oSCAN;
-
+
+ List CommandArgs = new List();
+
public MainWindow()
{
DateTime dstart = DateTime.Now;
@@ -131,7 +137,7 @@ public MainWindow()
FileVersionInfo FI = FileVersionInfo.GetVersionInfo(Assembly.GetEntryAssembly().Location);
oSCAN = new RZScan(false, true);
-
+
oSCAN.StaticInstalledSoftware.Add(new AddSoftware() { ProductName = "RuckZuck", Manufacturer = FI.CompanyName, ProductVersion = FI.ProductVersion.ToString() });
oSCAN.OnSWScanCompleted += OSCAN_OnSWScanCompleted;
oSCAN.OnUpdatesDetected += OSCAN_OnUpdatesDetected;
@@ -163,13 +169,32 @@ public MainWindow()
}
}
+ delegate void AnonymousDelegate();
+ public static ImageSource ByteToImage(byte[] imageData)
+ {
+ try
+ {
+ BitmapImage biImg = new BitmapImage();
+ MemoryStream ms = new MemoryStream(imageData);
+ biImg.BeginInit();
+ biImg.StreamSource = ms;
+ biImg.EndInit();
+
+ ImageSource imgSrc = biImg as ImageSource;
+ return imgSrc;
+ }
+ catch { }
+
+ return null;
+ }
+
///
- /// Encrypt a string
+ /// Decrypt a string
///
- ///
+ ///
///
///
- public static string Encrypt(string strPlainText, string strKey)
+ public static string Decrypt(string strBase64Text, string strKey)
{
try
{
@@ -178,24 +203,24 @@ public static string Encrypt(string strPlainText, string strKey)
SHA1CryptoServiceProvider objSHA1 = new SHA1CryptoServiceProvider();
byte[] bHash = objSHA1.ComputeHash(ASCIIEncoding.ASCII.GetBytes(strKey));
- byte[] bRes = ProtectedData.Protect(ASCIIEncoding.ASCII.GetBytes(strPlainText), bHash, DataProtectionScope.CurrentUser);
-
- return Convert.ToBase64String(bRes);
+ byte[] arrBuffer = Convert.FromBase64String(strBase64Text);
+ return ASCIIEncoding.ASCII.GetString(System.Security.Cryptography.ProtectedData.Unprotect(arrBuffer, bHash, DataProtectionScope.CurrentUser));
}
catch (System.Exception ex)
{
ex.Message.ToString();
}
return "";
+
}
///
- /// Decrypt a string
+ /// Encrypt a string
///
- ///
+ ///
///
///
- public static string Decrypt(string strBase64Text, string strKey)
+ public static string Encrypt(string strPlainText, string strKey)
{
try
{
@@ -204,188 +229,118 @@ public static string Decrypt(string strBase64Text, string strKey)
SHA1CryptoServiceProvider objSHA1 = new SHA1CryptoServiceProvider();
byte[] bHash = objSHA1.ComputeHash(ASCIIEncoding.ASCII.GetBytes(strKey));
- byte[] arrBuffer = Convert.FromBase64String(strBase64Text);
- return ASCIIEncoding.ASCII.GetString(System.Security.Cryptography.ProtectedData.Unprotect(arrBuffer, bHash, DataProtectionScope.CurrentUser));
+ byte[] bRes = ProtectedData.Protect(ASCIIEncoding.ASCII.GetBytes(strPlainText), bHash, DataProtectionScope.CurrentUser);
+
+ return Convert.ToBase64String(bRes);
}
catch (System.Exception ex)
{
ex.Message.ToString();
}
return "";
-
}
-
- private void OUpdPanel_OnSWUpdated(object sender, EventArgs e)
+ private void btBackInstall_Click(object sender, RoutedEventArgs e)
{
- oSCAN.tRegCheck.AutoReset = false;
- oSCAN.tRegCheck.Enabled = true;
- //Wait 1s;
- oSCAN.tRegCheck.Interval = 1000;
- oSCAN.tRegCheck.Start();
+ btNextScan.IsEnabled = true;
+ btBackScan.IsEnabled = false;
+ tabWizard.SelectedItem = tabMain;
}
- private void OSCAN_OnUpdScanCompleted(object sender, EventArgs e)
+ private void btBackNewSWARP_Click(object sender, RoutedEventArgs e)
{
- //Remove duplicates...
- lNewVersion = ((RZScan)sender).NewSoftwareVersions.GroupBy(x => x.ShortName).Select(y => y.First()).ToList();
-
- foreach (string sExclude in Properties.Settings.Default.UpdExlusion)
- {
- try
- {
- lNewVersion.RemoveAll(t => t.ShortName == sExclude);
- }
- catch { }
- }
-
- AnonymousDelegate update = delegate ()
- {
- Mouse.OverrideCursor = null;
- lbWait.Visibility = Visibility.Hidden;
- btNextScan.IsEnabled = true;
- btBackScan.IsEnabled = true;
-
- if (lNewVersion.Count > 0)
- {
- btUpdateSoftware.IsEnabled = true;
- if (lNewVersion.Count == 1)
- btUpdateSoftware.Content = "there is currently (" + lNewVersion.Count.ToString() + ") update available...";
- else
- btUpdateSoftware.Content = "there are currently (" + lNewVersion.Count.ToString() + ") updates available...";
- }
- else
- {
- btUpdateSoftware.IsEnabled = false;
- btUpdateSoftware.Content = "there are currently no updates available...";
- }
- };
- Dispatcher.Invoke(update);
+ tabWizard.SelectedItem = tabMain;
}
- private void OSCAN_OnSWRepoLoaded(object sender, EventArgs e)
+ private void btBackNewSWSMI_Click(object sender, RoutedEventArgs e)
{
- try
- {
- AnonymousDelegate update = delegate ()
- {
- btInstallSoftware.Content = "Install new Software";
- btInstallSoftware.IsEnabled = true;
- };
- Dispatcher.Invoke(update);
-
- oSCAN.bCheckUpdates = true;
- oSCAN.SWScan();
- }
- catch { }
+ tabWizard.SelectedItem = tabMain;
}
- private void OSCAN_OnUpdatesDetected(object sender, EventArgs e)
- {
+ private void btBackScanResult_Click(object sender, RoutedEventArgs e)
+ {
+ tabWizard.SelectedItem = tabScan;
}
- private void OSCAN_OnSWScanCompleted(object sender, EventArgs e)
+ private void btBackSettings_Click(object sender, RoutedEventArgs e)
{
- lSoftware = ((RZScan)sender).InstalledSoftware;
- AnonymousDelegate update = delegate ()
- {
- Mouse.OverrideCursor = null;
- lbWait.Visibility = Visibility.Hidden;
- btNextScan.IsEnabled = true;
- btBackScan.IsEnabled = true;
-
- if (lNewVersion.Count > 0)
- {
- btUpdateSoftware.IsEnabled = true;
- if(lNewVersion.Count == 1)
- btUpdateSoftware.Content = "there is currently (" + lNewVersion.Count.ToString() + ") update available...";
- else
- btUpdateSoftware.Content = "there are currently (" + lNewVersion.Count.ToString() + ") updates available...";
- }
- else
- {
- btUpdateSoftware.IsEnabled = false;
- if (((RZScan)sender).bCheckUpdates)
- {
- btUpdateSoftware.Content = "Scanning for updates... please wait !";
- }
- else
- {
- btUpdateSoftware.Content = "there are currently no updates available...";
- }
- }
-
- //tabWizard.SelectedItem = tabMain;
-
- };
- Dispatcher.Invoke(update);
+ tabWizard.SelectedItem = tabMain;
}
- void oInstPanel_onEdit(object sender, EventArgs e)
+ private void btCreatARPSW_Click(object sender, RoutedEventArgs e)
{
- AnonymousDelegate update = delegate ()
+ Mouse.OverrideCursor = Cursors.Wait;
+ try
{
- try
+ if (arpGrid2.SelectedItems.Count > 0)
{
- bool bNoPreReqCheck = false;
- if (sender.GetType() == typeof(GetSoftware))
- {
- GetSoftware oSelectedItem = (GetSoftware)sender;
-
- //Ignore PreRequisites if SHIFT is pressed
- if (Keyboard.Modifiers == ModifierKeys.Shift)
- {
- bNoPreReqCheck = true;
- }
+ AddSoftware oSelectedItem = arpGrid2.SelectedItem as AddSoftware;
+ //oNewPanel = new NewSWPanelxaml();
+ oNewPanel.tbManufacturer.Text = oSelectedItem.Manufacturer;
+ oNewPanel.tbProductName.Text = oSelectedItem.ProductName;
+ oNewPanel.tbVersion.Text = oSelectedItem.ProductVersion;
+ oNewPanel.imgIcon.Tag = oSelectedItem.Image;
+ oNewPanel.tbProductURL.Text = oSelectedItem.ProductURL;
- //Load Software details for a valid DeploymentType...
- SWUpdate oSW = new SWUpdate(oSelectedItem.ProductName, oSelectedItem.ProductVersion, oSelectedItem.Manufacturer, bNoPreReqCheck);
+ oNewPanel.tbDescription.Text = oSelectedItem.Description;
+ oNewPanel.tbArchitecture.Text = oSelectedItem.Architecture;
+ oNewPanel.tbContentId.Text = oSelectedItem.ContentID;
+ oNewPanel.tbPSDetection.Text = oSelectedItem.PSDetection;
+ oNewPanel.tbPSInstall.Text = oSelectedItem.PSInstall;
+ oNewPanel.tbPSPrereq.Text = oSelectedItem.PSPreReq;
+ oNewPanel.tbPSUnInstall.Text = oSelectedItem.PSUninstall;
+ oNewPanel.tbPSPreInstall.Text = oSelectedItem.PSPreInstall;
+ oNewPanel.tbPSPostInstall.Text = oSelectedItem.PSPostInstall;
+ oNewPanel.tbMSIId.Text = oSelectedItem.MSIProductID;
+ oNewPanel.imgIcon.Source = ByteToImage(oSelectedItem.Image);
- //get Icon
- oSW.SW.Image = RZRestAPIv2.GetIcon(oSW.SW.IconHash);
+ oNewPanel.dgSourceFiles.DataContext = null;
- oNewPanel.OpenXML(oSW.SW);
+ if (string.IsNullOrEmpty(oSelectedItem.ContentID))
+ oNewPanel.tbContentId.Text = Guid.NewGuid().ToString();
- tabWizard.SelectedItem = tabNewSWSMI;
+ if (oSelectedItem.Architecture == "NEW")
+ {
+ if (Environment.Is64BitOperatingSystem)
+ oNewPanel.tbArchitecture.Text = "X64";
+ else
+ oNewPanel.tbArchitecture.Text = "X86";
}
- if (sender.GetType() == typeof(AddSoftware))
- {
- AddSoftware oSelectedItem = (AddSoftware)sender;
+ if (oNewPanel.tbPSUnInstall.Text.ToLowerInvariant().Contains("(x86)") || oNewPanel.tbPSDetection.Text.ToLowerInvariant().Contains("wow6432node"))
+ oNewPanel.tbPSPrereq.Text = "[Environment]::Is64BitProcess";
- //Ignore PreRequisites if SHIFT is pressed
- if (Keyboard.Modifiers == ModifierKeys.Shift)
- {
- bNoPreReqCheck = true;
- }
+ //oNewPanel.tbPSUnInstall.Text = oNewPanel.tbPSUnInstall.Text.Replace(@"C:\Program Files (x86)", "$(${Env:ProgramFiles(x86)})");
+ //oNewPanel.tbPSUnInstall.Text = oNewPanel.tbPSUnInstall.Text.Replace(@"C:\Program Piles", "$($Env:ProgramFiles)");
- //Load Software details for a valid DeploymentType...
- SWUpdate oSW = new SWUpdate(oSelectedItem.ProductName, oSelectedItem.ProductVersion, oSelectedItem.Manufacturer, bNoPreReqCheck);
+ oNewPanel.tbPSUnInstall.Text = System.Text.RegularExpressions.Regex.Replace(oNewPanel.tbPSUnInstall.Text, System.Text.RegularExpressions.Regex.Escape(@"C:\Program Files (x86)"), @"$(${Env:ProgramFiles(x86)})", System.Text.RegularExpressions.RegexOptions.IgnoreCase | System.Text.RegularExpressions.RegexOptions.IgnorePatternWhitespace);
+ oNewPanel.tbPSUnInstall.Text = System.Text.RegularExpressions.Regex.Replace(oNewPanel.tbPSUnInstall.Text, System.Text.RegularExpressions.Regex.Escape(@"C:\Program Files"), "$($Env:ProgramFiles)", System.Text.RegularExpressions.RegexOptions.IgnoreCase | System.Text.RegularExpressions.RegexOptions.IgnorePatternWhitespace);
+ oNewPanel.tbPSUnInstall.Text = System.Text.RegularExpressions.Regex.Replace(oNewPanel.tbPSUnInstall.Text, System.Text.RegularExpressions.Regex.Escape(@"C:\Program Data"), "$($Env:ProgramData)", System.Text.RegularExpressions.RegexOptions.IgnoreCase | System.Text.RegularExpressions.RegexOptions.IgnorePatternWhitespace);
- oNewPanel.OpenXML(oSW.SW);
+ if (oNewPanel.tbPSDetection.Text.ToLowerInvariant().Contains("wow6432node"))
+ oNewPanel.tbArchitecture.Text = "X64";
+ if (oNewPanel.tbPSUnInstall.Text.ToLowerInvariant().Contains("(x86)"))
+ oNewPanel.tbArchitecture.Text = "X64";
- tabWizard.SelectedItem = tabNewSWSMI;
- }
- }
- catch { }
- };
- Dispatcher.Invoke(update);
- }
+ if (oNewPanel.tbPSUnInstall.Text.ToUpperInvariant().Contains("/SILENT"))
+ {
+ oNewPanel.tbPSInstall.Text = oNewPanel.tbPSInstall.Text.Replace("/?", "/SP- /VERYSILENT /NORESTART");
+ }
- public List lSoftware = new List();
- public List lNewVersion = new List();
- public List lUnknownSoftware = new List();
+ }
- private void OSCAN_OnInstalledSWAdded(object sender, EventArgs e)
- {
- oSCAN.CheckUpdates(new List() { ((AddSoftware)sender) });
+ tabWizard.SelectedItem = tabNewSWSMI;
+ }
+ finally
+ {
+ Mouse.OverrideCursor = null;
+ }
}
- private void btNewSoftware_Click(object sender, RoutedEventArgs e)
+ private void btFinishMain_Click(object sender, RoutedEventArgs e)
{
- tabWizard.SelectedItem = tabNewSWSMI;
- oNewPanel.btOpenMSI.RaiseEvent(e);
+ this.Close();
}
private void btInstallSoftware_Click(object sender, RoutedEventArgs e)
@@ -419,7 +374,7 @@ private void btInstallSoftware_Click(object sender, RoutedEventArgs e)
//Check if SW is already installed
if (lSoftware.FirstOrDefault(t => t.ProductName == oSW.ProductName && t.ProductVersion == oSW.ProductVersion) != null)
{
- GetSoftware oNew = new GetSoftware() { Categories = new List { sCAT }, Description = oSW.Description, Downloads = oSW.Downloads, SWId = oSW.SWId, Manufacturer = oSW.Manufacturer, ProductName = oSW.ProductName, ProductURL = oSW.ProductURL, ProductVersion = oSW.ProductVersion, ShortName = oSW.ShortName, IconHash = oSW.IconHash, isInstalled = true };
+ GetSoftware oNew = new GetSoftware() { Categories = new List { sCAT }, Description = oSW.Description, Downloads = oSW.Downloads, SWId = oSW.SWId, Manufacturer = oSW.Manufacturer, ProductName = oSW.ProductName, ProductURL = oSW.ProductURL, ProductVersion = oSW.ProductVersion, ShortName = oSW.ShortName, IconHash = oSW.IconHash, isInstalled = true };
oDBCat.Add(oNew);
}
else
@@ -451,14 +406,14 @@ private void btInstallSoftware_Click(object sender, RoutedEventArgs e)
foreach (var o in RZRestAPIv2.GetCategories(oSCAN.SoftwareRepository))
{
- PGD.GroupNames.Add(o);
+ PGD.GroupNames.Add(o);
}
lcv.GroupDescriptions.Add(PGD);
-
+
oInstPanel.lvSW.ItemsSource = lcv;
oInstPanel.lSoftware = lSoftware;
- oInstPanel.lAllSoftware = oSCAN.SoftwareRepository;
+ oInstPanel.lAllSoftware = oSCAN.SoftwareRepository;
//Mark all installed...
oInstPanel.lAllSoftware.ForEach(x => { if (lSoftware.FirstOrDefault(t => (t.ProductName == x.ProductName && t.ProductVersion == x.ProductVersion)) != null) { x.isInstalled = true; } });
@@ -475,252 +430,282 @@ private void btInstallSoftware_Click(object sender, RoutedEventArgs e)
tabWizard.SelectedItem = tabInstallSW;
}
- public class ShortNameToCategory : IValueConverter
+ private void btNewSoftware_Click(object sender, RoutedEventArgs e)
{
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ tabWizard.SelectedItem = tabNewSWSMI;
+ oNewPanel.btOpenMSI.RaiseEvent(e);
+ }
+
+ private void btNewSoftwareARP_Click(object sender, RoutedEventArgs e)
+ {
+ tabWizard.SelectedItem = tabNewSWARP;
+ }
+
+ private void btNextScan_Click(object sender, RoutedEventArgs e)
+ {
+ tabWizard.SelectedItem = tabMain;
+ }
+
+ private void btNextScanResult_Click(object sender, RoutedEventArgs e)
+ {
+ tabWizard.SelectedItem = tabMain;
+ }
+
+ private void btNextStart_Click(object sender, RoutedEventArgs e)
+ {
+ tabWizard.SelectedItem = tabMain;
+ }
+
+ private void btOpenSettings_Click(object sender, RoutedEventArgs e)
+ {
+ tabWizard.SelectedItem = tabSettings;
+ }
+
+ private void btUpdateSoftware_Click(object sender, RoutedEventArgs e)
+ {
+ Mouse.OverrideCursor = Cursors.Wait;
+ try
{
- try
- {
-
- if (value.GetType() == typeof(GetSoftware))
- {
- GetSoftware oSW = (GetSoftware)value;
- return oSW.Categories[0];
- }
- }
- catch(Exception ex)
+ foreach (string sException in Properties.Settings.Default.UpdExlusion)
{
- ex.Message.ToString();
+ lNewVersion.RemoveAll(t => t.ShortName == sException);
}
- return null;
-
+ oUpdPanel.lvSW.ItemsSource = lNewVersion; //oAPI.CheckForUpdate(lSoftware.Select(t => new RZApi.AddSoftware() { ProductName = t.ProductName, ProductVersion = t.ProductVersion, Manufacturer = t.Manufacturer }).ToArray());
+ oUpdPanel.lInstalledSW = oSCAN.InstalledSoftware;
+ oUpdPanel.lSWRep = oSCAN.SoftwareRepository;
}
-
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ finally
{
- throw new NotImplementedException();
+ Mouse.OverrideCursor = null;
}
+
+ tabWizard.SelectedItem = tabUpdateSW;
}
- private void btNewSoftwareARP_Click(object sender, RoutedEventArgs e)
+ private void btUpdExclusion_Click(object sender, RoutedEventArgs e)
{
- tabWizard.SelectedItem = tabNewSWARP;
+ Properties.Settings.Default.UpdExlusion.Clear();
+ Properties.Settings.Default.Save();
}
- private void btCreatARPSW_Click(object sender, RoutedEventArgs e)
+ private void cbRZCache_Checked(object sender, RoutedEventArgs e)
{
- Mouse.OverrideCursor = Cursors.Wait;
- try
+ Properties.Settings.Default.DisableBroadcast = !cbRZCache.IsChecked ?? false;
+ Properties.Settings.Default.Save();
+ }
+
+ private void Hyperlink_RequestNavigate(object sender, RequestNavigateEventArgs e)
+ {
+ Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri));
+ e.Handled = true;
+ }
+
+ void oInstPanel_onEdit(object sender, EventArgs e)
+ {
+ AnonymousDelegate update = delegate ()
{
- if (arpGrid2.SelectedItems.Count > 0)
+ try
{
- AddSoftware oSelectedItem = arpGrid2.SelectedItem as AddSoftware;
- //oNewPanel = new NewSWPanelxaml();
- oNewPanel.tbManufacturer.Text = oSelectedItem.Manufacturer;
- oNewPanel.tbProductName.Text = oSelectedItem.ProductName;
- oNewPanel.tbVersion.Text = oSelectedItem.ProductVersion;
- oNewPanel.imgIcon.Tag = oSelectedItem.Image;
- oNewPanel.tbProductURL.Text = oSelectedItem.ProductURL;
-
- oNewPanel.tbDescription.Text = oSelectedItem.Description;
- oNewPanel.tbArchitecture.Text = oSelectedItem.Architecture;
- oNewPanel.tbContentId.Text = oSelectedItem.ContentID;
- oNewPanel.tbPSDetection.Text = oSelectedItem.PSDetection;
- oNewPanel.tbPSInstall.Text = oSelectedItem.PSInstall;
- oNewPanel.tbPSPrereq.Text = oSelectedItem.PSPreReq;
- oNewPanel.tbPSUnInstall.Text = oSelectedItem.PSUninstall;
- oNewPanel.tbPSPreInstall.Text = oSelectedItem.PSPreInstall;
- oNewPanel.tbPSPostInstall.Text = oSelectedItem.PSPostInstall;
- oNewPanel.tbMSIId.Text = oSelectedItem.MSIProductID;
- oNewPanel.imgIcon.Source = ByteToImage(oSelectedItem.Image);
+ bool bNoPreReqCheck = false;
+ if (sender.GetType() == typeof(GetSoftware))
+ {
+ GetSoftware oSelectedItem = (GetSoftware)sender;
- oNewPanel.dgSourceFiles.DataContext = null;
+ //Ignore PreRequisites if SHIFT is pressed
+ if (Keyboard.Modifiers == ModifierKeys.Shift)
+ {
+ bNoPreReqCheck = true;
+ }
- if (string.IsNullOrEmpty(oSelectedItem.ContentID))
- oNewPanel.tbContentId.Text = Guid.NewGuid().ToString();
+ //Load Software details for a valid DeploymentType...
+ SWUpdate oSW = new SWUpdate(oSelectedItem.ProductName, oSelectedItem.ProductVersion, oSelectedItem.Manufacturer, bNoPreReqCheck);
- if (oSelectedItem.Architecture == "NEW")
- {
- if (Environment.Is64BitOperatingSystem)
- oNewPanel.tbArchitecture.Text = "X64";
- else
- oNewPanel.tbArchitecture.Text = "X86";
- }
+ //get Icon
+ oSW.SW.Image = RZRestAPIv2.GetIcon(oSW.SW.IconHash);
- if (oNewPanel.tbPSUnInstall.Text.ToLowerInvariant().Contains("(x86)") || oNewPanel.tbPSDetection.Text.ToLowerInvariant().Contains("wow6432node"))
- oNewPanel.tbPSPrereq.Text = "[Environment]::Is64BitProcess";
+ oNewPanel.OpenXML(oSW.SW);
- //oNewPanel.tbPSUnInstall.Text = oNewPanel.tbPSUnInstall.Text.Replace(@"C:\Program Files (x86)", "$(${Env:ProgramFiles(x86)})");
- //oNewPanel.tbPSUnInstall.Text = oNewPanel.tbPSUnInstall.Text.Replace(@"C:\Program Piles", "$($Env:ProgramFiles)");
+ tabWizard.SelectedItem = tabNewSWSMI;
+ }
- oNewPanel.tbPSUnInstall.Text = System.Text.RegularExpressions.Regex.Replace(oNewPanel.tbPSUnInstall.Text, System.Text.RegularExpressions.Regex.Escape(@"C:\Program Files (x86)"), @"$(${Env:ProgramFiles(x86)})", System.Text.RegularExpressions.RegexOptions.IgnoreCase | System.Text.RegularExpressions.RegexOptions.IgnorePatternWhitespace);
- oNewPanel.tbPSUnInstall.Text = System.Text.RegularExpressions.Regex.Replace(oNewPanel.tbPSUnInstall.Text, System.Text.RegularExpressions.Regex.Escape(@"C:\Program Files"), "$($Env:ProgramFiles)", System.Text.RegularExpressions.RegexOptions.IgnoreCase | System.Text.RegularExpressions.RegexOptions.IgnorePatternWhitespace);
- oNewPanel.tbPSUnInstall.Text = System.Text.RegularExpressions.Regex.Replace(oNewPanel.tbPSUnInstall.Text, System.Text.RegularExpressions.Regex.Escape(@"C:\Program Data"), "$($Env:ProgramData)", System.Text.RegularExpressions.RegexOptions.IgnoreCase | System.Text.RegularExpressions.RegexOptions.IgnorePatternWhitespace);
+ if (sender.GetType() == typeof(AddSoftware))
+ {
+ AddSoftware oSelectedItem = (AddSoftware)sender;
- if(oNewPanel.tbPSDetection.Text.ToLowerInvariant().Contains("wow6432node"))
- oNewPanel.tbArchitecture.Text = "X64";
+ //Ignore PreRequisites if SHIFT is pressed
+ if (Keyboard.Modifiers == ModifierKeys.Shift)
+ {
+ bNoPreReqCheck = true;
+ }
- if(oNewPanel.tbPSUnInstall.Text.ToLowerInvariant().Contains("(x86)"))
- oNewPanel.tbArchitecture.Text = "X64";
+ //Load Software details for a valid DeploymentType...
+ SWUpdate oSW = new SWUpdate(oSelectedItem.ProductName, oSelectedItem.ProductVersion, oSelectedItem.Manufacturer, bNoPreReqCheck);
+ oNewPanel.OpenXML(oSW.SW);
- if (oNewPanel.tbPSUnInstall.Text.ToUpperInvariant().Contains("/SILENT"))
- {
- oNewPanel.tbPSInstall.Text = oNewPanel.tbPSInstall.Text.Replace("/?", "/SP- /VERYSILENT /NORESTART");
- }
+ tabWizard.SelectedItem = tabNewSWSMI;
+ }
}
+ catch { }
+ };
+ Dispatcher.Invoke(update);
+ }
- tabWizard.SelectedItem = tabNewSWSMI;
- }
- finally
- {
- Mouse.OverrideCursor = null;
- }
+ private async void OSCAN_OnInstalledSWAdded(object sender, EventArgs e)
+ {
+ await oSCAN.CheckUpdatesAsync(new List() { ((AddSoftware)sender) });
}
- public static ImageSource ByteToImage(byte[] imageData)
+ private async void OSCAN_OnSWRepoLoaded(object sender, EventArgs e)
{
try
{
- BitmapImage biImg = new BitmapImage();
- MemoryStream ms = new MemoryStream(imageData);
- biImg.BeginInit();
- biImg.StreamSource = ms;
- biImg.EndInit();
+ AnonymousDelegate update = delegate ()
+ {
+ btInstallSoftware.Content = "Install new Software";
+ btInstallSoftware.IsEnabled = true;
+ };
+ Dispatcher.Invoke(update);
- ImageSource imgSrc = biImg as ImageSource;
- return imgSrc;
+ oSCAN.bCheckUpdates = true;
+ await oSCAN.SWScanAsync();
}
catch { }
-
- return null;
- }
-
- private void btNextStart_Click(object sender, RoutedEventArgs e)
- {
- tabWizard.SelectedItem = tabMain;
}
- private void tabWizard_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ private void OSCAN_OnSWScanCompleted(object sender, EventArgs e)
{
- if(tabWizard.SelectedItem != tabNewSWSMI && e.Source == tabWizard)
- oNewPanel.unload();
-
- if (tabWizard.SelectedItem == tabNewSWARP && e.Source == tabWizard)
+ lSoftware = ((RZScan)sender).InstalledSoftware;
+ AnonymousDelegate update = delegate ()
{
- Mouse.OverrideCursor = Cursors.Wait;
- try
+ Mouse.OverrideCursor = null;
+ lbWait.Visibility = Visibility.Hidden;
+ btNextScan.IsEnabled = true;
+ btBackScan.IsEnabled = true;
+
+ if (lNewVersion.Count > 0)
{
- arpGrid2.AutoGenerateColumns = false;
- List lServer = new List();
- if (oInstPanel.lvSW.ItemsSource == null)
- {
- lServer = RZRestAPIv2.GetCatalog().OrderBy(t => t.ShortName).ThenByDescending(t => t.ProductVersion).ThenByDescending(t => t.ProductName).ToList();
- }
+ btUpdateSoftware.IsEnabled = true;
+ if (lNewVersion.Count == 1)
+ btUpdateSoftware.Content = "there is currently (" + lNewVersion.Count.ToString() + ") update available...";
else
+ btUpdateSoftware.Content = "there are currently (" + lNewVersion.Count.ToString() + ") updates available...";
+ }
+ else
+ {
+ btUpdateSoftware.IsEnabled = false;
+ if (((RZScan)sender).bCheckUpdates)
{
- lServer = oInstPanel.lvSW.ItemsSource as List;
- }
-
- if(lServer == null)
- lServer = RZRestAPIv2.GetCatalog().OrderBy(t => t.ShortName).ThenByDescending(t => t.ProductVersion).ThenByDescending(t => t.ProductName).ToList();
-
- if (Keyboard.Modifiers == ModifierKeys.Shift)
- {
- arpGrid2.ItemsSource = lSoftware.OrderBy(t => t.ProductName).ThenBy(t => t.ProductVersion).ThenBy(t => t.Manufacturer).ToList();
+ btUpdateSoftware.Content = "Scanning for updates... please wait !";
}
else
{
- arpGrid2.ItemsSource = lSoftware.Where(t => lServer.Count(x => x.ProductName == t.ProductName && x.Manufacturer == t.Manufacturer && x.ProductVersion == t.ProductVersion) == 0).OrderBy(t => t.ProductName).ThenBy(t => t.ProductVersion).ThenBy(t => t.Manufacturer).ToList();
+ btUpdateSoftware.Content = "there are currently no updates available...";
}
}
- finally
- {
- Mouse.OverrideCursor = null;
- }
- }
- }
-
- private void btNextScan_Click(object sender, RoutedEventArgs e)
- {
- tabWizard.SelectedItem = tabMain;
- }
- private void btNextScanResult_Click(object sender, RoutedEventArgs e)
- {
- tabWizard.SelectedItem = tabMain;
- }
-
- private void btBackScanResult_Click(object sender, RoutedEventArgs e)
- {
- tabWizard.SelectedItem = tabScan;
- }
+ //tabWizard.SelectedItem = tabMain;
- private void btFinishMain_Click(object sender, RoutedEventArgs e)
- {
- this.Close();
+ };
+ Dispatcher.Invoke(update);
}
- private void btBackInstall_Click(object sender, RoutedEventArgs e)
+ private void OSCAN_OnUpdatesDetected(object sender, EventArgs e)
{
- btNextScan.IsEnabled = true;
- btBackScan.IsEnabled = false;
- tabWizard.SelectedItem = tabMain;
- }
- private void btBackNewSWSMI_Click(object sender, RoutedEventArgs e)
- {
- tabWizard.SelectedItem = tabMain;
}
- private void btBackNewSWARP_Click(object sender, RoutedEventArgs e)
+ private void OSCAN_OnUpdScanCompleted(object sender, EventArgs e)
{
- tabWizard.SelectedItem = tabMain;
- }
+ //Remove duplicates...
+ lNewVersion = ((RZScan)sender).NewSoftwareVersions.GroupBy(x => x.ShortName).Select(y => y.First()).ToList();
- private void btUpdateSoftware_Click(object sender, RoutedEventArgs e)
- {
- Mouse.OverrideCursor = Cursors.Wait;
- try
+ foreach (string sExclude in Properties.Settings.Default.UpdExlusion)
{
- foreach (string sException in Properties.Settings.Default.UpdExlusion)
+ try
{
- lNewVersion.RemoveAll(t => t.ShortName == sException);
+ lNewVersion.RemoveAll(t => t.ShortName == sExclude);
}
-
- oUpdPanel.lvSW.ItemsSource = lNewVersion; //oAPI.CheckForUpdate(lSoftware.Select(t => new RZApi.AddSoftware() { ProductName = t.ProductName, ProductVersion = t.ProductVersion, Manufacturer = t.Manufacturer }).ToArray());
- oUpdPanel.lInstalledSW = oSCAN.InstalledSoftware;
- oUpdPanel.lSWRep = oSCAN.SoftwareRepository;
+ catch { }
}
- finally
+
+ AnonymousDelegate update = delegate ()
{
Mouse.OverrideCursor = null;
- }
+ lbWait.Visibility = Visibility.Hidden;
+ btNextScan.IsEnabled = true;
+ btBackScan.IsEnabled = true;
- tabWizard.SelectedItem = tabUpdateSW;
+ if (lNewVersion.Count > 0)
+ {
+ btUpdateSoftware.IsEnabled = true;
+ if (lNewVersion.Count == 1)
+ btUpdateSoftware.Content = "there is currently (" + lNewVersion.Count.ToString() + ") update available...";
+ else
+ btUpdateSoftware.Content = "there are currently (" + lNewVersion.Count.ToString() + ") updates available...";
+ }
+ else
+ {
+ btUpdateSoftware.IsEnabled = false;
+ btUpdateSoftware.Content = "there are currently no updates available...";
+ }
+ };
+ Dispatcher.Invoke(update);
}
- private void btBackSettings_Click(object sender, RoutedEventArgs e)
+ private void OUpdPanel_OnSWUpdated(object sender, EventArgs e)
{
- tabWizard.SelectedItem = tabMain;
+ oSCAN.tRegCheck.AutoReset = false;
+ oSCAN.tRegCheck.Enabled = true;
+ //Wait 1s;
+ oSCAN.tRegCheck.Interval = 1000;
+ oSCAN.tRegCheck.Start();
}
-
private void tabSettings_Loaded(object sender, RoutedEventArgs e)
{
tbCustomerID.Text = RZRestAPIv2.CustomerID; // Properties.Settings.Default.CustomerID;
}
- private void btOpenSettings_Click(object sender, RoutedEventArgs e)
+ private void tabWizard_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
- tabWizard.SelectedItem = tabSettings;
- }
+ if (tabWizard.SelectedItem != tabNewSWSMI && e.Source == tabWizard)
+ oNewPanel.unload();
- private void Hyperlink_RequestNavigate(object sender, RequestNavigateEventArgs e)
- {
- Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri));
- e.Handled = true;
+ if (tabWizard.SelectedItem == tabNewSWARP && e.Source == tabWizard)
+ {
+ Mouse.OverrideCursor = Cursors.Wait;
+ try
+ {
+ arpGrid2.AutoGenerateColumns = false;
+ List lServer = new List();
+ if (oInstPanel.lvSW.ItemsSource == null)
+ {
+ lServer = RZRestAPIv2.GetCatalog().OrderBy(t => t.ShortName).ThenByDescending(t => t.ProductVersion).ThenByDescending(t => t.ProductName).ToList();
+ }
+ else
+ {
+ lServer = oInstPanel.lvSW.ItemsSource as List;
+ }
+
+ if (lServer == null)
+ lServer = RZRestAPIv2.GetCatalog().OrderBy(t => t.ShortName).ThenByDescending(t => t.ProductVersion).ThenByDescending(t => t.ProductName).ToList();
+
+ if (Keyboard.Modifiers == ModifierKeys.Shift)
+ {
+ arpGrid2.ItemsSource = lSoftware.OrderBy(t => t.ProductName).ThenBy(t => t.ProductVersion).ThenBy(t => t.Manufacturer).ToList();
+ }
+ else
+ {
+ arpGrid2.ItemsSource = lSoftware.Where(t => lServer.Count(x => x.ProductName == t.ProductName && x.Manufacturer == t.Manufacturer && x.ProductVersion == t.ProductVersion) == 0).OrderBy(t => t.ProductName).ThenBy(t => t.ProductVersion).ThenBy(t => t.Manufacturer).ToList();
+ }
+ }
+ finally
+ {
+ Mouse.OverrideCursor = null;
+ }
+ }
}
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
@@ -747,17 +732,32 @@ private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs
}
}
- private void btUpdExclusion_Click(object sender, RoutedEventArgs e)
+ public class ShortNameToCategory : IValueConverter
{
- Properties.Settings.Default.UpdExlusion.Clear();
- Properties.Settings.Default.Save();
- }
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ try
+ {
+
+ if (value.GetType() == typeof(GetSoftware))
+ {
+ GetSoftware oSW = (GetSoftware)value;
+ return oSW.Categories[0];
+ }
+ }
+ catch(Exception ex)
+ {
+ ex.Message.ToString();
+ }
- private void cbRZCache_Checked(object sender, RoutedEventArgs e)
- {
- Properties.Settings.Default.DisableBroadcast = !cbRZCache.IsChecked ?? false;
- Properties.Settings.Default.Save();
- }
+ return null;
+
+ }
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
}
}
diff --git a/RuckZuck_Tool/NewSWPanelxaml.xaml.cs b/RuckZuck_Tool/NewSWPanelxaml.xaml.cs
index 094b789..b282334 100644
--- a/RuckZuck_Tool/NewSWPanelxaml.xaml.cs
+++ b/RuckZuck_Tool/NewSWPanelxaml.xaml.cs
@@ -971,17 +971,20 @@ private void tbVersion_LostFocus(object sender, RoutedEventArgs e)
//Replace the Version in the PSDetctionScript
if (tbVersion.Text != sOldVersion)
{
- tbPSDetection.Text = tbPSDetection.Text.Replace("'" + sOldVersion + "'", "'" + tbVersion.Text + "'");
- tbPSUnInstall.Text = tbPSUnInstall.Text.Replace("'" + sOldVersion + "'", "'" + tbVersion.Text + "'");
+ //tbPSDetection.Text = tbPSDetection.Text.Replace("'" + sOldVersion + "'", "'" + tbVersion.Text + "'");
+ //tbPSUnInstall.Text = tbPSUnInstall.Text.Replace("'" + sOldVersion + "'", "'" + tbVersion.Text + "'");
tbPSPostInstall.Text = tbPSPostInstall.Text.Replace("'" + sOldVersion + "'", "'" + tbVersion.Text + "'");
tbPSPrereq.Text = tbPSPrereq.Text.Replace("'" + sOldVersion + "'", "'" + tbVersion.Text + "'");
tbPSPreInstall.Text = tbPSPreInstall.Text.Replace("'" + sOldVersion + "'", "'" + tbVersion.Text + "'");
- tbPSDetection.Text = tbPSDetection.Text.Replace("\"" + sOldVersion + "\"", "\"" + tbVersion.Text + "\"");
- tbPSUnInstall.Text = tbPSUnInstall.Text.Replace("\"" + sOldVersion + "\"", "\"" + tbVersion.Text + "\"");
+ //tbPSDetection.Text = tbPSDetection.Text.Replace("\"" + sOldVersion + "\"", "\"" + tbVersion.Text + "\"");
+ //tbPSUnInstall.Text = tbPSUnInstall.Text.Replace("\"" + sOldVersion + "\"", "\"" + tbVersion.Text + "\"");
tbPSPostInstall.Text = tbPSPostInstall.Text.Replace("\"" + sOldVersion + "\"", "\"" + tbVersion.Text + "\"");
tbPSPrereq.Text = tbPSPrereq.Text.Replace("\"" + sOldVersion + "\"", "\"" + tbVersion.Text + "\"");
tbPSPreInstall.Text = tbPSPreInstall.Text.Replace("\"" + sOldVersion + "\"", "\"" + tbVersion.Text + "\"");
+
+ tbPSDetection.Text = tbPSDetection.Text.Replace(sOldVersion, tbVersion.Text);
+ tbPSUnInstall.Text = tbPSUnInstall.Text.Replace(sOldVersion, tbVersion.Text);
}
}