SetAttributeValue() публичный Метод

public SetAttributeValue ( string attributeName, object value ) : void
attributeName string
value object
Результат void
		private bool FillConfigurationElementWithData(ConfigurationElement item2Fill, HttpError error, WebVirtualDirectory virtualDir)
		{
			// code
			Int64 statusCode = 0;
			if (!Int64.TryParse(error.ErrorCode, out statusCode)
				|| statusCode < 400 || statusCode > 999)
				return false;

			// sub-code
			Int32 subStatusCode = -1;
			if (!Int32.TryParse(error.ErrorSubcode, out subStatusCode))
				return false;
			//
			if (subStatusCode == 0)
				subStatusCode = -1;

            // correct error content
            string errorContent = error.ErrorContent;
            if (error.HandlerType.Equals("File"))
            {
                if(error.ErrorContent.Length > virtualDir.ContentPath.Length)
                    errorContent = errorContent.Substring(virtualDir.ContentPath.Length);

                errorContent = FileUtils.CorrectRelativePath(errorContent);
            }

			item2Fill.SetAttributeValue(StatusCodeAttribute, statusCode);
			item2Fill.SetAttributeValue(SubStatusCodeAttribute, subStatusCode);
            item2Fill.SetAttributeValue(PathAttribute, errorContent);

			//
			item2Fill.SetAttributeValue(ResponseModeAttribute, error.HandlerType);
			// We are succeeded
			return true;
		}
Пример #2
0
        private void ConvertHeliconZooEngineToElement(HeliconZooEngine item, ConfigurationElement engine)
        {
            engine.SetAttributeValue("name", item.name);
            engine.SetAttributeValue("displayName", item.displayName);
            engine.SetAttributeValue("arguments", item.arguments);
            engine.SetAttributeValue("fullPath", item.fullPath);
            engine.SetAttributeValue("arguments", item.arguments);
            engine.SetAttributeValue("transport", item.transport);
            engine.SetAttributeValue("protocol", item.protocol);
            engine.SetAttributeValue("host", item.host);

            engine.SetAttributeValue("portLower", item.portLower);
            engine.SetAttributeValue("portUpper", item.portUpper);
            engine.SetAttributeValue("maxInstances", item.maxInstances);
            engine.SetAttributeValue("minInstances", item.minInstances);
            engine.SetAttributeValue("timeLimit", item.timeLimit);
            engine.SetAttributeValue("gracefulShutdownTimeout", item.gracefulShutdownTimeout);
            engine.SetAttributeValue("memoryLimit", item.memoryLimit);


            ConfigurationElementCollection envColl = engine.GetChildElement("environmentVariables").GetCollection();
            

            foreach(HeliconZooEnv env in item.environmentVariables)
            {
                ConfigurationElement envElement = envColl.CreateElement();
                envElement.SetAttributeValue("name", env.Name);
                envElement.SetAttributeValue("value", env.Value);
                envColl.Add(envElement);
            }
            
            
        }
		private void FillConfigurationElementWithData(ConfigurationElement item2Fill, HttpHeader header)
		{
			//
			item2Fill.SetAttributeValue(NameAttribute, header.Key);
			item2Fill.SetAttributeValue(ValueAttribute, header.Value);
		}
Пример #4
0
 private void SetSwitchBoardValue(ConfigurationElement switchboardElement, bool enabled)
 {
     switchboardElement.SetAttributeValue("value", enabled ? "Enabled" : "Disabled");
 }
		private void FillConfigurationElementWithData(ConfigurationElement item2Fill, MimeMap mapping)
		{
			if (mapping == null
				|| item2Fill == null
					|| String.IsNullOrEmpty(mapping.MimeType)
						|| String.IsNullOrEmpty(mapping.Extension))
			{
				return;
			}
			//
			item2Fill.SetAttributeValue(MimeTypeAttribute, mapping.MimeType);
			item2Fill.SetAttributeValue(FileExtensionAttribute, mapping.Extension);
		}