/// <summary> /// 全てのIDを振りなおす /// </summary> internal void RenewId() { try { this.ProjectId = NewId(); Dictionary <string, string> idDic = new Dictionary <string, string>(); foreach (var process in ProcessModelList) { string newID = ProjectModel.NewId(); idDic.Add(process.ProcessId, newID); process.ProcessId = newID; } foreach (var macro in MacroModelList) { string newID = ProjectModel.NewId(); idDic.Add(macro.ProjectId, newID); macro.ProjectId = newID; foreach (var process in macro.ProcessModelList) { newID = ProjectModel.NewId(); idDic.Add(process.ProcessId, newID); process.ProcessId = newID; } } foreach (var process in ProcessModelList) { if (process.NextProcess != null) { if (idDic.ContainsKey(process.NextProcess.ProcessId)) { process.NextProcess.ProcessId = idDic[process.NextProcess.ProcessId]; } } if (process.ErrorProcess != null) { if (idDic.ContainsKey(process.ErrorProcess.ProcessId)) { process.ErrorProcess.ProcessId = idDic[process.ErrorProcess.ProcessId]; } } } for (int i = 0; i < NodeIdList.Count; i++) { if (idDic.ContainsKey(NodeIdList[i])) { NodeIdList[i] = idDic[NodeIdList[i]]; } } for (int x = 0; x < MacroModelList.Count; x++) { var macro = MacroModelList[x]; foreach (var process in macro.ProcessModelList) { if (process.NextProcess != null) { if (idDic.ContainsKey(process.NextProcess.ProcessId)) { process.NextProcess.ProcessId = idDic[process.NextProcess.ProcessId]; } } if (process.ErrorProcess != null) { if (idDic.ContainsKey(process.ErrorProcess.ProcessId)) { process.ErrorProcess.ProcessId = idDic[process.ErrorProcess.ProcessId]; } } } for (int i = 0; i < macro.NodeIdList.Count; i++) { if (idDic.ContainsKey(macro.NodeIdList[i])) { macro.NodeIdList[i] = idDic[macro.NodeIdList[i]]; } } } } catch (Exception ex) { throw Program.ThrowException(ex); } }