//生成LocalizationData //private void CreateDataClass() //{ // string path = Application.dataPath + PathDefinition.Auto_Generate_Path; // GenerateCode.Generate("LocalizationData", path, TypeAttributes.Public, CodeType.IsClass, GetFields(), null, // new CodeAttributeDeclaration(new CodeTypeReference(typeof(SerializableAttribute))), "EasyLocalization", GetImports()); //} //生成LanguageType private void CreateEnum() { string path = Application.dataPath + PathDefinition.Auto_Generate_Path; GenerateCode.Generate("LanguageType", path, TypeAttributes.Public, CodeType.IsEnum, GetEnumFields(), null, null, "EasyLocalization", null); //刷新资源(LanguageType会很久才会更新成新设置的) AssetDatabase.Refresh(); }
private void GenerateButtonClick() { if (!_isInit) { return; } generateCode.Generate(); }
private void Generate() { GCode = new GenerateCode(TargetGenerate, Options.Type, Options.WithCoockie, Options.WithHeaders); if (GCode.DirectoryNotFoundException()) { WindowsManager.Message("Project path error", "Directory path of project not found"); return; } GCode.Generate(); if (Options.OpenFolder) { Process.Start(TargetGenerate.ProjectPath); } }
/// <summary> /// starts actual generation for an ecr those info has been previously saved in globalvar from setoptions function. /// It Finally rollbacks transaction /// </summary> /// <returns></returns> public bool GenerateECRDeliverables(ECRLevelOptions ecrOptions, Logger logger) { DBManager dbManager = null; DataPrepartion dataPreparation = null; try { dbManager = new DBManager(this._connectionString); dataPreparation = new DataPrepartion(this._guid, dbManager, ref ecrOptions); if (this._userInputs.DataMode.Equals(DataMode.Model)) { _progress.Report("Populating Hashtables for " + ecrOptions.Ecrno + "..."); dataPreparation.PrepareHashTables(); } List <Task> consolidatedTasks = new List <Task>(); Task task1 = Task.Run(() => { GenerateCode generateCode = new GenerateCode(dataPreparation, ref ecrOptions, this._progress); generateCode.Generate(_userInputs); }); consolidatedTasks.Add(task1); Task task2 = Task.Run(() => { this.GenerateHtmXmlAndScripts(dataPreparation, this._userInputs, ref ecrOptions, logger); }); consolidatedTasks.Add(task2); Task.WaitAll(consolidatedTasks.ToArray()); return(ecrOptions.ErrorCollection != null ? ecrOptions.ErrorCollection.Count == 0 : true); } catch (Exception ex) { Logger.WriteLogToTraceListener("Codegenwrapper->Generate->", string.Format("{0}", ex.InnerException != null ? ex.InnerException.Message : ex.Message)); return(false); } finally { Logger.WriteLogToTraceListener("CodegenWrapper->Generate", string.Format("Rollback Transaction...")); if (dbManager != null && dbManager.Connection != null) { dbManager.RollbackTransaction(); dbManager.Close(); } } }
static void Main(string[] args) { //args = new string[1]; //args[0] = "C:/Users/DAYRENE/source/repos/CoolMIPS_Compiler_DW/Test/hello_world.cl"; Utils.Welcome(); Utils.OpenFile(args); var ast = Parsing.Parsing.AST(args[0]); var scope = new Scope(); ProgramNode programNode = ast as ProgramNode; Semantic.Semantic.Check(programNode, scope); GenerateCode.Generate(programNode, Utils.GetOutputPath(args[0]), scope); Environment.Exit(0); }