Exemplo n.º 1
0
		static void Main(string[] args)
		{
			Application.EnableVisualStyles();
			Application.SetCompatibleTextRenderingDefault(false);

			if (Properties.Settings.Default.RecentFiles == null)
				Properties.Settings.Default.RecentFiles = new System.Collections.Specialized.StringCollection();

			if (Properties.Settings.Default.RecentFilters == null)
				Properties.Settings.Default.RecentFilters = new System.Collections.Specialized.StringCollection();

			m_aForm = new XMLViewForm();

			if (args.Length > 0)
			{
				string strFileSpecToOpen = (string)args[0];
				if (!File.Exists(strFileSpecToOpen))
				{
					PrintUsage();
					return;
				}

				m_aForm.OpenDocument(strFileSpecToOpen);

				if (args.Length > 1)
				{
					string strSwitch = args[1];
					if (strSwitch != "/cm")
					{
						PrintUsage();
						return;
					}
					else if (args.Length > 2)
					{
						string strConverterMappingFile2Use = args[2];
						if (!File.Exists(strConverterMappingFile2Use))
						{
							if (File.Exists(Application.UserAppDataPath + @"\" + strConverterMappingFile2Use))
								strConverterMappingFile2Use = Application.UserAppDataPath + @"\" + strConverterMappingFile2Use;
							else
							{
								PrintUsage();
								return;
							}
						}

						m_aForm.LoadConverterMappingFile(strConverterMappingFile2Use);
						string strOutputFileSpec = strFileSpecToOpen;
						if (args.Length > 3)
							strOutputFileSpec = args[3];
						m_aForm.ProcessAndSave(false, strOutputFileSpec);
						return;
					}
				}
			}

			Application.Run(m_aForm);
		}
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            if (Properties.Settings.Default.RecentFiles == null)
            {
                Properties.Settings.Default.RecentFiles = new System.Collections.Specialized.StringCollection();
            }

            if (Properties.Settings.Default.RecentFilters == null)
            {
                Properties.Settings.Default.RecentFilters = new System.Collections.Specialized.StringCollection();
            }

            m_aForm = new XMLViewForm();

            if (args.Length > 0)
            {
                string strFileSpecToOpen = (string)args[0];
                if (!File.Exists(strFileSpecToOpen))
                {
                    PrintUsage();
                    return;
                }

                m_aForm.OpenDocument(strFileSpecToOpen);

                if (args.Length > 1)
                {
                    string strSwitch = args[1];
                    if (strSwitch != "/cm")
                    {
                        PrintUsage();
                        return;
                    }
                    else if (args.Length > 2)
                    {
                        string strConverterMappingFile2Use = args[2];
                        if (!File.Exists(strConverterMappingFile2Use))
                        {
                            if (File.Exists(Application.UserAppDataPath + @"\" + strConverterMappingFile2Use))
                            {
                                strConverterMappingFile2Use = Application.UserAppDataPath + @"\" + strConverterMappingFile2Use;
                            }
                            else
                            {
                                PrintUsage();
                                return;
                            }
                        }

                        m_aForm.LoadConverterMappingFile(strConverterMappingFile2Use);
                        string strOutputFileSpec = strFileSpecToOpen;
                        if (args.Length > 3)
                        {
                            strOutputFileSpec = args[3];
                        }
                        m_aForm.ProcessAndSave(false, strOutputFileSpec);
                        return;
                    }
                }
            }

            Application.Run(m_aForm);
        }