Beispiel #1
0
        public object __construct(ScriptContext /*!*/ context, object timezone_name)
        {
            if (timezone_name != null)
            {
                var zoneName = PHP.Core.Convert.ObjectToString(timezone_name);
                this.timezone = PhpTimeZone.GetTimeZone(zoneName);

                if (this.timezone == null)
                {
                    PhpException.Throw(PhpError.Notice, LibResources.GetString("unknown_timezone", zoneName));
                }
            }
            else
            {
                this.timezone = PhpTimeZone.CurrentTimeZone;
            }

            return(null);
        }
Beispiel #2
0
            public bool Parse(string name, string value, XmlNode node)
            {
                switch (name)
                {
                case "Latitude":
                    Latitude = ConfigUtils.ParseDouble(value, node);
                    break;

                case "Longitude":
                    Longitude = ConfigUtils.ParseDouble(value, node);
                    break;

                case "SunsetZenith":
                    SunsetZenith = ConfigUtils.ParseDouble(value, node);
                    break;

                case "SunriseZenith":
                    SunriseZenith = ConfigUtils.ParseDouble(value, node);
                    break;

                case "TimeZone":
                    if (!string.IsNullOrEmpty(value))
                    {
                        TimeZone = PhpTimeZone.GetTimeZone(value);
                        if (TimeZone == null)
                        {
                            throw new ConfigurationErrorsException(LibResources.GetString("unknown_timezone", value) + ".", node);
                        }
                    }
                    break;

                default:
                    return(false);
                }
                return(true);
            }