/// -----------------------------------------------------------------------------
        /// <summary>
        /// The GetWriter method instantiates the relevant PackageWriter Installer.
        /// </summary>
        /// <param name="package">The associated PackageInfo instance.</param>
        /// <returns></returns>
        /// -----------------------------------------------------------------------------
        public static PackageWriterBase GetWriter(PackageInfo package)
        {
            PackageWriterBase writer = null;

            switch (package.PackageType)
            {
            case "Auth_System":
                writer = new AuthenticationPackageWriter(package);
                break;

            case "Module":
                writer = new ModulePackageWriter(package);
                break;

            case "Container":
                writer = new ContainerPackageWriter(package);
                break;

            case "Skin":
                writer = new SkinPackageWriter(package);
                break;

            case "CoreLanguagePack":
            case "ExtensionLanguagePack":
                writer = new LanguagePackWriter(package);
                break;

            case "SkinObject":
                writer = new SkinControlPackageWriter(package);
                break;

            case "Provider":
                writer = new ProviderPackageWriter(package);
                break;

            case "Library":
                writer = new LibraryPackageWriter(package);
                break;

            case "Widget":
                writer = new WidgetPackageWriter(package);
                break;

            default:
                // PackageType is defined in the List
                var           listController = new ListController();
                ListEntryInfo entry          = listController.GetListEntryInfo("PackageWriter", package.PackageType);

                if (entry != null && !string.IsNullOrEmpty(entry.Text))
                {
                    // The class for the Installer is specified in the Text property
                    writer = (PackageWriterBase)Reflection.CreateObject(entry.Text, "PackageWriter_" + entry.Value);
                }

                break;
            }

            return(writer);
        }
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// The GetWriter method instantiates the relevant PackageWriter Installer
        /// </summary>
        /// <param name="package">The associated PackageInfo instance</param>
        /// <history>
        /// 	[cnurse]	01/31/2008  created
        /// </history>
        /// -----------------------------------------------------------------------------
        public static PackageWriterBase GetWriter(PackageInfo package)
        {
            PackageWriterBase writer = null;
            switch (package.PackageType)
            {
                case "Auth_System":
                    writer = new AuthenticationPackageWriter(package);
                    break;
                case "Module":
                    writer = new ModulePackageWriter(package);
                    break;
                case "Container":
                    writer = new ContainerPackageWriter(package);
                    break;
                case "Skin":
                    writer = new SkinPackageWriter(package);
                    break;
                case "CoreLanguagePack":
                case "ExtensionLanguagePack":
                    writer = new LanguagePackWriter(package);
                    break;
                case "SkinObject":
                    writer = new SkinControlPackageWriter(package);
                    break;
                case "Provider":
                    writer = new ProviderPackageWriter(package);
                    break;
                case "Library":
                    writer = new LibraryPackageWriter(package);
                    break;
                case "Widget":
                    writer = new WidgetPackageWriter(package);
                    break;
                default:
                    //PackageType is defined in the List
                    var listController = new ListController();
                    ListEntryInfo entry = listController.GetListEntryInfo("PackageWriter", package.PackageType);

                    if (entry != null && !string.IsNullOrEmpty(entry.Text))
                    {
						//The class for the Installer is specified in the Text property
                        writer = (PackageWriterBase) Reflection.CreateObject(entry.Text, "PackageWriter_" + entry.Value);
                    }
                    break;
            }
            return writer;
        }
        private static void CreateSkinManifest(XmlWriter writer, string skinFolder, string skinType, string tempInstallFolder, string subFolder)
        {
            string skinName = Path.GetFileNameWithoutExtension(skinFolder);
            var skin = new SkinPackageInfo();
            skin.SkinName = skinName;
            skin.SkinType = skinType;

            //Create a Package
            PackageInfo package = CreateSkinPackage(skin);

            //Create a SkinPackageWriter
            var skinWriter = new SkinPackageWriter(skin, package, tempInstallFolder, subFolder);
            skinWriter.GetFiles(false);

            //We need to reset the BasePath so it using the correct basePath rather than the Temp InstallFolder
            skinWriter.SetBasePath();

            //Writer package manifest fragment to writer
            skinWriter.WriteManifest(writer, true);
        }
        private static void ProcessLegacySkin(string skinFolder, string skinType)
        {
            string skinName = Path.GetFileName(skinFolder);
            if (skinName != "_default")
            {
                var skin = new SkinPackageInfo();
                skin.SkinName = skinName;
                skin.SkinType = skinType;

                //Create a Package
                PackageInfo package = CreateSkinPackage(skin);

                //Create a SkinPackageWriter
                var skinWriter = new SkinPackageWriter(skin, package);
                skinWriter.GetFiles(false);

                //Save the manifest
                package.Manifest = skinWriter.WriteManifest(true);

                //Save Package
                PackageController.Instance.SaveExtensionPackage(package);

                //Update Skin Package with new PackageID
                skin.PackageID = package.PackageID;

                //Save Skin Package
                skin.SkinPackageID = SkinController.AddSkinPackage(skin);

                foreach (InstallFile skinFile in skinWriter.Files.Values)
                {
                    if (skinFile.Type == InstallFileType.Ascx)
                    {
                        if (skinType == "Skin")
                        {
                            SkinController.AddSkin(skin.SkinPackageID, Path.Combine("[G]" + SkinController.RootSkin, Path.Combine(skin.SkinName, skinFile.FullName)));
                        }
                        else
                        {
                            SkinController.AddSkin(skin.SkinPackageID, Path.Combine("[G]" + SkinController.RootContainer, Path.Combine(skin.SkinName, skinFile.FullName)));
                        }
                    }
                }
            }
        }