static void OutputLicenseToText(Args _args)
{
#define.licenseVersion(2)
#define.KeywordLen(20)
#define.keywordLicense(' License')
#define.keywordProperties(' Properties')
#define.keywordCodes('Codes' )
#define.keywordCodeLine(' CodeLine')
#define.keywordDate('Date')
#define.keywordSerial(' Serial')
#define.keywordValue('Value' )
#define.blank('')
#define.space1(' ')
#define.space2(' ')
#define.space3(' ')
#define.spaceHash(' #')
#define.OutputFilename(@'C:\ OutputLicenseKeys.txt')
#define.keywordInfo(1)
#define.keywordWarning(2)
SysConfig sysConfig;
SysLicenseCodeSort sysLicenseCodeSort;
container fileOut;
int i;
System.IO.StreamWriter sw;
InteropPermission perm = new InteropPermission(InteropKind: :ClrInterop);
;
fileOut += "LicenseVersion " + strfmt("%1", #licenseVersion);
fileOut += #blank;
fileOut += #keywordLicense + #spaceHash + xSysConfig::find(ConfigType::L icenseName,0).Value;
fileOut += #blank;
fileOut += #space1 + #keywordProperties;
fileOut += #space2 + "Name" + #spaceHash + xSysConfig::find(ConfigType::L icenseName,0).Value;
fileOut += #space2 + #keywordSerial + #spaceHash + xSysConfig::find(ConfigType::S erialNo,0).Value;
fileOut += #space2 + #keywordDate + #spaceHash + xSysConfig::find(ConfigType::L icenseName,1).Value;
fileOut += #space1 + "EndProperties";
fileOut += #blank;
fileOut += #space1 + #keywordCodes;
// Build CodeLines
while select sysConfig
where sysConfig.configType == ConfigType::AccessCodes &&
sysConfig.value != #blank
join sysLicenseCodeSort
order by SortIdx
where sysLicenseCodeSort.Id == sysConfig.id
{
fileOut += #space2 + #keywordCodeLine + #spaceHash + int2str(sysConfig.id + 1);
fileOut += #space3 + #keywordValue + #spaceHash + sysConfig.value;
fileOut += #space2 + "EndCodeLine";
fileOut += #blank;
}
fileOut += #blank;
fileOut += #space2 + "EndCodes";
fileOut += #space1 + "EndLicense";
// Begin file output
perm.assert();
sw = new System.IO.StreamWriter(#Output Filename);
for (i=1; i<=conLen(fileOut); i++)
{
sw.WriteLine(conPeek( fileOut, i));
}
sw.Flush();
sw.Close();
sw.Dispose();
CodeAccessPermission:: revertAssert();
info("License successfully output to " + #OutputFilename);
}
{
#define.licenseVersion(2)
#define.KeywordLen(20)
#define.keywordLicense('
#define.keywordProperties('
#define.keywordCodes('Codes'
#define.keywordCodeLine('
#define.keywordDate('Date')
#define.keywordSerial('
#define.keywordValue('Value'
#define.blank('')
#define.space1(' ')
#define.space2(' ')
#define.space3(' ')
#define.spaceHash(' #')
#define.OutputFilename(@'C:\
#define.keywordInfo(1)
#define.keywordWarning(2)
SysConfig sysConfig;
SysLicenseCodeSort sysLicenseCodeSort;
container fileOut;
int i;
System.IO.StreamWriter sw;
InteropPermission perm = new InteropPermission(InteropKind:
;
fileOut += "LicenseVersion " + strfmt("%1", #licenseVersion);
fileOut += #blank;
fileOut += #keywordLicense + #spaceHash + xSysConfig::find(ConfigType::L
fileOut += #blank;
fileOut += #space1 + #keywordProperties;
fileOut += #space2 + "Name" + #spaceHash + xSysConfig::find(ConfigType::L
fileOut += #space2 + #keywordSerial + #spaceHash + xSysConfig::find(ConfigType::S
fileOut += #space2 + #keywordDate + #spaceHash + xSysConfig::find(ConfigType::L
fileOut += #space1 + "EndProperties";
fileOut += #blank;
fileOut += #space1 + #keywordCodes;
// Build CodeLines
while select sysConfig
where sysConfig.configType == ConfigType::AccessCodes &&
sysConfig.value != #blank
join sysLicenseCodeSort
order by SortIdx
where sysLicenseCodeSort.Id == sysConfig.id
{
fileOut += #space2 + #keywordCodeLine + #spaceHash + int2str(sysConfig.id + 1);
fileOut += #space3 + #keywordValue + #spaceHash + sysConfig.value;
fileOut += #space2 + "EndCodeLine";
fileOut += #blank;
}
fileOut += #blank;
fileOut += #space2 + "EndCodes";
fileOut += #space1 + "EndLicense";
// Begin file output
perm.assert();
sw = new System.IO.StreamWriter(#Output
for (i=1; i<=conLen(fileOut); i++)
{
sw.WriteLine(conPeek(
}
sw.Flush();
sw.Close();
sw.Dispose();
CodeAccessPermission::
info("License successfully output to " + #OutputFilename);
}
No comments:
Post a Comment