public MasterRef(string mastername, string stencilname) { if (mastername == null) { throw new ArgumentNullException(nameof(mastername)); } if (MasterRef.EndwithVSSorVSSX(mastername)) { throw new AutomationException("Master name ends with .VSS or .VSSX"); } if (this.StencilName != null) { if (!MasterRef.EndwithVSSorVSSX(stencilname)) { throw new AutomationException("Stencil name does not end with .VSS"); } } else { // Stencil names are allowed to be null. In this case // it means look for the stencil in the active document } this.VisioMaster = null; this.MasterName = mastername; this.StencilName = stencilname; }
public MasterRef(string mastername, string stencilname) { if (mastername == null) { throw new System.ArgumentNullException(nameof(mastername)); } if (MasterRef.HasStencilExtension(mastername)) { throw new AutomationException("Master name ends with .VSS or .VSSX"); // Passing in the stencil name for the master name is a very common error. // so we make sure to check for it } if (this.StencilName != null && (!MasterRef.HasStencilExtension(stencilname))) { throw new AutomationException("Stencil name does not end with .VSS"); // Passing in the master name for the stencil name is a very common error. // so we make sure to check for it } // NOTE: Stencil names are allowed to be null. In this case // it means look for the stencil in the active document this.VisioMaster = null; this.MasterName = mastername; this.StencilName = stencilname; }