Beispiel #1
0
        public static CommonTypes.EnumRenamePolicy getRenamePolicy(CmdLineArgs.CmdLineArguments cmdArgs, CommonTypes.EnumRenamePolicy defaultValue)
        {
            var renamePolicyStr = cmdArgs.GetOptionalArgument("renamePolicy", "xxx");
            var renamePolicy    = defaultValue;

            if (renamePolicyStr == "0")
            {
                renamePolicy = CommonTypes.EnumRenamePolicy.NoRenamePolicy;
            }
            else if (renamePolicyStr == "1")
            {
                renamePolicy = CommonTypes.EnumRenamePolicy.SelectiveEnumerants;
            }
            else if (renamePolicyStr == "2")
            {
                renamePolicy = CommonTypes.EnumRenamePolicy.AllEnumerants;
            }
            else if (renamePolicyStr != "xxx")
            {
                Console.Error.WriteLine("Invalid value for argument 'renamePolicy'\nValid values are 0,1,2");
                Environment.Exit(Usage());
            }

            return(renamePolicy);
        }
Beispiel #2
0
        static void exportCustomStg(CmdLineArgs.CmdLineArguments cmdArgs, String customStg, String cmdLingName, Action <string, string> backendInvocation)
        {
            var files = customStg.Split(':');

            if (files.Length != 2)
            {
                files = customStg.Split(new string[] { "::" }, StringSplitOptions.RemoveEmptyEntries);
                if (files.Length != 2)
                {
                    Console.Error.WriteLine("Invalid usage of {0} argument. Please use ':' to seperate the stg file with output file", cmdLingName);
                    Console.Error.WriteLine("E.g. -{0} mystg.stg:output.txt ", cmdLingName);
                    Console.Error.WriteLine("Under windows, you may user double :: to separate the stg file with output file");
                    Console.Error.WriteLine("E.g. -{0} c:\\mystg.stg::c:\\output.txt ", cmdLingName);
                    Environment.Exit(4);
                }
            }
            var stgFileName = files.First();
            var outFileName = files.Last();

            if (!File.Exists(stgFileName))
            {
                Console.Error.WriteLine("Custom stg file '{0}' does not exist", stgFileName);
                Environment.Exit(4);
            }


            backendInvocation(stgFileName, outFileName);
        }