コード例 #1
0
        private void AttachEA()
        {
            EA.App eaapp = null;

            try {
                eaapp = (EA.App)Microsoft.VisualBasic.Interaction.GetObject(null, "EA.App");
            } catch (Exception e) {
                toolStripStatusLabel1.Text = "EAが起動していなかったため、EAへの反映機能は使えません : " + e.Message;
                // MessageBox.Show( e.Message );
                return;
            } finally {
            }

            if (ProjectSetting.getVO() != null)
            {
                if (eaapp != null)
                {
                    EA.Repository repo = eaapp.Repository;
//					eaapp.Visible = true;
                    ProjectSetting.getVO().eaRepo = repo;
                    toolStripStatusLabel1.Text = "EAへのアタッチ成功 EA接続先=" + repo.ConnectionString;
                }
                else
                {
                    toolStripStatusLabel1.Text = "EAにアタッチできなかったため、EAへの反映機能は使えません";
                }
            }
        }
コード例 #2
0
ファイル: EA_APISerwis.cs プロジェクト: Zagii/EAkzg
        private static EA.Repository getOpenedModel()
        {
            try
            {
                EA.App ap = (EA.App)Marshal.GetActiveObject("EA.App");

                return(ap.Repository);
            }
            catch (COMException)
            {
                return(new EA.Repository());
            }
        }
コード例 #3
0
ファイル: EA_APISerwis.cs プロジェクト: Zagii/EAkzg
        private static EA.App getOpenedApp()
        {
            try
            {
                ap = (EA.App)Marshal.GetActiveObject("EA.App");

                return(ap);
            }
            catch (COMException)
            {
                ap = new EA.App();
                return(ap);
            }
        }
コード例 #4
0
        private static void runOnDependEaMode()
        {
            EA.App eaapp = null;
            try
            {
                eaapp = (EA.App)Microsoft.VisualBasic.Interaction.GetObject(null, "EA.App");
                EA.Repository repo = eaapp.Repository;

                // EA.Repository repo = new EA.Repository();
                //  repo.OpenFile2(@"C:\DesignHistory\staging\EAPBAK_cuvic_aswea_20190124_20181029.eap", "admin", "p@ssw0rd");
                // repo.OpenFile2(@"C:\DesignHistory\ea-artifact-manage\shortcut.eap", "admin", "p@ssw0rd");
                // repo.App.Visible = true;

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                if (eaapp != null)
                {
                    ProjectSetting.load(@"C:\DesignHistory\ea-artifact-manage\project.bdprj");
                    // projectsettingにEAリポジトリオブジェクトをセット
                    ProjectSetting.getVO().eaRepo = repo;

                    string connStr = repo.ConnectionString;
                    Console.WriteLine("EAへのアタッチ成功 EA接続先=" + connStr);

                    Application.Run(new MainForm());
                }
                else
                {
                    MessageBox.Show("EAにアタッチできなかったため、異常終了します");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("EAへの接続時に例外が発生しました。 msg=" + ex.Message);
                // Console.WriteLine("EAへの接続時に例外が発生しました。 msg=" + ex.Message);
            }
        }
コード例 #5
0
        public static void Main(string[] args)
        {
            //コマンドライン引数を配列で取得する
            string[] cmds = System.Environment.GetCommandLineArgs();

            string prjfile, projectPath;

            if (cmds != null && cmds.Length > 1)
            {
                prjfile = cmds[1];
            }
            else
            {
                Console.WriteLine("引数が足りません");
                Console.WriteLine("Usage: EAArtifactLoader.exe <projectFilePath>");
                return;
            }

            if (ProjectSetting.load(prjfile))
            {
                projectPath = Path.GetDirectoryName(prjfile);
                Console.WriteLine("プロジェクトファイルを読み込み : " + prjfile);
            }
            else
            {
                Console.WriteLine("プロジェクトファイル読み込みに失敗しました。 再度正しいファイルを選択して下さい。");
                return;
            }

            EA.App        eaapp = (EA.App)Microsoft.VisualBasic.Interaction.GetObject(null, "EA.App");
            EA.Repository repo;

            if (eaapp != null)
            {
                repo = eaapp.Repository;
                ProjectSetting.getVO().eaRepo = repo;
                Console.WriteLine("EAにアタッチ成功 : 接続文字列 = " + repo.ConnectionString);
            }
            else
            {
                Console.WriteLine("EAにアタッチできないため処理できません。終了します。");
                return;
            }

            // All_Artifact.xml から全成果物リストを取得
            Console.WriteLine("全成果物XMLファイルを読み込み :");
            string            artifactsFileName = ProjectSetting.getVO().artifactsFile;
            List <ArtifactVO> artifacts         = ArtifactsXmlReader.readArtifactList(projectPath, artifactsFileName);

            Console.WriteLine("成果物パッケージの件数: " + artifacts.Count);

            // 全成果物をなめ、それぞれの成果物パッケージをEAから取得してローカルを更新
            for (int i = 0; i < artifacts.Count; i++)
            {
                ArtifactVO atfvo = artifacts[i];
                Console.WriteLine(i + ": guid=" + atfvo.guid + ", name=" + atfvo.name);

                try {
                    EA.Package atfPacObj = repo.GetPackageByGuid(atfvo.guid);

                    EAArtifactXmlMaker maker       = new EAArtifactXmlMaker(atfPacObj);
                    ArtifactVO         newArtifact = maker.makeArtifactXml();

                    // 現在読み込まれている成果物の内容を今読んだもので置き換え
                    atfvo.package = newArtifact.package;

                    // elements配下の要素XMLファイルを今読んだもので置き換え
                    ArtifactXmlWriter writer = new ArtifactXmlWriter();
                    writer.rewriteElementXmlFiles(atfvo);
                } catch (Exception ex) {
                    Console.WriteLine(ex.Message);
                }
            }
        }