private static void runOnLocalFileMode(string projectFile, string elemGuid) { // プロジェクトファイルの存在チェック if (System.IO.File.Exists(projectFile)) { // プロジェクト設定ファイルのロード ProjectSetting.load(projectFile); } else { MessageBox.Show("指定されたプロジェクトファイルが見つかりません"); return; } try { // 要素ファイルからGUIDで検索した結果を読み込む ElementVO elemvo = ElementsXmlReader.readElementFile(elemGuid); ElementForm elementForm = new ElementForm(ref elemvo); Application.Run(elementForm); } catch (Exception ex) { MessageBox.Show(ex.Message, "エラー発生"); } }
private void writeDiagramPlantUml(DiagramVO diag, StreamWriter sw) { sw.WriteLine("### ダイアグラム: " + diag.name); sw.WriteLine(""); sw.WriteLine("[plantuml, img-diag-" + diag.guid.Substring(1, 13) + ", svg]"); sw.WriteLine("--"); sw.WriteLine("@startuml"); var elemNameHash = new Dictionary <int, string>(); foreach (DiagramObjectVO diaObj in diag.diagramObjects) { // ダイアグラムオブジェクトのobjectIdをキーとしてt_elementから要素を取りに行く ElementSearchItem elemSearchItem = this.elementSearcher.findByElementId(diaObj.objectId); // 取得できなかったらインデックスに登録される対象の要素タイプではないので、class文を出す必要はない // と思っていたらNoteはインデックスに登録されており、Noteは本文をnameにする必要があるので別ロジック if (elemSearchItem != null) { // 要素の型が "Note" の場合のみ if (elemSearchItem.elemType == "Note") { // note 要素を出力する(ひとまず全てフローティングにしておく) ElementVO elem = ElementsXmlReader.readElementFile(elemSearchItem.elemGuid); sw.WriteLine("note \"" + filterNoteString(elem.notes) + "\" "); } else { // クラス図の中で表示されるクラス名を取得(空白を別の文字に置換するなど) string normalizedName = filterSpecialChar(elemSearchItem.elemName); // 接続線を引く時にこのクラス名を使う必要があるので、ID毎に名前をキャッシュしておく elemNameHash.Add(elemSearchItem.elementId, normalizedName); // class 文の出力 sw.WriteLine("class \"" + normalizedName + "\" " + getStereotypeStr(elemSearchItem.elemStereotype) + " {"); sw.WriteLine("}"); } } } // ダイアグラムリンク(ダイアグラム上で有効な接続)情報を元にPlantUMLの接続線を引く foreach (DiagramLinkVO diaLink in diag.diagramLinks) { // diagramLink の connectorId をキーとして Connector情報を取得 List <ConnectorVO> conns = this.connSearcher.findByConnectorId(diaLink.connectorId); ConnectorVO targetConn = null; if (conns.Count > 0) { targetConn = conns[0]; outputSrcConnectLine(targetConn, sw); } } sw.WriteLine("@enduml"); sw.WriteLine("--"); sw.WriteLine(""); }