Example #1
0
		internal Auth(System.Xml.XmlElement element)
		{
			Token = element.SelectSingleNode("token").InnerText;
			Permissions = (AuthLevel)Enum.Parse(typeof(AuthLevel), element.SelectSingleNode("perms").InnerText, true);
			System.Xml.XmlNode node = element.SelectSingleNode("user");
			_user = new FoundUser(node);
		}
 public object Create(object parent, object configContext, System.Xml.XmlNode section)
 {
     MySettings settings = new MySettings();
     settings.lastUser   = section.SelectSingleNode("lastUser").InnerText;
     settings.lastNumber = int.Parse(section.SelectSingleNode("lastNumber").InnerText);
     return settings;
 }
Example #3
0
        /// <summary>
        /// Resolves resolution in degrees
        /// </summary>
        /// <returns>resolution in degrees</returns>
        public static double GetResolution(System.Xml.XmlDocument oMeta, DataSet oDataset)
        {
            try
            {
                System.Xml.XmlNode oNodeRes = oMeta.SelectSingleNode("//meta/CLASS/CLASS/ATTRIBUTE[@name='SpatialResolution']");
                if (oNodeRes != null)
                {
                    int dX, dY;

                    double dSpatRes = Convert.ToDouble(oNodeRes.Attributes["value"].Value, System.Globalization.CultureInfo.InvariantCulture);
                    double dMinX = Convert.ToDouble(oMeta.SelectSingleNode("//meta/CLASS/CLASS/ATTRIBUTE[@name='BoundingMinX']").Attributes["value"].Value, System.Globalization.CultureInfo.InvariantCulture);
                    double dMinY = Convert.ToDouble(oMeta.SelectSingleNode("//meta/CLASS/CLASS/ATTRIBUTE[@name='BoundingMinY']").Attributes["value"].Value, System.Globalization.CultureInfo.InvariantCulture);
                    double dMaxX = Convert.ToDouble(oMeta.SelectSingleNode("//meta/CLASS/CLASS/ATTRIBUTE[@name='BoundingMaxX']").Attributes["value"].Value, System.Globalization.CultureInfo.InvariantCulture);
                    double dMaxY = Convert.ToDouble(oMeta.SelectSingleNode("//meta/CLASS/CLASS/ATTRIBUTE[@name='BoundingMaxY']").Attributes["value"].Value, System.Globalization.CultureInfo.InvariantCulture);

                    dX = (int)Math.Round((dMaxX - dMinX) / dSpatRes);
                    dY = (int)Math.Round((dMaxY - dMinY) / dSpatRes);

                    return Math.Min((oDataset.Boundary.MaxX - oDataset.Boundary.MinX) / dX, (oDataset.Boundary.MaxY - oDataset.Boundary.MinY) / dY);
                }
            }
            catch
            {
                return 0.0;
            }
            return 0.0;
        }
        /// <summary>
        /// 实现IConfigurationSectionHandler接口Create方法
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="configContext"></param>
        /// <param name="section"></param>
        /// <returns></returns>
        public object Create(Object parent, Object configContext, System.Xml.XmlNode section)
        {
            Permission P_Mission = new Permission();
            XmlNode AppNode = section.SelectSingleNode("ApplicationID");
            P_Mission.ApplicationID = Convert.ToInt32(AppNode.InnerText);
            P_Mission.ApplicationName = AppNode.Attributes["name"].Value;
            AppNode = section.SelectSingleNode("PageCode");
            P_Mission.PageCode = AppNode.InnerText;
            P_Mission.PageCodeName = AppNode.Attributes["name"].Value;

            List<string> Files = Common.GetDirFileList("aspx");
            XmlNodeList ItemNodes = section.SelectNodes("Item");
            foreach (XmlNode Node in ItemNodes)
            {
                PermissionItem Item = new PermissionItem();
                Item.Item_Name = Node.Attributes["name"].Value;
                Item.Item_Value = Convert.ToInt32(Node.Attributes["value"].Value);
                Item.Item_FileList = Node.InnerText.ToLower();               
                P_Mission.ItemList.Add(Item);
                if (Item.Item_FileList.Trim() != "")
                {
                    RemoveFile(Files, Item.Item_FileList.Trim());
                }                
            }
            UpdatePermissionConfig(P_Mission, Files);
            
            return P_Mission;
        }
Example #5
0
            //<Company>
            //    <ID>SiteView</ID>
            //    <Name>SiteView</Name>
            //</Company>
            public Company(System.Xml.XmlNode company):this()
            {
                if (company == null)
                {
                    return;
                }

                this.strID = company.SelectSingleNode("ID").InnerText;
                this.strName = company.SelectSingleNode("Name").InnerText;
            }
		/// <summary>
		/// ITestStep.Execute() implementation
		/// </summary>
		/// <param name='testConfig'>The Xml fragment containing the configuration for this test step</param>
		/// <param name='context'>The context for the test, this holds state that is passed beteen tests</param>
		public void Execute(System.Xml.XmlNode testConfig, Context context)
		{
			RegistryKey rk = null ;
			SqlConnection conn = null ;
			SqlCommand command = null ;
			try
			{
				rk = Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\BizTalk Server\\3.0\\Administration\\");
				string dbname = rk.GetValue("MgmtDBName").ToString();
				string server = rk.GetValue("MgmtDBServer").ToString();
				string connection = "Initial Catalog=" + dbname + " ;Data Source=" + server + ";Integrated Security=SSPI;";
				XmlNode loginNode = testConfig.SelectSingleNode("LoginId");
				XmlNode passwordNode = testConfig.SelectSingleNode("password");

				if(loginNode != null && passwordNode != null)
				{
					connection = "Initial Catalog=" + dbname + " ;Data Source=" + server + ";User Id="+ loginNode.InnerText +";password=" + passwordNode.InnerText + ";";
				}
				else if(loginNode != null && passwordNode == null) //blank password !
				{
					connection = "Initial Catalog=" + dbname + " ;Data Source=" + server + ";User Id="+ loginNode.InnerText +";password=" + string.Empty + ";";
				}

				conn = new SqlConnection(connection);
				conn.Open();

				command = new SqlCommand();
				command.Connection = conn;

				command.CommandType = CommandType.StoredProcedure;
				command.CommandText = "xref_Cleanup";

				command.ExecuteNonQuery();

				context.LogInfo("Cross reference tables were cleared.");
			}
			finally
			{
				if(rk != null)
				{
					rk.Close();
				}

				if(command != null)
				{
					command.Dispose();
				}

                if (null != conn && conn.State != ConnectionState.Closed)
				{
					conn.Close();
					conn.Dispose();
				}
			}
		}
        public override bool SendNotification(System.Xml.XmlNode details, params object[] args)
        {
            try
            {
                SmtpClient c = new SmtpClient(details.SelectSingleNode("//smtp").InnerText);
                c.Credentials = new System.Net.NetworkCredential(details.SelectSingleNode("//username").InnerText, details.SelectSingleNode("//password").InnerText);

                MailAddress from = new MailAddress(
                    details.SelectSingleNode("//from/email").InnerText,
                    details.SelectSingleNode("//from/name").InnerText);

                string subject = details.SelectSingleNode("//subject").InnerText;
                string body = details.SelectSingleNode("//body").InnerText;

                string domain = details.SelectSingleNode("//domain").InnerText;

                int topicId = int.Parse(args[0].ToString());
                int memberId = int.Parse(args[1].ToString());

                uForum.Businesslogic.Topic t = new uForum.Businesslogic.Topic(topicId);

                Member m = new Member(memberId);

                body = string.Format(body,
                    t.Title,
                   "http://" + domain + args[2].ToString());

                if (m.getProperty("bugMeNot").Value.ToString() != "1")
                {
                    MailMessage mm = new MailMessage();
                    mm.Subject = subject;
                    mm.Body = body;

                    mm.To.Add(m.Email);
                    mm.From = from;

                    c.Send(mm);
                }

                SqlConnection conn = new SqlConnection(details.SelectSingleNode("//conn").InnerText);

                conn.Open();

                string insert =
                       "Insert into notificationMarkAsSolution(topicId, memberID, timestamp) values(@topicId, @memberID, getdate())";

                SqlCommand icomm = new SqlCommand(insert, conn);
                icomm.Parameters.AddWithValue("@topicId", topicId);
                icomm.Parameters.AddWithValue("@memberID", m.Id);
                icomm.ExecuteNonQuery();

                conn.Close();
            }
            catch (Exception e)
            {
                umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, -1, "[Notifications]" + e.Message);
            }
            return true;
        }
 /// <summary>
 /// Creates a configuration section handler.
 /// </summary>
 /// <param name="parent"></param>
 /// <param name="configContext">Configuration context object.</param>
 /// <param name="section"></param>
 /// <returns>The created section handler object.</returns>
 public object Create(object parent, object configContext, System.Xml.XmlNode section)
 {
     var configer = new ContainerConfiger
                        {
                            ClassName = section.SelectSingleNode("ClassName").InnerText ?? string.Empty,
                            ConfigFile =
                                section.SelectSingleNode("ConfigFile") == null
                                    ? string.Empty
                                    : section.SelectSingleNode("ConfigFile").InnerText
                        };
     return configer;
 }
Example #9
0
		/// <summary>
		/// ITestStep.Execute() implementation
		/// </summary>
		/// <param name='testConfig'>The Xml fragment containing the configuration for this test step</param>
		/// <param name='context'>The context for the test, this holds state that is passed beteen tests</param>
		public void Execute(System.Xml.XmlNode testConfig, Context context)
		{
			string queueManager = testConfig.SelectSingleNode("QueueManager").InnerText;
			string queue = testConfig.SelectSingleNode("Queue").InnerText;
			string path = testConfig.SelectSingleNode("SourcePath").InnerText;

			var reader = new StreamReader(path);
			string testData = reader.ReadToEnd();

			context.LogData("MSMQ input message:", testData);

			MQSeriesHelper.WriteMessage(queueManager, queue, testData, context);
		}
        public void Upgrade(string projectPath, string userSettingsPath, ref System.Xml.XmlDocument projectDocument, ref System.Xml.XmlDocument userSettingsDocument, ref System.Xml.XmlNamespaceManager nsm)
        {
            //Add DataTypeReferencedTableMappingSchemaName to each Parameter.
            foreach (XmlAttribute node in projectDocument.SelectNodes("//*/@DataTypeReferencedTableMappingName", nsm))
            {
                XmlAttribute tableSchemaName = (XmlAttribute)node.SelectSingleNode("//P:TableMapping[@TableName='{0}']/@SchemaName".FormatString(node.Value), nsm);
                XmlAttribute dataTypeReferencedTableMappingSchemaName = projectDocument.CreateAttribute("DataTypeReferencedTableMappingSchemaName");

                dataTypeReferencedTableMappingSchemaName.Value = tableSchemaName.Value;

                node.OwnerElement.Attributes.Append(dataTypeReferencedTableMappingSchemaName);
            }

            //Add ParentTableMappingSchemaName and ReferencedTableMappingSchemaName to each Foreign Key Mapping.
            foreach (XmlElement node in projectDocument.SelectNodes("//P:ForeignKeyMapping", nsm))
            {
                XmlAttribute parentTableSchemaName = (XmlAttribute)projectDocument.SelectSingleNode("//P:TableMapping[@TableName='{0}']/@SchemaName".FormatString(node.GetAttribute("ParentTableMappingName")), nsm);
                XmlAttribute referencedTableSchemaName = (XmlAttribute)projectDocument.SelectSingleNode("//P:TableMapping[@TableName='{0}']/@SchemaName".FormatString(node.GetAttribute("ReferencedTableMappingName")), nsm);
                XmlAttribute parentTableMappingSchemaName = projectDocument.CreateAttribute("ParentTableMappingSchemaName");
                XmlAttribute referencedTableMappingSchemaName = projectDocument.CreateAttribute("ReferencedTableMappingSchemaName");

                parentTableMappingSchemaName.Value = parentTableSchemaName.Value;
                referencedTableMappingSchemaName.Value = referencedTableSchemaName.Value;

                node.Attributes.Append(parentTableMappingSchemaName);
                node.Attributes.Append(referencedTableMappingSchemaName);
            }

            //Add ReferencedTableMappingSchemaName to each Enumeration Mapping.
            //Rename ReferencedTableName to ReferencedTableMappingName for each Enumeration Mapping
            foreach (XmlAttribute node in projectDocument.SelectNodes("//P:EnumerationMapping/@ReferencedTableName", nsm))
            {
                XmlAttribute tableSchemaName = (XmlAttribute)projectDocument.SelectSingleNode("//P:TableMapping[@TableName='{0}']/@SchemaName".FormatString(node.Value), nsm);
                XmlAttribute tableMappingSchemaName = projectDocument.CreateAttribute("ReferencedTableMappingSchemaName");
                XmlAttribute tableMappingName = projectDocument.CreateAttribute("ReferencedTableMappingName");

                tableMappingSchemaName.Value = tableSchemaName.Value;
                tableMappingName.Value = node.Value;

                node.OwnerElement.Attributes.Append(tableMappingSchemaName);
                node.OwnerElement.Attributes.Append(tableMappingName);
                node.OwnerElement.Attributes.Remove(node);
            }

            //Remove Template.Name attribute.
            foreach (XmlAttribute node in projectDocument.SelectNodes("//P:Template/@Name", nsm))
                node.OwnerElement.Attributes.Remove(node);
        }
Example #11
0
        public void Extract(System.Xml.XmlNode node)
        {
            Description = node.SelectSingleNode("//description").InnerText;

            XmlNode utilityNode = node.SelectSingleNode("//utility_space");

            Options = new NegotiationDescription<NegotiationTopic<NegotiationOption>, NegotiationOption>();
            Options.Extract(utilityNode.SelectSingleNode("//objective"));

            OwnerVariantDict = utilityNode.SelectNodes("//agent").Cast<XmlNode>().Select(x => new
            {
                Owner = x.Attributes["owner"].Value,
                                                                                                              Description = ExtractVariant(x),
                                                                                                              Name = x.Attributes["personality"].Value
            }).GroupBy(x=>x.Owner).ToDictionary(x=>x.Key,x=>x.ToDictionary(y=>y.Name,y=>y.Description));
        }
Example #12
0
        public Event CreateEvent(EventInformation eventInformation, System.Xml.XmlElement eventData)
        {
            FunctionCallDataElement el = new FunctionCallDataElement(eventData);

            uint socket = el.GetSimpleArgumentValueAsUInt(1);

            EndPoint ep = null;
            XmlNode saNode = eventData.SelectSingleNode("/event/arguments[@direction='in']/argument[2]/value/value");
            string family = saNode.SelectSingleNode("field[@name='sin_family']/value/@value").Value;
            if (family == "AF_INET")
            {
                string addr = saNode.SelectSingleNode("field[@name='sin_addr']/value/@value").Value;
                int port = Convert.ToInt32(saNode.SelectSingleNode("field[@name='sin_port']/value/@value").Value);
                ep = new IPEndPoint(IPAddress.Parse(addr), port);
            }

            ConnectResult result;
            if (el.ReturnValueAsInt == 0)
            {
                result = ConnectResult.Success;
            }
            else
            {
                if (el.LastError == 10035)
                    result = ConnectResult.WouldBlock;
                else
                    result = ConnectResult.Error;
            }

            return new ConnectEvent(eventInformation, socket, ep, result);
        }
        public object Create(object parent, object configContext, System.Xml.XmlNode section)
        {
            // set base path for rewriting module to
            // application root
            if (HttpContext.Current.Request.ApplicationPath.EndsWith("/"))
            {
                _RewriteBase = HttpContext.Current.Request.ApplicationPath;
            }
            else
            {
                _RewriteBase = HttpContext.Current.Request.ApplicationPath + "/";
            }

            // process configuration section
            // from web.config
            try
            {
                _XmlSection = section;
                _RewriteOn = Convert.ToBoolean(section.SelectSingleNode("rewriteOn").InnerText);
            }
            catch (Exception ex)
            {
                throw (new Exception("Error while processing RewriteModule configuration section.", ex));
            }
            return this;
        }
        protected override void ProcessDataNode(System.Xml.XmlDocument doc, System.Xml.XmlNamespaceManager namespaces)
        {
            namespaces.AddNamespace("contact", "urn:ietf:params:xml:ns:contact-1.0");

            var children = doc.SelectSingleNode("//contact:creData", namespaces);

            if (children != null)
            {
                XmlNode node;

                // ContactId
                node = children.SelectSingleNode("contact:id", namespaces);
                if (node != null)
                {
                    ContactId = node.InnerText;
                }

                // DateCreated
                node = children.SelectSingleNode("contact:crDate", namespaces);
                if (node != null)
                {
                    DateCreated = node.InnerText;
                }
            }
        }
        public override System.Xml.XmlNode WriteTo(System.Xml.XmlNode parent)
        {
            XmlElement startProcessMethodsElement = parent.SelectSingleNode("child::" + name) as XmlElement;
            if (startProcessMethodsElement != null)
            {
                parent.RemoveChild(startProcessMethodsElement);
            }

            startProcessMethodsElement = parent.OwnerDocument.CreateElement(name);
            parent.AppendChild(startProcessMethodsElement);

            if (values != null)
            {
                foreach (ProcessMethod method in values)
                {
                    XmlElement startMethodElement = parent.OwnerDocument.CreateElement("StartMethod");
                    startMethodElement.InnerText = method.MethodName;
                    startProcessMethodsElement.AppendChild(startMethodElement);

                    XmlAttribute sequenceAttribute = parent.OwnerDocument.CreateAttribute("Sequence");
                    sequenceAttribute.Value = method.Sequence.ToString();
                    startMethodElement.Attributes.Append(sequenceAttribute);

                }
            }

            return null;
        }
Example #16
0
 internal ReturnObj BuildEntity(IList<XmlHelper.ParamList> paramLists, System.Xml.XmlDocument xmlDoc)
 {
     ReturnObj returnObj = new ReturnObj();
     returnObj.Content = "";
     returnObj.Msg = "";
     returnObj.State = 0;
     IList<DataBean> list = new List<DataBean>();
     foreach (var p in paramLists)
     {
         if (p.Name.Equals("xsjls") && p.Value.Equals("1"))
         {
             list = BuildDataBeanEntity(xmlDoc.SelectSingleNode("/cpXML/xsjls"));
         }
     }
     IDao iDao = new Dao.Impl.Dao();
     int i = iDao.Save(list);
     if (i > 0)
     {
         returnObj.State = 1;
         returnObj.Content = "成功提交" + i.ToString() + "条数据!";
         returnObj.Msg = "操作成功!";
     }
     else
     {
         returnObj.State = -1;
         returnObj.Msg = "添加失败请再次尝试!";
     }
     return returnObj;
 }
        public override System.Xml.XmlNode ReadFrom(System.Xml.XmlNode parent)
        {
            values = new List<LongPauseEventListData>();

            XmlElement lpEventsElement = parent.SelectSingleNode("child::" + name) as XmlElement;
            if (lpEventsElement != null)
            {
                XmlNodeList nameElements = lpEventsElement.SelectNodes("child::LpEvent");

                foreach (XmlNode nameNode in nameElements)
                {
                    if (nameNode is XmlElement)
                    {
                        XmlElement eventElement = nameNode as XmlElement;
                        LongPauseEventListData lpEvent = new LongPauseEventListData();

                        if (eventElement != null && eventElement is XmlElement)
                        {
                            lpEvent.Name = eventElement.Attributes.GetNamedItem("Name").Value;
                            lpEvent.Enabled = Boolean.Parse(eventElement.Attributes.GetNamedItem("Enabled").Value);
                            lpEvent.ReasonCode = Int32.Parse(eventElement.Attributes.GetNamedItem("ReasonCode").Value);

                            values.Add(lpEvent);
                        }

                    }
                }
            }

            return null;
        }
Example #18
0
        protected override void Parse(System.Xml.XmlDocument doc)
        {
            GenerationContext.NamespaceManager = XmlUtils.BuildNamespaceManager(doc, "http://www.workshare.com/docxmapping");
            XmlElement rootNode = doc.SelectSingleNode("/x:DocxMappingDefinition", GenerationContext.NamespaceManager) as XmlElement;
            GenerationContext.DocObjectsSourceLocation = XmlUtils.GetOptionalAttribute(rootNode, "DocObjectsSourceLocation");
            GenerationContext.TargetSourceProject = XmlUtils.GetOptionalAttribute(rootNode, "TargetSourceProject");
            GenerationContext.TargetNamespace = XmlUtils.GetOptionalAttribute(rootNode, "TargetNamespace");
            GenerationContext.LoadSchema(rootNode.Attributes["SchemaPath"].Value);

            ParseNamespacePrefixes(rootNode);

            projUpdater = new CSProjUpdater(GenerationContext.TargetSourceProject);

            foreach (XmlNode xn in doc.SelectNodes("/x:DocxMappingDefinition/x:NodeToSimpleContentTypeMapping", GenerationContext.NamespaceManager))
            {
                NodeHandlerDefinition newnh = new NodeHandlerDefinition(xn as XmlElement);
                m_nodeHandlers.Add(newnh);
                projUpdater.AddFile(newnh.GetOutputFileName());
            }

            foreach (XmlNode xn in doc.SelectNodes("/x:DocxMappingDefinition/x:NodeToTypeMapping", GenerationContext.NamespaceManager))
            {
                NodeHandlerDefinition newnh = new NodeHandlerDefinition(xn as XmlElement);
                m_nodeHandlers.Add(newnh);
                projUpdater.AddFile(newnh.GetOutputFileName());
            }

        }
        public override System.Xml.XmlNode Decrypt(System.Xml.XmlNode encryptedNode)
        {
            //note: in order to verify the protected configuration route without going via s3, use the following line
            //string xmlRaw = "<sampleConfig><settings sampleConfigSetting=\"Sucess. This Setting came from code.\"></settings></sampleConfig>";

            //setup parameters we need to know (note: this could be extended to be further provider-based)
            string awsAccessKey, awsSecretKey, bucketName, objectKey;

            //collect parameter values
            XmlNode settingsNode = encryptedNode.SelectSingleNode("/EncryptedData/s3ProviderInfo");
            awsAccessKey = settingsNode.Attributes["s3AccessKey"].Value;
            awsSecretKey = settingsNode.Attributes["s3SecretKey"].Value;
            bucketName = settingsNode.Attributes["s3BucketName"].Value;
            objectKey = settingsNode.Attributes["objectKey"].Value;

            //get value from s3
            var service = new S3Service
            {
                AccessKeyID = awsAccessKey,
                SecretAccessKey = awsSecretKey,
                UseSsl = true,
                UseSubdomains = true
            };
            string xmlRaw = service.GetObjectString(bucketName, objectKey);

            //cast to XmlDocument
            var doc = new XmlDocument();
            doc.LoadXml(xmlRaw);

            //return node
            return doc.ChildNodes[0];
        }
Example #20
0
 protected string GetConfigValue(System.Xml.XmlNode section, string xPath)
 {
     string result = "";
     XmlNode node = section.SelectSingleNode(xPath);
     result = node.InnerText;
     return result;
 }
Example #21
0
        public void FromXml(System.Xml.XmlNode node)
        {
            _lastBuildConfiguration = AGS.Types.BuildConfiguration.Unknown;

            // Allow for earlier versions of the XML
            if (node != null && node.SelectSingleNode("WorkspaceState") != null)
                SerializeUtils.DeserializeFromXML(this, node);
        }
        public static bool HasDataSet(System.Xml.XmlDocument doc, string dataSetName)
        {
            dataSetName = XmlTools.XmlEscape(dataSetName);

            System.Xml.XmlNamespaceManager nsmgr = GetReportNamespaceManager(doc);
            System.Xml.XmlNode xnProc = doc.SelectSingleNode("/dft:Report/dft:DataSets/dft:DataSet[@Name=\"" + dataSetName + "\"]", nsmgr);

            return xnProc != null;
        }
Example #23
0
        public override void Configure(System.Xml.XmlElement element)
        {
            base.Configure(element);

            if (element.HasAttribute("availableMemoryLimit"))
            {
                availableMemoryLimit = Single.Parse(element.GetAttribute("availableMemoryLimit"));
            }
            else
            {
                availableMemoryLimit = 96.0f;
            }

            if (element.HasAttribute("miserInterval"))
            {
                miserInterval = TimeSpan.Parse(element.GetAttribute("miserInterval"));
            }
            else
            {
                miserInterval = TimeSpan.FromMinutes(1);
            }

            XmlElement volatileElement = (XmlElement) element.SelectSingleNode("volatileCache");
            if (volatileElement.HasAttribute("type"))
            {
                Type type = Type.GetType(volatileElement.GetAttribute("type"));
                volatileCache = (CacheBase) type.Assembly.CreateInstance(type.FullName);
                volatileCache.Configure(volatileElement);
            }

            XmlElement persistentElement = (XmlElement) element.SelectSingleNode("persistentCache");
            if (persistentElement.HasAttribute("type"))
            {
                Type type = Type.GetType(persistentElement.GetAttribute("type"));
                persistentCache = (CacheBase) type.Assembly.CreateInstance(type.FullName);
                persistentCache.Configure(persistentElement);
            }

            Type cacheBaseType = typeof(CacheBase);
            getCachedItemMethod = cacheBaseType.GetMethod("GetCachedItem", BindingFlags.Instance | BindingFlags.NonPublic);
            purgeMethod = cacheBaseType.GetMethod("Purge", BindingFlags.Instance | BindingFlags.NonPublic);

            miserTimer = new Timer(new TimerCallback(MiserTimerCallback), null, miserInterval, miserInterval);
        }
Example #24
0
        /// <summary>
        /// Creates a configuration section handler.
        /// </summary>
        /// <param name="parent">Parent object.</param>
        /// <param name="configContext">Configuration context object.</param>
        /// <param name="section">Section XML node.</param>
        /// <returns>The created section handler object.</returns>
        public object Create(object parent, object configContext, System.Xml.XmlNode section)
        {
            var config = new EzyConfig();
            var dynamicDiscoveryNode = section.SelectSingleNode("DynamicDiscovery");
            if (dynamicDiscoveryNode != null && dynamicDiscoveryNode.Attributes != null)
            {
                var attribute = dynamicDiscoveryNode.Attributes["Enabled"];
                if (attribute != null)
                    config.DynamicDiscovery = Convert.ToBoolean(attribute.Value);
            }

            var engineNode = section.SelectSingleNode("Engine");
            if (engineNode != null && engineNode.Attributes != null)
            {
                var attribute = engineNode.Attributes["Type"];
                if (attribute != null)
                    config.EngineType = attribute.Value;
            }

            var startupNode = section.SelectSingleNode("Startup");
            if (startupNode != null && startupNode.Attributes != null)
            {
                var attribute = startupNode.Attributes["IgnoreStartupTasks"];
                if (attribute != null)
                    config.IgnoreStartupTasks = Convert.ToBoolean(attribute.Value);
            }

            var themeNode = section.SelectSingleNode("Themes");
            if (themeNode != null && themeNode.Attributes != null)
            {
                var attribute = themeNode.Attributes["basePath"];
                if (attribute != null)
                    config.ThemeBasePath = attribute.Value;
            }

            var userAgentStringsNode = section.SelectSingleNode("UserAgentStrings");
            if (userAgentStringsNode != null && userAgentStringsNode.Attributes != null)
            {
                var attribute = userAgentStringsNode.Attributes["databasePath"];
                if (attribute != null)
                    config.UserAgentStringsPath = attribute.Value;
            }
            return config;
        }
Example #25
0
File: t35.cs Project: nlhepler/mono
        public object Create(object parent, object configContext, System.Xml.XmlNode section)
        {
            List<System.Xml.XmlNode> sectionList = new List<System.Xml.XmlNode>();
            foreach (System.Xml.XmlNode sectionXmlNode in section.SelectSingleNode("mynodes").ChildNodes)
            {
                sectionList.Add(sectionXmlNode);
            }

            return sectionList;
        }
        public bool Execute(string packageName, System.Xml.XmlNode xmlData)
        {

             string statement = xmlData.SelectSingleNode("//Sqlserver").InnerText;

             if (umbraco.GlobalSettings.DbDSN.ToLower().Contains("datalayer=mysql"))
             {
                 statement = xmlData.SelectSingleNode("//MySQL").InnerText;
             }
             else if (umbraco.GlobalSettings.DbDSN.ToLower().Contains("vistadb,vistadb"))
             {
                 statement = xmlData.SelectSingleNode("//VistaDB").InnerText;
             }

             ISqlHelper SqlHelper = DataLayerHelper.CreateSqlHelper(umbraco.GlobalSettings.DbDSN);
             SqlHelper.ExecuteNonQuery(statement);

             return true;
        }
 public object Create(object parent, object configContext, System.Xml.XmlNode section)
 {
     XmlSerializer ser = new XmlSerializer(typeof(TypeResolver));
     TypeResolver config = null;
     using (XmlNodeReader rd = new XmlNodeReader(section.SelectSingleNode("TypeResolver")))
     {
         rd.Read();
         config = (TypeResolver)ser.Deserialize(rd);
     }
     return config;
 }
        public object Create(object parent, object configContext, System.Xml.XmlNode section)
        {
            // parse "security" section
            XmlNode nodeSecurity = section.SelectSingleNode("security");
            if (nodeSecurity == null)
                throw new Exception("'websitepanel/security' section is missing");

            security = new SecuritySettings();
            security.ParseSection(nodeSecurity);

            return null;
        }
        public static string GetDataSetDefinition(System.Xml.XmlDocument doc, string dataSetName)
        {
            dataSetName = XmlTools.XmlEscape(dataSetName);

            if (HasDataSet(doc, dataSetName))
            {
                System.Xml.XmlNamespaceManager nsmgr = GetReportNamespaceManager(doc);
                System.Xml.XmlNode xnSQL = doc.SelectSingleNode("/dft:Report/dft:DataSets/dft:DataSet[@Name=\"" + dataSetName + "\"]/dft:Query/dft:CommandText", nsmgr);
                return xnSQL.InnerText;
            }

            return null;
        }
Example #30
0
        static bool callback(System.Xml.XmlNode result)
        {
            bool KEEP_GOING = true;
            bool STOP_RUNNING = false;

            if (result.Name != "test") { return KEEP_GOING; }

            if (result.Attributes["result"].Value == "Fail")
            {
                Console.WriteLine("The test {0} has damaged your karma. The following stack trace has been declared to be at fault", result.Attributes["name"].Value);
                Console.WriteLine(result.SelectSingleNode("failure/message").InnerText);
                Console.WriteLine(result.SelectSingleNode("failure/stack-trace").InnerText);
                Console.WriteLine(result.OuterXml);
                TEST_FAILED = 1;
                return STOP_RUNNING;
            }
            else
            {
                Console.WriteLine("{0} has expanded your awareness", result.Attributes["name"].Value);
                return STOP_RUNNING;
            }
        }