public override bool Process( GameMakerFile aGmFile ) { m_gmk = aGmFile; OnProcessStarted(); try { Directory.CreateDirectory( m_directory ); Directory.SetCurrentDirectory( m_directory ); ProcessResources(); OnProcessFinished(); } catch ( Exceptions.ProcessingAborted ) { OnProcessAborted(); return false; } return true; }
private void m_itemAsm_Click( object sender, EventArgs e ) { SetCurrentDirectory(); var importer = new XmlImporter( m_project.ResourceDirectory ); if ( !importer.IsValidImportDirectory() ) { LogLine( "Cannot assemble game project: specified resource directory lacks essential data files.", MessageType.Warning, false ); return; } importer.ProcessStarted += Importer_ProcessStarted; importer.ProcessFinished += Importer_ProcessFinished; importer.ProcessAborted += Importer_ProcessAborted; importer.CategoryProcessing += Importer_CategoryProcessing; importer.ProcessingErrorOccurred += Importer_ProcessingErrorOccurred; importer.XmlParseErrorOccurred += Importer_XmlParseErrorOccurred; if ( Settings.Default.VerboseLog ) importer.ResourceProcessed += Importer_ResourceProcessed; m_gmFile = new GameMakerFile(); SetStatus( "Assembling game project..." ); if ( importer.Process( m_gmFile ) ) { LogLine( "Project data collected!", MessageType.Information, false ); if ( SaveGameFile() ) SetLoggedStatus( "Game project created." ); else { LogLine( "Process aborted.", MessageType.Warning, false ); SetStatus( "Process aborted." ); } } m_statusProgress.Value = m_statusProgress.Maximum; GenerateResourceTree(); }
public abstract bool Process( GameMakerFile aGmFile );
private bool LoadGameFile() { SetCurrentDirectory(); if ( !File.Exists( m_project.GameFilePath ) ) { LogLine( "Game project file path is not set or is invalid. Go to project options and specify valid path.", MessageType.Warning, false ); return false; } m_treeResources.Nodes.Clear(); try { m_gmFile = new GameMakerFile(); SetLoggedStatus( "Loading " + Path.GetFileName( m_project.GameFilePath ) + "..." ); m_gmFile.Open( m_project.GameFilePath ); SetStatus( "File loaded successfully." ); LogLine( "File loaded successfully.", MessageType.Success, false ); GenerateResourceTree(); return true; } catch ( GameMaker.Format.Exceptions.FileCorrupted e ) { LogLine( "Failed to read the game project -- file is corrupted at position " + e.Position + ": " + e.Message, MessageType.Error, false ); } catch ( GameMaker.Format.Exceptions.UnknownFormat ) { LogLine( "Error: File is not a Game Maker game project or it is corrupted.", MessageType.Error, false ); } catch ( GameMaker.Format.Exceptions.UnsupportedVersion e ) { LogLine( "Error: Game project was created with an unsupported version of Game Maker or it is corrupted." + " (Version == " + e.Version + "?)", MessageType.Error, false ); } catch ( IOException e ) { LogLine( "Error occurred while trying to read the file: " + e.Message, MessageType.Error, false ); } m_gmFile = null; SetStatus( "Failed to the load game project." ); return false; }