예제 #1
0
파일: TimeZones.cs 프로젝트: ikvm/Phalanger
        /// <summary>
        /// Gets/sets/resets legacy configuration setting "date.timezone".
        /// </summary>
        internal static object GsrTimeZone(LibraryConfiguration /*!*/ local, LibraryConfiguration /*!*/ @default, object value, IniAction action)
        {
            string result = (local.Date.TimeZone != null) ? local.Date.TimeZone.StandardName : null;

            switch (action)
            {
            case IniAction.Set:
            {
                string       name = Core.Convert.ObjectToString(value);
                TimeZoneInfo zone = GetTimeZone(name);

                if (zone == null)
                {
                    PhpException.Throw(PhpError.Warning, LibResources.GetString("unknown_timezone", name));
                }
                else
                {
                    local.Date.TimeZone = zone;
                }
                break;
            }

            case IniAction.Restore:
                local.Date.TimeZone = @default.Date.TimeZone;
                break;
            }
            return(result);
        }
예제 #2
0
        private LibraryConfiguration(LibraryConfiguration source)
        {
            this.Highlighting = source.Highlighting.DeepCopy();
            this.Date         = source.Date.DeepCopy();
#if !SILVERLIGHT
            this.Mailer        = source.Mailer.DeepCopy();
            this.Session       = source.Session.DeepCopy();
            this.Serialization = source.Serialization.DeepCopy();
#endif
        }
예제 #3
0
        public static PhpReference Unserialize(PHP.Core.Reflection.DTypeDesc caller, PhpBytes bytes)
        {
            if (bytes == null || bytes.Length == 0)
            {
                return(new PhpReference(false));
            }

            LibraryConfiguration config = LibraryConfiguration.GetLocal(ScriptContext.CurrentContext);

            return(config.Serialization.DefaultSerializer.Deserialize(bytes, caller));
        }
예제 #4
0
        public static bool Mail(string to, string subject, string message, string additionalHeaders)
        {
            // to and subject cannot contain newlines, replace with spaces
            to      = (to != null) ? to.Replace("\r\n", " ").Replace('\n', ' ') : "";
            subject = (subject != null) ? subject.Replace("\r\n", " ").Replace('\n', ' ') : "";

            Debug.WriteLine("MAILER", "mail('{0}','{1}','{2}','{3}')", to, subject, message, additionalHeaders);

            // get current configuration, we need some fields for mailing
            LibraryConfiguration config = LibraryConfiguration.Local;

            // set SMTP server we are using
            RawSmtpClient client = new RawSmtpClient(config.Mailer.SmtpServer, config.Mailer.SmtpPort);

            // X-PHP-Originating-Script
            if (config.Mailer.AddXHeader)
            {
                additionalHeaders = "X-PHP-Originating-Script: 1:" + ScriptContext.CurrentContext.MainScriptFile.RelativePath.Path + "\n" + additionalHeaders;
            }

            try
            {
                client.Connect();
                client.SendMessage(
                    config.Mailer.DefaultFromHeader, to,
                    subject,
                    additionalHeaders,
                    message);
                return(true);
            }
            catch (Exception e)
            {
                string    error_message = e.Message;
                Exception inner         = e;
                while ((inner = inner.InnerException) != null)
                {
                    error_message += "; " + inner.Message;
                }

                PhpException.Throw(PhpError.Warning, LibResources.GetString("cannot_send_email", error_message)
#if DEBUG
                                   + "\n\n" + e.StackTrace
#endif
                                   );
                return(false);
            }
            finally
            {
                client.Disconnect();
            }
        }
예제 #5
0
        /// <summary>
        /// Writes Phalanger BCL legacy options and their values to XML text stream.
        /// Skips options whose values are the same as default values of Phalanger.
        /// </summary>
        /// <param name="writer">XML writer.</param>
        /// <param name="options">A hashtable containing PHP names and option values. Consumed options are removed from the table.</param>
        /// <param name="writePhpNames">Whether to add "phpName" attribute to option nodes.</param>
        public static void LegacyOptionsToXml(XmlTextWriter writer, Hashtable options, bool writePhpNames)         // GENERICS:<string,string>
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }

            LibraryConfiguration local = new LibraryConfiguration();
            PhpIniXmlWriter      ow    = new PhpIniXmlWriter(writer, options, writePhpNames);

            ow.StartSection("session");
            ow.WriteOption("session.cache_limiter", "CacheLimiter", "no-cache", PhpSession.DefaultCacheLimiter);
            ow.WriteOption("session.cache_expire", "CacheExpire", 180, PhpSession.DefaultCacheExpire);
            ow.WriteOption("session.serialize_handler", "Serializer", "php", local.Session.Serializer.Name);
            ow.WriteOption("session.gc_probability", "GcProbability", 1, local.Session.GcProbability);
            ow.WriteOption("session.gc_divisor", "GcDivisor", 100, local.Session.GcDivisor);
            ow.WriteOption("session.gc_maxlifetime", "GcMaxLifetime", 1440, local.Session.GcMaxLifetime);
            ow.WriteOption("session.save_path", "SavePath", "", local.Session.SavePath);
            ow.WriteOption("session.cookie_lifetime", "CookieLifetime", 0, PhpSession.DefaultCookieLifetime);
            ow.WriteOption("session.cookie_path", "CookiePath", "/", PhpSession.DefaultCookiePath);
            ow.WriteOption("session.cookie_domain", "CookieDomain", "", PhpSession.DefaultCookieDomain);
            ow.WriteOption("session.cookie_secure", "CookieSecure", false, PhpSession.DefaultCookieSecure);

            ow.StartSection("mailer");
            ow.WriteOption("SMTP", "SmtpServer", "localhost", local.Mailer.SmtpServer);
            ow.WriteOption("smtp_port", "SmtpPort", 25, local.Mailer.SmtpPort);
            ow.WriteOption("sendmail_from", "DefaultFromHeader", null, local.Mailer.DefaultFromHeader);

            ow.StartSection("highlighting");
            ow.WriteOption("highlight.bg", "Background", "#FFFFFF", local.Highlighting.Background);
            ow.WriteOption("highlight.string", "String", "#DD0000", local.Highlighting.String);
            ow.WriteOption("highlight.comment", "Comment", "#FF8000", local.Highlighting.Comment);
            ow.WriteOption("highlight.keyword", "Keyword", "#007700", local.Highlighting.Keyword);
            ow.WriteOption("highlight.html", "Html", "#000000", local.Highlighting.Html);
            ow.WriteOption("highlight.default", "Default", "#0000BB", local.Highlighting.Default);

            ow.StartSection("date");
            ow.WriteOption("date.default_latitude", "Latitude", 31.7667, local.Date.Latitude);
            ow.WriteOption("date.default_longitude", "Longitude", 35.2333, local.Date.Longitude);
            ow.WriteOption("date.sunrise_zenith", "SunriseZenith", 90.83, local.Date.SunriseZenith);
            ow.WriteOption("date.sunset_zenith", "SunsetZenith", 90.83, local.Date.SunsetZenith);
            ow.WriteOption("date.timezone", "TimeZone", null, local.Date.TimeZone.StandardName);

            ow.WriteEnd();
        }
예제 #6
0
        /// <summary>
        /// Parses a configuration section belonging to the library.
        /// </summary>
        /// <param name="result">A library configuration context.</param>
        /// <param name="context">The context of the configuration created by Phalanger Core.</param>
        /// <param name="section">A XML node containing the configuration or its part.</param>
        /// <returns>Updated library configuration context.</returns>
        protected override ConfigContextBase ParseConfig(ConfigContextBase result, PhpConfigurationContext context, XmlNode section)
        {
            LibraryConfiguration local = (LibraryConfiguration)result.Local;

            // parses XML tree:
            foreach (XmlNode node in section.ChildNodes)
            {
                if (node.NodeType == XmlNodeType.Element)
                {
                    switch (node.Name)
                    {
                    case "mailer":
                        ConfigUtils.ParseNameValueList(node, context, local.Mailer);
                        break;

                    case "highlighting":
                        ConfigUtils.ParseNameValueList(node, context, local.Highlighting);
                        break;

                    case "session":

                        // allowed only in web application configuration:
                        if (HttpContext.Current == null)
                        {
                            throw new ConfigurationErrorsException(CoreResources.GetString("web_only_option"), node);
                        }

                        ConfigUtils.ParseNameValueList(node, context, local.Session);
                        break;

                    case "date":
                        ConfigUtils.ParseNameValueList(node, context, local.Date);
                        break;

                    case "serialization":
                        ConfigUtils.ParseNameValueList(node, context, local.Serialization);
                        break;

                    default:
                        throw new ConfigUtils.InvalidNodeException(node);
                    }
                }
            }

            return(result);
        }
예제 #7
0
파일: TimeZones.cs 프로젝트: ikvm/Phalanger
            /// <summary>
            /// Finds out the time zone in the way how PHP does.
            /// </summary>
            private static TimeZoneInfo DetermineTimeZone(out Func <TimeZoneInfo, bool> changedFunc)
            {
                TimeZoneInfo result;

                // check environment variable:
#if !SILVERLIGHT
                string env_tz = Environment.GetEnvironmentVariable(EnvVariableName);
                if (!String.IsNullOrEmpty(env_tz))
                {
                    result = GetTimeZone(env_tz);
                    if (result != null)
                    {
                        // recheck the timezone only if the environment variable changes
                        changedFunc = (timezone) => !String.Equals(timezone.StandardName, Environment.GetEnvironmentVariable(EnvVariableName), StringComparison.OrdinalIgnoreCase);
                        // return the timezone set in environment
                        return(result);
                    }

                    PhpException.Throw(PhpError.Notice, LibResources.GetString("unknown_timezone_env", env_tz));
                }
#endif

                // check configuration:
                LibraryConfiguration config = LibraryConfiguration.Local;
                if (config.Date.TimeZone != null)
                {
                    // recheck the timezone only if the local configuration changes, ignore the environment variable from this point at all
                    changedFunc = (timezone) => LibraryConfiguration.Local.Date.TimeZone != timezone;
                    return(config.Date.TimeZone);
                }

                // convert current system time zone to PHP zone:
                result = SystemToPhpTimeZone(TimeZoneInfo.Local);

                // UTC:
                if (result == null)
                {
                    result = DateTimeUtils.UtcTimeZone;// GetTimeZone("UTC");
                }
                PhpException.Throw(PhpError.Strict, LibResources.GetString("using_implicit_timezone", result.Id));

                // recheck the timezone when the TimeZone in local configuration is set
                changedFunc = (timezone) => LibraryConfiguration.Local.Date.TimeZone != null;
                return(result);
            }
예제 #8
0
        public static object HighlightString(string str, bool returnHighlighted)
        {
            if (str == null)
            {
                str = "";
            }

            ScriptContext        context = ScriptContext.CurrentContext;
            LibraryConfiguration config  = LibraryConfiguration.GetLocal(context);

            TextWriter output = returnHighlighted ? new StringWriter() : context.Output;

            bool success = Highlight(str, output, config);

            if (returnHighlighted)
            {
                return(output.ToString());
            }
            else
            {
                return(success);
            }
        }
예제 #9
0
        ///// <summary>
        ///// Gets a list of implemented extensions.
        ///// </summary>
        //public override string[] ImplementedExtensions
        //{
        //    get { return new string[] { ExtStandard, ExtCore,/* ExtCalendar,*/ ExtCType, ExtSession, ExtTokenizer, ExtDate, ExtPcre, ExtEreg, ExtJson, ExtHash, ExtSpl }; }
        //}

        /// <summary>
        /// Called by the Core after the library is loaded.
        /// </summary>
        protected override void Loaded(PhpLibraryAttribute assemblyAttribute, LibraryConfigStore config)
        {
            base.Loaded(assemblyAttribute, config);
            singleton = this;

#if !SILVERLIGHT
            LibraryConfiguration.RegisterLegacyOptions();

            // registers session handlers:
            SessionHandlers.RegisterHandler(PhpSessionHandler.Default);
            SessionHandlers.RegisterHandler(PhpUserSessionHandler.Default);
            SessionHandlers.RegisterHandler(AspNetThruSessionHandler.Default);

            // registers serializers:
            Serializers.RegisterSerializer(PhpSerializer.Default);
            //Serializers.RegisterSerializer(PhalangerSerializer.Default);
            Serializers.RegisterSerializer(new ContextualSerializer("dotnet", delegate(PHP.Core.Reflection.DTypeDesc caller /*ignored*/)
            {
                return(new BinaryFormatter(
                           null,
                           new StreamingContext(StreamingContextStates.Persistence, new SerializationContext())));
            }));
#endif
        }
예제 #10
0
        public static bool Highlight(string /*!*/ code, TextWriter /*!*/ output, LibraryConfiguration /*!*/ config)
        {
            if (code == null)
            {
                throw new ArgumentNullException("code");
            }
            if (output == null)
            {
                throw new ArgumentNullException("output");
            }
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            Tokenizer.Features features = Tokenizer.Features.Default | Tokenizer.Features.ContextKeywords;

            Tokenizer tokenizer = new Tokenizer(new StringReader(code), features);
            Tokens    token;

            output.Write("<pre>");
            output.Write("<span style='color:");
            output.Write(config.Highlighting.Background);
            output.Write("'>");

            for (; ;)
            {
                token = tokenizer.GetNextToken();

                if (token == Tokens.ERROR || token == Tokens.EOF)
                {
                    break;
                }

                string fcolor  = config.Highlighting.Default;
                bool   is_bold = false;

                switch (tokenizer.TokenCategory)
                {
                case TokenCategory.Unknown:
                case TokenCategory.Text:
                case TokenCategory.Delimiter:
                case TokenCategory.Number:
                case TokenCategory.Identifier:
                case TokenCategory.Operator:
                case TokenCategory.WhiteSpace:
                    break;

                case TokenCategory.Html:
                    fcolor = config.Highlighting.Html;
                    break;

                case TokenCategory.Comment:
                case TokenCategory.LineComment:
                    fcolor = config.Highlighting.Comment;
                    break;

                case TokenCategory.ScriptTags:
                    fcolor = config.Highlighting.ScriptTags;
                    break;

                case TokenCategory.Keyword:
                    fcolor = config.Highlighting.Keyword;
                    break;

                case TokenCategory.StringCode:
                    is_bold = true;
                    fcolor  = config.Highlighting.String;
                    break;

                case TokenCategory.String:
                    fcolor = config.Highlighting.String;
                    break;
                }

                output.Write("<span style='color:");
                output.Write(fcolor);
                output.Write("'>");
                if (is_bold)
                {
                    output.Write("<b>");
                }

                output.Write(HttpUtility.HtmlEncode(tokenizer.TokenText));

                if (is_bold)
                {
                    output.Write("</b>");
                }
                output.Write("</span>");
            }

            output.Write("</pre>");
            return(token != Tokens.ERROR);
        }
예제 #11
0
        public static PhpBytes Serialize(PHP.Core.Reflection.DTypeDesc caller, object variable)
        {
            LibraryConfiguration config = LibraryConfiguration.GetLocal(ScriptContext.CurrentContext);

            return(config.Serialization.DefaultSerializer.Serialize(variable, caller));
        }
예제 #12
0
		public static bool Highlight(string/*!*/ code, TextWriter/*!*/ output, LibraryConfiguration/*!*/ config)
		{
			if (code == null)
				throw new ArgumentNullException("code");
			if (output == null)
				throw new ArgumentNullException("output");
			if (config == null)
				throw new ArgumentNullException("config");

			Tokenizer.Features features = Tokenizer.Features.Default | Tokenizer.Features.ContextKeywords;

			Tokenizer tokenizer = new Tokenizer(new StringReader(code), features);
			Tokens token;

			output.Write("<pre>");
			output.Write("<span style='color:");
			output.Write(config.Highlighting.Background);
			output.Write("'>");

			for (; ; )
			{
				token = tokenizer.GetNextToken();

				if (token == Tokens.ERROR || token == Tokens.EOF) break;

				string fcolor = config.Highlighting.Default;
				bool is_bold = false;

				switch (tokenizer.TokenCategory)
				{
					case TokenCategory.Unknown:
					case TokenCategory.Text:
					case TokenCategory.Delimiter:
					case TokenCategory.Number:
					case TokenCategory.Identifier:
					case TokenCategory.Operator:
					case TokenCategory.WhiteSpace:
						break;

					case TokenCategory.Html:
						fcolor = config.Highlighting.Html;
						break;

					case TokenCategory.Comment:
					case TokenCategory.LineComment:
						fcolor = config.Highlighting.Comment;
						break;

					case TokenCategory.ScriptTags:
						fcolor = config.Highlighting.ScriptTags;
						break;

					case TokenCategory.Keyword:
						fcolor = config.Highlighting.Keyword;
						break;

					case TokenCategory.StringCode:
						is_bold = true;
						fcolor = config.Highlighting.String;
						break;

					case TokenCategory.String:
						fcolor = config.Highlighting.String;
						break;
				}

				output.Write("<span style='color:");
				output.Write(fcolor);
				output.Write("'>");
				if (is_bold) output.Write("<b>");

				output.Write(HttpUtility.HtmlEncode(tokenizer.TokenText));

				if (is_bold) output.Write("</b>");
				output.Write("</span>");
			}

			output.Write("</pre>");
			return token != Tokens.ERROR;
		}
예제 #13
0
		/// <summary>
		/// GSR routine for "session.serialize_handler" configuration option.
		/// </summary>
		internal static object GsrSerializer(LibraryConfiguration/*!*/ local, LibraryConfiguration/*!*/ @default, object value, IniAction action)
		{
			string result = local.Session.Serializer.Name;

			switch (action)
			{
				case IniAction.Set:
					{
						string name = Core.Convert.ObjectToString(value);
						Serializer serializer = Serializers.GetSerializer(name);

						if (serializer == null)
						{
							PhpException.Throw(PhpError.Warning, LibResources.GetString("unknown_serializer", name));
						}
						else
						{
							local.Session.Serializer = serializer;
						}
						break;
					}

				case IniAction.Restore:
					local.Session.Serializer = @default.Session.Serializer;
					break;
			}

			return result;
		}
예제 #14
0
		/// <summary>
		/// Decides whether to perform collection or not.
		/// </summary>
		private static bool DoCollection(LibraryConfiguration config)
		{
			if (config.Session.GcProbability <= 0) return false;

			double rand = (double)config.Session.GcDivisor * PhpMath.Generator.NextDouble();
			return rand < config.Session.GcProbability;
		}
예제 #15
0
        /// <summary>
        /// Gets, sets, or restores a value of a legacy configuration option.
        /// </summary>
        private static object GetSetRestore(LocalConfiguration config, string option, object value, IniAction action)
        {
            LibraryConfiguration local    = (LibraryConfiguration)config.GetLibraryConfig(LibraryDescriptor.Singleton);
            LibraryConfiguration @default = DefaultLocal;

            switch (option)
            {
            case "sendmail_from": return(PhpIni.GSR(ref local.Mailer.DefaultFromHeader, @default.Mailer.DefaultFromHeader, value, action));

            case "SMTP": return(PhpIni.GSR(ref local.Mailer.SmtpServer, @default.Mailer.SmtpServer, value, action));

            case "smtp_port": return(PhpIni.GSR(ref local.Mailer.SmtpPort, @default.Mailer.SmtpPort, value, action));

            case "mail.add_x_header": return(PhpIni.GSR(ref local.Mailer.AddXHeader, @default.Mailer.AddXHeader, value, action));

            case "highlight.bg": return(PhpIni.GSR(ref local.Highlighting.Background, @default.Highlighting.Background, value, action));

            case "highlight.comment": return(PhpIni.GSR(ref local.Highlighting.Comment, @default.Highlighting.Comment, value, action));

            case "highlight.default": return(PhpIni.GSR(ref local.Highlighting.Default, @default.Highlighting.Default, value, action));

            case "highlight.html": return(PhpIni.GSR(ref local.Highlighting.Html, @default.Highlighting.Html, value, action));

            case "highlight.keyword": return(PhpIni.GSR(ref local.Highlighting.Keyword, @default.Highlighting.Keyword, value, action));

            case "highlight.string": return(PhpIni.GSR(ref local.Highlighting.String, @default.Highlighting.String, value, action));

            case "session.serialize_handler": return(PhpSession.GsrSerializer(local, @default, value, action));

            case "session.cache_expire": return(PhpSession.GsrCacheExpire(value, action));

            case "session.cache_limiter": return(PhpSession.GsrCacheLimiter(value, action));

            case "session.save_path": return(PhpIni.GSR(ref local.Session.SavePath, @default.Session.SavePath, value, action));

            case "session.gc_maxlifetime": return(PhpIni.GSR(ref local.Session.GcMaxLifetime, @default.Session.GcMaxLifetime, value, action));

            case "session.gc_probability": return(PhpIni.GSR(ref local.Session.GcProbability, @default.Session.GcProbability, value, action));

            case "session.gc_divisor": return(PhpIni.GSR(ref local.Session.GcDivisor, @default.Session.GcDivisor, value, action));

            case "session.cookie_lifetime": return(PhpSession.GsrCookieLifetime(value, action));

            case "session.cookie_path": return(PhpSession.GsrCookiePath(value, action));

            case "session.cookie_domain": return(PhpSession.GsrCookieDomain(value, action));

            case "session.cookie_secure": return(PhpSession.GsrCookieSecure(value, action));

            case "date.default_latitude": return(PhpIni.GSR(ref local.Date.Latitude, @default.Date.Latitude, value, action));

            case "date.default_longitude": return(PhpIni.GSR(ref local.Date.Longitude, @default.Date.Longitude, value, action));

            case "date.sunrise_zenith": return(PhpIni.GSR(ref local.Date.SunriseZenith, @default.Date.SunriseZenith, value, action));

            case "date.sunset_zenith": return(PhpIni.GSR(ref local.Date.SunsetZenith, @default.Date.SunsetZenith, value, action));

            case "date.timezone": return(PhpTimeZone.GsrTimeZone(local, @default, value, action));
            }

            Debug.Fail("Option '" + option + "' is supported but not implemented.");
            return(null);
        }
예제 #16
0
		/// <summary>
		/// Writes Phalanger BCL legacy options and their values to XML text stream.
		/// Skips options whose values are the same as default values of Phalanger.
		/// </summary>
		/// <param name="writer">XML writer.</param>
		/// <param name="options">A hashtable containing PHP names and option values. Consumed options are removed from the table.</param>
		/// <param name="writePhpNames">Whether to add "phpName" attribute to option nodes.</param>
		public static void LegacyOptionsToXml(XmlTextWriter writer, Hashtable options, bool writePhpNames) // GENERICS:<string,string>
		{
			if (writer == null)
				throw new ArgumentNullException("writer");
			if (options == null)
				throw new ArgumentNullException("options");

			LibraryConfiguration local = new LibraryConfiguration();
			PhpIniXmlWriter ow = new PhpIniXmlWriter(writer, options, writePhpNames);

			ow.StartSection("session");
			ow.WriteOption("session.cache_limiter", "CacheLimiter", "no-cache", PhpSession.DefaultCacheLimiter);
			ow.WriteOption("session.cache_expire", "CacheExpire", 180, PhpSession.DefaultCacheExpire);
			ow.WriteOption("session.serialize_handler", "Serializer", "php", local.Session.Serializer.Name);
			ow.WriteOption("session.gc_probability", "GcProbability", 1, local.Session.GcProbability);
			ow.WriteOption("session.gc_divisor", "GcDivisor", 100, local.Session.GcDivisor);
			ow.WriteOption("session.gc_maxlifetime", "GcMaxLifetime", 1440, local.Session.GcMaxLifetime);
			ow.WriteOption("session.save_path", "SavePath", "", local.Session.SavePath);
			ow.WriteOption("session.cookie_lifetime", "CookieLifetime", 0, PhpSession.DefaultCookieLifetime);
			ow.WriteOption("session.cookie_path", "CookiePath", "/", PhpSession.DefaultCookiePath);
			ow.WriteOption("session.cookie_domain", "CookieDomain", "", PhpSession.DefaultCookieDomain);
			ow.WriteOption("session.cookie_secure", "CookieSecure", false, PhpSession.DefaultCookieSecure);

			ow.StartSection("mailer");
			ow.WriteOption("SMTP", "SmtpServer", "localhost", local.Mailer.SmtpServer);
			ow.WriteOption("smtp_port", "SmtpPort", 25, local.Mailer.SmtpPort);
			ow.WriteOption("sendmail_from", "DefaultFromHeader", null, local.Mailer.DefaultFromHeader);

			ow.StartSection("highlighting");
			ow.WriteOption("highlight.bg", "Background", "#FFFFFF", local.Highlighting.Background);
			ow.WriteOption("highlight.string", "String", "#DD0000", local.Highlighting.String);
			ow.WriteOption("highlight.comment", "Comment", "#FF8000", local.Highlighting.Comment);
			ow.WriteOption("highlight.keyword", "Keyword", "#007700", local.Highlighting.Keyword);
			ow.WriteOption("highlight.html", "Html", "#000000", local.Highlighting.Html);
			ow.WriteOption("highlight.default", "Default", "#0000BB", local.Highlighting.Default);

			ow.StartSection("date");
			ow.WriteOption("date.default_latitude", "Latitude", 31.7667, local.Date.Latitude);
			ow.WriteOption("date.default_longitude", "Longitude", 35.2333, local.Date.Longitude);
			ow.WriteOption("date.sunrise_zenith", "SunriseZenith", 90.83, local.Date.SunriseZenith);
			ow.WriteOption("date.sunset_zenith", "SunsetZenith", 90.83, local.Date.SunsetZenith);
			ow.WriteOption("date.timezone", "TimeZone", null, local.Date.TimeZone.StandardName);

			ow.WriteEnd();
		}
예제 #17
0
        private LibraryConfiguration(LibraryConfiguration source)
        {
            this.Highlighting = source.Highlighting.DeepCopy();
            this.Date = source.Date.DeepCopy();
#if !SILVERLIGHT
            this.Mailer = source.Mailer.DeepCopy();
            this.Session = source.Session.DeepCopy();
            this.Serialization = source.Serialization.DeepCopy();
#endif
        }