Skip to content

Commit

Permalink
Fix lib ordering when loading
Browse files Browse the repository at this point in the history
  • Loading branch information
Suprcode authored Feb 11, 2021
1 parent 76b337f commit 50c5a4b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Client/MirGraphics/MLibrary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Frame = Client.MirObjects.Frame;
using Client.MirObjects;
using System.Text.RegularExpressions;
using System.Linq;

namespace Client.MirGraphics
{
Expand Down Expand Up @@ -190,9 +191,9 @@ static Libraries()

static void InitLibrary(ref MLibrary[] library, string path, string toStringValue, string suffix = "")
{
var allFiles = Directory.GetFiles(path, "*" + suffix + MLibrary.Extention, SearchOption.TopDirectoryOnly);
var allFiles = Directory.GetFiles(path, "*" + suffix + MLibrary.Extention, SearchOption.TopDirectoryOnly).OrderBy(x => int.Parse(Regex.Match(x, @"\d+").Value));

var lastFile = allFiles.Length > 0 ? Path.GetFileName(allFiles[allFiles.Length - 1]) : "0";
var lastFile = allFiles.Count() > 0 ? Path.GetFileName(allFiles.Last()) : "0";

var count = int.Parse(Regex.Match(lastFile, @"\d+").Value) + 1;

Expand Down Expand Up @@ -1059,4 +1060,4 @@ private static byte[] DecompressImage(byte[] image)
}
}
}
}
}

0 comments on commit 50c5a4b

Please sign in to comment.