Skip to content

Commit

Permalink
Performance updata
Browse files Browse the repository at this point in the history
  • Loading branch information
donkeyProgramming committed Nov 27, 2024
1 parent 58ff922 commit ee4944f
Showing 1 changed file with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,15 @@ void LoadFromPackFileContainer(PackFileContainer packFileContainer)

Parallel.For(0, groupedAnims.Count, index =>
{

using var handle = File.OpenHandle(groupedAnims[index].Key);

//https://www.jacksondunstan.com/articles/3568
var fileStream = File.OpenRead(groupedAnims[index].Key);
var buffer = new byte[100];

foreach (var file in groupedAnims[index])
{
fileStream.Seek(file.DataSource.Offset, SeekOrigin.Begin);
fileStream.ReadExactly(buffer);
{
RandomAccess.Read(handle, buffer, file.DataSource.Offset);
FileDiscovered(buffer, packFileContainer, file.FullPath, ref skeletonFileNameList, ref animationList);
}
});
Expand Down Expand Up @@ -167,10 +168,10 @@ void AddAnimation(string skeletonName, string fullPath, PackFileContainer contai
{
lock (_threadLock)
{
var newEntry = new ObservableCollection<AnimationReference>() { new AnimationReference(fullPath, container) };
if (animationList.ContainsKey(skeletonName) == false)
animationList[skeletonName] = [];
animationList[skeletonName].Add(new AnimationReference(fullPath, container));
var newEntry = new ObservableCollection<AnimationReference>() { new AnimationReference(fullPath, container) };
if (animationList.ContainsKey(skeletonName) == false)
animationList[skeletonName] = [];
animationList[skeletonName].Add(new AnimationReference(fullPath, container));

if (fullPath.Contains("animations\\skeletons", StringComparison.InvariantCultureIgnoreCase))
skeletonFileNameList.Add(fullPath);
Expand Down

0 comments on commit ee4944f

Please sign in to comment.