-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Converted EmbedFS readers to interface to simplify the code for acces…
…ing individual files and eve installations First steps for rendering .red models Added SharpDX DX9 as dependency to start Signed-off-by: Alexis Maiquez Murcia <[email protected]>
- Loading branch information
Showing
39 changed files
with
632 additions
and
171 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Runtime.CompilerServices; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace EVEmuTool.EmbedFS | ||
{ | ||
public class EmbedFSDirectory : IEmbedFS | ||
{ | ||
private List<IEmbedFS> mFiles = new List<IEmbedFS>(); | ||
|
||
public IEnumerable<StuffEntry> Files => this.mFiles.SelectMany(x => x.Files); | ||
|
||
public EmbedFSDirectory(string[] files) | ||
{ | ||
foreach (string file in files) | ||
this.mFiles.Add(new EmbedFSFile(File.OpenRead(file))); | ||
} | ||
|
||
|
||
public void InitializeFile() | ||
{ | ||
foreach (IEmbedFS file in this.mFiles) | ||
file.InitializeFile(); | ||
} | ||
|
||
public void Export(Stream output, StuffEntry entry) | ||
{ | ||
// directories are just a holder for a list of embedFS files | ||
// call the original container and export the file | ||
entry.Origin.Export(output, entry); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace EVEmuTool.EmbedFS | ||
{ | ||
public interface IEmbedFS | ||
{ | ||
/// <summary> | ||
/// Provides access to all the files inside this container | ||
/// </summary> | ||
public IEnumerable<StuffEntry> Files { get; } | ||
|
||
/// <summary> | ||
/// Initializes the file and reads the headers | ||
/// </summary> | ||
public void InitializeFile(); | ||
|
||
/// <summary> | ||
/// Obtains a MemoryStream of the given path inside the EmbedFS container | ||
/// </summary> | ||
/// <param name="path">File to get contents from</param> | ||
/// <returns>The contents of the file</returns> | ||
public MemoryStream ResolveFile(string path) | ||
{ | ||
path = path.ToLower(); | ||
|
||
// remove the : from the beginning as that's not used | ||
path = path.Replace("res:/", "res/"); | ||
|
||
StuffEntry entry = this.Files.FirstOrDefault(y => y.FileName.ToLower() == path); | ||
MemoryStream stream = new MemoryStream(entry.Length); | ||
|
||
entry.Origin.Export(stream, entry); | ||
|
||
stream.Seek(0, SeekOrigin.Begin); | ||
|
||
return stream; | ||
} | ||
|
||
/// <summary> | ||
/// Exports a file from the container into the given output stream | ||
/// </summary> | ||
/// <param name="output"></param> | ||
/// <param name="entry"></param> | ||
public void Export(Stream output, StuffEntry entry); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.