INNER CODE UNIT · C#
GetActivatedRoom
ArcadeMakerSources/ArcadeMaker · src/ArcadeMaker.Core/IGame.cs:51
internal RoomInstance GetActivatedRoom() => CurrentRoom ?? throw new NoActivatedRoomException(); // TODO: skip this method...
private static event EventHandler? OnProjectLoadingComplete;
public bool LoadFromProject(SerializeableGameProject sproject, Stream? bundledProjectFileStream, string? filePath)
{
// validate that arguments are valid
if (bundledProjectFileStream == null && filePath == null)
throw new ArgumentNullException(message: $"Argument {nameof(bundledProjectFileStream)} OR argument {nameof(filePath)} must have a value.", null);
// find directory of project file, if there's one
string? fileDir = System.IO.Path.GetDirectoryName(filePath);
// check file format
string fileExt = filePath == null ? SerializeableGameProject.FileFormat_AMPB : filePath.Substring(filePath.LastIndexOf('.'));
bool bundled = fileExt switch
{
SerializeableGameProject.FileFormat_AMP => false,
SerializeableGameProject.FileFormat_AMPB => true,
_ => throw new FormatException($"Unsupported project file format ({fileExt}).")