getopt.cpp

来自「把doc文档转成pdf后刻录成CD,用VC++开发,用了Nero的SDK和CXI」· C++ 代码 · 共 1,042 行 · 第 1/3 页

CPP
1,042 行
字号
			{
				ecl = params.SetNeroLogTimestamp();
			}
			else if (stricmp (*argv, "--force_erase_cdrw") == 0)
			{
				ecl = params.SetForceEraseCDRW();
			}
			else if (stricmp (*argv, "--temp_path") == 0)
			{
				ecl = params.SetTempPath(argc, argv);
			}
			else if (stricmp (*argv, "--media_type") == 0)
			{
				ecl = params.SetMediaType(argc, argv);
			}
			else if (stricmp (*argv, "--disable_eject_after_erase") == 0)
			{
				params.SetDisableEjectAfterErase();
			}
			else if (stricmp (*argv, "--force_eject_after_erase") == 0)
			{
				params.SetForceEjectAfterErase();
			}
			else if (stricmp (*argv, "--output_image") == 0)
			{
				ecl = params.SetOutputImageFileName(argc, argv);
			}
			else if (stricmp (*argv, "--imageinfo") == 0)
			{
				ecl = params.SetCommand(COMMAND_IMAGE_INFO);
				if (ecl == CLE_NO_ERROR)
				{
					ecl = params.SetImageInfoFileName(argc, argv);
				}
			}
			else if (stricmp (*argv, "--system_identifier") == 0)
			{
				ecl = params.SetSystemIdentifier(argc, argv);
			}
			else if (stricmp (*argv, "--volume_set") == 0)
			{
				ecl = params.SetVolumeSet(argc, argv);
			}
			else if (stricmp (*argv, "--publisher") == 0)
			{
				ecl = params.SetPublisher(argc, argv);
			}
			else if (stricmp (*argv, "--data_preparer") == 0)
			{
				ecl = params.SetDataPreparer(argc, argv);
			}
			else if (stricmp (*argv, "--application") == 0)
			{
				ecl = params.SetApplication(argc, argv);
			}
			else if (stricmp (*argv, "--copyright") == 0)
			{
				ecl = params.SetCopyright(argc, argv);
			}
			else if (stricmp (*argv, "--abstract") == 0)
			{
				ecl = params.SetAbstract(argc, argv);
			}
			else if (stricmp (*argv, "--bibliographic") == 0)
			{
				ecl = params.SetBibliographic(argc, argv);
			}
			else if (stricmp (*argv, "--backup") == 0)
			{
				ecl = params.SetBackup ();
			}
			else if (stricmp (*argv, "--video_resolution") == 0)
			{
				ecl = params.SetVideoResolution(argc, argv);
			}
			else if (stricmp (*argv, "--estimate_no_fs_overhead") == 0)
			{
				ecl = params.SetEstimateNoFSOverhead ();
			}
			else if (stricmp (*argv, "--estimate_no_data") == 0)
			{
				ecl = params.SetEstimateNoData ();
			}
			else if (stricmp (*argv, "--estimate_no_exact_size") == 0)
			{
				ecl = params.SetEstimateNoExactSize ();
			}
			else if ((*argv)[0] == '@')
			{
				if (params.GetProcessedParameterFile())
				{
					throw CLE_PARAMETER_FILE_ALREADY_PROCESSED;
				}

				ecl = params.SetProcessedParameterFile();
				if (CLE_NO_ERROR != ecl)
				{
					throw ecl;
				}

				if (!ReadParameterFile (params, &(*argv)[1]))
				{
					return false;
				}
			}
			else if (!strncmp (*argv, "--", 2))
			{
				ecl = params.AddAudioReadTrack(argc, argv);
			}
			else
			{
				ecl = params.AddAudioIsoFreestyleWriteTrack(argc, argv);
			}
		}

		// Make sure we had no error during
		// the last loop execution.

		if (CLE_NO_ERROR != ecl)
		{
			throw ecl;
		}

		if (params.GetCommand() == COMMAND_WRITE && params.GetBurnType() == BURNTYPE_UNKNOWN)
		{
			throw CLE_BURN_TYPE_NOT_SPECIFIED;
		}

		if ((params.GetBurnType() == BURNTYPE_ISOAUDIO ||
			params.GetBurnType() == BURNTYPE_SVIDEOCD ||
			params.GetBurnType() == BURNTYPE_VIDEOCD) &&
			params.GetNumberOfTracks() <= 0 && params.GetFileListSize() == 0)
		{
			throw CLE_NEED_TRACKS;
		}

		if (params.GetCommand () == COMMAND_UNKNOWN)
		{
			throw CLE_NO_COMMAND_SPECIFIED;
		}
	}
	catch (COMMAND_LINE_ERRORS e)
	{
		printf ("%s\n", s_cle[e]);
		Usage ();

		return false;
	}

	return true;
}


// This function displays usage information after the user enters incorrect parameters.
// It always displays only as many lines of text as there are visible lines.

static void Usage (void)
{
	LPCSTR psMessage = 
	"\nUsage:\n"
	"  _______________\n"
	" | List available| --listdrives\n"
	" | drives        |\n"
	" |_______________|\n"
	" | Obtain drive  | --driveinfo --drivename <name>\n"
	" | info          |\n"
	" |_______________|\n"
	" | Obtain disc   | --cdinfo --drivename <name>\n"
	" | info          |\n"
	" |_______________|\n"
	" | Write         | --write --drivename <name> [--real] [--tao]\n"
	" | ISO/Audio CD  | [--artist <artist>] [--title <title>] [--speed <speed>]\n"
	" |               | [--audio] <audio files> [--cdextra] [--iso <volumename>]\n"
	" |               | [--iso-no-joliet] [--iso-mode2] [--speedtest]\n"
	" |               | [--enable_abort] [--close_session] [--detect_non_empty_cdrw]\n"
	" |               | [--cd_text] [--underrun_prot]\n"
	" |               | [--import_udf] [--import_vms_session]\n"
	" |               | [--use_rockridge] [--create_iso_fs] [--create_udf_fs]\n"
	" |               | [--disable_eject] [--verify] [--dvd] [--use_allspace]\n"
	" |               | <disk file> ...\n"
	" |               | [--force_erase_cdrw] [--nero_log_timestamp]\n"
	" |               | [--output_image <filename>]\n"
	" |               |\n"
	" |               | NOTE: At least one audio file or one disk file needs to be\n"
	" |               | specified!\n"
	" |_______________|\n"
	" | Write         | --write --drivename <name> [--real] [--tao]\n"
	" | Video CD      | --videocd [--speed <speed>] [--speedtest] [--enable_abort]\n"
	" |               | [--close_session] <video files> [--iso <volumename>]\n"
	" |               | [--iso-no-joliet] [--iso-mode2] [--speedtest]\n"
	" |               | [--enable_abort] [--close_session] [--detect_non_empty_cdrw]\n"
	" |               | [--underrun_prot] [--disable_eject] <disk file>...\n"
	" |               | [--force_erase_cdrw] [--nero_log_timestamp]\n"
	" |               | [--temp_path <path>] [--output_image <filename>]\n"
	" |_______________|\n"
	" | Write Super   | --write --drivename <name> [--real] [--tao]\n"
	" | Video CD      | --svideocd [--speed <speed>] [--speedtest] [--enable_abort]\n"
	" |               | [--close_session] <video files> [--iso <volumename>]\n"
	" |               | [--iso-no-joliet] [--iso-mode2] [--speedtest]\n"
	" |               | [--enable_abort] [--close_session] [--detect_non_empty_cdrw]\n"
	" |               | [--underrun_prot] [--disable_eject] <disk file>...\n"
	" |               | [--force_erase_cdrw] [--nero_log_timestamp]\n"
	" |               | [--temp_path <path>] [--output_image <filename>]\n"
	" |_______________|\n"
	" | Write image   | --write --drivename <name> [--real] [--tao] [--dvd]\n"
	" |               | --image <image filename> [--speed <speed>] [--speedtest]\n"
	" |               | [--enable_abort] [--close_session] [--detect_non_empty_cdrw]\n"
	" |               | [--underrun_prot] [--disable_eject]\n"
	" |               | [--force_erase_cdrw] [--nero_log_timestamp]\n"
	" |               | [--output_image <filename>]\n"
	" |_______________|\n"
	" | Write         | --write --drivename <name> [--real] [--tao]\n"
	" | freestyle CD  | [--artist <artist>] [--title <title>] [--speed <speed>]\n"
	" |               | [--cdextra] [--iso <volumename>]\n"
	" |               | [--freestyle_mode1 <filename>]\n"
	" |               | [--freestyle_mode2 <filename>]\n"
	" |               | [--freestyle_audio <filename>]\n"
	" |               | [--iso-no-joliet] [--iso-mode2] [--speedtest]\n"
	" |               | [--enable_abort] [--close_session] [--detect_non_empty_cdrw]\n"
	" |               | [--cd_text] [--underrun_prot]\n"
	" |               | [--import_udf] [--import_vms_session]\n"
	" |               | [--use_rockridge] [--create_iso_fs] [--create_udf_fs]\n"
	" |               | [--disable_eject] [--verify] [--use_allspace] <disk file>...\n"
	" |               | [--force_erase_cdrw] [--nero_log_timestamp]\n"
	" |               | [--output_image <filename>]\n"
	" |               |\n"
	" |               | NOTE: Any number of freestyle tracks can be specified up to\n"
	" |               | a maximum of 99 tracks.!\n"
	" |_______________|\n"
	" | Estimate      | --estimate --drivename <name> [--tao]\n"
	" | track size    | [--iso <volumename>] [--iso-no-joliet] [--iso-mode2]\n"
	" |               | [--close_session] [--import_udf] [--import_vms_session]\n"
	" |               | [--use_rockridge] [--create_iso_fs] [--create_udf_fs]\n"
	" |               | [--disable_eject] [--dvd] [--use_allspace]\n"
	" |               | [--estimate_no_fs_overhead] [--estimate_no_data]\n"
	" |               | [--estimate_no_exact_size] <disk file> ...\n"
	" |_______________|\n"
	" | Read audio    | --read --drivename <name> [--read_speed <speed>]\n"
	" | track(s)      | --XY <filename> [-XY <filename> ...]\n"
	" |_______________|\n"
	" | List audio    | --listformats\n"
	" | formats       |\n"
	" |_______________|\n"
	" | Erase disc    | --erase [--entire] --drivename <name>\n"
	" |_______________|\n"
	" | Eject disc    | --eject --drivename <name>\n"
	" |_______________|\n"
	" | Load disc     | --load --drivename <name>\n"
	" |_______________|\n"
	" | Obtain image  | --imageinfo <filename>\n"
	" | file disc info|\n"
	" |_______________|\n"
	" | Version info  | --version\n"
	" |_______________|\n"
	"\n"
	" Each command supports the following switches: [--no_error_log],\n"
	" [--error_log <log filename>], [--no_user_interaction] and [@parameter_file]\n"
	"\n"
	"  _______________\n"
	" | --write       | Burn disc.\n"
	" |_______________|\n"
	" | --drivename   | <name> is either the \"full name\" of the drive or the\n"
	" | <name>        | drive letter.\n"
	" |_______________|\n"
	" | --real        | Forces the disc to be actually burned. If --real is not\n"
	" |               | specified the process is only simulated.\n"
	" |_______________|\n"
	" | --tao         | Disc is burned in TAO mode (DAO is default).\n"
	" |_______________|\n"
	" | --burnproof   | Obsolete option, use --underrun_prot instead.\n"
	" |_______________|\n"
	" | --artist      | <artist> is the artist name as to be written on CD.\n"
	" | <artist>      |\n"
	" |_______________|\n"
	" | --title       | <title> is the title to be written on CD.\n"
	" | <title>       |\n"
	" |_______________|\n"
	" | --read_speed  | <speed> is the speed at which the audio tracks will be read\n"
	" | <speed>       | (in x150KB/s).\n"
	" |_______________|\n"
	" | --speed       | <speed> is the speed at which the disc will be burned\n"
	" | <speed>       | (for CD in x150 KB/s and for DVD in x1,385 KB/s).\n"
	" |_______________|\n"
	" | --speed_in_   | <speed> is the speed at which the disc will be burned\n"
	" |  kbps <speed> | (in KB/s).\n"
	" |_______________|\n"
	" | --audio       | The disc is burned with audio information.\n"
	" |_______________|\n"
	" | <audio files> | <audio files> is a list of audio files (wav, mp3, wma, pcm).\n"
	" |_______________|\n"
	" | --cdextra     | Use the CDExtra feature.\n"
	" |_______________|\n"
	" | --iso         | <volume name> is the volume name to be stored on the disc.\n"
	" | <volume name> |\n"
	" |_______________|\n"
	" |--iso-no-joliet| Do not use Joliet format.\n"
	" |_______________|\n"
	" | --iso-mode2   | Burn the CD using mode 2.\n"
	" |_______________|\n"
	" | --speedtest   | Perform speed test before burning.\n"
	" |_______________|\n"
	" | --enable_abort| Notify which operations can and which cannot be aborted.\n"
	" |_______________|\n"
	" |--close_session| Close the session, not the whole disc.\n"
	" |_______________|\n"
	" |--detect_non_  | Detect if the disc for burning is a non empty\n"
	" | empty_cdrw    | RW media and offer to take certain actions.\n"
	" |_______________|\n"
	" | --cd_text     | Write CD text (if supported by device).\n"
	" |_______________|\n"
	" | --videocd     | Burn a Video CD.\n"
	" |_______________|\n"
	" | --svideocd    | Burn a Super Video CD.\n"
	" |_______________|\n"
	" | <video files> | <video files> represents a list of video files (mpeg, jpeg).\n"
	" |_______________|\n"
	" | --image       | <filename> is the filename to the image file.\n"
	" | <filename>    |\n"
	" |_______________|\n"
	" | --read        | Read audio track(s).\n"
	" |_______________|\n"
	" | --XY          | XY is the number of the audio track that is to be saved to\n"
	" | <filename>    | <filename>.\n"
	" |_______________|\n"
	" | --erase       | Erase an RW media.\n"
	" |_______________|\n"
	" | --entire      | Erase the entire disc (the default is quick erase).\n"
	" |_______________|\n"
	" | --eject       | Eject disc.\n"
	" |_______________|\n"
	" | --load        | Load disc.\n"
	" |_______________|\n"
	" | --version     | Print NeroAPI version information.\n"
	" |_______________|\n"
	" | --underrun_   | Protect from underrun condition.\n"
	" |   prot        |\n"
	" |_______________|\n"
	" | --use_        | Use rockridge format.\n"
	" |   rockridge   |\n"
	" |_______________|\n"
	" | --create      | Create ISO filesystem.\n"
	" |   _iso_fs     |\n"
	" |_______________|\n"
	" | --create      | Create UDF filesystem.\n"
	" |   _udf_fs     |\n"
	" |_______________|\n"
	" | --dvdvideo    | Perform reallocation of files in VIDEO_TS\n"
	" |   _realloc    | directory.\n"

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?