示例#1
0
文件: KmlIcon.cs 项目: hnjm/libKml
        public XmlNode ToXml(XmlNode parent)
        {
            XmlNode result = parent.OwnerDocument.CreateNode(XmlNodeType.Element, ElementName, string.Empty);

            if (_id.Length > 0)
            {
                XmlAttribute attId = result.OwnerDocument.CreateAttribute("id");
                attId.Value = _id;
                result.Attributes.Append(attId);
            }
            // child nodes
            XmlNode nodHref = result.OwnerDocument.CreateNode(XmlNodeType.Element, "href", string.Empty);

            nodHref.InnerText = Href;
            result.AppendChild(nodHref);

            if (RefreshMode.Length > 0)
            {
                XmlNode nodRefreshNode = result.OwnerDocument.CreateNode(XmlNodeType.Element, "refreshMode", string.Empty);
                nodRefreshNode.InnerText = RefreshMode;
                result.AppendChild(nodRefreshNode);
            }

            XmlNode nodRefreshInterval = result.OwnerDocument.CreateNode(XmlNodeType.Element, "refreshInterval", string.Empty);

            nodRefreshInterval.InnerText = RefreshInterval.ToString();
            result.AppendChild(nodRefreshInterval);

            if (ViewRefreshMode.Length > 0)
            {
                XmlNode nodViewRefreshMode = result.OwnerDocument.CreateNode(XmlNodeType.Element, "viewRefreshMode", string.Empty);
                nodViewRefreshMode.InnerText = ViewRefreshMode;
                result.AppendChild(nodViewRefreshMode);
            }
            XmlNode nodViewRefreshTime = result.OwnerDocument.CreateNode(XmlNodeType.Element, "viewRefreshTime", string.Empty);

            nodViewRefreshTime.InnerText = ViewRefreshTime.ToString();
            result.AppendChild(nodViewRefreshTime);

            XmlNode nodViewBoundScale = result.OwnerDocument.CreateNode(XmlNodeType.Element, "viewBoundScale", string.Empty);

            nodViewBoundScale.InnerText = ViewBoundScale.ToString();
            result.AppendChild(nodViewBoundScale);

            if (ViewFormat.Length > 0)
            {
                XmlNode nodViewFormat = result.OwnerDocument.CreateNode(XmlNodeType.Element, "viewFormat", string.Empty);
                nodViewFormat.InnerText = ViewFormat;
                result.AppendChild(nodViewFormat);
            }

            if (HttpQuery.Length > 0)
            {
                XmlNode nodHttpQuery = result.OwnerDocument.CreateNode(XmlNodeType.Element, "httpQuery", string.Empty);
                nodHttpQuery.InnerText = HttpQuery;
                result.AppendChild(nodHttpQuery);
            }

            return(result);
        }
示例#2
0
        public override void UpdateSoaRecord(string zoneName, string host, string primaryNsServer, string primaryPerson)
        {
            if (ZoneExists(zoneName))
            {
                //
                if (String.IsNullOrEmpty(primaryPerson))
                {
                    primaryPerson = "hostmaster";
                }
                //
                Connection cn = SetupProviderConnection();

                DNSZone dnsZone = cn.GetZone(zoneName);
                dnsZone.Comments = "Updated by WebsitePanel DNS API at " + DateTime.Now.ToString();

                DNSRecord soaRecord = (dnsZone.Records.Count == 0) ? dnsZone.Records.Add("@", "SOA") : dnsZone.Records[0];
                // Fill record fields with the data
                soaRecord.DataFields[SOA_PRIMARY_NAME_SERVER] = CorrectSOARecord(zoneName, primaryNsServer);
                soaRecord.DataFields[SOA_RESPONSIBLE_PERSON]  = primaryPerson;
                soaRecord.DataFields[SOA_SERIAL_NUMBER]       = UpdateSerialNumber(soaRecord.DataFields[SOA_SERIAL_NUMBER]);
                soaRecord.DataFields[SOA_REFRESH_INTERVAL]    = RefreshInterval.ToString();
                soaRecord.DataFields[SOA_RETRY_DELAY]         = RetryDelay.ToString();
                soaRecord.DataFields[SOA_EXPIRE_LIMIT]        = ExpireLimit.ToString();
                soaRecord.DataFields[SOA_MINIMUM_TTL]         = MinimumTTL.ToString();

                // remove "dumb" internal Name Server
                string internalNameServer = System.Net.Dns.GetHostEntry("LocalHost").HostName;
                dnsZone.Records.Remove(zoneName, "NS", internalNameServer);

                // save zone
                cn.UpdateZone(dnsZone, false);
            }
        }
示例#3
0
 private void RefreshRooms()
 {
     if (Rooms == null ||
         RefreshInterval.CompareTo(RoomsUpdated - DateTime.Now) > 0)
     {
         Rooms = Client.Get <RoomsResponse>("/rooms.json").Rooms;
     }
 }
示例#4
0
        /// <summary>
        /// 속성들을 Xml Attribute로 생성합니다.
        /// </summary>
        /// <param name="writer">Attribute를 쓸 Writer</param>
        public override void GenerateXmlAttributes(System.Xml.XmlWriter writer)
        {
            base.GenerateXmlAttributes(writer);

            if (DataStreamUrl.IsNotWhiteSpace())
            {
                writer.WriteAttributeString("dataStreamUrl", DataStreamUrl.UrlEncode());
            }
            if (RefreshInterval.HasValue)
            {
                writer.WriteAttributeString("refreshInterval", RefreshInterval.ToString());
            }
            if (DataStamp.IsNotWhiteSpace())
            {
                writer.WriteAttributeString("dataStamp", DataStamp);
            }
            if (ShowRTMenuItem.HasValue)
            {
                writer.WriteAttributeString("ShowRTMenuItem", ShowRTMenuItem.GetHashCode().ToString());
            }

            if (AnnRenderDelay.HasValue)
            {
                writer.WriteAttributeString("AnnRenderDelay", AnnRenderDelay.Value.ToString());
            }
            if (AutoScale.HasValue)
            {
                writer.WriteAttributeString("AutoScale", AutoScale.GetHashCode().ToString());
            }

            if (IsEditMode.HasValue)
            {
                writer.WriteAttributeString("IsEditMode", IsEditMode.GetHashCode().ToString());
            }

            if (ConnectNullData.HasValue)
            {
                writer.WriteAttributeString("ConnectNullData", ConnectNullData.GetHashCode().ToString());
            }

            if (_tickMarkAttr != null)
            {
                _tickMarkAttr.GenerateXmlAttributes(writer);
            }
            if (_messageLogAttr != null)
            {
                _messageLogAttr.GenerateXmlAttributes(writer);
            }

            if (_fontAttr != null)
            {
                _fontAttr.GenerateXmlAttributes(writer);
            }
        }
        public override int GetHashCode()
        {
            int hash = 1;

            if (refreshInterval_ != null)
            {
                hash ^= RefreshInterval.GetHashCode();
            }
            hash ^= resourceMonitors_.GetHashCode();
            hash ^= actions_.GetHashCode();
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
 public void MergeFrom(OverloadManager other)
 {
     if (other == null)
     {
         return;
     }
     if (other.refreshInterval_ != null)
     {
         if (refreshInterval_ == null)
         {
             RefreshInterval = new global::Google.Protobuf.WellKnownTypes.Duration();
         }
         RefreshInterval.MergeFrom(other.RefreshInterval);
     }
     resourceMonitors_.Add(other.resourceMonitors_);
     actions_.Add(other.actions_);
     _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
 }
示例#7
0
        public override void AddPrimaryZone(string zoneName, string[] secondaryServers)
        {
            Connection cn = SetupProviderConnection();

            // CREATE PRIMARY DNS ZONE
            string  primaryNameServer = System.Net.Dns.GetHostEntry("LocalHost").HostName;
            DNSZone zoneObj           = cn.CreateZone(zoneName, primaryNameServer, "hostmaster");

            zoneObj.Comments = String.Concat("Created with SolidCP DNS API at ", DateTime.Now);

            // Setup zone data transfer
            if (secondaryServers != null && secondaryServers.Length != 0)
            {
                if (secondaryServers.Length == 1 && secondaryServers[0] == "*")
                {
                    zoneObj.AllowZoneTransfer = "*";
                }
                else
                {
                    zoneObj.AllowZoneTransfer = String.Join(" ", secondaryServers);
                }
            }

            // Update SOA record
            DNSRecord soaRecord = zoneObj.Records[0];

            soaRecord.DataFields[SOA_PRIMARY_NAME_SERVER] = CorrectSOARecord(zoneName, primaryNameServer);
            soaRecord.DataFields[SOA_RESPONSIBLE_PERSON]  = CorrectSOARecord(zoneName, "hostmaster");
            // Issue new serial number for the zone
            soaRecord.DataFields[SOA_SERIAL_NUMBER]    = UpdateSerialNumber(null);
            soaRecord.DataFields[SOA_REFRESH_INTERVAL] = RefreshInterval.ToString();
            soaRecord.DataFields[SOA_RETRY_DELAY]      = RetryDelay.ToString();
            soaRecord.DataFields[SOA_EXPIRE_LIMIT]     = ExpireLimit.ToString();
            soaRecord.DataFields[SOA_MINIMUM_TTL]      = MinimumTTL.ToString();

            // Publish updates are made
            cn.UpdateZone(zoneObj, false);
        }
示例#8
0
        public string GetProperty(string propertyName, string format, CultureInfo formatProvider, UserInfo accessingUser, Scope currentScope, ref bool propertyNotFound)
        {
            string outputFormat = string.Empty;

            if (format == string.Empty)
            {
                outputFormat = "g";
            }

            string lowerPropertyName = propertyName.ToLower();

            if (currentScope == Scope.NoSettings)
            {
                propertyNotFound = true;
                return(PropertyAccess.ContentLocked);
            }
            propertyNotFound = true;

            string result   = string.Empty;
            bool   isPublic = true;

            switch (lowerPropertyName)
            {
            case "tabid":
                propertyNotFound = false;
                result           = (TabID.ToString(outputFormat, formatProvider));
                break;

            case "taborder":
                isPublic         = false;
                propertyNotFound = false;
                result           = (TabOrder.ToString(outputFormat, formatProvider));
                break;

            case "portalid":
                propertyNotFound = false;
                result           = (PortalID.ToString(outputFormat, formatProvider));
                break;

            case "tabname":
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(LocalizedTabName, format);
                break;

            case "isvisible":
                isPublic         = false;
                propertyNotFound = false;
                result           = (PropertyAccess.Boolean2LocalizedYesNo(IsVisible, formatProvider));
                break;

            case "parentid":
                isPublic         = false;
                propertyNotFound = false;
                result           = (ParentId.ToString(outputFormat, formatProvider));
                break;

            case "level":
                isPublic         = false;
                propertyNotFound = false;
                result           = (Level.ToString(outputFormat, formatProvider));
                break;

            case "iconfile":
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(IconFile, format);
                break;

            case "iconfilelarge":
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(IconFileLarge, format);
                break;

            case "disablelink":
                isPublic         = false;
                propertyNotFound = false;
                result           = (PropertyAccess.Boolean2LocalizedYesNo(DisableLink, formatProvider));
                break;

            case "title":
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(Title, format);
                break;

            case "description":
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(Description, format);
                break;

            case "keywords":
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(KeyWords, format);
                break;

            case "isdeleted":
                isPublic         = false;
                propertyNotFound = false;
                result           = (PropertyAccess.Boolean2LocalizedYesNo(IsDeleted, formatProvider));
                break;

            case "url":
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(Url, format);
                break;

            case "skinsrc":
                isPublic         = false;
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(SkinSrc, format);
                break;

            case "containersrc":
                isPublic         = false;
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(ContainerSrc, format);
                break;

            case "tabpath":
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(TabPath, format);
                break;

            case "startdate":
                isPublic         = false;
                propertyNotFound = false;
                result           = (StartDate.ToString(outputFormat, formatProvider));
                break;

            case "enddate":
                isPublic         = false;
                propertyNotFound = false;
                result           = (EndDate.ToString(outputFormat, formatProvider));
                break;

            case "haschildren":
                isPublic         = false;
                propertyNotFound = false;
                result           = (PropertyAccess.Boolean2LocalizedYesNo(HasChildren, formatProvider));
                break;

            case "refreshinterval":
                isPublic         = false;
                propertyNotFound = false;
                result           = (RefreshInterval.ToString(outputFormat, formatProvider));
                break;

            case "pageheadtext":
                isPublic         = false;
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(PageHeadText, format);
                break;

            case "skinpath":
                isPublic         = false;
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(SkinPath, format);
                break;

            case "skindoctype":
                isPublic         = false;
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(SkinDoctype, format);
                break;

            case "containerpath":
                isPublic         = false;
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(ContainerPath, format);
                break;

            case "issupertab":
                isPublic         = false;
                propertyNotFound = false;
                result           = (PropertyAccess.Boolean2LocalizedYesNo(IsSuperTab, formatProvider));
                break;

            case "fullurl":
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(FullUrl, format);
                break;

            case "sitemappriority":
                propertyNotFound = false;
                result           = PropertyAccess.FormatString(SiteMapPriority.ToString(), format);
                break;
            }
            if (!isPublic && currentScope != Scope.Debug)
            {
                propertyNotFound = true;
                result           = PropertyAccess.ContentLocked;
            }
            return(result);
        }
示例#9
0
 private void UpdateRecord(RefreshInterval refreshInterval)
 {
     recordStructuredBuilder.Set(frequencyFieldName, refreshInterval.Frequency.ToString());
     recordStructuredBuilder.Set(sleepDurationFieldName, refreshInterval.SleepDuration.ToString());
 }
示例#10
0
        void ReleaseDesignerOutlets()
        {
            if (AdminEmail != null)
            {
                AdminEmail.Dispose();
                AdminEmail = null;
            }

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

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

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

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

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

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

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

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

            if (ZoneType != null)
            {
                ZoneType.Dispose();
                ZoneType = null;
            }
        }
 internal override int GetDataHashCode()
 {
     return(RefreshInterval.GetHashCode());
 }
 private void UpdateRecord(RefreshInterval refreshInterval)
 {
     recordStructuredBuilder.Set(frequencyFieldName, refreshInterval.Frequency.ToString());
     recordStructuredBuilder.Set(sleepDurationFieldName, refreshInterval.SleepDuration.ToString());
 }