X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fclass%2FMicrosoft.VisualBasic%2FMicrosoft.VisualBasic%2FInteraction.cs;h=664dc49fde13d9e86eeec485846187bc53400fcb;hb=948dbf8d4581ac17f5420cc4f7dc375e3c502576;hp=d042be15f78fdf84a4f7c2234ee54dd8f3373cd9;hpb=dd866d68820e0f66046256bb5d3f84e3988a8be0;p=mono.git diff --git a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Interaction.cs b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Interaction.cs index d042be15f78..664dc49fde1 100644 --- a/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Interaction.cs +++ b/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic/Interaction.cs @@ -37,28 +37,33 @@ using System; using System.Reflection; using System.Collections; using System.Diagnostics; +using System.Runtime.InteropServices; +using Microsoft.VisualBasic.CompilerServices; + +#if ONLY_1_1 +using DefaultParameterValueAttribute = Microsoft.VisualBasic.CompilerServices.__DefaultParameterValueAttribute; +#endif + //using Windows.Drawing; //using System.Windows.Forms; -using Microsoft.VisualBasic.CompilerServices; - namespace Microsoft.VisualBasic { - [Microsoft.VisualBasic.CompilerServices.StandardModuleAttribute] - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Auto)] + [StandardModule] + [StructLayoutAttribute(LayoutKind.Auto)] sealed public class Interaction { + + private Interaction (){} + // Declarations // Constructors // Properties // Methods //[MonoTODO] - public static System.Int32 Shell (System.String Pathname, - [System.Runtime.InteropServices.Optional] - [System.ComponentModel.DefaultValue(2)] Microsoft.VisualBasic.AppWinStyle Style, - [System.Runtime.InteropServices.Optional] - [System.ComponentModel.DefaultValue(false)] System.Boolean Wait, - [System.Runtime.InteropServices.Optional] - [System.ComponentModel.DefaultValue(-1)] System.Int32 Timeout) - { + public static int Shell (string Pathname, + [Optional, __DefaultParameterValue(2)] AppWinStyle Style, + [Optional, DefaultParameterValue(false)] bool Wait, + [Optional, DefaultParameterValue(-1)] int Timeout) + { Process prcs = new Process(); ProcessWindowStyle PWinStyle = 0; @@ -121,7 +126,11 @@ namespace Microsoft.VisualBasic { } [MonoTODO] - public static System.String InputBox (System.String Prompt, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue("")] System.String Title, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue("")] System.String DefaultResponse, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] System.Int32 XPos, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(-1)] System.Int32 YPos) + public static System.String InputBox (System.String Prompt, + [Optional, DefaultParameterValue("")] System.String Title, + [Optional, DefaultParameterValue("")] System.String DefaultResponse, + [Optional, DefaultParameterValue(-1)] System.Int32 XPos, + [Optional, DefaultParameterValue(-1)] System.Int32 YPos) { throw new NotImplementedException (); } @@ -211,7 +220,9 @@ namespace Microsoft.VisualBasic { } [MonoTODO] - public static void DeleteSetting (System.String AppName, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(null)] System.String Section, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(null)] System.String Key) + public static void DeleteSetting (System.String AppName, + [Optional, DefaultParameterValue(null)] System.String Section, + [Optional, DefaultParameterValue(null)] System.String Key) { throw new NotImplementedException (); } @@ -223,7 +234,10 @@ namespace Microsoft.VisualBasic { } [MonoTODO] - public static System.String GetSetting (System.String AppName, System.String Section, System.String Key, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue("")] System.String Default) + public static System.String GetSetting (System.String AppName, + System.String Section, + System.String Key, + [Optional, DefaultParameterValue("")] System.String Default) { throw new NotImplementedException (); } @@ -235,30 +249,37 @@ namespace Microsoft.VisualBasic { } [MonoTODO] - public static System.Object CreateObject (System.String ProgId, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue("")] System.String ServerName) + public static System.Object CreateObject (System.String ProgId, + [Optional, DefaultParameterValue("")] System.String ServerName) { throw new NotImplementedException (); } [MonoTODO] - public static System.Object GetObject ([System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(null)] System.String PathName, [System.Runtime.InteropServices.Optional] [System.ComponentModel.DefaultValue(null)] System.String Class) + public static System.Object GetObject ([Optional, DefaultParameterValue(null)] System.String PathName, + [Optional, DefaultParameterValue(null)] System.String Class) { throw new NotImplementedException (); } - public static Object CallByName (Object objRef, String name, CallType userCallType, Object[] args) + public static Object CallByName (Object objRef, String name, CallType userCallType, params Object[] args) { - Object retVal = null; Type[] argsType = null; + if (userCallType != CallType.Method && + userCallType != CallType.Get && + userCallType != CallType.Set && + userCallType != CallType.Let) + throw new ArgumentException (Utils.GetResourceString("Argument_InvalidValue1", "CallType")); - - if(args != null && args.Length != 0) { + if(args != null) { argsType = new Type[args.Length]; for(int i = 0; i < args.Length; i++) argsType[i] = args[i].GetType(); } + /*else + argsType = new Type[0];*/ Type objType = objRef.GetType(); @@ -267,16 +288,16 @@ namespace Microsoft.VisualBasic { MethodInfo methodInfo = null; if(userCallType == CallType.Method) { - Console.WriteLine("Method"); + //Console.WriteLine("Method"); methodInfo = objType.GetMethod(name, argsType); } else if(userCallType == CallType.Get) { - Console.WriteLine("GetMethod"); + //Console.WriteLine("GetMethod"); methodInfo = objType.GetProperty(name).GetGetMethod(); } else if(userCallType == CallType.Set) { - Console.WriteLine("SetMethod"); + //Console.WriteLine("SetMethod"); methodInfo = objType.GetProperty(name).GetSetMethod(); } @@ -291,7 +312,7 @@ namespace Microsoft.VisualBasic { } - public static System.Object Choose (System.Double Index, System.Object[] Choice) + public static System.Object Choose (System.Double Index, params System.Object[] Choice) { int i; @@ -309,7 +330,6 @@ namespace Microsoft.VisualBasic { public static System.String Environ (System.Int32 Expression) { int index = 0; - Exception e; // Console.WriteLine("Coming Here"+Expression); @@ -352,19 +372,16 @@ namespace Microsoft.VisualBasic { string [] args = Environment.GetCommandLineArgs (); if (args != null && args.Length > 1) { - return string.Join (" ", args, 2, args.Length - 1); + return string.Join (" ", args, 1, args.Length - 1); } else { return ""; } } [MonoTODO] - public static Microsoft.VisualBasic.MsgBoxResult MsgBox (System.Object Prompt, - [System.Runtime.InteropServices.Optional] - [System.ComponentModel.DefaultValue(0)] - Microsoft.VisualBasic.MsgBoxStyle Buttons, - [System.Runtime.InteropServices.Optional] - [System.ComponentModel.DefaultValue(null)] System.Object Title) + public static MsgBoxResult MsgBox (object Prompt, + [Optional, __DefaultParameterValue(0)]MsgBoxStyle Buttons, + [Optional, DefaultParameterValue(null)] object Title) { throw new NotImplementedException (); /* //MessageButtons msgBoxButtons = 0;