public bool Equals(ModDefinitionIdentifier other) { if (other is null) { return(false); } return(ModName.Equals(other.ModName, StringComparison.InvariantCulture) && ExportMode == other.ExportMode && Version == other.Version); }
/// <summary> /// Fills in missing info about the mod from the given info. /// </summary> /// <param name="p_mifInfo">A <see cref="ModInfo" /> describing the info of the mod.</param> public void SetMissingInfo(ModInfo p_mifInfo) { Version mv = null; if (p_mifInfo == null) { return; } var booUpdated = false; if (ModName.Equals(Path.GetFileNameWithoutExtension(filepath)) && !String.IsNullOrEmpty(p_mifInfo.ModName)) { booUpdated = true; ModName = p_mifInfo.ModName; } if (DEFAULT_AUTHOR.Equals(Author) && !String.IsNullOrEmpty(p_mifInfo.Author)) { booUpdated = true; Author = p_mifInfo.Author; } if (HumanReadableVersion.Equals(DEFAULT_VERSION) && (MachineVersion == DefaultVersion) && !String.IsNullOrEmpty(p_mifInfo.Version)) { HumanReadableVersion = p_mifInfo.Version; var strVersionString = p_mifInfo.Version; var rgxCleanVersion = new Regex(@"[^\d\.]"); strVersionString = rgxCleanVersion.Replace(strVersionString, ""); if (String.IsNullOrEmpty(strVersionString)) { strVersionString = "0.0.0.0"; } if (Version.TryParse(strVersionString, out mv)) { MachineVersion = mv; } } if (!HasScreenshot && (p_mifInfo.Screenshot != null)) { booUpdated = true; } if (String.IsNullOrEmpty(Website) && (p_mifInfo.URL != null)) { booUpdated = true; Website = p_mifInfo.URL.ToString(); } if (booUpdated) { CommitInfo((p_mifInfo.Screenshot != null), p_mifInfo.Screenshot); } }