Пример #1
0
 private void OpenModelEditor(ProjectItemWrapper projectItemWrapper)
 {
     _dte.InitOutputCalls("OpenModelEditor");
     try{
         new ModelEditorRunner().Start(projectItemWrapper);
     }
     catch (Exception e) {
         _dte.WriteToOutput(e.ToString());
     }
 }
Пример #2
0
        private static bool FilterLocalizedItems(ProjectItemWrapper item, ProjectItemWrapper[] items)
        {
            var match = Regex.Match(item.ModelFileName, @"\A(.*)_(.*)\.xafml\z");

            if (match.Success && item.ModelFileName.EndsWith(match.Groups[2].Value + ".xafml"))
            {
                return(items.Any(wrapper => wrapper.ModelFileName == match.Groups[1].Value + ".xafml"));
            }
            return(item.ModelFileName.Contains("Model.DesignedDiffs.Localization."));
        }
Пример #3
0
        public void Start(ProjectItemWrapper projectItemWrapper)
        {
            string outputFileName = projectItemWrapper.OutputFileName;

            string path = GetPath();

            if (path != null)
            {
                StartMEProcess(projectItemWrapper, outputFileName, path);
            }
        }
Пример #4
0
        public void Start(ProjectItemWrapper projectItemWrapper)
        {
            string outputFileName = projectItemWrapper.OutputFileName;

            string path = MePath;

            if (path == null)
            {
                path = GridHelper.ExtractME();
            }
            StartMEProcess(projectItemWrapper, outputFileName, path);
        }
Пример #5
0
        void StartMEProcess(ProjectItemWrapper projectItemWrapper, string outputFileName, string path)
        {
            try{
                var    fullPath     = projectItemWrapper.FullPath;
                string assemblyPath = Path.Combine(fullPath, Path.Combine(projectItemWrapper.OutputPath, outputFileName));
                if (!File.Exists(assemblyPath))
                {
                    MessageBox.Show($@"Assembly {assemblyPath} not found", null, MessageBoxButtons.OK);
                    return;
                }

                var destFileName = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(assemblyPath) + "", Path.GetFileName(path) + ""));
                KillProcess(destFileName);
                if (!string.Equals(path, destFileName, StringComparison.OrdinalIgnoreCase))
                {
                    File.Copy(path, destFileName, true);
                    var configPath = Path.Combine(Path.GetDirectoryName(path) + "", Path.GetFileName(path) + ".config");
                    if (File.Exists(configPath))
                    {
                        _dte.WriteToOutput($"Copying App.config");
                        File.Copy(configPath, Path.Combine(Path.GetDirectoryName(destFileName) + "", Path.GetFileName(configPath)), true);
                    }
                }
                string debugMe   = OptionClass.Instance.DebugME ? "d":null;
                string arguments = String.Format("{0} {4} \"{1}\" \"{3}\" \"{2}\"", debugMe, Path.GetFullPath(assemblyPath), fullPath, projectItemWrapper.LocalPath, projectItemWrapper.IsApplicationProject);
                if (File.Exists(destFileName))
                {
                    try{
                        _dte.WriteToOutput($"Starting {destFileName} with arguments {arguments}");
                        Process.Start(destFileName, arguments);
                    }
                    catch (IOException) {
                        MessageBox.Show(@"You have probably open the same model from another ME instance. If not please report this with reproduction details in eXpandFramework bugs forum");
                    }
                }
                else
                {
                    MessageBox.Show($@"Model editor not found at {destFileName}");
                }
            }
            catch (Exception e) {
                MessageBox.Show(e.ToString());
            }
        }