Exemple #1
0
        static void Main(string[] args)
        {
            if (args.Length < 4)
            {
                Console.WriteLine("ArgsCount : " + args.Length + "입력된 전달 인자의 수가 부족합니다.");
                return;
            }

            int  Pivot = -1;                       //IncludeDebugInformation 위치
            bool IncludeDebugInformation = false;
            int  FindCount = 0;                    //IncludeDebugInformation 중복 여부

            //전달 받은 인자들을 전부 출력 및 분기점 획득(True, False의 위치)
            for (int i = 0; i < args.Length; ++i)
            {
                Console.WriteLine(args[i]);

                //파싱이 가능한 경우
                if ((bool.TryParse(args[i], out IncludeDebugInformation)) == true)
                {
                    Pivot = i;
                    ++FindCount;
                }
            }

            //DebugInformation 전달인자 부족 or 누락 or 중복
            if ((Pivot == -1) || (FindCount > 1))
            {
                Console.WriteLine("ArgsCount : " + args.Length + "입력된 전달 인자 중 디버그 정보가 잘못 되었습니다.");
                return;
            }


            //전달인자 세팅
            List <string> SourceList = new List <string>(args.Take(Pivot));

            String OutputAssemblyPath = SourceList.Last();          //SourceList 마지막 값에 출력 값이 들어있다.

            SourceList.RemoveAt(SourceList.Count - 1);

            List <string> ReferencedAssemblieList = new List <string>(args.Skip(Pivot + 1));


            //DLL Make
            Console.WriteLine("\nTry Make DLL File And " + ((IncludeDebugInformation) ? ("PDB") : ("No PDB")));


            try
            {
                CompileHelper.CompileAssemblyFromFile(SourceList, OutputAssemblyPath,
                                                      IncludeDebugInformation, ReferencedAssemblieList);

                Console.WriteLine("Success");
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);

                IList <String> list = (IList <String>)e.Data["ErrorList"];
                if (list != null)
                {
                    foreach (String s in list)
                    {
                        Console.WriteLine(s);
                    }
                }
                Console.WriteLine("Failure");
            }
        }