Корневой контейнер.
Inheritance: System.ComponentModel.Container, IEditContext
Esempio n. 1
0
        private static void Main(string[] args)
        {
            if (args.Length == 0)
            {
                Application.EnableVisualStyles();
                using (var mf = new MainForm())
                {
                    var cont = new RootAppContainer(mf);
                    cont.Add(mf);
                    Application.Run(mf);
                }
            }
            else
            {
                if (args.Length != 4)
                {
                    Console.WriteLine(msgBadArgCount);
                    return;
                }
                if (!File.Exists(args[0]))
                {
                    Console.WriteLine(msgResourceFileNotFound);
                    return;
                }
                if (!Directory.Exists(args[3]))
                {
                    Console.WriteLine(msgOutputDirNotFound);
                    return;
                }

                Console.Write("Generate resource helper ... ");
                CultureInfo[] loadedCultures;
                DateTime      lmt;
                var           rc = Loader.Load(args[0], out loadedCultures,
                                               out lmt);
                var outFile = Path.Combine(args[3], rc.TreeName + ".cs");
                Console.WriteLine(outFile);
                if (File.Exists(outFile) && lmt <= File.GetLastWriteTime(outFile))
                {
                    Console.WriteLine(msgFileUpToDate);
                    return;
                }
                if (File.Exists(outFile) && (File.GetAttributes(outFile) & FileAttributes.ReadOnly) == FileAttributes.ReadOnly)
                {
                    Console.WriteLine(msgReadOnlyError);
                    return;
                }

                bool isInternal;
                if (args[2] == "public")
                {
                    isInternal = false;
                }
                else if (args[2] == "internal")
                {
                    isInternal = true;
                }
                else
                {
                    throw new ArgumentException("Invalid class modifier argument");
                }

                var ccu = HelperGenerator.Generate(rc,
                                                   args[1], isInternal);
                var cscp = new CSharpCodeProvider();
                var cgo  = new CodeGeneratorOptions {
                    BracingStyle = "C"
                };
                using (var sw = new StreamWriter(
                           Path.Combine(args[3], rc.TreeName + ".cs")))
                    cscp.GenerateCodeFromCompileUnit(ccu, sw, cgo);
            }
        }
Esempio n. 2
0
		private static void Main(string[] args)
		{
			if (args.Length == 0)
			{
				Application.EnableVisualStyles();
				using (var mf = new MainForm())
				{
					var cont = new RootAppContainer(mf);
					cont.Add(mf);
					Application.Run(mf);
				}
			}
			else
			{
				if (args.Length != 4)
				{
					Console.WriteLine(msgBadArgCount);
					return;
				}
				if (!File.Exists(args[0]))
				{
					Console.WriteLine(msgResourceFileNotFound);
					return;
				}
				if (!Directory.Exists(args[3]))
				{
					Console.WriteLine(msgOutputDirNotFound);
					return;
				}

				Console.Write("Generate resource helper ... ");
				CultureInfo[] loadedCultures;
				DateTime lmt;
				var rc = Loader.Load(args[0], out loadedCultures,
					out lmt);
				var outFile = Path.Combine(args[3], rc.TreeName + ".cs");
				Console.WriteLine(outFile);
				if (File.Exists(outFile) && lmt <= File.GetLastWriteTime(outFile))
				{
					Console.WriteLine(msgFileUpToDate);
					return;
				}
				if (File.Exists(outFile) && (File.GetAttributes(outFile) & FileAttributes.ReadOnly) == FileAttributes.ReadOnly)
				{
					Console.WriteLine(msgReadOnlyError);
					return;
				}

				bool isInternal;
				if (args[2] == "public")
					isInternal = false;
				else if (args[2] == "internal")
					isInternal = true;
				else
					throw new ArgumentException("Invalid class modifier argument");

				var ccu = HelperGenerator.Generate(rc,
					args[1], isInternal);
				var cscp = new CSharpCodeProvider();
				var cgo = new CodeGeneratorOptions {BracingStyle = "C"};
				using (var sw = new StreamWriter(
						Path.Combine(args[3], rc.TreeName + ".cs")))
					cscp.GenerateCodeFromCompileUnit(ccu, sw, cgo);
			}
		}