/// <summary> /// Generate CSharp solution here /// </summary> /// <param name="option"></param> public void GenerateSolution(GenerateOption option) { // generate the solution tree solutionHomeDirection = Path.Combine(option.OutputFolder, "PAT.Module." + option.ModuleCode); solutionPropertiesDirection = Path.Combine(solutionHomeDirection, "Properties"); solutionAssertionDirection = Path.Combine(solutionHomeDirection, "Assertions"); solutionLtsDirection = Path.Combine(solutionHomeDirection, "LTS"); solutionLtsSampleDirection = Path.Combine(solutionLtsDirection, "Sample"); solutionUltilityDirection = Path.Combine(solutionHomeDirection, "Ultility"); solutionMainDirection = Path.Combine(option.OutputFolder, "PAT.Main"); solutionMainPropertiesDirection = Path.Combine(solutionMainDirection, "Properties"); solutionRootDirection = option.OutputFolder; //-------------------------------------------------------------- // resolve the parameters here, this params will be used by ptt // file to generate the solution solutionModuleCode = "PAT." + option.ModuleCode; ModuleCode = option.ModuleCode; solutionModuleName = option.ModuleName; assertionsNamespace = solutionModuleCode + ".Assertions"; ltsNamespace = solutionModuleCode + ".LTS"; ultilityNamespace = solutionModuleCode + ".Ultility"; // resolve the options the user selected // the custom syntax customSyntax = option.CustomSyntax; semanticModel = option.Semantics; // whether generate BDD encoding methods isBdd = option.IsBdd; // the assertion option selected // ------------------------------------------------------------------------ assertionDeadlock = option.Assertion.AssertionDeadlock; assertionLTL = option.Assertion.AssertionLTL; assertionRefinement = option.Assertion.AssertionRefinement; assertionReachability = option.Assertion.AssertionReachability; assertionDeterminism = option.Assertion.AssertionDeterminism; assertionDivergence = option.Assertion.AssertionDivergence; // the picture location // ----------------------------------------------------------------------- if (option.ModuleIconLocation != null && !option.ModuleIconLocation.Equals("")) { sourceModuleIconPath = option.ModuleIconLocation; // ReSharper disable AssignNullToNotNullAttribute destModuleIconPath = Path.Combine(solutionHomeDirection, Path.GetFileName(option.ModuleIconLocation)); // ReSharper restore AssignNullToNotNullAttribute } //-------------------------------------------------------------- // please assign the template path in the next code line templateHomeDirection = Path.Combine(Application.StartupPath, @"Docs\Template\Module"); templateAssertionsDirection = Path.Combine(templateHomeDirection, "Assertions"); templateLTSDirection = Path.Combine(templateHomeDirection, "LTS"); templateUltilityDirection = Path.Combine(templateHomeDirection, "Ultility"); templatePropertiesDirection = Path.Combine(templateHomeDirection, "Properties"); templateMainDirection = Path.Combine(Application.StartupPath, @"Docs\Template\Main"); templateMainPropertiesDirection = Path.Combine(templateMainDirection, "Properties"); templateRootDirection = Path.Combine(Application.StartupPath, @"Docs\Template"); // determine which fold to use switch (semanticModel) { case "Labeled Transition System (LTS)": templateAssertionsDirection += "LTS"; templateLTSDirection += "LTS"; break; case "Timed Transition System (TTS)": // use the default templates now! templateAssertionsDirection += "LTS"; // TODO use the default now templateLTSDirection += "LTS"; break; case "Markov Decision Processes (MDP)": templateAssertionsDirection += "MDP"; templateLTSDirection += "MDP"; // can also generate special classes here break; } //-------------------------------------------------------------- // Create the folder first GenerateFolders(); // After create the folder, we start to create the files GenerateFiles(); }
/// <summary> /// Generate CSharp solution here /// </summary> /// <param name="option"></param> public void GenerateSolution(GenerateOption option) { // generate the solution tree solutionHomeDirection = Path.Combine(option.OutputFolder, "PAT.Module." + option.ModuleCode); solutionPropertiesDirection = Path.Combine(solutionHomeDirection,"Properties"); solutionAssertionDirection = Path.Combine(solutionHomeDirection, "Assertions"); solutionLtsDirection = Path.Combine(solutionHomeDirection, "LTS"); solutionLtsSampleDirection = Path.Combine(solutionLtsDirection, "Sample"); solutionUltilityDirection = Path.Combine(solutionHomeDirection, "Ultility"); solutionMainDirection = Path.Combine(option.OutputFolder, "PAT.Main"); solutionMainPropertiesDirection = Path.Combine(solutionMainDirection, "Properties"); solutionRootDirection = option.OutputFolder; //-------------------------------------------------------------- // resolve the parameters here, this params will be used by ptt // file to generate the solution solutionModuleCode = "PAT." + option.ModuleCode; ModuleCode = option.ModuleCode; solutionModuleName = option.ModuleName; assertionsNamespace = solutionModuleCode + ".Assertions"; ltsNamespace = solutionModuleCode + ".LTS"; ultilityNamespace = solutionModuleCode + ".Ultility"; // resolve the options the user selected // the custom syntax customSyntax = option.CustomSyntax; semanticModel = option.Semantics; // whether generate BDD encoding methods isBdd = option.IsBdd; // the assertion option selected // ------------------------------------------------------------------------ assertionDeadlock = option.Assertion.AssertionDeadlock; assertionLTL = option.Assertion.AssertionLTL; assertionRefinement = option.Assertion.AssertionRefinement; assertionReachability = option.Assertion.AssertionReachability; assertionDeterminism = option.Assertion.AssertionDeterminism; assertionDivergence = option.Assertion.AssertionDivergence; // the picture location // ----------------------------------------------------------------------- if (option.ModuleIconLocation != null && !option.ModuleIconLocation.Equals("")) { sourceModuleIconPath = option.ModuleIconLocation; // ReSharper disable AssignNullToNotNullAttribute destModuleIconPath = Path.Combine(solutionHomeDirection, Path.GetFileName(option.ModuleIconLocation)); // ReSharper restore AssignNullToNotNullAttribute } //-------------------------------------------------------------- // please assign the template path in the next code line templateHomeDirection = Path.Combine(Application.StartupPath, @"Docs\Template\Module"); templateAssertionsDirection = Path.Combine(templateHomeDirection, "Assertions"); templateLTSDirection = Path.Combine(templateHomeDirection, "LTS"); templateUltilityDirection = Path.Combine(templateHomeDirection, "Ultility"); templatePropertiesDirection = Path.Combine(templateHomeDirection, "Properties"); templateMainDirection = Path.Combine(Application.StartupPath, @"Docs\Template\Main"); templateMainPropertiesDirection = Path.Combine(templateMainDirection, "Properties"); templateRootDirection = Path.Combine(Application.StartupPath, @"Docs\Template"); // determine which fold to use switch (semanticModel) { case "Labeled Transition System (LTS)": templateAssertionsDirection += "LTS"; templateLTSDirection += "LTS"; break; case "Timed Transition System (TTS)": // use the default templates now! templateAssertionsDirection += "LTS"; // TODO use the default now templateLTSDirection += "LTS"; break; case "Markov Decision Processes (MDP)": templateAssertionsDirection += "MDP"; templateLTSDirection += "MDP"; // can also generate special classes here break; } //-------------------------------------------------------------- // Create the folder first GenerateFolders(); // After create the folder, we start to create the files GenerateFiles(); }