|
| 1 | +using System; |
| 2 | +using System.Collections.Generic; |
| 3 | +using System.Data; |
| 4 | +using System.Linq; |
| 5 | +using System.Reflection; |
| 6 | +using System.Windows.Forms; |
| 7 | + |
| 8 | +namespace Rappen.XTB.CAT |
| 9 | +{ |
| 10 | + public partial class About : Form |
| 11 | + { |
| 12 | + private CustomActionTester cat; |
| 13 | + |
| 14 | + public About(CustomActionTester cat) |
| 15 | + { |
| 16 | + InitializeComponent(); |
| 17 | + this.cat = cat; |
| 18 | + PopulateAssemblies(); |
| 19 | + } |
| 20 | + |
| 21 | + private void PopulateAssemblies() |
| 22 | + { |
| 23 | + var assemblies = GetReferencedAssemblies(); |
| 24 | + var items = assemblies.Select(a => GetListItem(a)).ToArray(); |
| 25 | + listAssemblies.Items.Clear(); |
| 26 | + listAssemblies.Items.AddRange(items); |
| 27 | + } |
| 28 | + |
| 29 | + private ListViewItem GetListItem(AssemblyName a) |
| 30 | + { |
| 31 | + var item = new ListViewItem(a.Name); |
| 32 | + item.SubItems.Add(a.Version.ToString()); |
| 33 | + return item; |
| 34 | + } |
| 35 | + |
| 36 | + private List<AssemblyName> GetReferencedAssemblies() |
| 37 | + { |
| 38 | + var names = Assembly.GetExecutingAssembly().GetReferencedAssemblies() |
| 39 | + .Where(a => !a.Name.Equals("mscorlib") && !a.Name.StartsWith("System") && !a.Name.Contains("CSharp")).ToList(); |
| 40 | + names.Add(Assembly.GetEntryAssembly().GetName()); |
| 41 | + names.Add(Assembly.GetExecutingAssembly().GetName()); |
| 42 | + names = names.OrderBy(a => assemblyPrioritizer(a.Name)).ToList(); |
| 43 | + return names; |
| 44 | + } |
| 45 | + |
| 46 | + private static string assemblyPrioritizer(string assemblyName) |
| 47 | + { |
| 48 | + return |
| 49 | + assemblyName.Equals("XrmToolBox") ? "AAAAAAAAAAAA" : |
| 50 | + assemblyName.Contains("XrmToolBox") ? "AAAAAAAAAAAB" : |
| 51 | + assemblyName.Equals(Assembly.GetExecutingAssembly().GetName().Name) ? "AAAAAAAAAAAC" : |
| 52 | + assemblyName.Contains("Jonas") ? "AAAAAAAAAAAD" : |
| 53 | + assemblyName.Contains("Rappen") ? "AAAAAAAAAAAE" : |
| 54 | + assemblyName.Contains("Innofactor") ? "AAAAAAAAAAAF" : |
| 55 | + assemblyName.Contains("Cinteros") ? "AAAAAAAAAAAG" : |
| 56 | + assemblyName; |
| 57 | + } |
| 58 | + |
| 59 | + private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) |
| 60 | + { |
| 61 | + System.Diagnostics.Process.Start("https://jonasr.app"); |
| 62 | + } |
| 63 | + |
| 64 | + private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) |
| 65 | + { |
| 66 | + System.Diagnostics.Process.Start("https://jonasr.app"); |
| 67 | + } |
| 68 | + |
| 69 | + private void linkLabel5_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) |
| 70 | + { |
| 71 | + MessageBox.Show(@"The evolution of Custom Action Tester is based on feedback issues and anonymous statistics collected about usage. |
| 72 | +The statistics are a valuable source of information for continuing the development to make the tool even easier to use and improve the most popular features. |
| 73 | +
|
| 74 | +Thank You, |
| 75 | +Jonas", "Anonymous statistics", MessageBoxButtons.OK, MessageBoxIcon.Information); |
| 76 | + } |
| 77 | + } |
| 78 | +} |
0 commit comments