string GenerateUniqueIdByAppendingNumberToEnd(string id) { int count = 0; string baseId = id; do { ++count; id = String.Concat(baseId, count); } while (OwnerWixDocument.ComponentIdExists(id)); return(id); }
/// <remarks> /// Takes the filename, removes all periods, and /// capitalises the first character and first extension character. /// </remarks> public void GenerateUniqueIdFromFileName(string fileName) { Id = GenerateIdFromFileName(fileName); if (!OwnerWixDocument.ComponentIdExists(Id)) { return; } Id = GenerateIdFromParentDirectoryAndFileName(fileName, Id); if (!OwnerWixDocument.ComponentIdExists(Id)) { return; } Id = GenerateUniqueIdByAppendingNumberToEnd(Id); }