module WritingAdditions::WAD

Overview

Reads, writes, and stores the data of a WAD file.

This helps write out parsed ::WAD files to a .wad:

require "wa-cr/write"

my_wad = WAD.read("Path/To/Wad")

File.open("Path/To/MyWad.WAD", "w+") do |file|
  my_wad.write(file)
end

You can also write from new ::WAD files:

require "wa-cr/write"

my_wad = WAD.new

# You'll need to set the WAD type for new WAD's
my_wad.type = WAD::Type::Internal

File.open("Path/To/MyWad.WAD") do |file|
  my_wad.write(file)
end

Direct including types

Defined in:

write.cr

Instance Method Summary

Instance Method Detail

def write(file : String | Path) : UInt32 #

Writes a WAD class to an file and returns the written file's size

Writes a wad file to my_new_wad.WAD:

my_wad = WAD.read("Path/To/Wad")
my_wad.write("Path/To/my_wad.WAD")

def write(io : IO) : UInt32 #

Writes a WAD class to an io and returns the written file's size

Writes a wad file to my_new_wad.WAD:

my_wad = WAD.read("Path/To/Wad")
File.open("Path/To/my_new_wad.WAD", "w+") do |file|
  my_wad.write(file)
end