private InstallDestination CreateDestination(XmlNode sdest)
        {
            string asm = defaultAssembly;

            if ((sdest as XmlElement).HasAttribute(assemblyAttribute))
            {
                asm = sdest.Attributes[assemblyAttribute].Value;
            }

            string nsp = defaultDestinationNamespace;

            if ((sdest as XmlElement).HasAttribute(namespaceAttribute))
            {
                asm = sdest.Attributes[namespaceAttribute].Value;
            }

            string fullName = String.Format("{0}.{1}, {2}", nsp, sdest.Name, asm);
            Type   t        = Type.GetType(fullName);

            if (t != null)
            {
                InstallDestination inspected = t.GetConstructor(Type.EmptyTypes).Invoke(null) as InstallDestination;

                IComponentConfiguration config = new StandardConfiguration();
                foreach (XmlAttribute attribute in sdest.Attributes)
                {
                    config.Values[attribute.Name] = new Simple(attribute.Value);
                }

                return(ConfiguredComponent.ReconfigureInstance(inspected, inspected.GetType(), componentEnvironment, config));
            }

            throw new Exception(String.Format("The Install Destination {0} is not supported.", sdest.Name));
        }
示例#2
0
        private void DoInstall(InstallSource source, InstallDestination installDestination)
        {
            source.InstallEnvironment             = environment;
            installDestination.InstallEnvironment = environment;

            ApplicationDesc app = source.OpenForReading <ApplicationDesc>().Object;

            using (TypedStream <ApplicationDesc> appstream = installDestination.OpenForWriting <ApplicationDesc>())
            {
                appstream.Object = app;
            }

            /* register default bindings */
            foreach (string type in app.DefaultBindings.Keys)
            {
                documentManagement.RegisterDocumentUsage(
                    type, installDestination.ToString(), app.DefaultBindings[type]);
            }
        }
示例#3
0
        void DoCopy(InstallSource source, InstallDestination destination)
        {
            source.InstallEnvironment      = environment;
            destination.InstallEnvironment = environment;

            /* -- no, we don't do that anymore
             * if (destination.Exists)
             * {
             *  destination.Delete();
             * }
             */

            foreach (Type t in source.Types)
            {
                // Console.Out.WriteLine("{0}[{1}] -> {1}", source, t.Name, destination);
                TypedStream <object> dstStream = destination.OpenForWriting(t);
                using (TypedStream <object> srcStream = source.OpenForReading(t))
                {
                    dstStream.Array = srcStream.Array;
                    dstStream.Dispose();
                }
            }
        }