Ejemplo n.º 1
0
        static int Main( string [] args )
        {
            // ******
            //
            // load config file(s) if they can be found
            //
            // note: duplicates of the same command will be processed in the order in which they are
            // found, this allows a scenario where the "last config processed wins"; however since they
            // are each processed (new commands do not replace earliers commands with the same name) there
            // might be side effects from that processing - as of this time that is not at issue
            //
            var configFileName = AppName + ".config";
            var appDataFolder = Path.Combine( Environment.GetFolderPath( Environment.SpecialFolder.ApplicationData ), AppName );
            var personalFolder = Path.Combine( Environment.GetFolderPath( Environment.SpecialFolder.Personal ), AppName );

            var cmds = new CmdLineParams( args, false, false );

            //
            // try in app folder
            //
            cmds.LoadResponseFile( Path.Combine( LibInfo.CodeBase, configFileName ), false );

            //
            // then appication data folder (roaming)
            //
            cmds.LoadResponseFile( Path.Combine( appDataFolder, configFileName ), false );

            //
            // personal folder (documents)
            //
            cmds.LoadResponseFile( Path.Combine( personalFolder, configFileName ), false );

            // ******
            try {
                PreProcessCmds( cmds );
                ProcessCmds( cmds );

                ////Console.ReadKey();
                //if( Debugger.IsAttached ) {
                //	Debugger.Break();
                //}

                return 0;
            }
            catch( Exception ex ) {
                Console.WriteLine( ex.ToString() );

                //Console.ReadKey();
                if( Debugger.IsAttached ) {
                    Debugger.Break();
                }

                return 1;
            }
        }