public DeleteIniSectionRecord(int flags, byte[] data) { this.flags = (IniFlags)flags; List <string> items = Helpers.SplitString(data, true); filename = items[0]; section = items[1]; }
/// <summary> /// Formats a state of the specified option into <see cref="PhpArray"/>. /// </summary> /// <param name="flags">The option's flag.</param> /// <param name="defaultValue">A default value of the option.</param> /// <param name="localValue">A script local value of the option.</param> /// <returns>An array containig keys <c>"global_value"</c>, <c>"local_value"</c>, <c>"access"</c>.</returns> public static PhpArray FormatOptionState(IniFlags flags, PhpValue defaultValue, PhpValue localValue) { var result = new PhpArray(3); result.Add("global_value", defaultValue); result.Add("local_value", localValue); result.Add("access", (int)((flags & IniFlags.Local) != 0 ? IniAccessability.Local : IniAccessability.Global)); return(result); }
/// <summary> /// Registeres a standard configuration option. /// Not thread safe. /// </summary> /// <param name="name">A case-sensitive unique option name.</param> /// <param name="flags">Flags.</param> /// <param name="gsr">A delegate pointing to a method which will perform option's value getting, setting, and restoring.</param> /// <param name="extension">A case-sensitive name of the extension which the option belongs to. Can be a <B>null</B> reference.</param> /// <remarks> /// Registered options are known to <c>ini_get</c>, <c>ini_set</c>, and <c>ini_restore</c> PHP functions. /// </remarks> /// <exception cref="ArgumentNullException"><paramref name="name"/> is a <B>null</B> reference.</exception> /// <exception cref="ArgumentNullException"><paramref name="gsr"/> is a <B>null</B> reference.</exception> /// <exception cref="ArgumentException">An option with specified name has already been registered.</exception> public static void Register(string name, IniFlags flags, GetSetDelegate gsr, string extension = null) { if (name == null) { throw new ArgumentNullException(nameof(name)); } if (gsr == null) { throw new ArgumentNullException(nameof(gsr)); } _options.Add(name, new OptionDefinition(flags, gsr, extension)); }
/// <summary> /// Formats a state of the specified option into <see cref="PhpArray"/>. /// </summary> /// <param name="flags">The option's flag.</param> /// <param name="defaultValue">A default value of the option.</param> /// <param name="localValue">A script local value of the option.</param> /// <returns>An array containig keys <c>"global_value"</c>, <c>"local_value"</c>, <c>"access"</c>.</returns> private static PhpArray FormatOptionState(IniFlags flags, object defaultValue, object localValue) { PhpArray result = new PhpArray(0, 3); // default value: result.Add("global_value", Convert.ObjectToString(defaultValue)); // local value: result.Add("local_value", Convert.ObjectToString(localValue)); // accessibility: result.Add("access", (int)((flags & IniFlags.Local) != 0 ? IniAccessability.Local : IniAccessability.Global)); return(result); }
/// <summary> /// Registeres a legacy configuration option. Not thread safe. /// </summary> /// <param name="name">A case-sensitive unique option name.</param> /// <param name="flags">Flags.</param> /// <param name="gsr">A delegate pointing to a method which will perform option's value getting, setting, and restoring.</param> /// <param name="extension">A case-sensitive name of the extension which the option belongs to. Can be a <B>null</B> reference.</param> /// <remarks> /// Registered options are known to <c>ini_get</c>, <c>ini_set</c>, and <c>ini_restore</c> PHP functions. /// </remarks> /// <exception cref="ArgumentNullException"><paramref name="name"/> is a <B>null</B> reference.</exception> /// <exception cref="ArgumentNullException"><paramref name="gsr"/> is a <B>null</B> reference.</exception> /// <exception cref="ArgumentException">An option with specified name has already been registered.</exception> public static void Register(string name, IniFlags flags, GetSetRestoreDelegate gsr, string extension) { if (name == null) { throw new ArgumentNullException("name"); } if (gsr == null) { throw new ArgumentNullException("gsr"); } if (options.ContainsKey(name)) { throw new ArgumentException(LibResources.GetString("option_already_registered", name)); } options.Add(name, new OptionDefinition(flags, gsr, extension)); }
internal OptionDefinition(IniFlags flags, GetSetDelegate gsr, string extension) { this.Flags = flags; this.Gsr = gsr; this.Extension = extension; }
/// <see cref="IniEntry.Flags"/> public Builder Flags(IniFlags flags) { _ini.Flags = flags; return(this); }
internal OptionDefinition(IniFlags flags, GetSetRestoreDelegate gsr, string extension) { this.Flags = flags; this.Gsr = gsr; this.Extension = extension; }
/// <summary> /// Formats a state of the specified option into <see cref="PhpArray"/>. /// </summary> /// <param name="flags">The option's flag.</param> /// <param name="defaultValue">A default value of the option.</param> /// <param name="localValue">A script local value of the option.</param> /// <returns>An array containig keys <c>"global_value"</c>, <c>"local_value"</c>, <c>"access"</c>.</returns> private static PhpArray FormatOptionState(IniFlags flags, object defaultValue, object localValue) { PhpArray result = new PhpArray(0, 3); // default value: result.Add("global_value", Convert.ObjectToString(defaultValue)); // local value: result.Add("local_value", Convert.ObjectToString(localValue)); // accessibility: result.Add("access", (int)((flags & IniFlags.Local) != 0 ? IniAccessability.Local : IniAccessability.Global)); return result; }
/// <summary> /// Registeres a Core option. /// </summary> private static void RegisterCoreOption(string name, IniFlags flags) { options.Add(name, new OptionDefinition(flags, GsrCoreOption, null)); }
/// <summary> /// Registeres a legacy configuration option. Not thread safe. /// </summary> /// <param name="name">A case-sensitive unique option name.</param> /// <param name="flags">Flags.</param> /// <param name="gsr">A delegate pointing to a method which will perform option's value getting, setting, and restoring.</param> /// <param name="extension">A case-sensitive name of the extension which the option belongs to. Can be a <B>null</B> reference.</param> /// <remarks> /// Registered options are known to <c>ini_get</c>, <c>ini_set</c>, and <c>ini_restore</c> PHP functions. /// </remarks> /// <exception cref="ArgumentNullException"><paramref name="name"/> is a <B>null</B> reference.</exception> /// <exception cref="ArgumentNullException"><paramref name="gsr"/> is a <B>null</B> reference.</exception> /// <exception cref="ArgumentException">An option with specified name has already been registered.</exception> public static void Register(string name, IniFlags flags, GetSetRestoreDelegate gsr, string extension) { if (name == null) throw new ArgumentNullException("name"); if (gsr == null) throw new ArgumentNullException("gsr"); if (options.ContainsKey(name)) throw new ArgumentException(LibResources.GetString("option_already_registered", name)); options.Add(name, new OptionDefinition(flags, gsr, extension)); }