public WixDirectory(string name, string parentPath, string appRegFolder) : base("Directory") { this.Name = name; this.AppRegFolder = appRegFolder; if (!name.IsNullOrEmpty() && VariableConverter.VarToWixId.ContainsKey(name))//if it's a special folder, we just want to set the id verbatim { this.SetId(VariableConverter.VarToWixId[name]); this._path = name; } else//but if it's not a special folder, we need to create a unique ID for it using it's path { //make sure it's not too long, and sanitize it and make a removal component for it. if (parentPath.IsNullOrEmpty()) { throw new Exception(name + "'s parent path is null or empty!"); } this._path = System.IO.Path.Combine(parentPath, Name); this.SanitizeAndSetId(this._path); //if (parentPath != null) //{ // this._path = System.IO.Path.Combine(parentPath, Name); // this.SanitizeAndSetId(this._path); //} //else // this.SanitizeAndSetId(id); //now that our ID is set, let's create a removal component. string removeId = "Rmv_" + this.Id; WixComponent removeC = new WixComponent(removeId, GuidManager.GetGuid(removeId), AppRegFolder); removeC.AddRemoveFolder(new WixRemoveFolder(this.Id)); Objects.Add(removeC); removalComponent = removeC; } }
public WixFile(string relativeParentFolder, string name, string source, string appRegFolder) : base("File") { this._path = Path.Combine(relativeParentFolder, name); this.SanitizeAndSetSource(source); this.SanitizeAndSetId(this._path); this.SanitizeAndSetName(name); this.DiskId = "1"; this.KeyPath = "no"; var compId = "comp_" + this._path; this._fileComponent = new WixComponent(compId, GuidManager.GetGuid(compId), appRegFolder); _fileComponent.AddFile(this); }