コード例 #1
0
ファイル: FormApp.cs プロジェクト: theseye/Bim.Training
        /// <summary>
        /// 开始导出
        /// </summary>
        /// <param name="localConfig"></param>
        /// <param name="progressCallback"></param>
        /// <param name="cancellationToken"></param>
        private void StartExport(AppLocalConfig localConfig, Action <int> progressCallback, CancellationToken cancellationToken)
        {
            using (var log = new RuntimeLog())
            {
                var config = new ExportConfig();
                config.InputFilePath = localConfig.InputFilePath;
                config.TargetPath    = localConfig.LastTargetPath;
                config.Features      = localConfig.Features.ToDictionary(x => x, x => true);
                config.Trace         = log.Log;
                config.FontPath      = new List <string>
                {
                    App.GetFontFolderPath()
                };

                #region Add Plugin - CreatePropDb
                {
                    var cliPath = Path.Combine(
                        App.GetHomePath(),
                        @"Tools",
                        @"CreatePropDb",
                        @"CreatePropDbCLI.exe");
                    if (File.Exists(cliPath))
                    {
                        config.Addins.Add(new ExportPlugin(
                                              FeatureType.GenerateModelsDb,
                                              cliPath,
                                              new[] { @"-i", config.TargetPath }
                                              ));
                    }
                }
                #endregion

                Exporter.ExportToSvf(config, x => progressCallback?.Invoke((int)x), cancellationToken);
            }
        }
コード例 #2
0
        private bool StartExport(JobConfig jobConfig, RuntimeLog log, Action <int> progressCallback)
        {
            var targetFormat = jobConfig.Format?.Trim().ToLowerInvariant();

            switch (targetFormat)
            {
            case @"gltf":
                ExportToGltf(jobConfig, log, progressCallback);
                break;

            case @"3dtiles":
                ExportToCesium3DTiles(jobConfig, log, progressCallback);
                break;

#if !EXPRESS
            case @"svf":
                ExportToSvf(jobConfig, log, progressCallback);
                break;
#endif
            default:
                log.Log(@"Fail", @"Startup", $@"Unsupported format - {targetFormat}");
                return(false);
            }

            return(true);
        }
コード例 #3
0
        private void ExportToGltf(JobConfig config, RuntimeLog log, Action <int> progressCallback)
        {
            var features = new Dictionary <Common.Formats.Gltf.FeatureType, bool>();
            var options  = config.OutputOptions;

            if (options != null && options.Count > 0)
            {
                foreach (var option in options)
                {
                    if (Enum.TryParse(option, true, out Common.Formats.Gltf.FeatureType result))
                    {
                        features[result] = true;
                    }
                }
            }

            var setting = new Bimangle.ForgeEngine.Common.Formats.Gltf.Navisworks.ExportSetting();

            setting.OutputPath = config.OutputPath;
            setting.Features   = features?.Where(x => x.Value).Select(x => x.Key).ToList();

#if EXPRESS
            var exporter = new Bimangle.ForgeEngine.Navisworks.Express.Gltf.Exporter(App.GetHomePath());
#else
            var exporter = new Bimangle.ForgeEngine.Navisworks.Pro.Gltf.Exporter(App.GetHomePath());
#endif
            exporter.Export(setting, log, progressCallback, CancellationToken.None);
        }
コード例 #4
0
        /// <summary>
        /// 开始导出
        /// </summary>
        /// <param name="uidoc"></param>
        /// <param name="view"></param>
        /// <param name="localConfig"></param>
        /// <param name="exportType"></param>
        /// <param name="outputStream"></param>
        /// <param name="features"></param>
        /// <param name="useShareTexture"></param>
        /// <param name="progressCallback"></param>
        /// <param name="viewIds"></param>
        /// <param name="cancellationToken"></param>
        private void StartExport(UIDocument uidoc, View3D view, AppConfigSvf localConfig, ExportType exportType, Stream outputStream, Dictionary <FeatureType, bool> features, bool useShareTexture, Action <int> progressCallback, List <int> viewIds, CancellationToken cancellationToken)
        {
#if EXPRESS
            throw new NotImplementedException();
#else
            using (var log = new RuntimeLog())
            {
                var featureList   = features?.Where(x => x.Value).Select(x => x.Key).ToList() ?? new List <FeatureType>();
                var elementIdList = _ElementIds?.Where(x => x.Value).Select(x => x.Key).ToList();

                var exporter = new Bimangle.ForgeEngine.Revit.Pro.Svf.Exporter(InnerApp.GetHomePath());

                if (uidoc != null && uidoc.ActiveView.Id == view.Id)
                {
                    exporter.Export(
                        uidoc, view,
                        localConfig.LevelOfDetail, localConfig.LastTargetPath, exportType, outputStream,
                        featureList, elementIdList, viewIds,
                        log, progressCallback, cancellationToken
                        );
                }
                else
                {
                    exporter.Export(
                        view,
                        localConfig.LevelOfDetail, localConfig.LastTargetPath, exportType, outputStream,
                        featureList, elementIdList, viewIds,
                        log, progressCallback, cancellationToken
                        );
                }
            }
#endif
        }
コード例 #5
0
 /// <summary>
 /// 开始导出
 /// </summary>
 /// <param name="uidoc"></param>
 /// <param name="view"></param>
 /// <param name="setting"></param>
 /// <param name="progressCallback"></param>
 /// <param name="cancellationToken"></param>
 private void StartExport(UIDocument uidoc, View3D view, ExportSetting setting, Action <int> progressCallback, CancellationToken cancellationToken)
 {
     using (var log = new RuntimeLog())
     {
         var exporter = new ExporterX(InnerApp.GetHomePath());
         exporter.Export(view, uidoc, setting, log, progressCallback, cancellationToken);
     }
 }
コード例 #6
0
 private void StartExport(Viewport view, ExportSetting setting, Action <int> progressCallback, CancellationToken cancellationToken)
 {
     using (var log = new RuntimeLog())
     {
         var exporter = new Bimangle.ForgeEngine.Dgn.Pro.Svf.Exporter(InnerApp.GetHomePath());
         exporter.Export(view, setting, log, progressCallback, cancellationToken);
     }
 }
コード例 #7
0
 /// <summary>
 /// 开始导出
 /// </summary>
 /// <param name="setting"></param>
 /// <param name="progressCallback"></param>
 /// <param name="cancellationToken"></param>
 private void StartExport(ExportSetting setting, Action <int> progressCallback, CancellationToken cancellationToken)
 {
     using (var log = new RuntimeLog())
     {
         var exporter = new ExporterX(App.GetHomePath());
         exporter.Export(setting, log, progressCallback, cancellationToken);
     }
 }
コード例 #8
0
        /// <summary>
        /// 开始导出
        /// </summary>
        /// <param name="uidoc"></param>
        /// <param name="view"></param>
        /// <param name="localConfig"></param>
        /// <param name="exportType"></param>
        /// <param name="outputStream"></param>
        /// <param name="features"></param>
        /// <param name="useShareTexture"></param>
        /// <param name="progressCallback"></param>
        /// <param name="cancellationToken"></param>
        private void StartExport(UIDocument uidoc, View3D view, AppLocalConfig localConfig, ExportType exportType, Stream outputStream, Dictionary <FeatureType, bool> features, bool useShareTexture, Action <int> progressCallback, CancellationToken cancellationToken)
        {
            using (var log = new RuntimeLog())
            {
                var config = new ExportConfig();
                config.TargetPath      = localConfig.LastTargetPath;
                config.ExportType      = exportType;
                config.UseShareTexture = useShareTexture;
                config.OutputStream    = outputStream;
                config.Features        = features ?? new Dictionary <FeatureType, bool>();
                config.Trace           = log.Log;
                config.ElementIds      = (features?.FirstOrDefault(x => x.Key == FeatureType.OnlySelected).Value ?? false)
                    ? _ElementIds
                    : null;
                config.LevelOfDetail = localConfig.LevelOfDetail;

                #region Add Plugin - CreatePropDb
                {
                    var cliPath = Path.Combine(
                        App.GetHomePath(),
                        @"Tools",
                        @"CreatePropDb",
                        @"CreatePropDbCLI.exe");

                    if (File.Exists(cliPath))
                    {
                        config.Addins.Add(new ExportPlugin(
                                              FeatureType.GenerateModelsDb,
                                              cliPath,
                                              new[] { @"-i", config.TargetPath }
                                              ));
                    }
                }
                #endregion

                #region Add Plugin - CreateThumbnail
                {
                    var cliPath = Path.Combine(
                        App.GetHomePath(),
                        @"Tools",
                        @"CreateThumbnail",
                        @"CreateThumbnailCLI.exe");

                    if (File.Exists(cliPath))
                    {
                        config.Addins.Add(new ExportPlugin(
                                              FeatureType.GenerateThumbnail,
                                              cliPath,
                                              new[] { @"-i", config.TargetPath }
                                              ));
                    }
                }
                #endregion

                Exporter.ExportToSvf(uidoc, view, config, x => progressCallback?.Invoke((int)x), cancellationToken);
            }
        }
コード例 #9
0
 /// <summary>
 /// 开始导出
 /// </summary>
 /// <param name="localConfig"></param>
 /// <param name="features"></param>
 /// <param name="progressCallback"></param>
 /// <param name="cancellationToken"></param>
 private void StartExport(AppConfigCesium3DTiles localConfig, Dictionary <FeatureType, bool> features, Action <int> progressCallback, CancellationToken cancellationToken)
 {
     using (var log = new RuntimeLog())
     {
         var featureList = features?.Where(x => x.Value).Select(x => x.Key).ToList() ?? new List <FeatureType>();
         var exporter    = new ExporterX(App.GetHomePath());
         exporter.Export(localConfig.LastTargetPath, localConfig.Mode, featureList, log, progressCallback, cancellationToken);
     }
 }
コード例 #10
0
        // save log to db
        public static void SaveLog(RuntimeLog runTimeLog, bool sendEmail = true)
        {
            List <Task> TaskList = new List <Task>();

            try
            {
                DataRunTimeLogs.Insert(runTimeLog);
            }
            catch (Exception ex)
            {
            }
        }
コード例 #11
0
        /// <summary>
        /// 开始导出
        /// </summary>
        /// <param name="setting"></param>
        /// <param name="progressCallback"></param>
        /// <param name="cancellationToken"></param>
        private void StartExport(ExportSetting setting, Action <int> progressCallback, CancellationToken cancellationToken)
        {
#if EXPRESS
            throw new NotImplementedException();
#else
            using (var log = new RuntimeLog())
            {
                var exporter = new Bimangle.ForgeEngine.Navisworks.Pro.Svf.Exporter(App.GetHomePath());
                exporter.Export(setting, log, progressCallback, cancellationToken);
            }
#endif
        }
コード例 #12
0
        /// <summary>
        /// 开始导出
        /// </summary>
        /// <param name="view"></param>
        /// <param name="setting"></param>
        /// <param name="progressCallback"></param>
        /// <param name="cancellationToken"></param>
        private void StartExport(Viewport view, ExportSetting setting, Action <int> progressCallback, CancellationToken cancellationToken)
        {
            using (var log = new RuntimeLog())
            {
#if EXPRESS
                var exporter = new Bimangle.ForgeEngine.Dgn.Express.Cesium3DTiles.Exporter(InnerApp.GetHomePath());
#else
                var exporter = new Bimangle.ForgeEngine.Dgn.Pro.Cesium3DTiles.Exporter(InnerApp.GetHomePath());
#endif
                exporter.Export(view, setting, log, progressCallback, cancellationToken);
            }
        }
コード例 #13
0
        /// <summary>
        /// 开始导出
        /// </summary>
        /// <param name="localConfig"></param>
        /// <param name="exportType"></param>
        /// <param name="outputStream"></param>
        /// <param name="features"></param>
        /// <param name="useShareTexture"></param>
        /// <param name="progressCallback"></param>
        /// <param name="cancellationToken"></param>
        private void StartExport(AppLocalConfig localConfig, ExportType exportType, Stream outputStream, Dictionary <FeatureType, bool> features, bool useShareTexture, Action <int> progressCallback, CancellationToken cancellationToken)
        {
            using (var log = new RuntimeLog())
            {
                var config = new ExportConfig();
                config.TargetPath   = localConfig.LastTargetPath;
                config.ExportType   = exportType;
                config.OutputStream = outputStream;
                config.Features     = features?.Keys.ToList() ?? new List <FeatureType>();
                config.Trace        = log.Log;

                #region Add Plugin - CreatePropDb
                {
                    var cliPath = Path.Combine(
                        App.GetHomePath(),
                        @"Tools",
                        @"CreatePropDb",
                        @"CreatePropDbCLI.exe");
                    if (File.Exists(cliPath))
                    {
                        config.Addins.Add(new ExportPlugin(
                                              FeatureType.GenerateModelsDb,
                                              cliPath,
                                              new[] { @"-i", config.TargetPath }
                                              ));
                    }
                }
                #endregion

                #region Add Plugin - CreateThumbnail
                {
                    var cliPath = Path.Combine(
                        App.GetHomePath(),
                        @"Tools",
                        @"CreateThumbnail",
                        @"CreateThumbnailCLI.exe");
                    if (File.Exists(cliPath))
                    {
                        config.Addins.Add(new ExportPlugin(
                                              FeatureType.GenerateThumbnail,
                                              cliPath,
                                              new[] { @"-i", config.TargetPath }
                                              ));
                    }
                }
                #endregion

                Exporter.ExportToSvf(config, x => progressCallback?.Invoke((int)x), cancellationToken);
            }
        }
コード例 #14
0
        // every exception will land here insert log to db
        public override void OnException(ExceptionContext context)
        {
            var        Exception = context.Exception;
            StackFrame Stack     = new StackFrame(true);

            RuntimeLog NewException = new RuntimeLog(
                DateTime.Now, Exception.Message, "Fatal", Stack.GetFileName()
                , Stack.GetFileLineNumber(), Stack.GetFileColumnNumber()
                , "OnException", Exception.StackTrace
                , (Exception.InnerException == null ? string.Empty : "InnerException Message -" + Exception.InnerException.Message)
                , Exception.InnerException == null ? "" : " InnerException StackTrace - " + Exception.InnerException.StackTrace, 0);

            LogicRuntimeLogs.SaveLog(NewException);
        }
コード例 #15
0
        public static List <ReportRow> GetReportData(DateTime startDate)
        {
            var DLConnectionString = GetDatabaseConnectionStrings();

            var jobsList = RunJobsCommand.CreateJobList(JobType.All, JobScope.All, new List <string>(), JobConstants.DefaultJobConfiguration);
            var DLJobs   = jobsList.Select(x => x.Id()).Where(x => x.Contains("Jobs.Fetcher")).ToList();

            var dlLogEntries = GetLogs("logging", startDate, DLConnectionString, DLJobs);

            dlLogEntries.ForEach(x => {
                (x.FirstName, x.SurName) = RuntimeLog.ParseLogName(x.FullName, '.', 3);
            });
            return(dlLogEntries);
        }
コード例 #16
0
        public async Task <bool> InsertRuntimeLog(RuntimeLog log)
        {
            _logger.LogInformation("RuntimeLogService.InsertRuntimeLog - Service starts.");

            try {
                await _dbContext.RuntimeLog.InsertOneAsync(log);
            } catch (Exception e) {
                _logger.LogError("RuntimeLogService.InsertRuntimeLog - Error: " + e);
                return(false);
            }

            _logger.LogInformation("RuntimeLogService.InsertRuntimeLog - Service done.");
            return(true);
        }
コード例 #17
0
        /// <summary>
        /// 开始导出
        /// </summary>
        /// <param name="view"></param>
        /// <param name="targetPath"></param>
        /// <param name="exportType"></param>
        /// <param name="outputStream"></param>
        /// <param name="features"></param>
        private void StartExport(string targetPath, ExportType exportType, Stream outputStream, Dictionary <FeatureType, bool> features)
        {
            using (var log = new RuntimeLog())
            {
                var config = new ExportConfig();
                config.TargetPath   = targetPath;
                config.ExportType   = exportType;
                config.OutputStream = outputStream;
                config.Features     = features?.Keys.ToList() ?? new List <FeatureType>();
                config.Trace        = log.Log;

                Exporter.ExportToSvf(config);
            }
        }
コード例 #18
0
        /// <summary>
        /// 开始导出
        /// </summary>
        /// <param name="uidoc"></param>
        /// <param name="view"></param>
        /// <param name="localConfig"></param>
        /// <param name="features"></param>
        /// <param name="progressCallback"></param>
        /// <param name="cancellationToken"></param>
        private void StartExport(UIDocument uidoc, View3D view, AppConfigCesium3DTiles localConfig, Dictionary <FeatureType, bool> features, Action <int> progressCallback, CancellationToken cancellationToken)
        {
            using (var log = new RuntimeLog())
            {
                var featureList   = features?.Where(x => x.Value).Select(x => x.Key).ToList() ?? new List <FeatureType>();
                var elementIdList = _ElementIds?.Where(x => x.Value).Select(x => x.Key).ToList();

                var exporter = new ExporterX(InnerApp.GetHomePath());
                exporter.Export(
                    uidoc, view,
                    localConfig.LevelOfDetail, localConfig.LastTargetPath, localConfig.Mode,
                    featureList, elementIdList,
                    log, progressCallback, cancellationToken
                    );
            }
        }
コード例 #19
0
        //insert exception log
        public static async Task <int> Insert(RuntimeLog i_exception)
        {
            DynamicParameters _params = new DynamicParameters();

            _params.Add("@Time", i_exception.Time);
            _params.Add("@Exception", i_exception.Exception);
            _params.Add("@Log_level", i_exception.Log_level);
            _params.Add("@NLine", i_exception.NLine);
            _params.Add("@NColumn", i_exception.NColumn);
            _params.Add("@Method", i_exception.Method);
            _params.Add("@StackTrace", i_exception.StackTrace);
            _params.Add("@Custom1", i_exception.Custom1);
            _params.Add("@Custom2", i_exception.Custom2);
            _params.Add("@BuildVersion", i_exception.BuildVersion);

            string sql = " INSERT INTO " + bodsruntimelogs.bodsruntimelogs.Truntimelogs
                         + "    ("
                         + bodsruntimelogs.bodsruntimelogs.Truntimelogs.FTime.Cn
                         + "    ," + bodsruntimelogs.bodsruntimelogs.Truntimelogs.FException.Cn
                         + "    ," + bodsruntimelogs.bodsruntimelogs.Truntimelogs.FLog_level.Cn
                         + "    ," + bodsruntimelogs.bodsruntimelogs.Truntimelogs.FNLine.Cn
                         + "    ," + bodsruntimelogs.bodsruntimelogs.Truntimelogs.FNColumn.Cn
                         + "    ," + bodsruntimelogs.bodsruntimelogs.Truntimelogs.FMethod.Cn
                         + "    ," + bodsruntimelogs.bodsruntimelogs.Truntimelogs.FStackTrace.Cn
                         + "    ," + bodsruntimelogs.bodsruntimelogs.Truntimelogs.FCustom1.Cn
                         + "    ," + bodsruntimelogs.bodsruntimelogs.Truntimelogs.FCustom2.Cn
                         + "    ," + bodsruntimelogs.bodsruntimelogs.Truntimelogs.FBuildVersion.Cn
                         + ")"
                         + " VALUES"
                         + " (@Time,"
                         + " @Exception,"
                         + " @Log_level,"
                         + " @NLine,"
                         + " @NColumn,"
                         + " @Method,"
                         + " @StackTrace,"
                         + " @Custom1,"
                         + " @Custom2,"
                         + " @BuildVersion"
                         + ")";


            using (IDbConnection conn = new MySqlConnection(RuntimeLogsConnectionString))
            {
                return(await conn.ExecuteAsync(sql, _params));
            }
        }
コード例 #20
0
        /// <summary>
        /// 开始导出
        /// </summary>
        /// <param name="targetPath"></param>
        /// <param name="exportType"></param>
        /// <param name="outputStream"></param>
        /// <param name="features"></param>
        /// <param name="progressCallback"></param>
        /// <param name="cancellationToken"></param>
        private void StartExport(string targetPath, ExportType exportType, Stream outputStream, Dictionary <FeatureType, bool> features, Action <int> progressCallback, CancellationToken cancellationToken)
        {
#if EXPRESS
            throw new NotImplementedException();
#else
            using (var log = new RuntimeLog())
            {
                var featureList = features?.Where(x => x.Value).Select(x => x.Key).ToList() ?? new List <FeatureType>();

                var exporter = new Bimangle.ForgeEngine.Navisworks.Pro.Svf.Exporter(App.GetHomePath());
                exporter.Export(
                    targetPath, exportType, outputStream, featureList,
                    log, progressCallback, cancellationToken
                    );
            }
#endif
        }
コード例 #21
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form2());

            int a = 0;
            int b = 2;

            try
            {
                int count = b / a;
            }
            catch (Exception ex) {
                RuntimeLog.WriteRuntimeErrorLog(ex);
            }
        }
コード例 #22
0
        /// <summary>
        /// 开始导出
        /// </summary>
        /// <param name="view"></param>
        /// <param name="targetPath"></param>
        /// <param name="exportType"></param>
        /// <param name="outputStream"></param>
        /// <param name="features"></param>
        /// <param name="useShareTexture"></param>
        private void StartExport(View3D view, string targetPath, ExportType exportType, Stream outputStream, Dictionary <FeatureType, bool> features, bool useShareTexture)
        {
            using (var log = new RuntimeLog())
            {
                var config = new ExportConfig();
                config.TargetPath      = targetPath;
                config.ExportType      = exportType;
                config.UseShareTexture = useShareTexture;
                config.OutputStream    = outputStream;
                config.Features        = features ?? new Dictionary <FeatureType, bool>();
                config.Trace           = log.Log;
                config.ElementIds      = (features?.FirstOrDefault(x => x.Key == FeatureType.OnlySelected).Value ?? false)
                    ?  _ElementIds
                    : null;

                Exporter.ExportToSvf(view, config);
            }
        }
コード例 #23
0
        private void ExportToCesium3DTiles(JobConfig config, RuntimeLog log, Action <int> progressCallback)
        {
            var features = new Dictionary <Common.Formats.Cesium3DTiles.FeatureType, bool>();
            var options  = config.OutputOptions;

            if (options != null && options.Count > 0)
            {
                foreach (var option in options)
                {
                    if (Enum.TryParse(option, true, out Common.Formats.Cesium3DTiles.FeatureType result))
                    {
                        features[result] = true;
                    }
                }

                features[Common.Formats.Cesium3DTiles.FeatureType.EnableEmbedGeoreferencing] = true;
            }
            else
            {
                var defaultConfig = new AppConfigCesium3DTiles();
                foreach (var feature in defaultConfig.Features)
                {
                    features[feature] = true;
                }
            }


            var setting = new Bimangle.ForgeEngine.Common.Formats.Cesium3DTiles.Navisworks.ExportSetting();

            setting.OutputPath = config.OutputPath;
            setting.Mode       = config.Mode;
            setting.Features   = features?.Where(x => x.Value).Select(x => x.Key).ToList();
            setting.Site       = SiteInfo.CreateDefault();
            setting.Oem        = LicenseConfig.GetOemInfo(App.GetHomePath());

#if EXPRESS
            var exporter = new Bimangle.ForgeEngine.Navisworks.Express.Cesium3DTiles.Exporter(App.GetHomePath());
#else
            var exporter = new Bimangle.ForgeEngine.Navisworks.Pro.Cesium3DTiles.Exporter(App.GetHomePath());
#endif
            exporter.Export(setting, log, progressCallback, CancellationToken.None);
        }
コード例 #24
0
ファイル: ErrorReport.cs プロジェクト: Riadhoq/aurelia
        public static List <ReportRow> GetReportData(DateTime startDate)
        {
            var ConnectionStrings  = GetDatabaseConnectionStrings();
            var APConnectionString = ConnectionStrings.Item1;
            var DLConnectionString = ConnectionStrings.Item2;

            var jobsList = RunJobsCommand.CreateJobList(JobType.All, JobScope.All, new List <string>(), JobConstants.DefaultJobConfiguration);
            var APJobs   = jobsList.Select(x => x.Id()).Where(x => x.Contains("Jobs.Transformation")).ToList();
            var DLJobs   = jobsList.Select(x => x.Id()).Where(x => x.Contains("Jobs.Fetcher")).ToList();

            var apLogEntries = GetLogs("application", startDate, APConnectionString, APJobs);
            var dlLogEntries = GetLogs("logging", startDate, DLConnectionString, DLJobs);

            var all = dlLogEntries.Union(apLogEntries).OrderBy(x => x.FullName).ToList();

            all.ForEach(x => {
                (x.FirstName, x.SurName) = RuntimeLog.ParseLogName(x.FullName, '.', 3);
            });
            return(all);
        }
コード例 #25
0
        /// <summary>
        /// 开始导出
        /// </summary>
        /// <param name="uidoc"></param>
        /// <param name="view"></param>
        /// <param name="setting"></param>
        /// <param name="progressCallback"></param>
        /// <param name="cancellationToken"></param>
        private void StartExport(UIDocument uidoc, View3D view, ExportSetting setting, Action <int> progressCallback, CancellationToken cancellationToken)
        {
#if EXPRESS
            throw new NotImplementedException();
#else
            using (var log = new RuntimeLog())
            {
                var exporter = new Bimangle.ForgeEngine.Revit.Pro.Svf.Exporter(InnerApp.GetHomePath());
                exporter.Handler = new ExportHandler();

                if (uidoc != null && uidoc.ActiveView.Id == view.Id)
                {
                    exporter.Export(view, uidoc, setting, log, progressCallback, cancellationToken);
                }
                else
                {
                    exporter.Export(view, setting, log, progressCallback, cancellationToken);
                }
            }
#endif
        }
コード例 #26
0
        public override int Execute(params string[] args)
        {
            using (var log = new RuntimeLog())
                using (var session = LicenseConfig.Create())
                {
                    try
                    {
                        if (args == null || args.Length != 1)
                        {
                            log.Log(@"Fail", @"Startup", $@"传入参数数量: {args?.Length ?? -1}");
                            return(101);
                        }

                        var jobConfigFilePath = args[0];
                        var jobConfig         = JobConfig.Load(jobConfigFilePath);
                        if (jobConfig == null)
                        {
                            log.Log(@"Fail", @"Startup", @"任务设置加载失败");
                            return(102);
                        }

                        if (session.IsValid == false)
                        {
                            log.Log(@"Fail", @"Startup", @"授权无效!");

                            #region 保存授权无效信息文件
                            try
                            {
                                var filePath = Path.Combine(jobConfig.OutputPath, @"License Invalid.txt");
                                File.WriteAllText(filePath, @"未检测到有效的授权, 请检查授权期限是否已过期, 如使用 USBKEY 请确认 USBKEY 是否已正确插入 USB 接口!", Encoding.UTF8);
                            }
                            catch
                            {
                                // ignored
                            }
                            #endregion

                            return(110);
                        }

                        const string SOURCE_NAME = @"Nw"; //这个数据源名称不可修改,是和 CLI 里的设置对应的
                        Router.SetProgressPhase(SOURCE_NAME, 1.0);

                        var progress = 0;
                        var ret      = StartExport(jobConfig, log, x =>
                        {
                            var newProgress = x;
                            if (newProgress > progress)
                            {
                                progress = newProgress;
                                Router.SetProgressValue(SOURCE_NAME, newProgress);
                            }
                        });

                        if (!ret)
                        {
                            return(103);
                        }

                        Router.SetProgressValue(SOURCE_NAME, 100);
                    }
                    catch (Exception ex)
                    {
                        log.Log(@"Exception", @"Startup", ex.ToString());
                        return(100);
                    }
                }

            return(0);
        }
コード例 #27
0
ファイル: AbstractJob.cs プロジェクト: Riadhoq/aurelia
 static public bool IsJobRuntimeLog(RuntimeLog row)
 {
     return(row.Name.StartsWith("Jobs."));
 }
コード例 #28
0
 public static void Out(object s) => RuntimeLog.LogOut(s);
コード例 #29
0
 public static void Warn(object s) => RuntimeLog.LogWarn(s);
コード例 #30
0
 public static void Error(object s) => RuntimeLog.LogError(s);