void IPlugin.ProcessRepository(EA.Repository repository) { Log.Info(""); string targetPath = GetTargetPath(); StateGenSync.Types.StateMachineData data = m_IRepositoryHandler.HandleRepository(repository); StateGenSync.Types.Product iActionHandler = m_IInterfaceBuilder.CreateProduct(data.GetActions(), FILENAME_IACTIONHANDLER); StateGenSync.Types.Product iConditionHandler = m_IInterfaceBuilder.CreateProduct(data.GetGuards(), FILENAME_ICONDITIONHANDLER); StateGenSync.Types.Product iFsm = m_IInterfaceBuilder.CreateProduct(data.GetFsm().GetMethods(), data.GetFsm().GetInferfaceName() + ".hpp"); StateGenSync.Types.Product fsmData = m_IFsmDataBuilder.CreateProduct(data, FILENAME_FSMDATA); StateGenSync.Types.Product events = m_IEnumBuilder.CreateProduct(data.GetEnumEvents(), FILENAME_EVENTS); StateGenSync.Types.Product activities = m_IEnumBuilder.CreateProduct(data.GetEnumActivities(), FILENAME_ACTIVITIES); StateGenSync.Types.Product conditionHandlerHeader = m_IClassHeaderBuilder.CreateProduct(data.GetGuards(), FILENAME_CONDITIONHANDLER, FILENAME_ICONDITIONHANDLER); StateGenSync.Types.Product actionHandlerHeader = m_IClassHeaderBuilder.CreateProduct(data.GetActions(), FILENAME_ACTIONHANDLER, FILENAME_IACTIONHANDLER); StateGenSync.Types.Product conditionHandlerImpl = m_IClassImplBuilder.CreateProduct(data.GetGuards(), FILENAME_CONDITIONHANDLERIMPL); StateGenSync.Types.Product actionHandlerImpl = m_IClassImplBuilder.CreateProduct(data.GetActions(), FILENAME_ACTIONHANDLERIMPL); StateGenSync.Types.Product fsmHandlerHeader = m_IFsmHandlerHeaderBuilder.CreateProduct(data.GetFsm().GetMethods(), FILENAME_FSMHANDLERHEADER); StateGenSync.Types.Product fsmHandlerImpl = m_IFsmHandlerImplBuilder.CreateProduct(FILENAME_FSMHANDLERIMPL); StateGenSync.Types.Product transitionRow = m_ITransitionRowBuilder.CreateProduct(FILENAME_TRANSITIONROW); m_IFileWriter.WriteProduct(targetPath, iActionHandler); m_IFileWriter.WriteProduct(targetPath, iConditionHandler); m_IFileWriter.WriteProduct(targetPath, iFsm); m_IFileWriter.WriteProduct(targetPath, fsmData); m_IFileWriter.WriteProduct(targetPath, events); m_IFileWriter.WriteProduct(targetPath, activities); m_IFileWriter.WriteProduct(targetPath, conditionHandlerHeader); m_IFileWriter.WriteProduct(targetPath, actionHandlerHeader); m_IFileWriter.WriteProduct(targetPath, conditionHandlerImpl); m_IFileWriter.WriteProduct(targetPath, actionHandlerImpl); m_IFileWriter.WriteProduct(targetPath, fsmHandlerHeader); m_IFileWriter.WriteProduct(targetPath, fsmHandlerImpl); m_IFileWriter.WriteProduct(targetPath, transitionRow); MessageBox.Show("Finish"); }
public void WriteProduct(string path, StateGenSync.Types.Product product) { Log.Info(""); try { System.IO.StreamWriter file = new System.IO.StreamWriter(path + product.GetFilename()); file.WriteLine(product.GetProduct().ToString()); file.Close(); } catch (Exception e) { Log.Info("Exception:" + e.Message); } finally { // nothing } }