Exemple #1
0
        public static string Convert(this string name)
        {
            Project = LocalUtils.GetActiveProjectNode();
            ProjectParameters.Contruct();
            MetaModelProviders = ServiceLocator.GetService(typeof(IMetaModelProviders)) as IMetaModelProviders;
            MetaModelService   = MetaModelProviders.CurrentMetaModelService;

            var extension = ProjectParameters.Instance.Extension;

            var englishLabelFile =
                MetaModelService.GetLabelFileNames()
                .FirstOrDefault(
                    lableFileName => lableFileName.StartsWith(extension) && lableFileName.Contains("en-US"));

            var lableFile = MetaModelService.GetLabelFile(englishLabelFile);
            var labelKey  = name.Replace(extension, "");

            var lableTxt = Regex.Replace(labelKey, "((?<=[a-z])[A-Z]|[A-Z](?=[a-z]))", " $1").Trim().ToLower().UppercaseFirst();

            LabelControllerFactory factory = new LabelControllerFactory();
            LabelEditorController  labelEditorController = factory.GetOrCreateLabelController(lableFile, LocalUtils.Context);

            //CoreUtility.DisplayInfo(labelKey);

            if (!labelEditorController.Exists(labelKey))
            {
                labelEditorController.Insert(labelKey, lableTxt, string.Empty);
                labelEditorController.Save();
            }

            return($"@{extension}Labels:{labelKey}");
        }
Exemple #2
0
        public static ModelSaveInfo GetModel()
        {
            var modelInfo = LocalUtils.GetActiveProjectNode().GetProjectsModelInfo();

            var model = new ModelSaveInfo
            {
                Id    = modelInfo.Id,
                Layer = modelInfo.Layer
            };

            return(model);
        }