List:Commits« Previous MessageNext Message »
From:Reggie Burnett Date:January 26 2011 7:30pm
Subject:bzr commit into wex-installer-1.0 branch (reggie.burnett:267)
View as plain text  
#At file:///C:/Users/Reggie/work/wex/installer-updated/ based on revid:reggie.burnett@strippedyjz4qdf1ye0ln3

  267 Reggie Burnett	2011-01-26
      pushing manifest manager changes before researching different UI approach

    removed:
      WexInstaller/Properties/Settings.Designer.cs
      WexInstaller/Properties/Settings.settings
    modified:
      ManifestManager/Form1.Designer.cs
      ManifestManager/Form1.cs
      ManifestManager/ManifestManager.csproj
      ManifestManager/Product.cs
      ManifestManager/ProductCatalog.cs
      ManifestManager/ProductCategory.cs
      ManifestManager/ProductFeature.cs
      ManifestManager/ProductManifest.cs
      ManifestManager/app.config
=== modified file 'ManifestManager/Form1.Designer.cs'
=== modified file 'ManifestManager/Form1.Designer.cs'
--- a/ManifestManager/Form1.Designer.cs	2011-01-24 21:36:57 +0000
+++ b/ManifestManager/Form1.Designer.cs	2011-01-26 19:30:56 +0000
@@ -134,10 +134,10 @@
             // 
             // manifestTree
             // 
-            this.manifestTree.Dock = System.Windows.Forms.DockStyle.Top;
+            this.manifestTree.Dock = System.Windows.Forms.DockStyle.Fill;
             this.manifestTree.Location = new System.Drawing.Point(0, 0);
             this.manifestTree.Name = "manifestTree";
-            this.manifestTree.Size = new System.Drawing.Size(200, 489);
+            this.manifestTree.Size = new System.Drawing.Size(200, 492);
             this.manifestTree.TabIndex = 2;
             this.manifestTree.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.manifestTree_AfterSelect);
             // 

=== modified file 'ManifestManager/Form1.cs'
--- a/ManifestManager/Form1.cs	2011-01-24 21:36:57 +0000
+++ b/ManifestManager/Form1.cs	2011-01-26 19:30:56 +0000
@@ -17,9 +17,11 @@
     {
         private ProductManifest manifest;
         private string fileName;
+        public static Form1 Instance;
 
         public Form1()
         {
+            Instance = this;
             InitializeComponent();
         }
 
@@ -70,6 +72,7 @@
                     MessageBox.Show("Unable to parse product manifest");
                     return;
                 }
+                ProductManifest.Instance = manifest;
                 saveManifestToolStripMenuItem.Enabled = true;
             }
             catch (Exception ex)
@@ -87,11 +90,18 @@
 
             TreeNode manifestNode = manifestTree.Nodes.Add("Manifest");
             manifestNode.Tag = manifest;
+
+            // Load our catalogs
             TreeNode catalogsNode = manifestTree.Nodes.Add("Catalogs");
             catalogsNode.Tag = manifest.ProductCatalogs;
-
             foreach (ProductCatalog cat in manifest.ProductCatalogs)
                 LoadCatalog(catalogsNode, cat);
+
+            // Load our categories
+            TreeNode categoriesNode = manifestTree.Nodes.Add("Categories");
+            categoriesNode.Tag = manifest.ProductCategories;
+            foreach (ProductCategory category in manifest.ProductCategories)
+                LoadCategory(categoriesNode, category);
         }
 
         private void LoadCatalog(TreeNode parentNode, ProductCatalog cat)
@@ -105,7 +115,10 @@
             TreeNode productsNode = catNode.Nodes.Add("Included Products");
             productsNode.Tag = cat.Products;
             foreach (CatalogProduct catProduct in cat.Products)
+            {
+                catProduct.Catalog = cat;
                 LoadCatalogProduct(productsNode, catProduct);
+            }
         }
 
         private void LoadSetupType(TreeNode parentNode, SetupType setupType)
@@ -119,24 +132,51 @@
             TreeNode catProductNode = parentNode.Nodes.Add(product.ProductId);
             catProductNode.Tag = product;
         }
-        //    }
-        //    TreeNode categoriesNode = manifestTree.Nodes.Add("Categories");
-        //    categoriesNode.Tag = manifest.ProductCategories;
-        //    foreach (ProductCategory category in manifest.ProductCategories)
-        //    {
-        //        TreeNode categoryNode = categoriesNode.Nodes.Add(category.Name);
-        //        foreach (Product p in category.Products)
-        //        {
-        //            TreeNode productNode = categoryNode.Nodes.Add(p.Name);
-        //            productNode.Tag = p;
-        //            foreach (Package package in p.Packages)
-        //            {
-        //                TreeNode packageNode = productNode.Nodes.Add(package.Id);
-        //                packageNode.Tag = package;
-        //            }
-        //        }
-        //    }
-        //}
+
+        private void LoadCategory(TreeNode parentNode, ProductCategory category)
+        {
+            TreeNode categoryNode = parentNode.Nodes.Add(category.Name);
+            categoryNode.Tag = category;
+            TreeNode productsNode = categoryNode.Nodes.Add("Products");
+            productsNode.Tag = category.Products;
+            foreach (Product product in category.Products)
+                LoadProduct(productsNode, product);
+        }
+
+        private void LoadProduct(TreeNode parentNode, Product product)
+        {
+            TreeNode productNode = parentNode.Nodes.Add(product.Name);
+            productNode.Tag = product;
+            //TreeNode productsNode = categoryNode.Nodes.Add("Products");
+            //productsNode.Tag = category.Products;
+            //foreach (Product product in category.Products)
+            //    LoadProduct(productsNode, product);
+        }
+
+        public void UpdateNode(object o)
+        {
+            if (manifest == null) return;
+            
+            TreeNode node = FindNodeWithTag(manifestTree.Nodes[1], o);
+            if (node == null)
+                node = FindNodeWithTag(manifestTree.Nodes[2], o);
+            if (node == null)
+                return;
+            node.Text = o.ToString();
+        }
+
+        private TreeNode FindNodeWithTag(TreeNode node, object o)
+        {
+            if (node == null) return null;
+
+            foreach (TreeNode childNode in node.Nodes)
+            {
+                if (childNode.Tag != null && childNode.Tag == o) return childNode;
+                TreeNode foundNode = FindNodeWithTag(childNode, o);
+                if (foundNode != null) return foundNode;
+            }
+            return null;
+        }
 
         private void addButton_Click(object sender, EventArgs e)
         {
@@ -177,22 +217,6 @@
             LoadCatalogProduct(node, catProduct);
         }
 
-
-        //private void EditCategoryNode(TreeNode node)
-        //{
-        //    CategoryEditorDlg dlg = new CategoryEditorDlg();
-        //    dlg.Category = node.Tag as ProductCategory;
-        //    dlg.ShowDialog();
-        //    if (dlg.DialogResult == DialogResult.Cancel) return;
-
-        //    if (node.Tag == null)
-        //    {
-        //        TreeNode newNode = node.Nodes.Add(dlg.Category.Name);
-        //        newNode.Tag = dlg.Category;
-        //        manifest.ProductCategories.Add(dlg.Category);
-        //    }
-        //}
-
         private void removeButton_Click(object sender, EventArgs e)
         {
             if (manifestTree.SelectedNode == null) return;

=== modified file 'ManifestManager/ManifestManager.csproj'
--- a/ManifestManager/ManifestManager.csproj	2011-01-24 21:36:57 +0000
+++ b/ManifestManager/ManifestManager.csproj	2011-01-26 19:30:56 +0000
@@ -11,7 +11,8 @@
     <RootNamespace>ManifestManager</RootNamespace>
     <AssemblyName>ManifestManager</AssemblyName>
     <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
-    <TargetFrameworkProfile>Client</TargetFrameworkProfile>
+    <TargetFrameworkProfile>
+    </TargetFrameworkProfile>
     <FileAlignment>512</FileAlignment>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
@@ -36,6 +37,7 @@
   <ItemGroup>
     <Reference Include="System" />
     <Reference Include="System.Core" />
+    <Reference Include="System.Design" />
     <Reference Include="System.Xml.Linq" />
     <Reference Include="System.Data.DataSetExtensions" />
     <Reference Include="Microsoft.CSharp" />
@@ -52,6 +54,7 @@
     <Compile Include="Form1.Designer.cs">
       <DependentUpon>Form1.cs</DependentUpon>
     </Compile>
+    <Compile Include="ListEditor.cs" />
     <Compile Include="Package.cs" />
     <Compile Include="Product.cs" />
     <Compile Include="ProductCatalog.cs" />
@@ -74,15 +77,6 @@
       <DesignTime>True</DesignTime>
     </Compile>
     <None Include="app.config" />
-    <None Include="Properties\Settings.settings">
-      <Generator>SettingsSingleFileGenerator</Generator>
-      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
-    </None>
-    <Compile Include="Properties\Settings.Designer.cs">
-      <AutoGen>True</AutoGen>
-      <DependentUpon>Settings.settings</DependentUpon>
-      <DesignTimeSharedInput>True</DesignTimeSharedInput>
-    </Compile>
   </ItemGroup>
   <ItemGroup />
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

=== modified file 'ManifestManager/Product.cs'
--- a/ManifestManager/Product.cs	2011-01-24 21:36:57 +0000
+++ b/ManifestManager/Product.cs	2011-01-26 19:30:56 +0000
@@ -24,6 +24,11 @@
         [XmlAttribute("urlBaseDir")]
         public string UrlBase { get; set; }
 
+        public override string ToString()
+        {
+            return Name;
+        }
+
         //public long GetInstallationSizeEstimate()
         //{
         //    return GetPackage().GetInstallationSizeEstimate();

=== modified file 'ManifestManager/ProductCatalog.cs'
--- a/ManifestManager/ProductCatalog.cs	2011-01-24 21:36:57 +0000
+++ b/ManifestManager/ProductCatalog.cs	2011-01-26 19:30:56 +0000
@@ -5,6 +5,7 @@
 using System.Xml.Serialization;
 using System.Runtime.Serialization;
 using System.ComponentModel;
+using ManifestManager;
 
 namespace WexInstaller.Core
 {
@@ -35,18 +36,42 @@
         [Browsable(false)]
         [XmlArray("CatalogProducts")]
         public List<CatalogProduct> Products { get; set; }
+
+        public bool Includes(Product p)
+        {
+            foreach (CatalogProduct catalogProduct in Products)
+                if (catalogProduct.ReferencedProduct == p) return true;
+            return false;
+        }
     }
 
     public class CatalogProduct
     {
+        private Product referencedProduct;
+
+        [Editor(typeof(CatalogProductList), typeof(System.Drawing.Design.UITypeEditor))]
         [XmlIgnore]
-        public Product ReferencedProduct;
+        public Product ReferencedProduct
+        {
+            get { return referencedProduct; }
+            set { referencedProduct = value; ProductId = value.Name; Form1.Instance.UpdateNode(this); }
+        }
 
+        [Browsable(false)]
         [XmlAttribute("productId")]
         public string ProductId { get; set; }
 
         [XmlAttribute("setupTypeFlags")]
         public int SetupTypeFlag { get; set; }
+
+        [Browsable(false)]
+        [XmlIgnore]
+        public ProductCatalog Catalog { get; set; }
+
+        public override string ToString()
+        {
+            return ProductId;
+        }
     }
 
     public enum SetupTypeFlag : int
@@ -57,15 +82,25 @@
         Custom=128
     }
 
+    [Serializable]
     public class SetupType
     {
         [XmlAttribute("flag")]
-        public int Flag { get; set; }
+        [Browsable(false)]
+        public int FlagAsInt { get; set; }
+
+        [XmlIgnore]
+        public SetupTypeFlag Flag
+        {
+            get { return (SetupTypeFlag)FlagAsInt; }
+            set { FlagAsInt = (int)value; }
+        }
 
         [XmlAttribute("name")]
         public string Name { get; set; }
 
         [XmlAttribute("description")]
         public string Description { get; set; }
+
     }
 }

=== modified file 'ManifestManager/ProductCategory.cs'
--- a/ManifestManager/ProductCategory.cs	2011-01-24 21:36:57 +0000
+++ b/ManifestManager/ProductCategory.cs	2011-01-26 19:30:56 +0000
@@ -2,11 +2,13 @@
 using System.Collections.Generic;
 using System.Text;
 using System.Xml.Serialization;
+using System.ComponentModel;
 
 namespace WexInstaller.Core
 {
     public class ProductCategory : ProductElement
     {
+        [Browsable(false)]
         [XmlElement("Product")]
         public List<Product> Products;
 

=== modified file 'ManifestManager/ProductFeature.cs'
--- a/ManifestManager/ProductFeature.cs	2011-01-24 21:36:57 +0000
+++ b/ManifestManager/ProductFeature.cs	2011-01-26 19:30:56 +0000
@@ -5,6 +5,7 @@
 using System.Xml.Serialization;
 using System.Drawing;
 using System.Resources;
+using System.ComponentModel;
 
 namespace WexInstaller.Core
 {
@@ -12,6 +13,7 @@
     {
         private Image icon;
 
+        [Browsable(false)]
         [XmlIgnore]
         public ProductElement Parent { get; private set; }
 
@@ -44,6 +46,7 @@
         [XmlAttribute("hasComponents")]
         public string HasComponents { get; set; }
 
+        [Browsable(false)]
         [XmlElement("Feature")]
         public List<ProductFeature> Features { get; set; }
 

=== modified file 'ManifestManager/ProductManifest.cs'
--- a/ManifestManager/ProductManifest.cs	2011-01-24 21:36:57 +0000
+++ b/ManifestManager/ProductManifest.cs	2011-01-26 19:30:56 +0000
@@ -5,23 +5,51 @@
 using System.Xml.Serialization;
 using System.IO;
 using System.ComponentModel;
+using System.Drawing.Design;
+using System.Windows.Forms.Design;
+using System.Security.Cryptography;
 
 namespace WexInstaller.Core
 {
     public sealed class ProductManifest
     {
+        public static ProductManifest Instance;
+        private string installerFileName;
+
+        [Category("Version")]
         [XmlAttribute("version")]
         public int Version { get; set; }
 
+        [Category("Version")]
         [XmlAttribute("format")]
         public int Format { get; set; }
 
+        [Category("Updates")]
         [XmlElement("UpdateVersion")]
         public string UpdateVersion { get; set; }
 
+        [Category("Updates")]
         [XmlElement("UpdateURL")]
         public string UpdateUrl { get; set; }
 
+        [Category("Updates")]
+        [RefreshProperties(RefreshProperties.All)]
+        [XmlElement("UpdateHash")]
+        public string UpdateHash { get; set; }
+
+        [Category("Updates")]
+        [Editor(typeof(FileNameEditor), typeof(UITypeEditor))]
+        [XmlIgnore()]
+        public string UpdaterFile
+        {
+            get { return installerFileName; }
+            set
+            {
+                installerFileName = value;
+                UpdateHash = GetSHAHash(installerFileName);
+            }
+        }
+
         [Browsable(false)]
         [XmlArray()]
         public List<ProductCatalog> ProductCatalogs;
@@ -29,5 +57,25 @@
         [Browsable(false)]
         [XmlArray]
         public List<ProductCategory> ProductCategories;
+
+        public static string GetSHAHash(string pathName)
+        {
+            SHA1CryptoServiceProvider hasher = new SHA1CryptoServiceProvider();
+
+            try
+            {
+                Stream stream = new FileStream(pathName, FileMode.Open);
+                byte[] hash = hasher.ComputeHash(stream);
+                stream.Close();
+
+                string stringHash = BitConverter.ToString(hash);
+                stringHash = stringHash.Replace("-", "");
+                return stringHash;
+            }
+            catch (Exception)
+            {
+                return null;
+            }
+        }
     }
 }

=== modified file 'ManifestManager/app.config'
--- a/ManifestManager/app.config	2011-01-24 21:36:57 +0000
+++ b/ManifestManager/app.config	2011-01-26 19:30:56 +0000
@@ -1,3 +1,3 @@
 <?xml version="1.0"?>
 <configuration>
-<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client"/></startup></configuration>
+<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>

=== removed file 'WexInstaller/Properties/Settings.Designer.cs'
--- a/WexInstaller/Properties/Settings.Designer.cs	2010-06-02 18:30:09 +0000
+++ b/WexInstaller/Properties/Settings.Designer.cs	1970-01-01 00:00:00 +0000
@@ -1,26 +0,0 @@
-//------------------------------------------------------------------------------
-// <auto-generated>
-//     This code was generated by a tool.
-//     Runtime Version:4.0.30319.1
-//
-//     Changes to this file may cause incorrect behavior and will be lost if
-//     the code is regenerated.
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-namespace WexInstaller.Properties {
-    
-    
-    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
-    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
-    internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
-        
-        private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
-        
-        public static Settings Default {
-            get {
-                return defaultInstance;
-            }
-        }
-    }
-}

=== removed file 'WexInstaller/Properties/Settings.settings'
--- a/WexInstaller/Properties/Settings.settings	2010-03-05 23:26:32 +0000
+++ b/WexInstaller/Properties/Settings.settings	1970-01-01 00:00:00 +0000
@@ -1,7 +0,0 @@
-<?xml version='1.0' encoding='utf-8'?>
-<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
-  <Profiles>
-    <Profile Name="(Default)" />
-  </Profiles>
-  <Settings />
-</SettingsFile>

Attachment: [text/bzr-bundle] bzr/reggie.burnett@oracle.com-20110126193056-c46ent4a4n5dephj.bundle
Thread
bzr commit into wex-installer-1.0 branch (reggie.burnett:267) Reggie Burnett26 Jan