packages: docky/docky-mono28.patch (NEW) - fix build with mono-2.8

lisu lisu at pld-linux.org
Thu Nov 18 16:08:04 CET 2010


Author: lisu                         Date: Thu Nov 18 15:08:04 2010 GMT
Module: packages                      Tag: HEAD
---- Log message:
- fix build with mono-2.8

---- Files affected:
packages/docky:
   docky-mono28.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: packages/docky/docky-mono28.patch
diff -u /dev/null packages/docky/docky-mono28.patch:1.1
--- /dev/null	Thu Nov 18 16:08:04 2010
+++ packages/docky/docky-mono28.patch	Thu Nov 18 16:07:59 2010
@@ -0,0 +1,1415 @@
+diff -u -Nr docky-2.0.7/configure.ac docky-2.0.7.build/configure.ac
+--- docky-2.0.7/configure.ac	2010-08-31 23:28:08.847531997 -0700
++++ docky-2.0.7.build/configure.ac	2010-10-19 01:54:40.136682364 -0700
+@@ -76,7 +76,6 @@
+ SHAMROCK_EXPAND_BINDIR
+ SHAMROCK_EXPAND_DATADIR
+ 
+-
+ PKG_CHECK_MODULES([GCONF_SHARP_20], [gconf-sharp-2.0])
+ PKG_CHECK_MODULES([GLADE_SHARP_20], [glade-sharp-2.0])
+ PKG_CHECK_MODULES([GLIB_SHARP_20], [glib-sharp-2.0])
+@@ -90,7 +89,6 @@
+ PKG_CHECK_MODULES([MONO_ADDINS_GUI], [mono-addins-gui])
+ PKG_CHECK_MODULES([MONO_ADDINS_SETUP], [mono-addins-setup])
+ PKG_CHECK_MODULES([MONO_CAIRO], [mono-cairo])
+-PKG_CHECK_MODULES([MONO_OPTIONS], [mono-options])
+ PKG_CHECK_MODULES([NDESK_DBUS_10], [ndesk-dbus-1.0])
+ PKG_CHECK_MODULES([NDESK_DBUS_GLIB_10], [ndesk-dbus-glib-1.0])
+ PKG_CHECK_MODULES([NOTIFY_SHARP], [notify-sharp])
+@@ -120,7 +118,6 @@
+ MONO_CAIRO_LIBS="-r:Mono.Cairo"
+ AC_SUBST([MONO_CAIRO_LIBS])
+ 
+-AC_SUBST([MONO_OPTIONS_LIBS])
+ AC_SUBST([NDESK_DBUS_10_LIBS])
+ AC_SUBST([NDESK_DBUS_GLIB_10_LIBS])
+ AC_SUBST([NOTIFY_SHARP_LIBS])
+diff -u -Nr docky-2.0.7/Docky/AssemblyInfo.cs docky-2.0.7.build/Docky/AssemblyInfo.cs
+--- docky-2.0.7/Docky/AssemblyInfo.cs	2010-10-02 04:01:38.090463001 -0700
++++ docky-2.0.7.build/Docky/AssemblyInfo.cs	2010-10-19 01:55:41.430017686 -0700
+@@ -17,7 +17,6 @@
+ 
+ using System.Reflection;
+ using System.Runtime.CompilerServices;
+-using Mono.GetOptions;
+ 
+ // Information about this assembly is defined by the following
+ // attributes.
+diff -u -Nr docky-2.0.7/Docky/AssemblyInfo.cs.in docky-2.0.7.build/Docky/AssemblyInfo.cs.in
+--- docky-2.0.7/Docky/AssemblyInfo.cs.in	2010-06-26 06:47:36.543229000 -0700
++++ docky-2.0.7.build/Docky/AssemblyInfo.cs.in	2010-10-19 01:54:37.573351289 -0700
+@@ -17,7 +17,6 @@
+ 
+ using System.Reflection;
+ using System.Runtime.CompilerServices;
+-using Mono.GetOptions;
+ 
+ // Information about this assembly is defined by the following
+ // attributes.
+@@ -33,13 +32,6 @@
+ [assembly: AssemblyTrademark("")]
+ [assembly: AssemblyCulture("")]
+ 
+-[assembly: Mono.About ("For more information, please visit http://launchpad.net/docky/")]
+-[assembly: Mono.Author ("Daniel For\u0233 <daniel.p.fore at gmail.com>")]
+-[assembly: Mono.Author ("Chris Szikszoy <chris at szikszoy.com>")]
+-[assembly: Mono.Author ("Robert Dyer <psybers at gmail.com>")]
+-[assembly: Mono.Author ("Jason Smith <jassmith at gmail.com>")]
+-[assembly: Mono.UsageComplement ("")]
+-
+ // The assembly version has following format:
+ //
+ // Major.Minor.Build.Revision
+diff -u -Nr docky-2.0.7/Docky/Docky/Docky.cs docky-2.0.7.build/Docky/Docky/Docky.cs
+--- docky-2.0.7/Docky/Docky/Docky.cs	2010-08-24 11:41:52.206278994 -0700
++++ docky-2.0.7.build/Docky/Docky/Docky.cs	2010-10-19 02:05:26.020019496 -0700
+@@ -37,7 +37,7 @@
+ {
+ 	public static class Docky
+ 	{
+-		public static UserArgs CommandLinePreferences { get; private set; }
++		public static UserArgs UserArgs { get; private set; }
+ 		
+ 		static DockController controller;
+ 		internal static DockController Controller { 
+@@ -66,7 +66,8 @@
+ 			GLib.GType.Init ();
+ 			
+ 			// process the command line args
+-			CommandLinePreferences = new UserArgs (args);
++			if (!UserArgs.Parse (args))
++				return;
+ 			
+ 			Wnck.Global.ClientType = Wnck.ClientType.Pager;
+ 			
+diff -u -Nr docky-2.0.7/Docky/Docky/Interface/CursorTracker.cs docky-2.0.7.build/Docky/Docky/Interface/CursorTracker.cs
+--- docky-2.0.7/Docky/Docky/Interface/CursorTracker.cs	2010-06-26 06:47:36.543229000 -0700
++++ docky-2.0.7.build/Docky/Docky/Interface/CursorTracker.cs	2010-10-19 01:54:40.130014783 -0700
+@@ -113,7 +113,7 @@
+ 			if (timer_speed != length) {
+ 				if (timer > 0)
+ 					GLib.Source.Remove (timer);
+-				if (!Docky.CommandLinePreferences.NoPollCursor)
++				if (!UserArgs.NoPollCursor)
+ 					timer = GLib.Timeout.Add (length, OnTimerTick);
+ 				timer_speed = length;
+ 			}
+diff -u -Nr docky-2.0.7/Docky/Docky/Interface/DockWindow.cs docky-2.0.7.build/Docky/Docky/Interface/DockWindow.cs
+--- docky-2.0.7/Docky/Docky/Interface/DockWindow.cs	2010-10-01 00:00:03.733783001 -0700
++++ docky-2.0.7.build/Docky/Docky/Interface/DockWindow.cs	2010-10-19 02:07:49.340017589 -0700
+@@ -730,8 +730,8 @@
+ 			Wnck.Screen.Default.WindowOpened += HandleWindowOpened;
+ 			
+ 			// fix for nvidia bug
+-			if (Docky.CommandLinePreferences.BufferTime > 0)
+-				GLib.Timeout.Add (Docky.CommandLinePreferences.BufferTime * 60 * 1000, delegate {
++			if (UserArgs.BufferTime > 0)
++				GLib.Timeout.Add (UserArgs.BufferTime * 60 * 1000, delegate {
+ 					ResetBuffers ();
+ 					return true;
+ 				});
+@@ -1498,14 +1498,14 @@
+ 			UpdateMonitorGeometry ();
+ 			
+ 			if (VerticalDock) {
+-				Height = Math.Min (Docky.CommandLinePreferences.MaxSize, monitor_geo.Height);
++				Height = Math.Min (UserArgs.MaxSize, monitor_geo.Height);
+ 				Width = DockHeightBuffer + ZoomedIconSize + UrgentBounceHeight;
+ 			} else {
+-				Width = Math.Min (Docky.CommandLinePreferences.MaxSize, monitor_geo.Width);
++				Width = Math.Min (UserArgs.MaxSize, monitor_geo.Width);
+ 				Height = DockHeightBuffer + ZoomedIconSize + UrgentBounceHeight;
+ 			}
+ 			
+-			if (Docky.CommandLinePreferences.NetbookMode) {
++			if (UserArgs.NetbookMode) {
+ 				// Currently the intel i945 series of cards (used on netbooks frequently) will 
+ 				// for some mystical reason get terrible drawing performance if the window is
+ 				// between 1009 pixels and 1024 pixels in width OR height. We just pad it out an extra
+diff -u -Nr docky-2.0.7/Docky/Docky/UserArgs.cs docky-2.0.7.build/Docky/Docky/UserArgs.cs
+--- docky-2.0.7/Docky/Docky/UserArgs.cs	2010-06-26 06:47:36.543229000 -0700
++++ docky-2.0.7.build/Docky/Docky/UserArgs.cs	2010-10-19 01:54:40.136682364 -0700
+@@ -19,57 +19,106 @@
+ 
+ using Docky.Services;
+ 
+-using Mono.GetOptions;
+-
+-// disable the warning message about Mono.GetOptions.Options being obsolete
+-#pragma warning disable 618
++using Mono.Options;
+ 
+ namespace Docky
+ {
+-	public class UserArgs : Options
++	public class UserArgs
+ 	{
+-		[Option ("Disable cursor polling (for testing)", 'p', "disable-polling")]
+-		public bool NoPollCursor;
+-		
+-		[Option ("Maximum window dimension (min 500)", 'm', "max-size")]
+-		public int MaxSize;
+-		
+-		[Option ("Enable debug level logging", 'd', "debug")]
+-		public bool Debug;
++		const int FORCE_BUFFER_REFRESH = 10;
+ 		
+-		[Option ("Netbook mode", 'n', "netbook")]
+-		public bool NetbookMode;
++		/// <summary>
++		/// Gets or sets a value indicating whether cursor polling should be disabled.
++		/// </summary>
++		/// <value>
++		/// <c>true</c> cursor polling should be disabled; otherwise, <c>false</c>.
++		/// </value>
++		public static bool NoPollCursor { get; private set; }
++		/// <summary>
++		/// Gets or sets the maximum dock window size.
++		/// </summary>
++		/// <value>
++		/// The max size of the dock window.
++		/// </value>
++		public static int MaxSize { get; private set; }
++		/// <summary>
++		/// Gets or sets a value indicating whether Docky should run in netbook mode.
++		/// </summary>
++		/// <value>
++		/// <c>true</c> if netbook mode; otherwise, <c>false</c>.
++		/// </value>
++		public static bool NetbookMode { get; private set; }
++		/// <summary>
++		/// The number of minutes to keep buffers.
++		/// </summary>
++		/// <value>
++		/// The buffer refresh interval.
++		/// </value>
++		public static uint BufferTime { get; private set; }
+ 		
+-		[Option ("Nvidia mode (for Nvidia cards that lag after awhile) [-b 10]", "nvidia")]
+-		public bool NvidiaMode;
++		static bool HelpShown { get; set; }
++		static OptionSet Options { get; set; }
+ 		
+-		[Option ("Maximum time (in minutes) to keep buffers", 'b', "buffer-time")]
+-		public uint BufferTime;
+-
+-		public UserArgs (string[] args)
++		static UserArgs ()
+ 		{
+-			Log.DisplayLevel = LogLevel.Warn;
++			MaxSize = int.MaxValue;
+ 			
+-			ParsingMode = OptionsParsingMode.GNU_DoubleDash;
+-			ProcessArgs (args);
++			Options = new OptionSet () {
++				{ "p|disable-polling", "Disable cursor polling (for testing)", val => NoPollCursor = true },
++				{ "m|max-size=", "Maximum window dimension (min 500)", (int max) => MaxSize = Math.Max (max, 500) },
++				{ "d|debug", "Enable debug logging", debug => {
++						Log.DisplayLevel = (debug == null) ? LogLevel.Warn : LogLevel.Debug;
++					} },
++				{ "n|netbook", "Netbook mode", netbook => NetbookMode = true },
++				{ "nv|nvidia", "Nvidia mode (for Nvidia cards that lag after a while).  Equivalent to '-b 10'.",
++					nv => {
++						if (BufferTime == 0)
++							BufferTime = FORCE_BUFFER_REFRESH;
++					} },
++				{ "b|buffer-time=", "Maximum time (in minutes) to keep buffers", (uint buf) => BufferTime = buf },
++				{ "h|?|help", "Show this help list", help => ShowHelp () },
++			};
++		}
++		
++		/// <summary>
++		/// Parse the specified command line args.
++		/// </summary>
++		/// <param name='args'>
++		/// The arguments to parse.
++		/// </param>
++		/// <returns>
++		/// <c>true</c> if help was shown, otherwise <c>false</c>.
++		/// </returns>
++		public static bool Parse (string[] args)
++		{
++			try {
++				Options.Parse (args);
++			} catch (OptionException ex) {
++				Log<UserArgs>.Error ("Error parsing options: {0}", ex.Message);
++				ShowHelp ();
++			}
+ 			
+-			// defaults
+-			NvidiaMode |= DockServices.System.HasNvidia;
+-			if (MaxSize == 0)
+-				MaxSize = int.MaxValue;
+-			MaxSize = Math.Max (MaxSize, 500);
+-			if (NvidiaMode && BufferTime == 0)
+-				BufferTime = 10;
+-			// if the debug option was passed, set it to debug
+-			// otherwise leave it to the default, which is warn
+-			if (Debug)
+-				Log.DisplayLevel = LogLevel.Debug;
++			// if the buffer time wasn't explicity set, and a Nvidia card is present,
++			// force the buffer refresh time to 10 minutes
++			if (DockServices.System.HasNvidia && BufferTime == 0)
++				BufferTime = FORCE_BUFFER_REFRESH;
+ 			
+ 			// log the parsed user args
+ 			Log<UserArgs>.Debug ("BufferTime = " + BufferTime);
+ 			Log<UserArgs>.Debug ("MaxSize = " + MaxSize);
+ 			Log<UserArgs>.Debug ("NetbookMode = " + NetbookMode);
+ 			Log<UserArgs>.Debug ("NoPollCursor = " + NoPollCursor);
++			
++			// if the help was shown, return false, alerting the main thread to exit
++			return !HelpShown;
++		}
++		
++		static void ShowHelp ()
++		{
++			Console.WriteLine ("usage: docky [options]");
++			Console.WriteLine ();
++			Options.WriteOptionDescriptions (Console.Out);
++			HelpShown = true;
+ 		}
+ 	}
+ }
+diff -u -Nr docky-2.0.7/Docky/Makefile.am docky-2.0.7.build/Docky/Makefile.am
+--- docky-2.0.7/Docky/Makefile.am	2010-09-15 23:54:05.277920997 -0700
++++ docky-2.0.7.build/Docky/Makefile.am	2010-10-19 01:55:27.843351708 -0700
+@@ -10,6 +10,7 @@
+ 	gtk-gui/Docky.Interface.DockPreferences.cs \
+ 	gtk-gui/Docky.ConfigurationWindow.cs \
+ 	Gtk/Widget_Extensions.cs \
++	Mono/Options.cs \
+ 	Docky/ConfigurationWindow.cs \
+ 	Docky/DockController.cs \
+ 	Docky/Docky.cs \
+@@ -65,7 +66,6 @@
+ 	System \
+ 	System.Core \
+ 	Mono.Posix \
+-	Mono.GetOptions \
+ 	$(MONO_CAIRO_LIBS) \
+ 	$(GIO_SHARP_LIBS) \
+ 	$(GLIB_SHARP_20_LIBS) \
+@@ -90,4 +90,4 @@
+ module_DATA += Docky.addins
+ bin_SCRIPTS = docky
+ 
+-MCS_FLAGS += -unsafe
++MCS_FLAGS += -d:LINQ -unsafe
+diff -u -Nr docky-2.0.7/Docky/Makefile.in docky-2.0.7.build/Docky/Makefile.in
+--- docky-2.0.7/Docky/Makefile.in	2010-10-02 04:01:31.670463001 -0700
++++ docky-2.0.7.build/Docky/Makefile.in	2010-10-19 01:55:15.670019205 -0700
+@@ -382,7 +382,6 @@
+ 	System \
+ 	System.Core \
+ 	Mono.Posix \
+-	Mono.GetOptions \
+ 	$(MONO_CAIRO_LIBS) \
+ 	$(GIO_SHARP_LIBS) \
+ 	$(GLIB_SHARP_20_LIBS) \
+diff -u -Nr docky-2.0.7/Docky/Mono/Options.cs docky-2.0.7.build/Docky/Mono/Options.cs
+--- docky-2.0.7/Docky/Mono/Options.cs	1969-12-31 16:00:00.000000000 -0800
++++ docky-2.0.7.build/Docky/Mono/Options.cs	2010-10-19 01:54:40.136682364 -0700
+@@ -0,0 +1,1101 @@
++//
++// Options.cs
++//
++// Authors:
++//  Jonathan Pryor <jpryor at novell.com>
++//
++// Copyright (C) 2008 Novell (http://www.novell.com)
++//
++// Permission is hereby granted, free of charge, to any person obtaining
++// a copy of this software and associated documentation files (the
++// "Software"), to deal in the Software without restriction, including
++// without limitation the rights to use, copy, modify, merge, publish,
++// distribute, sublicense, and/or sell copies of the Software, and to
++// permit persons to whom the Software is furnished to do so, subject to
++// the following conditions:
++// 
++// The above copyright notice and this permission notice shall be
++// included in all copies or substantial portions of the Software.
++// 
++// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
++// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
++// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
++// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
++// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
++// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
++// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
++//
++
++// Compile With:
++//   gmcs -debug+ -r:System.Core Options.cs -o:NDesk.Options.dll
++//   gmcs -debug+ -d:LINQ -r:System.Core Options.cs -o:NDesk.Options.dll
++//
++// The LINQ version just changes the implementation of
++// OptionSet.Parse(IEnumerable<string>), and confers no semantic changes.
++
++//
++// A Getopt::Long-inspired option parsing library for C#.
++//
++// NDesk.Options.OptionSet is built upon a key/value table, where the
++// key is a option format string and the value is a delegate that is 
++// invoked when the format string is matched.
++//
++// Option format strings:
++//  Regex-like BNF Grammar: 
++//    name: .+
++//    type: [=:]
++//    sep: ( [^{}]+ | '{' .+ '}' )?
++//    aliases: ( name type sep ) ( '|' name type sep )*
++// 
++// Each '|'-delimited name is an alias for the associated action.  If the
++// format string ends in a '=', it has a required value.  If the format
++// string ends in a ':', it has an optional value.  If neither '=' or ':'
++// is present, no value is supported.  `=' or `:' need only be defined on one
++// alias, but if they are provided on more than one they must be consistent.
++//
++// Each alias portion may also end with a "key/value separator", which is used
++// to split option values if the option accepts > 1 value.  If not specified,
++// it defaults to '=' and ':'.  If specified, it can be any character except
++// '{' and '}' OR the *string* between '{' and '}'.  If no separator should be
++// used (i.e. the separate values should be distinct arguments), then "{}"
++// should be used as the separator.
++//
++// Options are extracted either from the current option by looking for
++// the option name followed by an '=' or ':', or is taken from the
++// following option IFF:
++//  - The current option does not contain a '=' or a ':'
++//  - The current option requires a value (i.e. not a Option type of ':')
++//
++// The `name' used in the option format string does NOT include any leading
++// option indicator, such as '-', '--', or '/'.  All three of these are
++// permitted/required on any named option.
++//
++// Option bundling is permitted so long as:
++//   - '-' is used to start the option group
++//   - all of the bundled options are a single character
++//   - at most one of the bundled options accepts a value, and the value
++//     provided starts from the next character to the end of the string.
++//
++// This allows specifying '-a -b -c' as '-abc', and specifying '-D name=value'
++// as '-Dname=value'.
++//
++// Option processing is disabled by specifying "--".  All options after "--"
++// are returned by OptionSet.Parse() unchanged and unprocessed.
++//
++// Unprocessed options are returned from OptionSet.Parse().
++//
++// Examples:
++//  int verbose = 0;
++//  OptionSet p = new OptionSet ()
++//    .Add ("v", v => ++verbose)
++//    .Add ("name=|value=", v => Console.WriteLine (v));
++//  p.Parse (new string[]{"-v", "--v", "/v", "-name=A", "/name", "B", "extra"});
++//
++// The above would parse the argument string array, and would invoke the
++// lambda expression three times, setting `verbose' to 3 when complete.  
++// It would also print out "A" and "B" to standard output.
++// The returned array would contain the string "extra".
++//
++// C# 3.0 collection initializers are supported and encouraged:
++//  var p = new OptionSet () {
++//    { "h|?|help", v => ShowHelp () },
++//  };
++//
++// System.ComponentModel.TypeConverter is also supported, allowing the use of
++// custom data types in the callback type; TypeConverter.ConvertFromString()
++// is used to convert the value option to an instance of the specified
++// type:
++//
++//  var p = new OptionSet () {
++//    { "foo=", (Foo f) => Console.WriteLine (f.ToString ()) },
++//  };
++//
++// Random other tidbits:
++//  - Boolean options (those w/o '=' or ':' in the option format string)
++//    are explicitly enabled if they are followed with '+', and explicitly
++//    disabled if they are followed with '-':
++//      string a = null;
++//      var p = new OptionSet () {
++//        { "a", s => a = s },
++//      };
++//      p.Parse (new string[]{"-a"});   // sets v != null
++//      p.Parse (new string[]{"-a+"});  // sets v != null
++//      p.Parse (new string[]{"-a-"});  // sets v == null
++//
++
++using System;
++using System.Collections;
++using System.Collections.Generic;
++using System.Collections.ObjectModel;
++using System.ComponentModel;
++using System.Globalization;
++using System.IO;
++using System.Runtime.Serialization;
++using System.Security.Permissions;
++using System.Text;
++using System.Text.RegularExpressions;
++
++#if LINQ
++using System.Linq;
++#endif
++
++#if TEST
++using NDesk.Options;
++#endif
++
++#if NDESK_OPTIONS
++namespace NDesk.Options
++#else
++namespace Mono.Options
++#endif
++{
++	public class OptionValueCollection : IList, IList<string> {
++
++		List<string> values = new List<string> ();
++		OptionContext c;
++
++		internal OptionValueCollection (OptionContext c)
++		{
++			this.c = c;
++		}
++
++		#region ICollection
++		void ICollection.CopyTo (Array array, int index)  {(values as ICollection).CopyTo (array, index);}
++		bool ICollection.IsSynchronized                   {get {return (values as ICollection).IsSynchronized;}}
++		object ICollection.SyncRoot                       {get {return (values as ICollection).SyncRoot;}}
++		#endregion
++
++		#region ICollection<T>
++		public void Add (string item)                       {values.Add (item);}
++		public void Clear ()                                {values.Clear ();}
++		public bool Contains (string item)                  {return values.Contains (item);}
++		public void CopyTo (string[] array, int arrayIndex) {values.CopyTo (array, arrayIndex);}
++		public bool Remove (string item)                    {return values.Remove (item);}
++		public int Count                                    {get {return values.Count;}}
++		public bool IsReadOnly                              {get {return false;}}
++		#endregion
++
++		#region IEnumerable
++		IEnumerator IEnumerable.GetEnumerator () {return values.GetEnumerator ();}
++		#endregion
++
++		#region IEnumerable<T>
++		public IEnumerator<string> GetEnumerator () {return values.GetEnumerator ();}
++		#endregion
++
++		#region IList
++		int IList.Add (object value)                {return (values as IList).Add (value);}
++		bool IList.Contains (object value)          {return (values as IList).Contains (value);}
++		int IList.IndexOf (object value)            {return (values as IList).IndexOf (value);}
++		void IList.Insert (int index, object value) {(values as IList).Insert (index, value);}
++		void IList.Remove (object value)            {(values as IList).Remove (value);}
++		void IList.RemoveAt (int index)             {(values as IList).RemoveAt (index);}
++		bool IList.IsFixedSize                      {get {return false;}}
++		object IList.this [int index]               {get {return this [index];} set {(values as IList)[index] = value;}}
++		#endregion
++
++		#region IList<T>
++		public int IndexOf (string item)            {return values.IndexOf (item);}
++		public void Insert (int index, string item) {values.Insert (index, item);}
++		public void RemoveAt (int index)            {values.RemoveAt (index);}
++
++		private void AssertValid (int index)
++		{
++			if (c.Option == null)
++				throw new InvalidOperationException ("OptionContext.Option is null.");
++			if (index >= c.Option.MaxValueCount)
++				throw new ArgumentOutOfRangeException ("index");
++			if (c.Option.OptionValueType == OptionValueType.Required &&
++					index >= values.Count)
++				throw new OptionException (string.Format (
++							c.OptionSet.MessageLocalizer ("Missing required value for option '{0}'."), c.OptionName), 
++						c.OptionName);
++		}
++
++		public string this [int index] {
++			get {
++				AssertValid (index);
++				return index >= values.Count ? null : values [index];
++			}
++			set {
++				values [index] = value;
++			}
++		}
++		#endregion
++
++		public List<string> ToList ()
++		{
++			return new List<string> (values);
++		}
++
++		public string[] ToArray ()
++		{
++			return values.ToArray ();
++		}
++
++		public override string ToString ()
++		{
++			return string.Join (", ", values.ToArray ());
++		}
++	}
++
++	public class OptionContext {
++		private Option                option;
++		private string                name;
++		private int                   index;
++		private OptionSet             set;
++		private OptionValueCollection c;
++
++		public OptionContext (OptionSet set)
++		{
++			this.set = set;
++			this.c   = new OptionValueCollection (this);
++		}
++
++		public Option Option {
++			get {return option;}
++			set {option = value;}
++		}
++
++		public string OptionName { 
++			get {return name;}
++			set {name = value;}
++		}
++
++		public int OptionIndex {
++			get {return index;}
++			set {index = value;}
++		}
++
++		public OptionSet OptionSet {
++			get {return set;}
++		}
++
++		public OptionValueCollection OptionValues {
++			get {return c;}
++		}
++	}
<<Diff was trimmed, longer than 597 lines>>


More information about the pld-cvs-commit mailing list