示例#1
0
    static int Main(string[] args)
    {
        IL2Asm16 il2asm = new IL2Asm16();
        string   target = null, asm = null;

        foreach (string arg in args)
        {
            string u = arg.ToUpper();
            if (u.StartsWith("/MAIN:"))
            {
                il2asm.jumpTo = arg.Substring(6, arg.Length - 6);
            }
            else if (u.StartsWith("/OPT:"))
            {
                try
                {
                    il2asm.optimize = int.Parse(arg.Substring(5, arg.Length - 5));
                }
                catch {}
            }
            else if (u.StartsWith("/OUT:"))
            {
                asm = arg.Substring(5, arg.Length - 5);
            }
            else if (u == "/NOMAIN")
            {
                il2asm.noMain = true;
            }
            else if (u.StartsWith("/PRE:"))
            {
                il2asm.pre = arg.Substring(5, arg.Length - 5);
            }
            else if (u.StartsWith("/POST:"))
            {
                il2asm.post = arg.Substring(6, arg.Length - 6);
            }
            else
            {
                target = arg;
            }
        }
        if (target == null)
        {
            Console.WriteLine("usage: IL2Asm16 [/MAIN:xxx] [/NOMAIN] [/OPT:1/2] [PRE:xxx.asm] [POST:xxx.asm] [/OUT:xxx.asm] assembly.exe");
            return(1);
        }
        if (!il2asm.ReadPE(target))
        {
            return(1);
        }
        if (asm == null)
        {
            asm = Util.SwapExt(target, ".asm");
        }
        if (!il2asm.WriteAsm(asm))
        {
            return(1);
        }
        return(0);
    }
示例#2
0
文件: IL2Asm16.cs 项目: higepon/mona
 static int Main(string[] args)
 {
     IL2Asm16 il2asm = new IL2Asm16();
     string target = null, asm = null;
     foreach (string arg in args)
     {
         string u = arg.ToUpper();
         if (u.StartsWith("/MAIN:"))
         {
             il2asm.jumpTo = arg.Substring(6, arg.Length - 6);
         }
         else if (u.StartsWith("/OPT:"))
         {
             try
             {
                 il2asm.optimize = int.Parse(arg.Substring(5, arg.Length - 5));
             }
             catch {}
         }
         else if (u.StartsWith("/OUT:"))
         {
             asm = arg.Substring(5, arg.Length - 5);
         }
         else if (u == "/NOMAIN")
         {
             il2asm.noMain = true;
         }
         else if (u.StartsWith("/PRE:"))
         {
             il2asm.pre = arg.Substring(5, arg.Length - 5);
         }
         else if (u.StartsWith("/POST:"))
         {
             il2asm.post = arg.Substring(6, arg.Length - 6);
         }
         else
         {
             target = arg;
         }
     }
     if (target == null)
     {
         Console.WriteLine("usage: IL2Asm16 [/MAIN:xxx] [/NOMAIN] [/OPT:1/2] [PRE:xxx.asm] [POST:xxx.asm] [/OUT:xxx.asm] assembly.exe");
         return 1;
     }
     if (!il2asm.ReadPE(target)) return 1;
     if (asm == null) asm = Util.SwapExt(target, ".asm");
     if (!il2asm.WriteAsm(asm)) return 1;
     return 0;
 }