2using System.Collections.Generic;
 
    4using Terraria.Localization;
 
   10        public override string HelpLink => 
"https://github.com/tModLoader/tModLoader/wiki/Basic-tModLoader-Modding-FAQ#terrariamodloadermodgettexturestring-name-error";
 
   20            : base(message, inner) {
 
   26        public static string ProcessMessage(
string message, ICollection<string> keys) {
 
   27            string closestMatch = 
"";
 
   29            if (closestMatch != 
null && closestMatch != 
"") {
 
   30                return Language.GetTextValue(
"tModLoader.LoadErrorResourceNotFoundPathHint", message, closestMatch) + 
"\n";
 
   38        internal static string FolderAwareEditDistance(
string source, 
string[] targets) {
 
   39            if (targets.Length == 0) 
return null;
 
   41            var sourceParts = source.Split(separator);
 
   42            var sourceFolders = sourceParts.Reverse().Skip(1).ToList();
 
   43            var sourceFile = sourceParts.Last();
 
   45            int missingFolderPenalty = 4;
 
   46            int extraFolderPenalty = 3;
 
   48            var scores = targets.Select(target => {
 
   49                var targetParts = target.Split(separator);
 
   50                var targetFolders = targetParts.Reverse().Skip(1).ToList();
 
   51                var targetFile = targetParts.Last();
 
   53                var commonFolders = sourceFolders.Where(x => targetFolders.Contains(x));
 
   54                var reducedSourceFolders = sourceFolders.Except(commonFolders).ToList();
 
   55                var reducedTargetFolders = targetFolders.Except(commonFolders).ToList();
 
   58                int folderDiff = reducedSourceFolders.Count - reducedTargetFolders.Count;
 
   60                    score += folderDiff * missingFolderPenalty;
 
   61                else if (folderDiff < 0)
 
   62                    score += -folderDiff * extraFolderPenalty;
 
   64                if (reducedSourceFolders.Count > 0 && reducedSourceFolders.Count >= reducedTargetFolders.Count) {
 
   65                    foreach (var item in reducedTargetFolders) {
 
   66                        int min = Int32.MaxValue;
 
   67                        foreach (var item2 in reducedSourceFolders) {
 
   68                            min = Math.Min(min, LevenshteinDistance.Compute(item, item2));
 
   73                else if (reducedSourceFolders.Count > 0) {
 
   74                    foreach (var item in reducedSourceFolders) {
 
   75                        int min = Int32.MaxValue;
 
   76                        foreach (var item2 in reducedTargetFolders) {
 
   77                            min = Math.Min(min, LevenshteinDistance.Compute(item, item2));
 
   89            var b = scores.OrderBy(x => x.Score);
 
   90            return scores.OrderBy(x => x.Score).First().Target;
 
   93        public static int Compute(
string s, 
string t) {
 
   96            int[,] d = 
new int[n + 1, m + 1];
 
  108            for (
int i = 0; i <= n; d[i, 0] = i++) {
 
  111            for (
int j = 0; j <= m; d[0, j] = j++) {
 
  115            for (
int i = 1; i <= n; i++) {
 
  117                for (
int j = 1; j <= m; j++) {
 
  119                    int cost = (t[j - 1] == s[i - 1]) ? 0 : 2; 
 
  123                        Math.Min(d[i - 1, j] + 2, d[i, j - 1] + 2),
 
  124                        d[i - 1, j - 1] + cost);
 
static int Compute(string s, string t)
 
MissingResourceException(string message)
 
MissingResourceException(string message, Exception inner)
 
MissingResourceException()
 
static string ProcessMessage(string message, ICollection< string > keys)
 
MissingResourceException(string message, ICollection< string > keys)