コード例 #1
0
ファイル: Configuration.CLR.cs プロジェクト: proff/Phalanger
            public bool Parse(string name, string value, XmlNode node)
            {
                switch (name)
                {
                    case "DefaultSerializer":
                        {
                            Serializer serializer = Serializers.GetSerializer(value);

                            if (serializer == null)
                                throw new ConfigurationErrorsException(LibResources.GetString("unknown_serializer", value) + ".", node);

                            this.defaultSerializer = serializer;
                            break;
                        }
                    default:
                        return false;
                }
                return true;
            }
コード例 #2
0
ファイル: Serializers.CLR.cs プロジェクト: dw4dev/Phalanger
		/// <summary>
		/// Registeres a new serializer. Serializers are usualy registered by libraries.
		/// </summary>
		/// <param name="serializer">The serializer.</param>
		/// <returns>Whether the serializer has been successfuly registered. Two serializers with the same names can't be registered.</returns>
		/// <exception cref="ArgumentNullException"><paramref name="serializer"/> is a <B>null</B> reference.</exception>
		public static bool RegisterSerializer(Serializer serializer)
		{
            if (serializer == null) throw new ArgumentNullException("serializer");

			lock (serializersLock)
			{
				if (serializers.ContainsKey(serializer.Name))
					return false;

				serializers.Add(serializer.Name, serializer);
			}

			return true;
		}
コード例 #3
0
ファイル: Configuration.CLR.cs プロジェクト: proff/Phalanger
			public bool Parse(string name, string value, XmlNode node)
			{
				switch (name)
				{
					case "Serializer":
						{
							Serializer serializer = Serializers.GetSerializer(value);

							if (serializer == null)
								throw new ConfigurationErrorsException(LibResources.GetString("unknown_serializer", value) + ".", node);

							this.serializer = serializer;
							break;
						}

					case "GcProbability":
						GcProbability = ConfigUtils.ParseInteger(value, 0, Int32.MaxValue, node);
						break;

					case "GcDivisor":
						GcDivisor = ConfigUtils.ParseInteger(value, 1, Int32.MaxValue, node);
						break;

					case "GcMaxLifetime":
						GcMaxLifetime = ConfigUtils.ParseInteger(value, Int32.MinValue, Int32.MaxValue, node);
						break;

					case "SavePath":
						if (value != "")
							SavePath = value;
						break;

					case "CacheExpire":
						CacheExpire = ConfigUtils.ParseInteger(value, 0, Int32.MaxValue, node);
						break;

					case "CacheLimiter":
                        CacheLimiter = value;
                        break;

					case "CookieLifetime":
						CookieLifetime = ConfigUtils.ParseInteger(value, 0, Int32.MaxValue, node);
						break;

					case "CookiePath":
                        CookiePath = value;
						break;

					case "CookieDomain":
                        CookieDomain = value;
						break;

					case "CookieSecure":
                        CookieSecure = value == "true";
						break;

					default:
						return false;
				}
				return true;
			}