private void LoadTemplates() { _adGenerator = new AdaptorGenerator(); _adGenerator.LoadTemplateFromFile(_tmpdPath + "adaptor.tmpd"); _helpGenerator = new HelperGenerator(); _helpGenerator.LoadTemplateFromFile(_tmpdPath + "helper.tmpd"); }
//private void LoadDelegateRegister(string key, object type) //{ // if (!_delegateRegDic.ContainsKey(key)) // _delegateRegDic.Add(key, type); //} //private void LoadDelegateConvertor(Type type) //{ // if (!_delegateSet.Contains(type)) // _delegateSet.Add(type); //} //private void LoadAdaptor(Type type) //{ // if (!_adaptorSet.Contains(type)) // _adaptorSet.Add(type); //} //private void CreateILRuntimeHelper() //{ // Print($"==================Begin create helper:====================="); // _helpGenerator.LoadData(new Tuple<HashSet<Type>, HashSet<Type>, Dictionary<string, object>>(_adaptorSet, _delegateSet, _delegateRegDic)); // var helperStr = _helpGenerator.Generate(); // using (var fs2 = File.Create(_outputPath + "helper.cs")) // { // var sw = new StreamWriter(fs2); // sw.Write(helperStr); // sw.Flush(); // } // Print($"==============End create helper:==================="); //} //private void CreateAdaptor(Type type) //{ // if (type.IsInterface) // return; // Print($"================begin create adaptor:{type.Name}======================="); // var adaptorName = type.Name + "Adaptor"; // using (var fs = File.Create(_outputPath + adaptorName + ".cs")) // { // _adGenerator.LoadData(type); // var classbody = _adGenerator.Generate(); // var sw = new StreamWriter(fs); // sw.Write(classbody); // sw.Flush(); // } // Print($"================end create adaptor:{type.Name}======================="); //} private void LoadTemplates() { var tmpdPath = Application.StartupPath + "/Template/"; _adGenerator = new AdaptorGenerator(); _adGenerator.LoadTemplateFromFile(tmpdPath + "adaptor.tmpd"); _helpGenerator = new HelperGenerator(); _helpGenerator.LoadTemplateFromFile(tmpdPath + "helper.tmpd"); }
/// <summary> /// 加载所有模板 /// </summary> private void LoadTemplates() { var tmpdPath = Application.dataPath + "/ThirdParty/ILRuntime/Adapters/Editor/Adapter/Template"; _interfaceAdapterGenerator = new InterfaceAdapterGenerator(); _interfaceAdapterGenerator.LoadTemplateFromFile(tmpdPath + "adaptor_single_interface.tmpd"); _adGenerator = new AdaptorGenerator(); _adGenerator.LoadTemplateFromFile(tmpdPath + "adaptor.tmpd"); _helpGenerator = new HelperGenerator(); _helpGenerator.LoadTemplateFromFile(tmpdPath + "helper.tmpd"); }