private static bool ExistsSame(VisioPage Page, VisioClass VisioClass, String Name) { foreach (VisioClass vc in Page.Classes) { if (!VisioClass.Equals(vc) && vc.Name == Name) { return true; } } return false; }
private static bool ExistsSame(VisioPage Page, VisioConnector VisioConnector, String Name) { foreach (VisioConnector vc in Page.Relationships) { if (!VisioConnector.Equals(vc) && vc.Name == Name) { return true; } } return false; }
public static String UniqueName(VisioPage Page, VisioConnector VisioConnector) { String Name = VisioConnector.Name; Regex regex = new Regex(@"^(.*?)([0-9]+)$"); Match m = regex.Match(Name); String BaseName = m.Success ? m.Groups[1].Value : Name; int index = m.Success ? int.Parse(m.Groups[2].Value) : 1; while (ExistsSame(Page, VisioConnector, Name)) { Name = BaseName + (++index); } Trace.WriteLine(Name); return Name; }
public VisioSync(Logger Logger) { this.Logger = Logger; this.Doc = new DslDocument(); if (Logger.Document != null) { string documentPath = VisioHelpers.GetDSLPath(Logger.Document); if (!string.IsNullOrEmpty(documentPath)) { this.Doc.Load(documentPath); } if (Logger.Document.Pages.Count > 0) { this.Page = new VisioPage(Logger.Document.Pages[1]); } } }
public DslSync(Logger Logger) { this.Logger = Logger; this.Doc = Logger.DslDocument; this.Page = new VisioPage(Logger.Document.Pages[1]); }