示例#1
0
 public void Update()
 {
     if (finished)
     {
         return;
     }
     if (www == null)
     {
         Debug.Log("manifestUri not implemented, quitting.");
         _status  = WWWStatus.NotImplemented;
         finished = true;
         return;
     }
     if (!www.isDone)
     {
         _status = WWWStatus.Downloading;
     }
     if (!www.error.NullOrEmpty())
     {
         Debug.Log($"error: {www.error}");
         _status  = WWWStatus.Error;
         error    = www.error;
         finished = true;
         return;
     }
     if (www.isDone)
     {
         Debug.Log($"Fetching {www.url} completed: {www.text}");
         try
         {
             manifest = IO.ItemFromXmlString <Manifest>(www.text);
             manifest.SetVersion(false);
             if (!manifest.downloadUri.NullOrEmpty())
             {
                 try
                 {
                     manifest.DownloadUri = new Uri(manifest.downloadUri);
                 }
                 catch (Exception e)
                 {
                     Log.Warning($"Error parsing downloadUri: {e.Message}\n\n{e.StackTrace}");
                 }
             }
             _status = WWWStatus.Done;
         }
         catch (Exception e)
         {
             _status = WWWStatus.Error;
             error   = e.Message;
         }
         finished = true;
     }
 }
示例#2
0
        // *********************************************************************
        //  LoadValuesFromConfigurationXml
        //
        /// <summary>
        /// Loads the forums configuration values.
        /// </summary>
        /// <param name="node">XmlNode of the configuration section to parse.</param>
        /// 
        // ***********************************************************************/
        internal void LoadValuesFromConfigurationXml()
        {
            XmlNode node = GetConfigSection("CommunityServer/Core");

            XmlAttributeCollection attributeCollection = node.Attributes;

            // Get the default language
            //

            XmlAttribute att = attributeCollection["defaultLanguage"];
            if(att != null)
                defaultLanguage =att.Value;
            else
                defaultLanguage = "en-US";

            att = attributeCollection["filesPath"];
            if(att != null)
                filesPath = att.Value;
            else
                filesPath = "/";

            att = attributeCollection["applicationKeyOverride"];
            if(att != null)
                applicationKeyOverride = att.Value;

            att = attributeCollection["disableThreading"];
            if(att != null)
                disableBackgroundThreads = bool.Parse(att.Value);

            att = attributeCollection["disableIndexing"];
            if(att != null)
                disableIndexing = bool.Parse(att.Value);

            att = attributeCollection["cacheFactor"];
            if(att != null)
                cacheFactor = Int32.Parse(att.Value);
            else
                cacheFactor = 5;

            att = attributeCollection["disableEmail"];
            if(att != null)
                disableEmail = bool.Parse(att.Value);

            att = attributeCollection["smtpServerConnectionLimit"];
            if(att != null)
                smtpServerConnectionLimit = short.Parse(att.Value);
            else
                smtpServerConnectionLimit = -1;

            att = attributeCollection["enableLatestVersionCheck"];
            if(att != null)
                enableLatestVersionCheck = bool.Parse(att.Value);

            att = attributeCollection["backwardsCompatiblePasswords"];
            if(att != null)
                backwardsCompatiblePasswords = bool.Parse(att.Value);

            att = attributeCollection["textEditorType"];
            if(att != null)
                textEditorType = att.Value;
            else
                textEditorType =  "CommunityServer.Controls.DefaultTextEditor,CommunityServer.Controls";

            att = attributeCollection["applicationOverride"];
            if(att != null)
                applicationOverride = att.Value;
            else
                applicationOverride = null;

            att = attributeCollection["systemType"];
            if(att != null)
                systemType =  (SystemType)Enum.Parse(typeof(SystemType),attributeCollection["systemType"].Value);
            else
                systemType = SystemType.Self;

            att = attributeCollection["wwwStatus"];
            if(att != null)
                _wwwStatus = (WWWStatus)Enum.Parse(typeof(WWWStatus),attributeCollection["wwwStatus"].Value);

            // ��ȡĬ�ϸ������淽ʽ
            //
            att = attributeCollection["AttachmentSaveMode"];
            if(att != null)
            {
                try
                {
                    attachmentSaveMode = (FileSaveMode)Enum.Parse(typeof(FileSaveMode), attributeCollection["AttachmentSaveMode"].Value);
                }
                catch{}
            }

            // ��ȡĬ�ϸ������淽ʽ
            //
            att = attributeCollection["AvatarSaveMode"];
            if(att != null)
            {
                try
                {
                    avatarSaveMode = (FileSaveMode)Enum.Parse(typeof(FileSaveMode), attributeCollection["AvatarSaveMode"].Value);
                }
                catch{}
            }

            // ��ȡ��������·��
            //
            att = attributeCollection["AttachmentsPath"];
            if(att != null)
                attachmentsPath = att.Value;

            // ��ȡͷ�񱣴�·��
            //
            att = attributeCollection["AvatarsPath"];
            if(att != null)
                avatarsPath = att.Value;

            att = attributeCollection["requireSSL"];
            if(att != null)
                requireSSL = bool.Parse(att.Value);

            XmlAttribute roles = attributeCollection["defaultRoles"];
            if(roles != null)
            {
                _defaultRoles = roles.Value.Split(';');
            }

            // Read child nodes
            //
            foreach (XmlNode child in node.ChildNodes)
            {

                if (child.Name == "providers")
                    GetProviders(child, providers);

                if(child.Name == "appLocation")
                    GetAppLocation(child);

                if (child.Name == "extensionModules")
                    GetProviders(child, extensions);

                if(child.Name == "roleConfiguration")
                    GetRoleConfiguration(child);

            }

            //if we do not have an application, create the default one
            if(app == null)
            {
                app = AppLocation.Default();
            }

            if(roleConfiguration == null)
            {
                roleConfiguration = new RolesConfiguration();
            }
        }