示例#1
0
    static public void setDefaultSettings(ref ApplicationItemEx applicationItemEx, XmlNode settingsNode, bool isContent)
    {
        XmlNode folderNode       = settingsNode.SelectSingleNode("Folder");
        XmlNode descNode         = settingsNode.SelectSingleNode("Description");
        XmlNode remoteAccessNode = settingsNode.SelectSingleNode("RemoteAccessEnabled");

        if (folderNode != null)
        {
            if (folderNode.FirstChild != null)
            {
                applicationItemEx.FolderName = folderNode.FirstChild.Value;
            }
        }
        if (descNode != null)
        {
            if (descNode.FirstChild != null)
            {
                applicationItemEx.Description = descNode.FirstChild.Value;
            }
        }
        if (remoteAccessNode != null)
        {
            applicationItemEx.RemoteAccessEnabled = remoteAccessNode.FirstChild.Value;
        }

        XmlNode seqNo = settingsNode.SelectSingleNode("SeqNo");

        if (seqNo != null)
        {
            applicationItemEx.SequenceNumber = seqNo.FirstChild.Value;
        }
        XmlNode serverType = settingsNode.SelectSingleNode("ServerType");

        if (serverType != null)
        {
            applicationItemEx.ServerType = serverType.FirstChild.Value;
        }
        XmlNode clientType = settingsNode.SelectSingleNode("ClientType");

        if (clientType != null)
        {
            applicationItemEx.ClientType = clientType.FirstChild.Value;
        }
        // those data returned only for applications that are not contents
        if (!isContent)
        {
            try
            {
                applicationItemEx.WinWidth  = settingsNode.SelectSingleNode("WinWidth").FirstChild.Value;
                applicationItemEx.WinHeight = settingsNode.SelectSingleNode("WinHeight").FirstChild.Value;
                if (settingsNode.SelectSingleNode("WinColor") != null)
                {
                    applicationItemEx.WinColor = settingsNode.SelectSingleNode("WinColor").FirstChild.Value;
                }
                if (settingsNode.SelectSingleNode("WinScale") != null)
                {
                    applicationItemEx.WinScale = settingsNode.SelectSingleNode("WinScale").FirstChild.Value;
                }
                if (settingsNode.SelectSingleNode("WinType") != null)
                {
                    applicationItemEx.WinType = settingsNode.SelectSingleNode("WinType").FirstChild.Value;
                }
                if (settingsNode.SelectSingleNode("SoundType") != null)
                {
                    applicationItemEx.SoundType = settingsNode.SelectSingleNode("SoundType").FirstChild.Value;
                    if (settingsNode.SelectSingleNode("SoundType").Attributes != null && settingsNode.SelectSingleNode("SoundType").Attributes.Count != 0)
                    {
                        applicationItemEx.SoundTypeMinimum = settingsNode.SelectSingleNode("SoundType").Attributes[0].FirstChild.Value;
                    }
                }
                if (settingsNode.SelectSingleNode("VideoType") != null)
                {
                    applicationItemEx.VideoType = settingsNode.SelectSingleNode("VideoType").FirstChild.Value;
                    if (settingsNode.SelectSingleNode("VideoType").Attributes != null && settingsNode.SelectSingleNode("VideoType").Attributes.Count != 0)
                    {
                        applicationItemEx.VideoTypeMinimum = settingsNode.SelectSingleNode("VideoType").Attributes[0].FirstChild.Value;
                    }
                }

                if (settingsNode.SelectSingleNode("Encryption") != null)
                {
                    applicationItemEx.Encryption = settingsNode.SelectSingleNode("Encryption").FirstChild.Value;
                    if (settingsNode.SelectSingleNode("Encryption").Attributes != null && settingsNode.SelectSingleNode("Encryption").Attributes.Count != 0)
                    {
                        applicationItemEx.EncryptionMinimum = settingsNode.SelectSingleNode("Encryption").Attributes[0].FirstChild.Value;
                    }
                }
                if (settingsNode.SelectSingleNode("PublisherName") != null)
                {
                    applicationItemEx.PublisherName = settingsNode.SelectSingleNode("PublisherName").FirstChild.Value;
                }
                applicationItemEx.SSLEnabled = settingsNode.SelectSingleNode("SSLEnabled").FirstChild.Value;
                if (settingsNode.SelectSingleNode("AppInStartmenu").FirstChild != null)
                {
                    applicationItemEx.StartmenuFolder = settingsNode.SelectSingleNode("AppInStartmenu").FirstChild.Value;
                    if (settingsNode.SelectSingleNode("AppInStartmenu").Attributes.Count == 2)
                    {
                        applicationItemEx.StartMenuRoot = settingsNode.SelectSingleNode("AppInStartmenu").Attributes["root"].FirstChild.Value;
                    }
                    if (settingsNode.SelectSingleNode("AppInStartmenu").Attributes != null && settingsNode.SelectSingleNode("AppInStartmenu").Attributes.Count != 0)
                    {
                        applicationItemEx.AppInStartmenu = settingsNode.SelectSingleNode("AppInStartmenu").Attributes["value"].FirstChild.Value;
                    }
                }
                applicationItemEx.AppOnDesktop = settingsNode.SelectSingleNode("AppOnDesktop").Attributes[0].FirstChild.Value;
            }
            catch
            {
            }
        }
        else
        {
            // contents only
            try
            {
                applicationItemEx.ContentAddress = settingsNode.SelectSingleNode("ContentAddress").FirstChild.Value;
            }
            catch
            {
            }
        }
    }
示例#2
0
 public string GetApplicationIcon(ApplicationItemEx app, int size, int colorDepth, string format, Credentials credentials, string farmName)
 {
     WSConstants.CTX_XML    = farms[farmName].Url;
     WSConstants.CTXXMLPort = farms[farmName].Port;
     return(WebService.GetApplicationIcon(app, size, colorDepth, format, credentials));
 }
示例#3
0
    static public ApplicationItemEx[] parseAppData(string responseText)
    {
        XmlDocument xmlDoc = new XmlDocument();

        responseText = Regex.Replace(responseText, "<!DOCTYPE.+?>", string.Empty);

        xmlDoc.LoadXml(responseText);
        string MyPath      = "NFuseProtocol/ResponseAppData/AppDataSet/AppData";
        var    appNodeList = xmlDoc.SelectNodes(MyPath);

        var appsList = new List <ApplicationItemEx>();

        foreach (XmlNode appNode in appNodeList)
        {
            //if(appNode.SelectSingleNode("ClientType").FirstChild.Value == "content")
            //  continue;

            var app = new ApplicationItemEx();
            app.InternalName = appNode.SelectSingleNode("InName").FirstChild.Value;
            app.FreindlyName = appNode.SelectSingleNode("FName").FirstChild.Value;

            // default 32 *32 icon

            XmlNode iconNode = appNode.SelectSingleNode("Details/Icon");
            if (iconNode != null)
            {
                app.Icon = IconMaker.makeIcon(appNode.SelectSingleNode("Details/Icon").FirstChild.Value);
            }
            //iconNode = appNode.selectSingleNode("IconData");
            //if(iconNode != null)
            //    apps[j].Icon = IconMaker.makeIcon((string)iconNode.firstChild.nodeValue,16);

            // access list
            XmlNode accessListNode = appNode.SelectSingleNode("Details/AccessList");
            if (accessListNode != null)
            {
                XmlNodeList usersNodes = accessListNode.SelectNodes("User");
                if (usersNodes != null && usersNodes.Count != 0)
                {
                    app.users = setUsers(usersNodes);
                }
                XmlNodeList groupsNodes = accessListNode.SelectNodes("Group");
                if (groupsNodes != null)
                {
                    app.groups = setGroups(groupsNodes);
                }
            }

            // settings
            bool    nodeTypeFlag = false;
            XmlNode settingsNode = appNode.SelectSingleNode("Details/Settings");
            if (settingsNode == null)
            {
                settingsNode = appNode.SelectSingleNode("Details/ContentSettings");
                nodeTypeFlag = true;
            }
            if (settingsNode != null)
            {
                // add three nodes seqNo, ClientType, ServerType to settingNode
                XmlNode seqNo = appNode.SelectSingleNode("SeqNo");
                if (seqNo != null)
                {
                    settingsNode.AppendChild(seqNo);
                }
                XmlNode serverType = appNode.SelectSingleNode("ServerType");
                if (serverType != null)
                {
                    settingsNode.AppendChild(serverType);
                }
                XmlNode clientType = appNode.SelectSingleNode("ClientType");
                if (clientType != null)
                {
                    settingsNode.AppendChild(clientType);
                }
                // end block
                setDefaultSettings(ref app, settingsNode, nodeTypeFlag);
            }
            //file types
            XmlNodeList fileTypeNodes = appNode.SelectNodes("Details/FileType");
            if (fileTypeNodes != null && fileTypeNodes.Count != 0)
            {
                app.fileTypes = setFileTypes(fileTypeNodes);
            }
            //icon info
            XmlNodeList iconInfoNodes = appNode.SelectNodes("Details/IconInfo/IconType");
            if (iconInfoNodes != null && iconInfoNodes.Count != 0)
            {
                app.availableIcons = setIconInfo(iconInfoNodes);
            }
            appsList.Add(app);
        }

        return(appsList.ToArray());
    }