public static bool _ConvertFromString_System_ComponentModel_ByteConverter_System_ComponentModel_ITypeDescriptorContext_System_String( )
        {
            //class object
            System.ComponentModel.ByteConverter _System_ComponentModel_ByteConverter = new System.ComponentModel.ByteConverter();

            //Parameters
            System.ComponentModel.ITypeDescriptorContext context = null;
            System.String text = null;

            //ReturnType/Value
            System.Object returnVal_Real        = null;
            System.Object returnVal_Intercepted = null;

            //Exception
            System.Exception exception_Real        = null;
            System.Exception exception_Intercepted = null;

            InterceptionMaintenance.disableInterception( );

            try
            {
                returnVal_Real = _System_ComponentModel_ByteConverter.ConvertFromString(context, text);
            }

            catch (System.Exception e)
            {
                exception_Real = e;
            }


            InterceptionMaintenance.enableInterception( );

            try
            {
                returnVal_Intercepted = _System_ComponentModel_ByteConverter.ConvertFromString(context, text);
            }

            catch (System.Exception e)
            {
                exception_Intercepted = e;
            }


            return((exception_Real.Messsage == exception_Intercepted.Message) && (returnValue_Real == returnValue_Intercepted));
        }
        public static bool _ConvertFromString_System_ComponentModel_ByteConverter_System_ComponentModel_ITypeDescriptorContext_System_String( )
        {
            //class object
            System.ComponentModel.ByteConverter _System_ComponentModel_ByteConverter = new System.ComponentModel.ByteConverter();

               //Parameters
               System.ComponentModel.ITypeDescriptorContext context = null;
               System.String text = null;

               //ReturnType/Value
               System.Object returnVal_Real = null;
               System.Object returnVal_Intercepted = null;

               //Exception
               System.Exception exception_Real = null;
               System.Exception exception_Intercepted = null;

               InterceptionMaintenance.disableInterception( );

               try
               {
              returnVal_Real = _System_ComponentModel_ByteConverter.ConvertFromString(context,text);
               }

               catch( System.Exception e )
               {
              exception_Real = e;
               }

               InterceptionMaintenance.enableInterception( );

               try
               {
              returnVal_Intercepted = _System_ComponentModel_ByteConverter.ConvertFromString(context,text);
               }

               catch( System.Exception e )
               {
              exception_Intercepted = e;
               }

               return( ( exception_Real.Messsage == exception_Intercepted.Message ) && ( returnValue_Real == returnValue_Intercepted ) );
        }
示例#3
0
        public int ProcessArguments(string[] args)
        {
            // Make errors printed by EC plugin visible
            var traceListener = new ConsoleTraceListener(true);
            Debug.Listeners.Add(traceListener);

            var converter = new System.ComponentModel.ByteConverter();
            try {
                if (args.Length > 0 && args[0] == "ec-write") {
                    if (args.Length == 3) {
                        return this.ECWrite(
                            (byte)converter.ConvertFromString(args[1]),
                            (byte)converter.ConvertFromString(args[2])
                        );
                    } else {
                        Console.Error.WriteLine("Action `ec-write` requires exactly 2 arguments");
                        return 2;
                    }
                } else if (args.Length > 0 && args[0] == "ec-read") {
                    if (args.Length == 2) {
                        return this.ECRead((byte)converter.ConvertFromString(args[1]));
                    } else {
                        Console.Error.WriteLine("Action `ec-read` requires exactly 1 arguments");
                        return 2;
                    }
                } else if (args.Length > 0 && args[0] == "ec-dump") {
                    if (args.Length == 1) {
                        return this.ECDump();
                    } else {
                        Console.Error.WriteLine("Action `ec-dump` requires no arguments");
                        return 2;
                    }
                } else {
                    int returnValue = 0;
                    TextWriter console = Console.Out;
                    if (args.Length > 0 && (args[0] != "--help" || args[0] != "-h")) {
                        console = Console.Error;

                        console.WriteLine("Unknown action `{0}`!", args[0]);
                        console.WriteLine();

                        returnValue = 2;
                    }

                    console.WriteLine("Usage: nbfc-probe [-h|--help] [ec-dump|ec-read|ec-write] {arguments}");
                    console.WriteLine();
                    console.WriteLine("Possible modes:");
                    console.WriteLine(" * ec-dump");
                    console.WriteLine("    Dump all registers that are present in EC memory as hexadecimal table.");
                    console.WriteLine(" * ec-read [register]");
                    console.WriteLine("    Print the value of the given EC register number.");
                    console.WriteLine(" * ec-write [register] [value]");
                    console.WriteLine("    Write the given value to the given EC RAM register number,");
                    console.WriteLine("    then read the given value from the EC and print the new value.");
                    console.WriteLine();
                    console.WriteLine("All numbers are in decimal format by default; hexadecimal values may be");
                    console.WriteLine("entered by prefixing them with \"0x\".");

                    return returnValue;
                }
            } finally {
                Debug.Listeners.Remove(traceListener);
            }
        }