当前位置: 首页>>代码示例>>Java>>正文


Java CmdLineOption类代码示例

本文整理汇总了Java中com.trollworks.toolkit.utility.cmdline.CmdLineOption的典型用法代码示例。如果您正苦于以下问题:Java CmdLineOption类的具体用法?Java CmdLineOption怎么用?Java CmdLineOption使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CmdLineOption类属于com.trollworks.toolkit.utility.cmdline包,在下文中一共展示了CmdLineOption类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import com.trollworks.toolkit.utility.cmdline.CmdLineOption; //导入依赖的package包/类
/** Utility for creating GCS's icon sets. */
public static void main(String[] args) {
    String name = "GenerateIcons";
    Attributes attributes = new Attributes();
    attributes.putValue(BundleInfo.BUNDLE_NAME, name);
    attributes.putValue(BundleInfo.BUNDLE_VERSION, "1.0");
    attributes.putValue(BundleInfo.BUNDLE_COPYRIGHT_OWNER, "Richard A. Wilkes");
    attributes.putValue(BundleInfo.BUNDLE_COPYRIGHT_YEARS, "2014");
    attributes.putValue(BundleInfo.BUNDLE_LICENSE, "Mozilla Public License 2.0");
    BundleInfo.setDefault(new BundleInfo(attributes, name));
    CmdLineOption icnsOption = new CmdLineOption("Generate ICNS files", null, "icns");
    CmdLineOption icoOption = new CmdLineOption("Generate ICO files", null, "ico");
    CmdLineOption appOption = new CmdLineOption("Generate just the 128x128 app icon", null, "app");
    CmdLineOption dirOption = new CmdLineOption("The directory to place the generated files into", "DIR", "dir");
    CmdLine cmdline = new CmdLine();
    cmdline.addOptions(icnsOption, icoOption, appOption, dirOption);
    cmdline.processArguments(args);
    boolean icns = cmdline.isOptionUsed(icnsOption);
    boolean ico = cmdline.isOptionUsed(icoOption);
    boolean app = cmdline.isOptionUsed(appOption);
    if (!icns && !ico && !app) {
        System.err.printf("At least one of %s, %s, or %s must be specified.\n", icnsOption, icoOption, appOption);
        System.exit(1);
    }
    try {
        File dir = new File(cmdline.isOptionUsed(dirOption) ? cmdline.getOptionArgument(dirOption) : ".");
        System.out.println("Generating icons into " + dir);
        dir.mkdirs();
        if (app) {
            File file = new File(dir, "gcs.png");
            if (StdImage.writePNG(file, getAppIcons().getImage(128), 72)) {
                System.out.println("Created: " + file);
            } else {
                System.err.println("Unable to create: " + file);
            }
        }
        if (icns || ico) {
            createIconFiles(getAppIcons(), dir, "app", icns, ico);
            createIconFiles(getAdvantagesDocumentIcons(), dir, AdvantageList.EXTENSION, icns, ico);
            createIconFiles(getEquipmentDocumentIcons(), dir, EquipmentList.EXTENSION, icns, ico);
            createIconFiles(getCharacterSheetDocumentIcons(), dir, GURPSCharacter.EXTENSION, icns, ico);
            createIconFiles(getTemplateDocumentIcons(), dir, Template.EXTENSION, icns, ico);
            createIconFiles(getSkillsDocumentIcons(), dir, SkillList.EXTENSION, icns, ico);
            createIconFiles(getSpellsDocumentIcons(), dir, SpellList.EXTENSION, icns, ico);
            createIconFiles(getPDFDocumentIcons(), dir, FileType.PDF_EXTENSION, icns, ico);
        }
    } catch (Exception exception) {
        exception.printStackTrace(System.err);
    }
}
 
开发者ID:richardwilkes,项目名称:gcs,代码行数:51,代码来源:GCSImages.java


注:本文中的com.trollworks.toolkit.utility.cmdline.CmdLineOption类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。