Exemplo n.º 1
0
		public override void ViewDidLoad()
		{
			base.ViewDidLoad();

            var vm = (IssueComponentsViewModel)ViewModel;
            BindCollection(vm.Components, x => {
                var e = new ComponentElement(x);
                e.Clicked.Subscribe(_ => {
                    if (vm.SelectedValue != null && string.Equals(vm.SelectedValue, x.Name))
                        vm.SelectedValue = null;
					else
                        vm.SelectedValue = x.Name;
                });
                if (vm.SelectedValue != null && string.Equals(vm.SelectedValue, x.Name))
					e.Accessory = UITableViewCellAccessory.Checkmark;
				return e;
			});

            vm.Bind(x => x.SelectedValue).Subscribe(x =>
				{
					if (Root.Count == 0) return;
                    foreach (var m in Root[0].Elements.Cast<ComponentElement>())
                        m.Accessory = (x != null && string.Equals(m.Component.Name, x)) ? UITableViewCellAccessory.Checkmark : UITableViewCellAccessory.None;
				});

            OnActivation(d => d(vm.Bind(x => x.IsSaving).SubscribeStatus("Saving...")));
		}
Exemplo n.º 2
0
		public override void ViewDidLoad()
		{
			base.ViewDidLoad();

            var vm = (IssueComponentsViewModel)ViewModel;
            BindCollection(vm.Components, x => {
                var e = new ComponentElement(x);
				e.Tapped += () => {
                    if (vm.SelectedValue != null && string.Equals(vm.SelectedValue, x.Name))
                        vm.SelectedValue = null;
					else
                        vm.SelectedValue = x.Name;
				};
                if (vm.SelectedValue != null && string.Equals(vm.SelectedValue, x.Name))
					e.Accessory = UITableViewCellAccessory.Checkmark;
				return e;
			});

            vm.Bind(x => x.SelectedValue, x =>
				{
					if (Root.Count == 0)
						return;
                    foreach (var m in Root[0].Elements.Cast<ComponentElement>())
                        m.Accessory = (x != null && string.Equals(m.Component.Name, x)) ? UITableViewCellAccessory.Checkmark : UITableViewCellAccessory.None;
					Root.Reload(Root[0], UITableViewRowAnimation.None);
				});

			var _hud = new Hud(View);
			vm.Bind(x => x.IsSaving, x =>
			{
				if (x) _hud.Show("Saving...");
				else _hud.Hide();
			});
		}
        protected override TreeViewItem BuildRoot()
        {
            //Reset variables and create Root node.
            ids = 0;
            rows.Clear();
            var root = new TreeViewItem(-1, -1, "Root");

            if (entityManager.IsCreated)
            {
                var entities = entityManager.GetAllEntities().ToArray();
                foreach (var entity in entities)
                {
                    var entityItem = new EntityElement(ids++, entity);
                    rows.Add(entityItem);
                    foreach (var type in entityManager.GetComponentTypes(entity))
                    {
                        var ctype = new ComponentElement(type, ids++, 1);
                        rows.Add(ctype);
                        entityItem.AddChild(ctype);
                    }
                    root.AddChild(entityItem);
                }
            }
            root.AddChild(new TreeViewItem(1));
            SetupDepthsFromParentsAndChildren(root);
            return(root);
        }
Exemplo n.º 4
0
    public ComponentElement Test(PoolType pool)
    {
        ComponentElement element = grenadeEffectPool.Allocate();

        element.Initialize(() => grenadeEffectPool.Release(element));

        return(element);
    }
Exemplo n.º 5
0
        public void should_parse_string_element_as_3_component_elements()
        {
            var components = ComponentElement.TryParse("01:02:03", FormattingOptions.DefaultOptions);

            components.Should().HaveCount(3);
            components.ElementAt(0).Value.Should().Be("01");
            components.ElementAt(1).Value.Should().Be("02");
            components.ElementAt(2).Value.Should().Be("03");
        }
Exemplo n.º 6
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var vm = (IssueComponentsViewModel)ViewModel;

            BindCollection(vm.Components, x => {
                var e     = new ComponentElement(x);
                e.Tapped += () => {
                    if (vm.SelectedValue != null && string.Equals(vm.SelectedValue, x.Name))
                    {
                        vm.SelectedValue = null;
                    }
                    else
                    {
                        vm.SelectedValue = x.Name;
                    }
                };
                if (vm.SelectedValue != null && string.Equals(vm.SelectedValue, x.Name))
                {
                    e.Accessory = UITableViewCellAccessory.Checkmark;
                }
                return(e);
            });

            vm.Bind(x => x.SelectedValue, x =>
            {
                if (Root.Count == 0)
                {
                    return;
                }
                foreach (var m in Root[0].Elements.Cast <ComponentElement>())
                {
                    m.Accessory = (x != null && string.Equals(m.Component.Name, x)) ? UITableViewCellAccessory.Checkmark : UITableViewCellAccessory.None;
                }
                Root.Reload(Root[0], UITableViewRowAnimation.None);
            });

            var _hud = new Hud(View);

            vm.Bind(x => x.IsSaving, x =>
            {
                if (x)
                {
                    _hud.Show("Saving...");
                }
                else
                {
                    _hud.Hide();
                }
            });
        }
Exemplo n.º 7
0
        public static T CreateObject <T>(this ComponentElement com) where T : class
        {
            Type   type = Type.GetType(com.Type);
            object obj  = type.GetConstructor(Type.EmptyTypes).Invoke(Type.EmptyTypes);

            if (com.ComponentProperties != null)
            {
                if (obj is IConfigable)
                {
                    foreach (NameValueConfigurationElement p in com.ComponentProperties)
                    {
                        (obj as IConfigable).SetProperty(p.Name, p.Value);
                    }
                }
            }
            return(obj as T);
        }
Exemplo n.º 8
0
        private void CreateWixComponents(Wix model, List <string> filesTree)
        {
            try
            {
                model.Fragment.ComponentGroup = new ComponentGroupElement {
                    Id = $"{ Working.RemoveIllegalCharacters(InstallDirPath.Substring(InstallDirPath.LastIndexOf('\\') + 1)) }FileComponents"
                };
                model.Fragment.ComponentGroup.Components = new List <ComponentElement>();

                var format     = Working.GetToStringFormat(filesTree.Count);
                var components = model.Fragment.ComponentGroup.Components;
                foreach (var filePath in filesTree)
                {
                    var i                  = components.Count + 1;
                    var count              = i.ToString(format);
                    var fileName           = Path.GetFileName(filePath);
                    var componentDirectory = Working.GetSubDirPath(InstallDirPath, filePath);
                    componentDirectory = componentDirectory.Substring(0, componentDirectory.Length - fileName.Length - 1).Replace('\\', '_');
                    var component = new ComponentElement
                    {
                        Id        = Working.RemoveIllegalCharacters($"IDC_{ fileName }_{ count }"),
                        Directory = Working.RemoveIllegalCharacters($"IDD_{ componentDirectory }"),
                        Guid      = ShouldGenerateGuids ? Guid.NewGuid().ToString().ToUpper() : "*",
                        Win64     = ShouldPrepareX64Components ? "yes" : "no"
                    };

                    var file = new FileElement
                    {
                        Id      = Working.RemoveIllegalCharacters($"IDF_{ fileName }_{ count }"),
                        Name    = fileName,
                        DiskId  = "1",
                        Source  = $"$(var.SolutionDir){ Working.GetSubDirPath(InstallDirPath, filePath) }",
                        KeyPath = "yes"
                    };

                    component.File = file;
                    components.Add(component);
                }
            }
            catch (Exception ex)
            {
                var message = "Exception thrown in CreateWixComponents()\n";
                throw new Exception(message, ex);
            }
        }
Exemplo n.º 9
0
        private void AddTo(TreeViewItem item, ComponentType type)
        {
            var child = new ComponentElement(type, ids++, 1);

            if (Objects.TryGetValue(type, out var obj) && obj != null)
            {
                if (!type.IsZeroSized)
                {
                    foreach (var fieldInfo in obj.GetType().GetFields())
                    {
                        var field = new FieldElement(ids++, 2, fieldInfo, ref obj);

                        child.AddChild(field);
                    }
                }
            }
            item.AddChild(child);
        }
Exemplo n.º 10
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var vm = (IssueComponentsViewModel)ViewModel;

            BindCollection(vm.Components, x => {
                var e = new ComponentElement(x);
                e.Clicked.Subscribe(_ => {
                    if (vm.SelectedValue != null && string.Equals(vm.SelectedValue, x.Name))
                    {
                        vm.SelectedValue = null;
                    }
                    else
                    {
                        vm.SelectedValue = x.Name;
                    }
                });
                if (vm.SelectedValue != null && string.Equals(vm.SelectedValue, x.Name))
                {
                    e.Accessory = UITableViewCellAccessory.Checkmark;
                }
                return(e);
            });

            vm.Bind(x => x.SelectedValue).Subscribe(x =>
            {
                if (Root.Count == 0)
                {
                    return;
                }
                foreach (var m in Root[0].Elements.Cast <ComponentElement>())
                {
                    m.Accessory = (x != null && string.Equals(m.Component.Name, x)) ? UITableViewCellAccessory.Checkmark : UITableViewCellAccessory.None;
                }
            });

            OnActivation(d => d(vm.Bind(x => x.IsSaving).SubscribeStatus("Saving...")));
        }
Exemplo n.º 11
0
		private static void GenerateComponent(ComponentElement component, Page page)
		{
			if(component == null)
				return;

			if(component.Dependencies.Count > 0)
			{
				foreach(var dependency in component.Dependencies)
				{
					var target = dependency.GetDependenceObject();

					if(target != null)
						GenerateComponent(target, page);
				}
			}

			if(component.Files.Count > 0)
			{
				foreach(var file in component.Files)
				{
					GenerateFileLink(GetFileUrl(file.Name, component.Theme.Name), page);
				}
			}
		}
Exemplo n.º 12
0
        private static void InstallBindings(Dictionary <string, GameObject> byKeys, ComponentElement element, System.Type monoBehaviourType, Component component, IReadOnlyLayoutContext context)
        {
            foreach (var componentBinding in element.Bindings)
            {
                PropertyInfo property = null;
                var          field    = monoBehaviourType.GetField(componentBinding.Field,
                                                                   BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic);

                Action <object> setValue = v => field.SetValue(component, v);

                if (field == null)
                {
                    property = monoBehaviourType.GetProperty(componentBinding.Field,
                                                             BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic);

                    if (property == null)
                    {
                        Debug.LogError(
                            $"Component {monoBehaviourType.FullName} doesn't have field {componentBinding.Field}");
                        continue;
                    }

                    setValue = v => property.SetValue(component, v);
                }

                string fieldName = field?.Name ?? property.Name;
                Type   fieldType = field?.FieldType ?? property.PropertyType;

                if (componentBinding is BindingElement binding)
                {
                    if (!byKeys.TryGetValue(binding.Source, out var source))
                    {
                        Debug.LogError($"Trying to bind object of key {binding.Source} but not found");
                        continue;
                    }

                    if (field.FieldType.IsSubclassOf(typeof(Component)))
                    {
                        var sourceComponent = source.GetComponent((System.Type)field.FieldType);

                        if (sourceComponent == null)
                        {
                            Debug.LogError($"Component {field.FieldType} not found on {source}", source);
                        }
                        else
                        {
                            setValue(sourceComponent);
                        }
                    }
                    else if (field.FieldType == typeof(GameObject))
                    {
                        setValue(source);
                    }
                    else
                    {
                        Debug.LogError($"Cannot bind type {field.FieldType}");
                    }
                }
                else if (componentBinding is ComponentSetterElement setter)
                {
                    ReflectionUtils.ReflectionSetComponentField(context, fieldName, fieldType, setValue, component, setter.Value);
                }
            }
        }
Exemplo n.º 13
0
        // research: https://www.youtube.com/watch?v=6Yf-eDsRrnM

        public static void Main(string[] args)
        {
            // pre UI
            //"C:\Program Files (x86)\WiX Toolset v3.11\bin\candle" -ext "C:\Program Files (x86)\WiX Toolset v3.11\bin\WixNetFxExtension.dll" .\output\output.xml
            //"C:\Program Files (x86)\WiX Toolset v3.11\bin\light" -ext "C:\Program Files (x86)\WiX Toolset v3.11\bin\WixNetFxExtension.dll" output.wixobj


            // Post UI
            //"C:\Program Files (x86)\WiX Toolset v3.11\bin\candle" -ext "C:\Program Files (x86)\WiX Toolset v3.11\bin\WixNetFxExtension.dll" -ext "C:\Program Files (x86)\WiX Toolset v3.11\bin\WixUIExtension.dll" .\output\output.xml
            //"C:\Program Files (x86)\WiX Toolset v3.11\bin\light" -ext "C:\Program Files (x86)\WiX Toolset v3.11\bin\WixNetFxExtension.dll" -ext "C:\Program Files (x86)\WiX Toolset v3.11\bin\WixUIExtension.dll" -cultures:en-us output.wixobj



            string major_version   = "18.02.22";
            string minor_version   = "3db277d";
            string current_version = $"{major_version} v({minor_version})";


            if (args.Length > 0)
            {
                for (var i = 1; i < args.Length; i++)
                {
                    string arg   = args [i];
                    int    index = arg.IndexOf(':');
                    string val   = arg.Substring(index + 1, arg.Length - (index + 1)).Trim(new char [] { '\"' });

                    if (arg.ToLower().StartsWith("wix_directory_path"))
                    {
                        wix_directory_path = val;
                    }
                    else if (arg.ToLower().StartsWith("build_directory_path"))
                    {
                        build_directory_path = val;
                    }
                    else if (arg.ToLower().StartsWith("input_directory_path"))
                    {
                        input_directory_path = val;
                    }
                    else if (arg.ToLower().StartsWith("output_directory_path"))
                    {
                        output_directory_path = val;
                    }
                    else if (arg.ToLower().StartsWith("mmria_server_binary_directory_path"))
                    {
                        mmria_server_binary_directory_path = val;
                    }
                    else if (arg.ToLower().StartsWith("mmria_console_binary_directory_path"))
                    {
                        mmria_console_binary_directory_path = val;
                    }
                    else if (arg.ToLower().StartsWith("mmria_server_html_directory_path"))
                    {
                        mmria_server_html_directory_path = val;
                    }
                }
            }


            if (string.IsNullOrWhiteSpace(wix_directory_path))
            {
                wix_directory_path = System.Configuration.ConfigurationManager.AppSettings["wix_directory_path"];
            }
            if (string.IsNullOrWhiteSpace(build_directory_path))
            {
                build_directory_path = System.Configuration.ConfigurationManager.AppSettings ["build_directory_path"];
            }
            if (string.IsNullOrWhiteSpace(input_directory_path))
            {
                input_directory_path = System.Configuration.ConfigurationManager.AppSettings["input_directory_path"];
            }
            if (string.IsNullOrWhiteSpace(output_directory_path))
            {
                output_directory_path = System.Configuration.ConfigurationManager.AppSettings["output_directory_path"];
            }
            if (string.IsNullOrWhiteSpace(mmria_server_binary_directory_path))
            {
                mmria_server_binary_directory_path = System.Configuration.ConfigurationManager.AppSettings ["mmria_server_binary_directory_path"];
            }
            if (string.IsNullOrWhiteSpace(mmria_console_binary_directory_path))
            {
                mmria_console_binary_directory_path = System.Configuration.ConfigurationManager.AppSettings ["mmria_console_binary_directory_path"];
            }
            if (string.IsNullOrWhiteSpace(mmria_server_html_directory_path))
            {
                mmria_server_html_directory_path = System.Configuration.ConfigurationManager.AppSettings ["mmria_server_html_directory_path"];
            }

            if (System.IO.Directory.Exists(input_directory_path))
            {
                System.IO.Directory.Delete(input_directory_path, true);
            }

            if (System.IO.Directory.Exists(output_directory_path))
            {
                System.IO.Directory.Delete(output_directory_path, true);
            }


            if (System.IO.File.Exists(build_directory_path + @"\output.wixobj"))
            {
                System.IO.File.Delete(build_directory_path + @"\output.wixobj");
            }

            if (System.IO.File.Exists(build_directory_path + @"\output.wixpdb"))
            {
                System.IO.File.Delete(build_directory_path + @"\output.wixpdb");
            }

            if (System.IO.File.Exists(build_directory_path + @"\output.msi"))
            {
                System.IO.File.Delete(build_directory_path + @"\output.msi");
            }

            CopyFolder.CopyDirectory(mmria_server_binary_directory_path, input_directory_path);
            CopyFolder.CopyDirectory(mmria_server_html_directory_path, input_directory_path + "/app");

            CopyFolder.CopyDirectory(mmria_console_binary_directory_path + "/mapping-file-set", input_directory_path + "/mapping-file-set");

            File.Copy(mmria_console_binary_directory_path + "/mmria.exe", input_directory_path + "/mmria.exe");
            File.Copy(mmria_console_binary_directory_path + "/mmria.pdb", input_directory_path + "/mmria.pdb");
            File.Copy(mmria_console_binary_directory_path + "/LumenWorks.Framework.IO.dll", input_directory_path + "/LumenWorks.Framework.IO.dll");

            File.Copy("./mmria.exe.config", input_directory_path + "/mmria.exe.config", true);
            File.Copy("./mmria-server.exe.config", input_directory_path + "/mmria-server.exe.config", true);


            // version number -- Start
            System.Text.RegularExpressions.Regex version_tag = new System.Text.RegularExpressions.Regex("<\\%=version\\%>");

            string profile_text = System.IO.File.ReadAllText(input_directory_path + "/app/scripts/profile.js");

            System.IO.File.WriteAllText(input_directory_path + "/app/scripts/profile.js", version_tag.Replace(profile_text, current_version));

            string index_text = System.IO.File.ReadAllText(input_directory_path + "/app/index.html");

            System.IO.File.WriteAllText(input_directory_path + "/app/index.html", version_tag.Replace(index_text, current_version));
            // version number -- End

            // remove unneeded files -- start
            if (System.IO.Directory.Exists(input_directory_path + "/app/metadata"))
            {
                System.IO.Directory.Delete(input_directory_path + "/app/metadata", true);
            }

            if (File.Exists(input_directory_path + "/app/grid-test-1.html"))
            {
                File.Delete(input_directory_path + "/app/grid-test-1.html");
            }

            if (File.Exists(input_directory_path + "/app/grid-test-2.html"))
            {
                File.Delete(input_directory_path + "/app/grid-test-2.html");
            }

            if (File.Exists(input_directory_path + "/app/grid-test-3.html"))
            {
                File.Delete(input_directory_path + "/app/grid-test-3.html");
            }

            if (File.Exists(input_directory_path + "/app/socket-test.html"))
            {
                File.Delete(input_directory_path + "/app/socket-test.html");
            }

            if (File.Exists(input_directory_path + "/app/socket-test2.html"))
            {
                File.Delete(input_directory_path + "/app/socket-test2.html");
            }
            // remove uneeded files -- end


            // version number....

            /*
             *
             *
             *
             * cp "${source_code_directory}/owin/psk/app/scripts/profile.js" "$wix_root_directory/profile.js.bk" && \
             * cp "${source_code_directory}/owin/psk/app/index.html" "$wix_root_directory/index.html.bk" && \
             * sed -e 's/<\%=version\%>/'$current_year'.'$current_month'.'$current_day' v('$current_build')/g' "${wix_root_directory}/profile.js.bk"  > "${wix_root_directory}/profile.js" && \
             * sed -e 's/<\%=version\%>/'$current_year'.'$current_month'.'$current_day' v('$current_build')/g' "${wix_root_directory}/index.html.bk"  > "${wix_root_directory}/index.html" && \
             * rm -f "$wix_input_directory/app/scripts/profile.js" && cp "$wix_root_directory/profile.js" "$wix_input_directory/app/scripts/profile.js" && \
             * rm -f "$wix_input_directory/app/index.html" && cp "$wix_root_directory/index.html" "$wix_input_directory/app/index.html"
             *
             *
             *
             *
             *
             * File.Copy(mmria_console_binary_directory_path + "/", input_directory_path + "/");
             * File.Copy(mmria_console_binary_directory_path + "/", input_directory_path + "/");
             * File.Copy(mmria_console_binary_directory_path + "/", input_directory_path + "/");
             * File.Copy(mmria_console_binary_directory_path + "/", input_directory_path + "/");
             * File.Copy(mmria_console_binary_directory_path + "/", input_directory_path + "/");
             *
             *
             *
             *
             * File.Copy(mmria_console_binary_directory_path + "/", input_directory_path + "/");
             * File.Copy(mmria_console_binary_directory_path + "/", input_directory_path + "/");
             */

            CopyFolder.CopyDirectory(input_directory_path, output_directory_path);

            //Console.WriteLine("Hello World!");
            string name_hash_file_name      = "id.csv";
            string wix_output_msi_file_name = $"MMRIA-Install-{current_version}.msi";
            string wix_file_name            = "output.xml";


            name_hash_list = new System.Collections.Generic.Dictionary <string, string>(StringComparer.OrdinalIgnoreCase);


            if (System.IO.File.Exists(name_hash_file_name))
            {
                using (System.IO.TextReader reader = System.IO.File.OpenText(name_hash_file_name))
                {
                    string   file      = reader.ReadToEnd();
                    string[] line_list = file.Split('\n');
                    for (int i = 0; i < line_list.Length; i++)
                    {
                        string[] name_hash = line_list[i].Split(',');
                        if (name_hash.Length > 1)
                        {
                            name_hash_list.Add(name_hash[0].Trim(), name_hash[1].Trim());
                        }
                    }
                }
            }

            string xml = get_xml_template();


            var       xmlReader        = XmlReader.Create(new StringReader(xml));
            XDocument wix_doc          = XDocument.Load(xmlReader);
            var       namespaceManager = new XmlNamespaceManager(xmlReader.NameTable);

            namespaceManager.AddNamespace("prefix", "http://schemas.microsoft.com/wix/2006/wi");


            XElement ProductElement = wix_doc.XPathSelectElement("prefix:Wix/prefix:Product", namespaceManager);

            ProductElement.Attribute("Id").SetValue(get_id("PRODUCT_ID"));
            ProductElement.Attribute("UpgradeCode").SetValue(get_id("PRODUCT_UPGRADECODE"));

            Console.WriteLine("Product");
            Console.WriteLine(ProductElement.Attribute("Name"));
            Console.WriteLine(ProductElement.Attribute("Id"));
            Console.WriteLine(ProductElement.Attribute("UpgradeCode"));
            Console.WriteLine(ProductElement.Attribute("Manufacturer"));
            Console.WriteLine(ProductElement.Attribute("Version"));



            XElement PackageElement = ProductElement.XPathSelectElement("./prefix:Package", namespaceManager);

            Console.WriteLine("Package");
            Console.WriteLine(PackageElement.Attribute("Description"));
            Console.WriteLine(PackageElement.Attribute("Comments"));
            Console.WriteLine(PackageElement.Attribute("Manufacturer"));
            //Console.WriteLine(PackageElement.Attribute("Manufacturer"));
            //Console.WriteLine(PackageElement.Attribute("Version"));

            XElement MediaElement = ProductElement.XPathSelectElement("./prefix:Media", namespaceManager);

            Console.WriteLine("Media");
            Console.WriteLine(MediaElement.Attribute("Cabinet"));


            XElement PropertyElement = ProductElement.XPathSelectElement("./prefix:Property", namespaceManager);

            Console.WriteLine("Property");
            Console.WriteLine(PropertyElement.Attribute("Id"));
            Console.WriteLine(PropertyElement.Attribute("Value"));

            XElement IconElement = ProductElement.XPathSelectElement("./prefix:Icon", namespaceManager);

            Console.WriteLine("Icon");
            print_xattribute(IconElement.Attribute("Id"), IconElement.Attribute("SourceFile"));


            XElement DirectoryElement = ProductElement.XPathSelectElement(".//prefix:Directory[@Id='INSTALLDIR']", namespaceManager);

            Console.WriteLine("Directory");
            print_xattribute(DirectoryElement.Attribute("Id"), DirectoryElement.Attribute("Name"));



            XElement FeatureElement = ProductElement.XPathSelectElement("./prefix:Feature", namespaceManager);

            Console.WriteLine("Feature");
            print_xattribute(FeatureElement.Attribute("Id"), FeatureElement.Attribute("Level"));

            // removed components and features
            foreach (XElement ComponentElement in ProductElement.XPathSelectElements(".//prefix:Component", namespaceManager).ToList())
            {
                if (ComponentElement.Attribute("Id").Value != "ProgramMenuDir")
                {
                    ComponentElement.Remove();
                }
            }

            foreach (XElement ComponentRefElement in FeatureElement.XPathSelectElements(".//prefix:ComponentRef", namespaceManager).ToList())
            {
                if (ComponentRefElement.Attribute("Id").Value != "ProgramMenuDir")
                {
                    ComponentRefElement.Remove();
                }
            }

            AddComponents(DirectoryElement, FeatureElement, new System.IO.DirectoryInfo(output_directory_path));

            Console.WriteLine("Components");
            foreach (XElement ComponentElement in ProductElement.XPathSelectElements(".//prefix:Component", namespaceManager))
            {
                ComponentElement.Attribute("Guid").SetValue(get_id(ComponentElement.Attribute("Id").Value));

                print_xattribute(ComponentElement.Attribute("Id"), ComponentElement.Attribute("Guid"));
                XElement FileElement = ComponentElement.XPathSelectElement("./prefix:File", namespaceManager);
                if (FileElement != null)
                {
                    print_xattribute(FileElement.Attribute("Id"), FileElement.Attribute("Name"));
                }

                /*
                 * XElement new_node = new_file_node();
                 * new_node.Add(new_short_cut_node());
                 * ComponentElement.Add(new_node);
                 */
            }
            Console.WriteLine("ComponentRefs");
            foreach (XElement ComponentRefElement in ProductElement.XPathSelectElements(".//prefix:ComponentRef", namespaceManager))
            {
                print_xattribute(ComponentRefElement.Attribute("Id"));
            }


            wix_doc.Save(wix_file_name);

            System.Text.RegularExpressions.Regex major_version_tag = new System.Text.RegularExpressions.Regex("<\\%=major_version\\%>");
            System.Text.RegularExpressions.Regex minor_version_tag = new System.Text.RegularExpressions.Regex("<\\%=minor_version\\%>");

            string text = File.ReadAllText(wix_file_name);

            text = System.Text.RegularExpressions.Regex.Replace(text, "xmlns=\"\"", "");
            text = major_version_tag.Replace(text, major_version);
            text = minor_version_tag.Replace(text, minor_version);

            File.WriteAllText(Path.Combine(output_directory_path, wix_file_name), text);

            System.Text.StringBuilder name_hash_file_builder = new StringBuilder();
            foreach (System.Collections.Generic.KeyValuePair <string, string> kvp in name_hash_list)
            {
                name_hash_file_builder.Append(kvp.Key);
                name_hash_file_builder.Append(",");
                name_hash_file_builder.AppendLine(kvp.Value);
            }



            System.IO.File.WriteAllText(name_hash_file_name, name_hash_file_builder.ToString());

            //var FieldsTypeIDs = from _FieldTypeID in wix_doc.Descendants("Field") select _FieldTypeID;

            //double width, height;



            //string checkcode = ViewElement.Attribute("CheckCode").Value.ToString();

            /*
             *
             * StringBuilder JavaScript = new StringBuilder();
             * StringBuilder VariableDefinitions = new StringBuilder();
             *
             * XDocument xdocResponse = XDocument.Parse("");
             *
             * XDocMetadata.RequiredFieldsList = xdocResponse.Root.Attribute("RequiredFieldsList").Value;
             * XDocMetadata.HiddenFieldsList = xdocResponse.Root.Attribute("HiddenFieldsList").Value;
             * XDocMetadata.HighlightedFieldsList = xdocResponse.Root.Attribute("HighlightedFieldsList").Value;
             * XDocMetadata.DisabledFieldsList = xdocResponse.Root.Attribute("DisabledFieldsList").Value;
             *
             */

            //System.IO.File.Copy ("./mmria.exe.config", System.IO.Path.Combine (output_directory_path, "mmria.exe.config"), true);
            //System.IO.File.Copy ("./mmria-server.exe.config", System.IO.Path.Combine (output_directory_path, "mmria-server.exe.config"), true);


            //"C:\Program Files (x86)\WiX Toolset v3.11\bin\candle" -ext "C:\Program Files (x86)\WiX Toolset v3.11\bin\WixNetFxExtension.dll" .\output\output.xml

            //"C:\Program Files (x86)\WiX Toolset v3.11\bin\light" -ext "C:\Program Files (x86)\WiX Toolset v3.11\bin\WixNetFxExtension.dll" output.wixobj

            execute_shell(build_directory_path, wix_directory_path + @"\bin\candle", @" -ext ""C:\Program Files (x86)\WiX Toolset v3.11\bin\WixNetFxExtension.dll""  -ext ""C:\Program Files (x86)\WiX Toolset v3.11\bin\WixUIExtension.dll"" .\output\output.xml");
            execute_shell(build_directory_path, wix_directory_path + @"\bin\light", @"  -ext ""C:\Program Files (x86)\WiX Toolset v3.11\bin\WixNetFxExtension.dll""  -ext ""C:\Program Files (x86)\WiX Toolset v3.11\bin\WixUIExtension.dll"" -cultures:en-us .\output.wixobj");

            System.IO.File.Copy(build_directory_path + "/output.msi", build_directory_path + "/" + wix_output_msi_file_name, true);
            System.IO.File.Delete(build_directory_path + "/output.msi");


            install.setup.util.cFolderCompressor folder_compressor = new install.setup.util.cFolderCompressor();

            folder_compressor.Compress
            (
                System.IO.Path.Combine(System.IO.Path.Combine(build_directory_path, wix_output_msi_file_name.Replace(".msi", ".zip"))),
                null,                // string password
                System.IO.Path.Combine(System.IO.Path.Combine(build_directory_path, "output"))
            );
        }
Exemplo n.º 14
0
		private void ResolveDependencyElement(XmlReader reader, ComponentElement component)
		{
			int depth = reader.Depth;

			while(reader.Read())
			{
				if(depth == reader.Depth)
					return;

				if(reader.NodeType == XmlNodeType.Element)
				{
					if(reader.Name == "dependency")
						component.Dependencies.Add(new DependencyElement(reader.GetAttribute("name")));
					else
						throw new ThemeException("Invalid '" + reader.Name + "' of element in this '" + component.Name + "' component.");
				}
			}
		}
Exemplo n.º 15
0
		private void ResolveComponentElement(XmlReader reader, Theme theme)
		{
			reader = reader.ReadSubtree();

			if(reader != null && reader.ReadState == ReadState.Initial)
				reader.Read();

			int depth = reader.Depth;
			ComponentElement component = new ComponentElement(reader.GetAttribute("name"));

			while(reader.Read())
			{
				if(reader.NodeType == XmlNodeType.Element)
				{
					switch(reader.Name)
					{
						case "file":
							component.Files.Add(new FileElement(reader.GetAttribute("name").Replace('\\', '/').TrimStart('/')));
							break;
						case "dependencies":
							this.ResolveDependencyElement(reader, component);
							break;
						default:
							throw new ThemeException("Invalid '" + reader.Name + "' of element in this '" + theme.Name + "' theme.");
					}
				}
			}

			theme.Components.Add(component);
		}