コード例 #1
0
        private string GenerateLicenseData(LicenseDataParser licenseDataParser)
        {
            var licenses   = licenseDataParser.ParseLicenses();
            var exceptions = licenseDataParser.ParseExceptions();

            if (!licenses.LicenseListVersion.Equals(exceptions.LicenseListVersion))
            {
                throw new ArgumentException("The license list version and the exception list version are not equivalent");
            }

            return(Environment.NewLine +
                   LicenseDataClassDeclaration +
                   licenses.LicenseListVersion +
                   DictionaryDeclaration +
                   string.Join(Environment.NewLine, licenses.LicenseList.OrderBy(e => e.LicenseID).Select(e => PrettyPrint(e))) +
                   ClosingBracket +
                   string.Join(Environment.NewLine, exceptions.ExceptionList.OrderBy(e => e.LicenseExceptionID).Select(e => PrettyPrint(e))) +
                   ClosingBracket2 +
                   Environment.NewLine);
        }
コード例 #2
0
 public LicenseDataCodeGenerator(string licenseFile, string exceptionsFile)
 {
     _parser = new LicenseDataParser(licenseFile, exceptionsFile);
 }