コード例 #1
0
ファイル: Program.cs プロジェクト: androidhacker/DotNetProjs
		static void Main(string[] args)
		{
			if (args.Length > 1 && args[0].Length > 1 && args[0][0] == '/')
			{
				Application.EnableVisualStyles();
				Application.SetCompatibleTextRenderingDefault(false);
				frmBatch batch = new frmBatch();
				batch.Profile = args[0].Substring(1);

				if (args.Length == 2 && args[1][0] != '@')
					batch.InputPath = args[1];
				else for (int i = 1; i < args.Length; i++)
				{
					if (args[i][0] == '@')
					{
						string lineStr;
						StreamReader sr;
						try
						{
							sr = new StreamReader(args[i].Substring(1), Encoding.Default);
							while ((lineStr = sr.ReadLine()) != null)
								batch.AddInputPath(lineStr);
						}
						catch
						{
							batch.AddInputPath(args[i]);
						}
					} else
						batch.AddInputPath(args[i]);
				}
				Application.Run(batch);
				return;
			}

			string myId = "BZ92759C-63Q7-444e-ADA6-E495634A493D";
			Application.EnableVisualStyles();
			Application.SetCompatibleTextRenderingDefault(false);

			CUEConfig config = new CUEConfig();
			config.Load(new SettingsReader("CUE Tools", "settings.txt", Application.ExecutablePath));
			try { Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo(config.language); }
			catch { }
			frmCUETools form = new frmCUETools();
			if (!config.oneInstance || SingletonController.IamFirst(myId, new SingletonController.ReceiveDelegate(form.OnSecondCall)))
			{
				if (args.Length == 1)
					form.InputPath = args[0];
				Application.Run(form);
			}
			else
			{
				List<string> newArgs = new List<string>();
				foreach (string arg in args)
					newArgs.Add(Path.GetFullPath(arg));
				SingletonController.Send(myId, newArgs.ToArray());
			}
			SingletonController.Cleanup();
		}
コード例 #2
0
ファイル: Program.cs プロジェクト: ruanfeixiong/CueTools.NET
        static void Main(string[] args)
        {
            if (args.Length > 1 && args[0].Length > 1 && args[0][0] == '/')
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                frmBatch batch = new frmBatch();
                batch.Profile = args[0].Substring(1);

                if (args.Length == 2 && args[1][0] != '@')
                {
                    batch.InputPath = args[1];
                }
                else
                {
                    for (int i = 1; i < args.Length; i++)
                    {
                        if (args[i][0] == '@')
                        {
                            string       lineStr;
                            StreamReader sr;
                            try
                            {
                                sr = new StreamReader(args[i].Substring(1), Encoding.Default);
                                while ((lineStr = sr.ReadLine()) != null)
                                {
                                    batch.AddInputPath(lineStr);
                                }
                            }
                            catch
                            {
                                batch.AddInputPath(args[i]);
                            }
                        }
                        else
                        {
                            batch.AddInputPath(args[i]);
                        }
                    }
                }
                Application.Run(batch);
                return;
            }

            string myId = "BZ92759C-63Q7-444e-ADA6-E495634A493D";

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            CUEConfig config = new CUEConfig();

            config.Load(new SettingsReader("CUE Tools", "settingsTEST.txt", Application.ExecutablePath));
            try { Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo(config.language); }
            catch { }
            frmCUETools form = new frmCUETools();

            if (!config.oneInstance || SingletonController.IamFirst(myId, new SingletonController.ReceiveDelegate(form.OnSecondCall)))
            {
                if (args.Length == 1)
                {
                    form.InputPath = args[0];
                }
                Application.Run(form);
            }
            else
            {
                List <string> newArgs = new List <string>();
                foreach (string arg in args)
                {
                    newArgs.Add(Path.GetFullPath(arg));
                }
                SingletonController.Send(myId, newArgs.ToArray());
            }
            SingletonController.Cleanup();
        }