Example #1
0
        protected virtual DesktopModuleInfo GetDesktopModule(PaFolder Folder)
        {
            DesktopModuleController objDesktopModules = new DesktopModuleController();
            DesktopModuleInfo       objDesktopModule  = objDesktopModules.GetDesktopModuleByFriendlyName(Folder.FriendlyName);

            return(objDesktopModule);
        }
Example #2
0
        protected override DesktopModuleInfo GetDesktopModule(PaFolder Folder)
        {
            DesktopModuleController objDesktopModules = new DesktopModuleController();
            DesktopModuleInfo       objDesktopModule  = objDesktopModules.GetDesktopModuleByModuleName(Folder.ModuleName);

            return(objDesktopModule);
        }
        protected override void RegisterModules(PaFolder Folder, ArrayList Modules, ArrayList Controls)
        {
            InstallerInfo.Log.AddInfo(REGISTER_Controls);

            ModuleControlController objModuleControls = new ModuleControlController();

            ModuleControlInfo objModuleControl;
            foreach (ModuleControlInfo tempLoopVar_objModuleControl in Controls)
            {
                objModuleControl = tempLoopVar_objModuleControl;
                // Skins Objects have a null ModuleDefID
                objModuleControl.ModuleDefID = Null.NullInteger;

                // check if control exists
                ModuleControlInfo objModuleControl2 = objModuleControls.GetModuleControlByKeyAndSrc(Null.NullInteger, objModuleControl.ControlKey, objModuleControl.ControlSrc);
                if (objModuleControl2 == null)
                {
                    // add new control
                    objModuleControls.AddModuleControl(objModuleControl);
                }
                else
                {
                    // update existing control
                    objModuleControl.ModuleControlID = objModuleControl2.ModuleControlID;
                    objModuleControls.UpdateModuleControl(objModuleControl);
                }
            }

            InstallerInfo.Log.EndJob(REGISTER_End);
        }
Example #4
0
 /// <Summary>
 /// Creates a one-dimensional Array instance containing the collection items.
 /// </Summary>
 /// <Returns>Array of type PaFolder</Returns>
 public PaFolder[] ToArray()
 {
     PaFolder[] paFolders = new PaFolder[((this.Count - 1) + 1)];
     paFolders = ((PaFolder[])Utils.CopyArray(paFolders, new PaFolder[((this.Count - 1) + 1)]));
     this.CopyTo(paFolders, 0);
     return(paFolders);
 }
Example #5
0
        protected override void RegisterModules(PaFolder Folder, ArrayList Modules, ArrayList Controls)
        {
            InstallerInfo.Log.AddInfo(REGISTER_Controls);

            ModuleControlController objModuleControls = new ModuleControlController();

            ModuleControlInfo objModuleControl;

            foreach (ModuleControlInfo tempLoopVar_objModuleControl in Controls)
            {
                objModuleControl = tempLoopVar_objModuleControl;
                // Skins Objects have a null ModuleDefID
                objModuleControl.ModuleDefID = Null.NullInteger;

                // check if control exists
                ModuleControlInfo objModuleControl2 = objModuleControls.GetModuleControlByKeyAndSrc(Null.NullInteger, objModuleControl.ControlKey, objModuleControl.ControlSrc);
                if (objModuleControl2 == null)
                {
                    // add new control
                    objModuleControls.AddModuleControl(objModuleControl);
                }
                else
                {
                    // update existing control
                    objModuleControl.ModuleControlID = objModuleControl2.ModuleControlID;
                    objModuleControls.UpdateModuleControl(objModuleControl);
                }
            }

            InstallerInfo.Log.EndJob(REGISTER_End);
        }
Example #6
0
        protected virtual void CreateModuleFile(PaFile File, PaFolder Folder)
        {
            // account for skinobject names which include [ ]
            string FolderName = Folder.FolderName.Trim('[').Trim(']');

            string rootFolder = "";

            // check for the [app_code] token ( dynamic modules )
            if (File.Path.ToLower().StartsWith("[app_code]"))
            {
                rootFolder = Path.Combine(InstallerInfo.SitePath, Path.Combine("App_Code", FolderName));
                // remove the [app_code] token
                if (File.Path.ToLower() == "[app_code]")
                {
                    File.Path = "";
                }
                else // there is extra path info to retain
                {
                    File.Path = File.Path.Substring(10);
                }
                Config.AddCodeSubDirectory(FolderName);
            }
            else
            {
                rootFolder = Path.Combine(InstallerInfo.SitePath, Path.Combine("DesktopModules", FolderName));
            }

            // create the root folder
            if (!Directory.Exists(rootFolder))
            {
                Directory.CreateDirectory(rootFolder);
            }

            //if this is a Resource file, then we need to expand the resourcefile
            if (Folder.ResourceFile != null && File.Name.ToLower().Equals(Folder.ResourceFile.ToLower()))
            {
                CreateResourceFile(File, rootFolder);
            }
            else
            {
                // create the actual file folder which includes any relative filepath info
                string fileFolder = Path.Combine(rootFolder, File.Path);
                if (!Directory.Exists(fileFolder))
                {
                    Directory.CreateDirectory(fileFolder);
                }

                // save file
                string FullFileName = Path.Combine(fileFolder, File.Name);
                if (File.Type == PaFileType.Dnn)
                {
                    FullFileName += ".config"; // add a forbidden extension so that it is not browsable
                }
                CreateFile(FullFileName, File.Buffer);
                InstallerInfo.Log.AddInfo(FILE_Created + FullFileName);
            }
        }
Example #7
0
        /// <summary>
        /// Creates the files.
        /// </summary>
        /// <param name="Folder">The folder.</param>
        protected virtual void CreateFiles(PaFolder Folder)
        {
            InstallerInfo.Log.StartJob(FILES_Creating);

            // create the files
            foreach (PaFile file in Folder.Files)
            {
                switch (file.Type)
                {
                case PaFileType.DataProvider:

                    // We need to store uninstall files in the main module directory because
                    // that is where the uninstaller expects to find them
                    if (file.Name.ToLower().IndexOf("uninstall") != -1)
                    {
                        CreateModuleFile(file, Folder);
                    }
                    else
                    {
                        CreateDataProviderFile(file, Folder);
                    }
                    break;

                case PaFileType.Dll:

                    if (Folder.SupportsProbingPrivatePath)
                    {
                        CreatePrivateBinFile(file);
                    }
                    else
                    {
                        CreateBinFile(file);
                    }
                    break;

                case PaFileType.Dnn:
                    CreateModuleFile(file, Folder);
                    break;

                case PaFileType.Ascx:
                    CreateModuleFile(file, Folder);
                    break;

                case PaFileType.Sql:
                    CreateModuleFile(file, Folder);
                    break;

                case PaFileType.Other:

                    CreateModuleFile(file, Folder);
                    break;
                }
            }

            InstallerInfo.Log.EndJob(FILES_Created);
        }
Example #8
0
        protected bool ValidateVersion(PaFolder Folder)
        {
            // check if desktop module exists
            DesktopModuleInfo objDesktopModule = GetDesktopModule(Folder);

            if (objDesktopModule != null)
            {
                if (String.Compare(objDesktopModule.Version, Folder.Version, false) > 0)
                {
                    return(false);
                }
            }
            return(true);
        }
Example #9
0
        protected virtual void CreateDataProviderFile(PaFile file, PaFolder Folder)
        {
            string rootFolder         = Path.Combine(InstallerInfo.SitePath, Path.Combine("DesktopModules", Folder.FolderName));
            string ProviderTypeFolder = Path.Combine("Providers\\DataProviders", file.Extension);
            string ProviderFolder     = Path.Combine(rootFolder, ProviderTypeFolder);

            if (!Directory.Exists(ProviderFolder))
            {
                Directory.CreateDirectory(ProviderFolder);
            }

            // save file
            string FullFileName = Path.Combine(ProviderFolder, file.Name);

            CreateFile(FullFileName, file.Buffer);
            InstallerInfo.Log.AddInfo(FILE_Created + FullFileName);
        }
Example #10
0
        protected override void CreateFiles(PaFolder Folder)
        {
            InstallerInfo.Log.StartJob(FILES_Creating);
            // define bin folder location
            string binFolder = Path.Combine(InstallerInfo.SitePath, "bin");

            // create the root folder
            string rootFolder = Path.Combine(InstallerInfo.SitePath, Path.Combine("Providers", Path.Combine(Folder.ProviderType, Folder.Name)));

            if (!Directory.Exists(rootFolder))
            {
                Directory.CreateDirectory(rootFolder);
            }

            // create the files
            PaFile file;

            foreach (PaFile tempLoopVar_file in Folder.Files)
            {
                file = tempLoopVar_file;
                if (file.Type == PaFileType.DataProvider || file.Type == PaFileType.Other || file.Type == PaFileType.Sql)
                {
                    // create the directory for this file
                    string fileFolder = Path.Combine(rootFolder, file.Path);
                    if (!Directory.Exists(fileFolder))
                    {
                        Directory.CreateDirectory(fileFolder);
                    }

                    // save file
                    string FullFileName = Path.Combine(fileFolder, file.Name);
                    CreateFile(FullFileName, file.Buffer);
                    InstallerInfo.Log.AddInfo(FILE_Created + FullFileName);
                }
                else if (file.Type == PaFileType.Dll)
                {
                    // all dlls go to the bin folder
                    string binFullFileName = Path.Combine(binFolder, file.Name);
                    CreateFile(binFullFileName, file.Buffer);
                    InstallerInfo.Log.AddInfo(FILE_Created + binFullFileName);
                }
            }
            InstallerInfo.Log.EndJob(FILES_Created);
        }
        protected override void CreateFiles( PaFolder Folder )
        {
            InstallerInfo.Log.StartJob( FILES_Creating );
            // define bin folder location
            string binFolder = Path.Combine( InstallerInfo.SitePath, "bin" );

            // create the root folder
            string rootFolder = Path.Combine( InstallerInfo.SitePath, Path.Combine( "Providers", Path.Combine( Folder.ProviderType, Folder.Name ) ) );
            if( !Directory.Exists( rootFolder ) )
            {
                Directory.CreateDirectory( rootFolder );
            }

            // create the files
            PaFile file;
            foreach( PaFile tempLoopVar_file in Folder.Files )
            {
                file = tempLoopVar_file;
                if( file.Type == PaFileType.DataProvider || file.Type == PaFileType.Other || file.Type == PaFileType.Sql )
                {
                    // create the directory for this file
                    string fileFolder = Path.Combine( rootFolder, file.Path );
                    if( !Directory.Exists( fileFolder ) )
                    {
                        Directory.CreateDirectory( fileFolder );
                    }

                    // save file
                    string FullFileName = Path.Combine( fileFolder, file.Name );
                    CreateFile( FullFileName, file.Buffer );
                    InstallerInfo.Log.AddInfo( FILE_Created + FullFileName );
                }
                else if( file.Type == PaFileType.Dll )
                {
                    // all dlls go to the bin folder
                    string binFullFileName = Path.Combine( binFolder, file.Name );
                    CreateFile( binFullFileName, file.Buffer );
                    InstallerInfo.Log.AddInfo( FILE_Created + binFullFileName );
                }
            }
            InstallerInfo.Log.EndJob( FILES_Created );
        }
Example #12
0
        protected bool ValidateCompatibility(PaFolder Folder)
        {
            // check core framework compatibility
            if (!String.IsNullOrEmpty(Folder.CompatibleVersions))
            {
                try
                {
                    Match objMatch = Regex.Match(Globals.glbAppVersion, Folder.CompatibleVersions, RegexOptions.IgnoreCase | RegexOptions.Singleline);
                    if (objMatch.Groups[1].Value == "")
                    {
                        return(false);
                    }
                }
                catch // RegExp expression is not valid
                {
                    return(false);
                }
            }

            return(true);
        }
Example #13
0
        protected virtual PaFolder GetFolderAttributesFromNode(XmlElement FolderElement)
        {
            PaFolder Folder = new PaFolder();

            //The folder/name node is a required node.  If empty, this will throw an exception.
            try
            {
                Folder.Name = FolderElement.SelectSingleNode("name").InnerText.Trim();
            }
            catch (Exception)
            {
                throw (new Exception(EXCEPTION_FolderName));
            }

            XmlElement descriptionElement = (XmlElement)FolderElement.SelectSingleNode("description");

            if (descriptionElement != null)
            {
                Folder.Description = descriptionElement.InnerText.Trim();
            }

            //The folder/version node is a required node.  If empty, this will throw an exception.
            try
            {
                Folder.Version = FolderElement.SelectSingleNode("version").InnerText.Trim();
            }
            catch (Exception)
            {
                throw (new Exception(EXCEPTION_FolderVersion));
            }

            // in V2 the FriendlyName/FolderName/ModuleName attributes were not supported in the *.dnn file,
            // so set them to the Folder Name
            Folder.FriendlyName = Folder.Name;
            Folder.FolderName   = Folder.Name;
            Folder.ModuleName   = Folder.Name;

            return(Folder);
        }
        protected virtual PaFolder GetFolderAttributesFromNode(XmlElement FolderElement)
        {
            PaFolder Folder = new PaFolder();

            //The folder/name node is a required node.  If empty, this will throw an exception.
            try
            {
                Folder.Name = FolderElement.SelectSingleNode("name").InnerText.Trim();
            }
            catch (Exception)
            {
                throw (new Exception(EXCEPTION_FolderName));
            }

            XmlElement descriptionElement = (XmlElement)FolderElement.SelectSingleNode("description");
            if (descriptionElement != null)
            {
                Folder.Description = descriptionElement.InnerText.Trim();
            }

            //The folder/version node is a required node.  If empty, this will throw an exception.
            try
            {
                Folder.Version = FolderElement.SelectSingleNode("version").InnerText.Trim();
            }
            catch (Exception)
            {
                throw (new Exception(EXCEPTION_FolderVersion));
            }

            // in V2 the FriendlyName/FolderName/ModuleName attributes were not supported in the *.dnn file,
            // so set them to the Folder Name
            Folder.FriendlyName = Folder.Name;
            Folder.FolderName = Folder.Name;
            Folder.ModuleName = Folder.Name;

            return Folder;
        }
Example #15
0
 /// <Summary>
 /// Add an element of the specified PaFolder to the collection at the designated index.
 /// </Summary>
 /// <Param name="index">
 /// An Integer to indicate the location to add the object to the collection.
 /// </Param>
 /// <Param name="value">
 /// An object of type PaFolder to add to the collection.
 /// </Param>
 public void Insert(int index, PaFolder value)
 {
     this.List.Insert(index, value);
 }
Example #16
0
 /// <Summary>
 /// Remove the specified object of type PaFolder from the collection.
 /// </Summary>
 /// <Param name="value">
 /// An object of type PaFolder to remove to the collection.
 /// </Param>
 public void Remove(PaFolder value)
 {
     this.List.Remove(value);
 }
        public override PaFolderCollection ReadDnn()
        {
            //This is a very long subroutine and should probably be broken down
            //into a couple of smaller routines.  That would make it easier to
            //maintain.
            InstallerInfo.Log.StartJob(DNN_Reading);

            //Determine if XML conforms to designated schema
            ArrayList DnnErrors = ValidateDnn();
            if (DnnErrors.Count == 0)
            {
                InstallerInfo.Log.AddInfo(string.Format(DNN_Valid, "2.0"));

                PaFolderCollection Folders = new PaFolderCollection();

                XmlDocument doc = new XmlDocument();
                MemoryStream buffer = new MemoryStream(InstallerInfo.DnnFile.Buffer, false);
                doc.Load(buffer);
                InstallerInfo.Log.AddInfo(XML_Loaded);

                //Create an XmlNamespaceManager for resolving namespaces.
                //Dim nsmgr As XmlNamespaceManager = New XmlNamespaceManager(doc.NameTable)
                //nsmgr.AddNamespace("dnn", "urn:ModuleDefinitionSchema")

                XmlNode dnnRoot = doc.DocumentElement;

                XmlElement FolderElement = (XmlElement)dnnRoot.SelectSingleNode("folder");
                //We will process each folder individually.  So we don't need to keep
                //as much in memory.

                //As we loop through each folder, we will save the data
                PaFolder Folder = new PaFolder();

                //The folder/name node is a required node.  If empty, this will throw
                //an exception.
                try
                {
                    Folder.Name = FolderElement.SelectSingleNode("name").InnerText.Trim();
                }
                catch (Exception)
                {
                    throw (new Exception(EXCEPTION_FolderName));
                }

                try
                {
                    Folder.ProviderType = FolderElement.SelectSingleNode("type").InnerText.Trim();
                }
                catch (Exception)
                {
                    throw (new Exception(EXCEPTION_FolderProvider));
                }

                // loading files
                InstallerInfo.Log.AddInfo(FILES_Loading);
                XmlElement file;
                foreach (XmlElement tempLoopVar_file in FolderElement.SelectNodes("files/file"))
                {
                    file = tempLoopVar_file;
                    //The file/name node is a required node.  If empty, this will throw
                    //an exception.
                    string name;
                    try
                    {
                        name = file.SelectSingleNode("name").InnerText.Trim();
                    }
                    catch (Exception)
                    {
                        throw (new Exception(EXCEPTION_FileName));
                    }
                    PaFile paf = (PaFile)InstallerInfo.FileTable[name.ToLower()];
                    if (paf == null)
                    {
                        InstallerInfo.Log.AddFailure(FILE_NotFound + name);
                    }
                    else
                    {
                        //A file path may or may not exist
                        XmlElement pathElement = (XmlElement)file.SelectSingleNode("path");
                        if (!(pathElement == null))
                        {
                            string filepath = pathElement.InnerText.Trim();
                            InstallerInfo.Log.AddInfo(string.Format(FILE_Found, filepath, name));
                            paf.Path = filepath;
                        }
                        else
                        {
                            // This is needed to override any file path which may exist in the zip file
                            paf.Path = "";
                        }
                        Folder.Files.Add(paf);
                    }
                }

                Folders.Add(Folder);

                if (!InstallerInfo.Log.Valid)
                {
                    throw (new Exception(EXCEPTION_LoadFailed));
                }
                InstallerInfo.Log.EndJob(DNN_Success);

                return Folders;
            }
            else
            {
                string err;
                foreach (string tempLoopVar_err in DnnErrors)
                {
                    err = tempLoopVar_err;
                    InstallerInfo.Log.AddFailure(err);
                }
                throw (new Exception(EXCEPTION_Format));
            }
        }
 /// <Summary>
 /// Remove the specified object of type PaFolder from the collection.
 /// </Summary>
 /// <Param name="value">
 /// An object of type PaFolder to remove to the collection.
 /// </Param>
 public void Remove( PaFolder value )
 {
     this.List.Remove( value );
 }
 /// <Summary>
 /// Copies the collection objects to a one-dimensional Array instance beginning at the specified index.
 /// </Summary>
 /// <Param name="array">
 /// The one-dimensional Array that is the destination of the values copied from the collection.
 /// </Param>
 /// <Param name="index">
 /// The index of the array at which to begin inserting.
 /// </Param>
 public void CopyTo( PaFolder[] array, int index )
 {
     this.List.CopyTo( ( (Array)array ), index );
 }
 /// <Summary>
 /// Creates a one-dimensional Array instance containing the collection items.
 /// </Summary>
 /// <Returns>Array of type PaFolder</Returns>
 public PaFolder[] ToArray()
 {
     PaFolder[] paFolders = new PaFolder[( ( this.Count - 1 ) + 1 )];
     paFolders = ( (PaFolder[])Utils.CopyArray( paFolders, new PaFolder[( ( this.Count - 1 ) + 1 )] ) );
     this.CopyTo( paFolders, 0 );
     return paFolders;
 }
        public override PaFolderCollection ReadDnn()
        {
            //This is a very long subroutine and should probably be broken down
            //into a couple of smaller routines.  That would make it easier to
            //maintain.
            InstallerInfo.Log.StartJob(DNN_Reading);

            //Determine if XML conforms to designated schema
            ArrayList DnnErrors = ValidateDnn();
            if (DnnErrors.Count == 0)
            {
                InstallerInfo.Log.AddInfo(DNN_ValidSkinObject);

                PaFolderCollection Folders = new PaFolderCollection();

                XmlDocument doc = new XmlDocument();
                MemoryStream buffer = new MemoryStream(InstallerInfo.DnnFile.Buffer, false);
                doc.Load(buffer);
                InstallerInfo.Log.AddInfo(XML_Loaded);

                XmlNode dnnRoot = doc.DocumentElement;

                int TempModuleDefinitionID = 0;

                XmlElement FolderElement;
                foreach (XmlElement tempLoopVar_FolderElement in dnnRoot.SelectNodes("folders/folder"))
                {
                    FolderElement = tempLoopVar_FolderElement;
                    //We will process each folder individually.  So we don't need to keep
                    //as much in memory.

                    //As we loop through each folder, we will save the data
                    PaFolder Folder = new PaFolder();

                    //The folder/name node is a required node.  If empty, this will throw
                    //an exception.
                    try
                    {
                        Folder.Name = FolderElement.SelectSingleNode("name").InnerText.Trim();
                    }
                    catch (Exception)
                    {
                        throw (new Exception(EXCEPTION_FolderName));
                    }

                    // in V2 the FriendlyName/FolderName/ModuleName attributes were not supported in the *.dnn file,
                    // so set them to the Folder Name
                    Folder.FriendlyName = Folder.Name;
                    Folder.FolderName = Folder.Name;
                    Folder.ModuleName = Folder.Name;

                    XmlElement resourcefileElement = (XmlElement)FolderElement.SelectSingleNode("resourcefile");
                    if (resourcefileElement != null)
                    {
                        if (resourcefileElement.InnerText.Trim() != "")
                        {
                            Folder.ResourceFile = resourcefileElement.InnerText.Trim();
                            PaFile paRF = (PaFile)InstallerInfo.FileTable[Folder.ResourceFile.ToLower()];
                            if (paRF == null)
                            {
                                InstallerInfo.Log.AddFailure(EXCEPTION_MissingResource + Folder.ResourceFile);
                            }
                            else
                            {
                                paRF.Path = Folder.ResourceFile;
                            }
                        }
                    }

                    // loading files
                    InstallerInfo.Log.AddInfo(FILES_Loading);
                    XmlElement file;
                    foreach (XmlElement tempLoopVar_file in FolderElement.SelectNodes("files/file"))
                    {
                        file = tempLoopVar_file;
                        //The file/name node is a required node.  If empty, this will throw
                        //an exception.
                        string name;
                        try
                        {
                            name = file.SelectSingleNode("name").InnerText.Trim();
                        }
                        catch (Exception)
                        {
                            throw (new Exception(EXCEPTION_FileName));
                        }
                        PaFile paf = (PaFile)InstallerInfo.FileTable[name.ToLower()];
                        if (paf == null)
                        {
                            InstallerInfo.Log.AddFailure(FILE_NotFound + name);
                        }
                        else
                        {
                            //A file path may or may not exist
                            XmlElement pathElement = (XmlElement)file.SelectSingleNode("path");
                            if (!(pathElement == null))
                            {
                                string filepath = pathElement.InnerText.Trim();
                                InstallerInfo.Log.AddInfo(string.Format(FILE_Found, filepath, name));
                                paf.Path = filepath;
                            }
                            Folder.Files.Add(paf);
                        }
                    }

                    // add dnn file to collection ( if it does not exist already )
                    if (Folder.Files.Contains(InstallerInfo.DnnFile) == false)
                    {
                        Folder.Files.Add(InstallerInfo.DnnFile);
                    }

                    InstallerInfo.Log.AddInfo(MODULES_Loading);
                    XmlElement DNNModule;
                    foreach (XmlElement tempLoopVar_DNNModule in FolderElement.SelectNodes("modules/module"))
                    {
                        DNNModule = tempLoopVar_DNNModule;

                        ModuleDefinitionInfo ModuleDef = new ModuleDefinitionInfo();

                        ModuleDef.TempModuleID = TempModuleDefinitionID;
                        //We need to ensure that admin order is null for "User" modules

                        TempModuleDefinitionID++;

                        Folder.Modules.Add(ModuleDef);

                        InstallerInfo.Log.AddInfo(string.Format(MODULES_ControlInfo, ModuleDef.FriendlyName));
                        XmlElement ModuleControl;
                        foreach (XmlElement tempLoopVar_ModuleControl in DNNModule.SelectNodes("controls/control"))
                        {
                            ModuleControl = tempLoopVar_ModuleControl;
                            ModuleControlInfo ModuleControlDef = new ModuleControlInfo();

                            XmlElement keyElement = (XmlElement)ModuleControl.SelectSingleNode("key");
                            if (keyElement != null)
                            {
                                ModuleControlDef.ControlKey = keyElement.InnerText.Trim();
                            }

                            XmlElement titleElement = (XmlElement)ModuleControl.SelectSingleNode("title");
                            if (titleElement != null)
                            {
                                ModuleControlDef.ControlTitle = titleElement.InnerText.Trim();
                            }

                            try
                            {
                                ModuleControlDef.ControlSrc = Path.Combine("DesktopModules", Path.Combine(Folder.Name, ModuleControl.SelectSingleNode("src").InnerText.Trim()).Replace('\\', '/')).Replace(@"\", "/");
                            }
                            catch (Exception)
                            {
                                throw (new Exception(EXCEPTION_Src));
                            }

                            XmlElement iconFileElement = (XmlElement)ModuleControl.SelectSingleNode("iconfile");
                            if (iconFileElement != null)
                            {
                                ModuleControlDef.IconFile = iconFileElement.InnerText.Trim();
                            }

                            try
                            {
                                ModuleControlDef.ControlType = (SecurityAccessLevel)TypeDescriptor.GetConverter(typeof(SecurityAccessLevel)).ConvertFromString(ModuleControl.SelectSingleNode("type").InnerText.Trim());
                                //ModuleControlDef.ControlType = CType(ModuleControl.SelectSingleNode("type").InnerText.Trim, SecurityAccessLevel)
                            }
                            catch (Exception)
                            {
                                throw (new Exception(EXCEPTION_Type));
                            }

                            XmlElement orderElement = (XmlElement)ModuleControl.SelectSingleNode("vieworder");
                            if (orderElement != null)
                            {
                                ModuleControlDef.ViewOrder = Convert.ToInt32(orderElement.InnerText.Trim());
                            }
                            else
                            {
                                ModuleControlDef.ViewOrder = Null.NullInteger;
                            }

                            //This is a temporary relationship since the ModuleDef has not been saved to the db
                            //it does not have a valid ModuleDefID.  Once it is saved then we can update the
                            //ModuleControlDef with the correct value.
                            ModuleControlDef.ModuleDefID = ModuleDef.TempModuleID;

                            Folder.Controls.Add(ModuleControlDef);
                        }
                    }

                    Folders.Add(Folder);
                }

                if (!InstallerInfo.Log.Valid)
                {
                    throw (new Exception(EXCEPTION_LoadFailed));
                }
                InstallerInfo.Log.EndJob(DNN_Success);

                return Folders;
            }
            else
            {
                string err;
                foreach (string tempLoopVar_err in DnnErrors)
                {
                    err = tempLoopVar_err;
                    InstallerInfo.Log.AddFailure(err);
                }
                throw (new Exception(EXCEPTION_Format));
            }
        }
 /// <Summary>
 /// Add an element of the specified PaFolder to the end of the collection.
 /// </Summary>
 /// <Param name="value">
 /// An object of type PaFolder to add to the collection.
 /// </Param>
 public int Add( PaFolder value )
 {
     return this.List.Add( value );
 }
        protected override DesktopModuleInfo GetDesktopModuleSettings(DesktopModuleInfo objDesktopModule, PaFolder Folder)
        {
            // call the V2 implementation to load the values
            objDesktopModule = base.GetDesktopModuleSettings(objDesktopModule, Folder);

            // V3 .dnn file format adds the optional businesscontrollerclass node to the folder node element
            objDesktopModule.BusinessControllerClass = Folder.BusinessControllerClass;

            // V4.3.6 .dnn file format adds the optional compatibleversions node to the folder node element
            objDesktopModule.CompatibleVersions = Folder.CompatibleVersions;

            //V3.1 adds the IsSearchable/IsPortable properties - set them to false
            objDesktopModule.IsSearchable = false;
            objDesktopModule.IsPortable = false;

            //Create an instance of the business controller and determine the values of IsSearchable and
            //IsPortable by Reflection
            try
            {
                if (!String.IsNullOrEmpty(objDesktopModule.BusinessControllerClass))
                {
                    object objController = Reflection.CreateObject(objDesktopModule.BusinessControllerClass, objDesktopModule.BusinessControllerClass);
                    if (objController is ISearchable)
                    {
                        objDesktopModule.IsSearchable = true;
                    }
                    if (objController is IPortable)
                    {
                        objDesktopModule.IsPortable = true;
                    }
                }
            }
            catch
            {
                //this code may not work because the module may have just been upgraded and did not have
                //the BusinessControllerClass in the version that is currently in the Application Domain
                //if this is the case, then the updating of thos features will be handled after the application is restarted
            }

            return objDesktopModule;
        }
        protected override DesktopModuleInfo GetDesktopModule(PaFolder Folder)
        {
            DesktopModuleController objDesktopModules = new DesktopModuleController();
            DesktopModuleInfo objDesktopModule = objDesktopModules.GetDesktopModuleByModuleName(Folder.ModuleName);

            return objDesktopModule;
        }
Example #25
0
        protected override PaFolder GetFolderAttributesFromNode(XmlElement FolderElement)
        {
            // call the V2 implementation to load the values
            PaFolder folder = base.GetFolderAttributesFromNode(FolderElement);

            // V3 .dnn file format adds the optional businesscontrollerclass node to the folder node element
            XmlElement businessControllerElement = (XmlElement)FolderElement.SelectSingleNode("businesscontrollerclass");

            if (businessControllerElement != null)
            {
                folder.BusinessControllerClass = businessControllerElement.InnerText.Trim();
            }

            // V3 .dnn file format adds the optional friendlyname/foldername/modulename nodes to the folder node element
            //For these new nodes the defaults are as follows
            // <friendlyname>, <name>
            // <foldernamee>, <name>, "MyModule"
            // <modulename>, <friendlyname>, <name>
            XmlElement friendlynameElement = (XmlElement)FolderElement.SelectSingleNode("friendlyname");

            if (friendlynameElement != null)
            {
                folder.FriendlyName = friendlynameElement.InnerText.Trim();
                folder.ModuleName   = friendlynameElement.InnerText.Trim();
            }

            XmlElement foldernameElement = (XmlElement)FolderElement.SelectSingleNode("foldername");

            if (foldernameElement != null)
            {
                folder.FolderName = foldernameElement.InnerText.Trim();
            }
            if (folder.FolderName == "")
            {
                folder.FolderName = "MyModule";
            }

            XmlElement modulenameElement = (XmlElement)FolderElement.SelectSingleNode("modulename");

            if (modulenameElement != null)
            {
                folder.ModuleName = modulenameElement.InnerText.Trim();
            }

            // V4.3.6 .dnn file format adds the optional compatibleversions node to the folder node element
            XmlElement compatibleVersionsElement = (XmlElement)(FolderElement.SelectSingleNode("compatibleversions"));

            if (compatibleVersionsElement != null)
            {
                folder.CompatibleVersions = compatibleVersionsElement.InnerText.Trim();
            }

            // V4.4.0 .dnn file format adds the optional supportsprobingprivatepath node to the folder node element
            XmlElement supportsProbingPrivatePath = (XmlElement)(FolderElement.SelectSingleNode("supportsprobingprivatepath"));

            if (supportsProbingPrivatePath != null)
            {
                folder.SupportsProbingPrivatePath = Convert.ToBoolean(supportsProbingPrivatePath.InnerText.Trim());
            }

            return(folder);
        }
Example #26
0
        protected override ModuleDefinitionInfo GetModuleFromNode(int TempModuleDefinitionID, PaFolder Folder, XmlElement DNNModule)
        {
            ModuleDefinitionInfo ModuleDef = base.GetModuleFromNode(TempModuleDefinitionID, Folder, DNNModule);

            if (ModuleDef != null)
            {
                XmlElement cacheElement = (XmlElement)DNNModule.SelectSingleNode("cachetime");
                if (cacheElement != null)
                {
                    ModuleDef.DefaultCacheTime = Convert.ToInt32(cacheElement.InnerText.Trim());
                }
            }

            return(ModuleDef);
        }
Example #27
0
        public override PaFolderCollection ReadDnn()
        {
            //This is a very long subroutine and should probably be broken down
            //into a couple of smaller routines.  That would make it easier to
            //maintain.
            InstallerInfo.Log.StartJob(DNN_Reading);

            //Determine if XML conforms to designated schema
            ArrayList DnnErrors = ValidateDnn();

            if (DnnErrors.Count == 0)
            {
                InstallerInfo.Log.AddInfo(DNN_ValidSkinObject);

                PaFolderCollection Folders = new PaFolderCollection();

                XmlDocument  doc    = new XmlDocument();
                MemoryStream buffer = new MemoryStream(InstallerInfo.DnnFile.Buffer, false);
                doc.Load(buffer);
                InstallerInfo.Log.AddInfo(XML_Loaded);

                XmlNode dnnRoot = doc.DocumentElement;

                int TempModuleDefinitionID = 0;

                XmlElement FolderElement;
                foreach (XmlElement tempLoopVar_FolderElement in dnnRoot.SelectNodes("folders/folder"))
                {
                    FolderElement = tempLoopVar_FolderElement;
                    //We will process each folder individually.  So we don't need to keep
                    //as much in memory.

                    //As we loop through each folder, we will save the data
                    PaFolder Folder = new PaFolder();

                    //The folder/name node is a required node.  If empty, this will throw
                    //an exception.
                    try
                    {
                        Folder.Name = FolderElement.SelectSingleNode("name").InnerText.Trim();
                    }
                    catch (Exception)
                    {
                        throw (new Exception(EXCEPTION_FolderName));
                    }

                    // in V2 the FriendlyName/FolderName/ModuleName attributes were not supported in the *.dnn file,
                    // so set them to the Folder Name
                    Folder.FriendlyName = Folder.Name;
                    Folder.FolderName   = Folder.Name;
                    Folder.ModuleName   = Folder.Name;

                    XmlElement resourcefileElement = (XmlElement)FolderElement.SelectSingleNode("resourcefile");
                    if (resourcefileElement != null)
                    {
                        if (resourcefileElement.InnerText.Trim() != "")
                        {
                            Folder.ResourceFile = resourcefileElement.InnerText.Trim();
                            PaFile paRF = (PaFile)InstallerInfo.FileTable[Folder.ResourceFile.ToLower()];
                            if (paRF == null)
                            {
                                InstallerInfo.Log.AddFailure(EXCEPTION_MissingResource + Folder.ResourceFile);
                            }
                            else
                            {
                                paRF.Path = Folder.ResourceFile;
                            }
                        }
                    }

                    // loading files
                    InstallerInfo.Log.AddInfo(FILES_Loading);
                    XmlElement file;
                    foreach (XmlElement tempLoopVar_file in FolderElement.SelectNodes("files/file"))
                    {
                        file = tempLoopVar_file;
                        //The file/name node is a required node.  If empty, this will throw
                        //an exception.
                        string name;
                        try
                        {
                            name = file.SelectSingleNode("name").InnerText.Trim();
                        }
                        catch (Exception)
                        {
                            throw (new Exception(EXCEPTION_FileName));
                        }
                        PaFile paf = (PaFile)InstallerInfo.FileTable[name.ToLower()];
                        if (paf == null)
                        {
                            InstallerInfo.Log.AddFailure(FILE_NotFound + name);
                        }
                        else
                        {
                            //A file path may or may not exist
                            XmlElement pathElement = (XmlElement)file.SelectSingleNode("path");
                            if (!(pathElement == null))
                            {
                                string filepath = pathElement.InnerText.Trim();
                                InstallerInfo.Log.AddInfo(string.Format(FILE_Found, filepath, name));
                                paf.Path = filepath;
                            }
                            Folder.Files.Add(paf);
                        }
                    }

                    // add dnn file to collection ( if it does not exist already )
                    if (Folder.Files.Contains(InstallerInfo.DnnFile) == false)
                    {
                        Folder.Files.Add(InstallerInfo.DnnFile);
                    }

                    InstallerInfo.Log.AddInfo(MODULES_Loading);
                    XmlElement DNNModule;
                    foreach (XmlElement tempLoopVar_DNNModule in FolderElement.SelectNodes("modules/module"))
                    {
                        DNNModule = tempLoopVar_DNNModule;

                        ModuleDefinitionInfo ModuleDef = new ModuleDefinitionInfo();

                        ModuleDef.TempModuleID = TempModuleDefinitionID;
                        //We need to ensure that admin order is null for "User" modules

                        TempModuleDefinitionID++;

                        Folder.Modules.Add(ModuleDef);

                        InstallerInfo.Log.AddInfo(string.Format(MODULES_ControlInfo, ModuleDef.FriendlyName));
                        XmlElement ModuleControl;
                        foreach (XmlElement tempLoopVar_ModuleControl in DNNModule.SelectNodes("controls/control"))
                        {
                            ModuleControl = tempLoopVar_ModuleControl;
                            ModuleControlInfo ModuleControlDef = new ModuleControlInfo();

                            XmlElement keyElement = (XmlElement)ModuleControl.SelectSingleNode("key");
                            if (keyElement != null)
                            {
                                ModuleControlDef.ControlKey = keyElement.InnerText.Trim();
                            }

                            XmlElement titleElement = (XmlElement)ModuleControl.SelectSingleNode("title");
                            if (titleElement != null)
                            {
                                ModuleControlDef.ControlTitle = titleElement.InnerText.Trim();
                            }

                            try
                            {
                                ModuleControlDef.ControlSrc = Path.Combine("DesktopModules", Path.Combine(Folder.Name, ModuleControl.SelectSingleNode("src").InnerText.Trim()).Replace('\\', '/')).Replace(@"\", "/");
                            }
                            catch (Exception)
                            {
                                throw (new Exception(EXCEPTION_Src));
                            }

                            XmlElement iconFileElement = (XmlElement)ModuleControl.SelectSingleNode("iconfile");
                            if (iconFileElement != null)
                            {
                                ModuleControlDef.IconFile = iconFileElement.InnerText.Trim();
                            }

                            try
                            {
                                ModuleControlDef.ControlType = (SecurityAccessLevel)TypeDescriptor.GetConverter(typeof(SecurityAccessLevel)).ConvertFromString(ModuleControl.SelectSingleNode("type").InnerText.Trim());
                                //ModuleControlDef.ControlType = CType(ModuleControl.SelectSingleNode("type").InnerText.Trim, SecurityAccessLevel)
                            }
                            catch (Exception)
                            {
                                throw (new Exception(EXCEPTION_Type));
                            }

                            XmlElement orderElement = (XmlElement)ModuleControl.SelectSingleNode("vieworder");
                            if (orderElement != null)
                            {
                                ModuleControlDef.ViewOrder = Convert.ToInt32(orderElement.InnerText.Trim());
                            }
                            else
                            {
                                ModuleControlDef.ViewOrder = Null.NullInteger;
                            }

                            //This is a temporary relationship since the ModuleDef has not been saved to the db
                            //it does not have a valid ModuleDefID.  Once it is saved then we can update the
                            //ModuleControlDef with the correct value.
                            ModuleControlDef.ModuleDefID = ModuleDef.TempModuleID;

                            Folder.Controls.Add(ModuleControlDef);
                        }
                    }

                    Folders.Add(Folder);
                }

                if (!InstallerInfo.Log.Valid)
                {
                    throw (new Exception(EXCEPTION_LoadFailed));
                }
                InstallerInfo.Log.EndJob(DNN_Success);

                return(Folders);
            }
            else
            {
                string err;
                foreach (string tempLoopVar_err in DnnErrors)
                {
                    err = tempLoopVar_err;
                    InstallerInfo.Log.AddFailure(err);
                }
                throw (new Exception(EXCEPTION_Format));
            }
        }
Example #28
0
        protected virtual void ExecuteSql(PaFolder Folder)
        {
            InstallerInfo.Log.StartJob(SQL_Begin);
            // get list of script files
            ArrayList arrScriptFiles = new ArrayList();
            PaFile    InstallScript  = null;

            // executing all the sql files
            foreach (PaFile file in Folder.Files)
            {
                // DataProvider files may be either: the SQL to execute, uninstall, or XML stored procs.
                // We only want to execute the first type of DataProvider files.
                if (file.Type == PaFileType.Sql || (file.Type == PaFileType.DataProvider && file.Name.ToLower().IndexOf("uninstall") == -1 && file.Name.ToLower().IndexOf(".xml") == -1))
                {
                    ProviderConfiguration objProviderConfiguration = ProviderConfiguration.GetProviderConfiguration("data");

                    if (objProviderConfiguration.DefaultProvider.ToLower() == Path.GetExtension(file.Name.ToLower()).Substring(1))
                    {
                        if (file.Name.ToLower().StartsWith("install."))
                        {
                            InstallScript = file;
                        }
                        else
                        {
                            arrScriptFiles.Add(file);
                        }
                    }
                }
            }

            // get current module version
            string            strModuleVersion = "000000";
            DesktopModuleInfo objDesktopModule = GetDesktopModule(Folder);

            if (objDesktopModule != null)
            {
                strModuleVersion = objDesktopModule.Version.Replace(".", "");
            }

            if (InstallScript != null && objDesktopModule == null)
            {
                // new install
                InstallerInfo.Log.AddInfo(SQL_Executing + InstallScript.Name);
                BatchSql(InstallScript);

                string strInstallVersion = Path.GetFileNameWithoutExtension(InstallScript.Name).Replace(".", "");
                strInstallVersion = strInstallVersion.ToLower().Replace("install", "");

                // if install script includes version number will be used a base version for upgrades
                // otherwise it is assigned an initial version of 000000
                if (!String.IsNullOrEmpty(strInstallVersion))
                {
                    strModuleVersion = strInstallVersion;
                }
                UpgradeVersions.Add(Regex.Replace(strModuleVersion, "^(?<a>\\d{2})(?<b>\\d{2})(?<c>\\d{2})$", "${a}.${b}.${c}"));
            }

            // iterate through scripts
            PaDataProviderComparer Comparer = new PaDataProviderComparer();

            arrScriptFiles.Sort(Comparer);
            foreach (PaFile scriptFile in arrScriptFiles)
            {
                string strScriptVersion = Path.GetFileNameWithoutExtension(scriptFile.Name).Replace(".", "");
                if (String.Compare(strScriptVersion, strModuleVersion, false) > 0)
                {
                    UpgradeVersions.Add(Path.GetFileNameWithoutExtension(scriptFile.Name));
                    InstallerInfo.Log.AddInfo(SQL_Executing + scriptFile.Name);
                    BatchSql(scriptFile);
                }
            }

            InstallerInfo.Log.EndJob(SQL_End);
        }
Example #29
0
        protected virtual void RegisterModules(PaFolder Folder, ArrayList Modules, ArrayList Controls)
        {
            InstallerInfo.Log.StartJob(REGISTER_Module);

            DesktopModuleController objDesktopModules = new DesktopModuleController();

            // check if desktop module exists
            DesktopModuleInfo objDesktopModule = GetDesktopModule(Folder);

            if (objDesktopModule == null)
            {
                objDesktopModule = new DesktopModuleInfo();
                objDesktopModule.DesktopModuleID = Null.NullInteger;
            }

            objDesktopModule = GetDesktopModuleSettings(objDesktopModule, Folder);

            if (Null.IsNull(objDesktopModule.DesktopModuleID))
            {
                // new desktop module
                objDesktopModule.DesktopModuleID = objDesktopModules.AddDesktopModule(objDesktopModule);
            }
            else
            {
                // existing desktop module
                objDesktopModules.UpdateDesktopModule(objDesktopModule);
            }

            InstallerInfo.Log.AddInfo(REGISTER_Definition);

            ModuleDefinitionController objModuleDefinitons = new ModuleDefinitionController();

            foreach (ModuleDefinitionInfo objModuleDefinition in Modules)
            {
                // check if definition exists
                ModuleDefinitionInfo objModuleDefinition2 = objModuleDefinitons.GetModuleDefinitionByName(objDesktopModule.DesktopModuleID, objModuleDefinition.FriendlyName);
                if (objModuleDefinition2 == null)
                {
                    // add new definition
                    objModuleDefinition.DesktopModuleID = objDesktopModule.DesktopModuleID;
                    objModuleDefinition.ModuleDefID     = objModuleDefinitons.AddModuleDefinition(objModuleDefinition);
                }
                else
                {
                    // update existing definition
                    objModuleDefinition.ModuleDefID = objModuleDefinition2.ModuleDefID;
                    objModuleDefinitons.UpdateModuleDefinition(objModuleDefinition);
                }
            }

            InstallerInfo.Log.AddInfo(REGISTER_Controls);

            ModuleControlController objModuleControls = new ModuleControlController();

            foreach (ModuleControlInfo objModuleControl in Controls)
            {
                // get the real ModuleDefID from the associated Module
                objModuleControl.ModuleDefID = GetModDefID(objModuleControl.ModuleDefID, Modules);

                // check if control exists
                ModuleControlInfo objModuleControl2 = objModuleControls.GetModuleControlByKeyAndSrc(objModuleControl.ModuleDefID, objModuleControl.ControlKey, objModuleControl.ControlSrc);
                if (objModuleControl2 == null)
                {
                    // add new control
                    objModuleControls.AddModuleControl(objModuleControl);
                }
                else
                {
                    // update existing control
                    objModuleControl.ModuleControlID = objModuleControl2.ModuleControlID;
                    objModuleControls.UpdateModuleControl(objModuleControl);
                }
            }

            InstallerInfo.Log.EndJob(REGISTER_End);

            UpgradeModule(objDesktopModule);
        }
Example #30
0
        protected virtual ModuleDefinitionInfo GetModuleFromNode(int TempModuleDefinitionID, PaFolder Folder, XmlElement DNNModule)
        {
            ModuleDefinitionInfo ModuleDef = new ModuleDefinitionInfo();

            XmlElement friendlyNameElement = (XmlElement)DNNModule.SelectSingleNode("friendlyname");

            if (friendlyNameElement != null)
            {
                ModuleDef.FriendlyName = friendlyNameElement.InnerText.Trim();
            }

            ModuleDef.TempModuleID = TempModuleDefinitionID;
            //We need to ensure that admin order is null for "User" modules

            InstallerInfo.Log.AddInfo(string.Format(MODULES_ControlInfo, ModuleDef.FriendlyName));

            XmlElement ModuleControl;

            foreach (XmlElement tempLoopVar_ModuleControl in DNNModule.SelectNodes("controls/control"))
            {
                ModuleControl = tempLoopVar_ModuleControl;

                Folder.Controls.Add(GetModuleControlFromNode(Folder.Name, ModuleDef.TempModuleID, ModuleControl));
            }

            return(ModuleDef);
        }
 /// <Summary>
 /// Gets the index in the collection of the specified PaFolderCollection, if it exists in the collection.
 /// </Summary>
 /// <Param name="value">
 /// The PaFolderCollection to locate in the collection.
 /// </Param>
 /// <Returns>
 /// The index in the collection of the specified object, if found; otherwise, -1.
 /// </Returns>
 public int IndexOf( PaFolder value )
 {
     return this.List.IndexOf( value );
 }
Example #32
0
 /// <Summary>
 /// Gets the index in the collection of the specified PaFolderCollection, if it exists in the collection.
 /// </Summary>
 /// <Param name="value">
 /// The PaFolderCollection to locate in the collection.
 /// </Param>
 /// <Returns>
 /// The index in the collection of the specified object, if found; otherwise, -1.
 /// </Returns>
 public int IndexOf(PaFolder value)
 {
     return(this.List.IndexOf(value));
 }
 /// <Summary>
 /// Copies the elements of the specified PaFolder array to the end of the collection.
 /// </Summary>
 /// <Param name="value">
 /// An array of type PaFolder containing the objects to add to the collection.
 /// </Param>
 public void AddRange( PaFolder[] value )
 {
     int total = ( value.Length - 1 );
     for( int i = 0; ( i <= total ); i++ )
     {
         this.Add( value[i] );
     }
 }
        protected virtual ModuleDefinitionInfo GetModuleFromNode(int TempModuleDefinitionID, PaFolder Folder, XmlElement DNNModule)
        {
            ModuleDefinitionInfo ModuleDef = new ModuleDefinitionInfo();

            XmlElement friendlyNameElement = (XmlElement)DNNModule.SelectSingleNode("friendlyname");
            if (friendlyNameElement != null)
            {
                ModuleDef.FriendlyName = friendlyNameElement.InnerText.Trim();
            }

            ModuleDef.TempModuleID = TempModuleDefinitionID;
            //We need to ensure that admin order is null for "User" modules

            InstallerInfo.Log.AddInfo(string.Format(MODULES_ControlInfo, ModuleDef.FriendlyName));

            XmlElement ModuleControl;
            foreach (XmlElement tempLoopVar_ModuleControl in DNNModule.SelectNodes("controls/control"))
            {
                ModuleControl = tempLoopVar_ModuleControl;

                Folder.Controls.Add(GetModuleControlFromNode(Folder.Name, ModuleDef.TempModuleID, ModuleControl));
            }

            return ModuleDef;
        }
 /// <Summary>
 /// Add an element of the specified PaFolder to the collection at the designated index.
 /// </Summary>
 /// <Param name="index">
 /// An Integer to indicate the location to add the object to the collection.
 /// </Param>
 /// <Param name="value">
 /// An object of type PaFolder to add to the collection.
 /// </Param>
 public void Insert( int index, PaFolder value )
 {
     this.List.Insert( index, value );
 }
Example #36
0
 /// <Summary>
 /// Gets a value indicating whether the collection contains the specified PaFolderCollection.
 /// </Summary>
 /// <Param name="value">
 /// The PaFolderCollection to search for in the collection.
 /// </Param>
 /// <Returns>
 /// true if the collection contains the specified object; otherwise, false.
 /// </Returns>
 public bool Contains(PaFolder value)
 {
     return(this.List.Contains(value));
 }
 /// <Summary>
 /// Initializes a new instance of the PaFolderCollection class containing the specified array of PaFolder objects.
 /// </Summary>
 /// <Param name="value">
 /// An array of PaFolder objects with which to initialize the collection.
 /// </Param>
 public PaFolderCollection( PaFolder[] value )
 {
     this.AddRange( value );
 }
Example #38
0
 /// <Summary>
 /// Add an element of the specified PaFolder to the end of the collection.
 /// </Summary>
 /// <Param name="value">
 /// An object of type PaFolder to add to the collection.
 /// </Param>
 public int Add(PaFolder value)
 {
     return(this.List.Add(value));
 }
 /// <Summary>
 /// Gets a value indicating whether the collection contains the specified PaFolderCollection.
 /// </Summary>
 /// <Param name="value">
 /// The PaFolderCollection to search for in the collection.
 /// </Param>
 /// <Returns>
 /// true if the collection contains the specified object; otherwise, false.
 /// </Returns>
 public bool Contains( PaFolder value )
 {
     return this.List.Contains( value );
 }
Example #40
0
        protected virtual PaFolder GetFolderFromNode(ref int TempModuleDefinitionID, XmlElement FolderElement)
        {
            PaFolder Folder = GetFolderAttributesFromNode(FolderElement);

            XmlElement resourcefileElement = (XmlElement)FolderElement.SelectSingleNode("resourcefile");

            if (resourcefileElement != null)
            {
                if (resourcefileElement.InnerText.Trim() != "")
                {
                    Folder.ResourceFile = resourcefileElement.InnerText.Trim();
                    PaFile paRF = (PaFile)InstallerInfo.FileTable[Folder.ResourceFile.ToLower()];
                    if (paRF == null)
                    {
                        InstallerInfo.Log.AddFailure(EXCEPTION_MissingResource + Folder.ResourceFile);
                    }
                    else
                    {
                        //need to add this file to the list of files to be installed
                        Folder.Files.Add(paRF);
                    }
                }
            }

            // loading files
            InstallerInfo.Log.AddInfo(FILES_Loading);
            XmlElement file;

            foreach (XmlElement tempLoopVar_file in FolderElement.SelectNodes("files/file"))
            {
                file = tempLoopVar_file;
                //The file/name node is a required node.  If empty, this will throw
                //an exception.
                string name;
                try
                {
                    name = file.SelectSingleNode("name").InnerText.Trim();
                }
                catch (Exception)
                {
                    throw (new Exception(EXCEPTION_FolderName));
                }
                PaFile paf = (PaFile)InstallerInfo.FileTable[name.ToLower()];
                if (paf == null)
                {
                    InstallerInfo.Log.AddFailure(FILE_NotFound + name);
                }
                else
                {
                    //A file path may or may not exist
                    XmlElement pathElement = (XmlElement)file.SelectSingleNode("path");
                    if (!(pathElement == null))
                    {
                        string filepath = pathElement.InnerText.Trim();
                        InstallerInfo.Log.AddInfo(string.Format(FILE_Found, filepath, name));
                        paf.Path = filepath;
                    }
                    Folder.Files.Add(paf);
                }
            }

            // add dnn file to collection ( if it does not exist already )
            if (Folder.Files.Contains(InstallerInfo.DnnFile) == false)
            {
                Folder.Files.Add(InstallerInfo.DnnFile);
            }

            InstallerInfo.Log.AddInfo(MODULES_Loading);
            XmlElement DNNModule;

            foreach (XmlElement tempLoopVar_DNNModule in FolderElement.SelectNodes("modules/module"))
            {
                DNNModule = tempLoopVar_DNNModule;

                Folder.Modules.Add(GetModuleFromNode(TempModuleDefinitionID, Folder, DNNModule));

                TempModuleDefinitionID++;
            }

            return(Folder);
        }
Example #41
0
        protected override DesktopModuleInfo GetDesktopModuleSettings(DesktopModuleInfo objDesktopModule, PaFolder Folder)
        {
            // call the V2 implementation to load the values
            objDesktopModule = base.GetDesktopModuleSettings(objDesktopModule, Folder);

            // V3 .dnn file format adds the optional businesscontrollerclass node to the folder node element
            objDesktopModule.BusinessControllerClass = Folder.BusinessControllerClass;

            // V4.3.6 .dnn file format adds the optional compatibleversions node to the folder node element
            objDesktopModule.CompatibleVersions = Folder.CompatibleVersions;

            //V3.1 adds the IsSearchable/IsPortable properties - set them to false
            objDesktopModule.IsSearchable = false;
            objDesktopModule.IsPortable   = false;

            //Create an instance of the business controller and determine the values of IsSearchable and
            //IsPortable by Reflection
            try
            {
                if (!String.IsNullOrEmpty(objDesktopModule.BusinessControllerClass))
                {
                    object objController = Reflection.CreateObject(objDesktopModule.BusinessControllerClass, objDesktopModule.BusinessControllerClass);
                    if (objController is ISearchable)
                    {
                        objDesktopModule.IsSearchable = true;
                    }
                    if (objController is IPortable)
                    {
                        objDesktopModule.IsPortable = true;
                    }
                }
            }
            catch
            {
                //this code may not work because the module may have just been upgraded and did not have
                //the BusinessControllerClass in the version that is currently in the Application Domain
                //if this is the case, then the updating of thos features will be handled after the application is restarted
            }

            return(objDesktopModule);
        }
        protected override ModuleDefinitionInfo GetModuleFromNode(int TempModuleDefinitionID, PaFolder Folder, XmlElement DNNModule)
        {
            ModuleDefinitionInfo ModuleDef = base.GetModuleFromNode(TempModuleDefinitionID, Folder, DNNModule);

            if (ModuleDef != null)
            {
                XmlElement cacheElement = (XmlElement)DNNModule.SelectSingleNode("cachetime");
                if (cacheElement != null)
                {
                    ModuleDef.DefaultCacheTime = Convert.ToInt32(cacheElement.InnerText.Trim());
                }
            }

            return ModuleDef;
        }
Example #43
0
        public override PaFolderCollection ReadDnn()
        {
            //This is a very long subroutine and should probably be broken down
            //into a couple of smaller routines.  That would make it easier to
            //maintain.
            InstallerInfo.Log.StartJob(DNN_Reading);

            //Determine if XML conforms to designated schema
            ArrayList DnnErrors = ValidateDnn();

            if (DnnErrors.Count == 0)
            {
                InstallerInfo.Log.AddInfo(string.Format(DNN_Valid, "2.0"));

                PaFolderCollection Folders = new PaFolderCollection();

                XmlDocument  doc    = new XmlDocument();
                MemoryStream buffer = new MemoryStream(InstallerInfo.DnnFile.Buffer, false);
                doc.Load(buffer);
                InstallerInfo.Log.AddInfo(XML_Loaded);

                //Create an XmlNamespaceManager for resolving namespaces.
                //Dim nsmgr As XmlNamespaceManager = New XmlNamespaceManager(doc.NameTable)
                //nsmgr.AddNamespace("dnn", "urn:ModuleDefinitionSchema")

                XmlNode dnnRoot = doc.DocumentElement;

                XmlElement FolderElement = (XmlElement)dnnRoot.SelectSingleNode("folder");
                //We will process each folder individually.  So we don't need to keep
                //as much in memory.

                //As we loop through each folder, we will save the data
                PaFolder Folder = new PaFolder();

                //The folder/name node is a required node.  If empty, this will throw
                //an exception.
                try
                {
                    Folder.Name = FolderElement.SelectSingleNode("name").InnerText.Trim();
                }
                catch (Exception)
                {
                    throw (new Exception(EXCEPTION_FolderName));
                }

                try
                {
                    Folder.ProviderType = FolderElement.SelectSingleNode("type").InnerText.Trim();
                }
                catch (Exception)
                {
                    throw (new Exception(EXCEPTION_FolderProvider));
                }

                // loading files
                InstallerInfo.Log.AddInfo(FILES_Loading);
                XmlElement file;
                foreach (XmlElement tempLoopVar_file in FolderElement.SelectNodes("files/file"))
                {
                    file = tempLoopVar_file;
                    //The file/name node is a required node.  If empty, this will throw
                    //an exception.
                    string name;
                    try
                    {
                        name = file.SelectSingleNode("name").InnerText.Trim();
                    }
                    catch (Exception)
                    {
                        throw (new Exception(EXCEPTION_FileName));
                    }
                    PaFile paf = (PaFile)InstallerInfo.FileTable[name.ToLower()];
                    if (paf == null)
                    {
                        InstallerInfo.Log.AddFailure(FILE_NotFound + name);
                    }
                    else
                    {
                        //A file path may or may not exist
                        XmlElement pathElement = (XmlElement)file.SelectSingleNode("path");
                        if (!(pathElement == null))
                        {
                            string filepath = pathElement.InnerText.Trim();
                            InstallerInfo.Log.AddInfo(string.Format(FILE_Found, filepath, name));
                            paf.Path = filepath;
                        }
                        else
                        {
                            // This is needed to override any file path which may exist in the zip file
                            paf.Path = "";
                        }
                        Folder.Files.Add(paf);
                    }
                }

                Folders.Add(Folder);

                if (!InstallerInfo.Log.Valid)
                {
                    throw (new Exception(EXCEPTION_LoadFailed));
                }
                InstallerInfo.Log.EndJob(DNN_Success);

                return(Folders);
            }
            else
            {
                string err;
                foreach (string tempLoopVar_err in DnnErrors)
                {
                    err = tempLoopVar_err;
                    InstallerInfo.Log.AddFailure(err);
                }
                throw (new Exception(EXCEPTION_Format));
            }
        }
Example #44
0
        protected virtual DesktopModuleInfo GetDesktopModuleSettings(DesktopModuleInfo objDesktopModule, PaFolder Folder)
        {
            objDesktopModule.FriendlyName = Folder.FriendlyName;
            objDesktopModule.FolderName   = Folder.FolderName;
            objDesktopModule.ModuleName   = Folder.ModuleName;
            objDesktopModule.Description  = Folder.Description;
            objDesktopModule.Version      = Folder.Version;

            return(objDesktopModule);
        }