예제 #1
0
 public static L1Array<int> GetArrayFromObjectArray(object[] a)
 {
     L1Array<int> array = new L1Array<int>(a.Length);
     for (int i = 0; i < a.Length; ++i)
         array.SetValue(i, Convert.ToInt32(a[i]));
     return array;
 }
예제 #2
0
 public static L1Array<int> GetArrayFromString(string str)
 {
     L1Array<int> array = new L1Array<int>(str.Length);
     for (int i = 0; i < str.Length; ++i)
         array.SetValue(i, Convert.ToInt32(str[i]));
     return array;
 }
예제 #3
0
        public static void L1Main(string[] args)
        {
            Type program = null;
            Assembly[] asm = AppDomain.CurrentDomain.GetAssemblies();
            foreach (Assembly a in asm)
            {
                program = a.GetType("L1ProgramFunctions");
                if (program != null)
                    break;
            }

            MethodInfo mi = program.GetMethod("Main", new Type[] { typeof(int), typeof(L1Array<L1Array<int>>) });
            if (mi == null)
            {
                Console.WriteLine("Missing method: Main(int, int array array)");
            }
            else
            {
                L1Array<L1Array<int>> l1args = new L1Array<L1Array<int>>(args.Length);
                for (int i = 0; i < args.Length; ++i)
                {
                    l1args.SetValue(i, GetArrayFromString(args[i]));
                }

                int code = (int)mi.Invoke(null, new object[] { args.Length, l1args });

                Console.WriteLine();
                Console.WriteLine("End program with code " + code);
            }
        }