public void Init(bool init = true) { Log.set("Bootstrap"); desktop_path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); debug_path = desktop_path; if (isTeklaActive) { // if Tekla is active - get Path of TSmatch classCAD = new TS(); _TOCdir = TS.GetTeklaDir(TS.ModelDir.exceldesign); ModelDir = TS.GetTeklaDir(TS.ModelDir.model); //6/4/17 macroDir = TS.GetTeklaDir(TS.ModelDir.macro); classCAD = new TS(); } else { // if not active - Windows Environment Variable value _TOCdir = Environment.GetEnvironmentVariable(Decl.WIN_TSMATCH_DIR, EnvironmentVariableTarget.User); ModelDir = desktop_path; classCAD = ifc; } DebugDir = Path.Combine(TOCdir, "TSmatch_DebugData"); ComponentsDir = TOCdir + @"\База комплектующих"; // all price-lists directory if (!init) return; CheckResx(Path.Combine(_TOCdir, "TSmatch.xlsx"), Resx.TSmatch_xlsx); //--- initiate Docs with #Templates Dictionary <string, string> Templates = new Dictionary<string, string> { {"#TOC", TOCdir }, {"#Model", ModelDir}, {"#Components", ComponentsDir}, {"#TMP", TMPdir}, {"#DEBUG", DebugDir}, {"#Macros", macroDir}, {"#Envir", IFCschema} }; Docs.Start(Templates); docTSmatch = Docs.getDoc(); //--- iniciate Ifc IFCschema = Path.Combine(_TOCdir, @"..\inp\IFC2X3.exp"); ifc.init(IFCschema); // инициируем IFC, используя файл схемы IFC - обычно из Tekla //--check other Resources and we're in air CheckResx("Forms", Resx.Forms); Log.exit(); }
internal object init(BootInitMode mode, string arg = "") { List <Resource> Resources = new List <Resource>(); object moduleApp = null; switch (mode) { case BootInitMode.Bootstrap: Resources = Resource.Start(); //Initiate Resorse list with their types and dates Resources.Find(x => x.name == Decl.R_TEKLA).checkResource(Resource.R_name.Tekla); if (isTeklaActive) { // if Tekla is active - get Path of TSmatch classCAD = new TS(); _TOCdir = TS.GetTeklaDir(TS.ModelDir.exceldesign); ModelDir = TS.GetTeklaDir(TS.ModelDir.model); //6/4/17 macroDir = TS.GetTeklaDir(TS.ModelDir.macro); classCAD = new TS(); } else { // if not active - Windows Environment Variable value _TOCdir = Environment.GetEnvironmentVariable(Decl.WIN_TSMATCH_DIR, EnvironmentVariableTarget.User); classCAD = ifc; } desktop_path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); debug_path = desktop_path; //22.12.16 позже, при реинжиниринге TSmatch, нужно будет специально заняться ресурсами - RESX .Net //.. тогда и понадобится эта строчка Console.WriteLine("IsTeklaActive=" + isTeklaActive + "\tTOCdir=" + TOCdir); Resource.checkResource(Resources, Resource.R_name.TSmatch, TOCdir); Dictionary <string, string> Templates = new Dictionary <string, string> { { "#TOC", TOCdir }, { "#Model", ModelDir }, { "#Components", TOCdir + @"\База комплектующих" }, { "#TMP", TMPdir }, { "#DEBUG", DebugDir }, { "#Macros", macroDir }, { "#Envir", IFCschema } }; Docs.Start(Templates); docTSmatch = Docs.getDoc(); Msg.Start(); model = new Mod(); break; #if OLD //17/3/2017 new initSection(); recentModel = Model.Model.RecentModel(); // bool flg = Resource.Check(); //20/12/16// TOCdir = Directory.GetCurrentDirectory(); ////////////desktop_path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); ////////////DebugDir = desktop_path; ////////////Resource.Start(); // подготавливаем ресурсы - в Bootstrap ////////////Resource.checkResource(Decl.R_TEKLA); // проверяем, активна ли Tekla ////////////Resource.checkResource(Decl.R_TSMATCH); // проверяем, доступен ли файл TSmach.xlsx ////////////Template.Start(); // подготавливаем #шаблоны - в Bootstrap ////////////Docs.Start(TOCdir); // инициируем Документы из TSmatch.xlsx/TOC ////////////Msg.Start(); // инициируем Сообщения из TSmatch.xlsx/Messages ////////////Resource.checkResource(); // проверяем все ресурсы, в частности, актуальность даты в [1,1] ////////////recentModel = Model.Model.RecentModel(); ////////////ModelDir = recentModel.ModelDir(); ////////////if (!isTeklaActive) ////////////{ //////////// recentModel = Model.Model.RecentModel(); //////////// ModelDir = recentModel.ModelDir(); //////////// Template.Reset(Decl.TEMPL_MODEL, ModelDir); //////////// ifc = new Ifc(); //////////// ifc.init(IFCschema); // инициируем IFC, используя файл схемы IFC - обычно из Tekla ////////////} case BootInitMode.Tekla: moduleApp = arg == "" ? recentModel : models.Find(x => x.name == arg); if (moduleApp.Equals(null)) { moduleApp = Model.Model.newModelOpenDialog(out models); } break; case BootInitMode.TSmatch: throw new NotImplementedException(); //29/11 moduleApp = suppliers; break; case BootInitMode.Model: if (isTeklaActive) { //7/6 moduleApp = Model.Model.getModelFrTekla(); moduleApp = new Model.Model(); } else { moduleApp = arg == "" ? recentModel : models.Find(x => x.name == arg); if (moduleApp.Equals(null)) { moduleApp = Model.Model.newModelOpenDialog(out models); } classCAD = ifc; } break; #endif // OLD 7/4/17 } return(moduleApp); }