public void SkippingTagsOnFileLoad() { var loadedFile = new NbtFile(); loadedFile.LoadFromFile("TestFiles/bigtest.nbt", NbtCompression.None, tag => tag.Name != "nested compound test"); Assert.IsFalse(loadedFile.RootTag.Contains("nested compound test")); Assert.IsTrue(loadedFile.RootTag.Contains("listTest (long)")); loadedFile.LoadFromFile("TestFiles/bigtest.nbt", NbtCompression.None, tag => tag.TagType != NbtTagType.Float || tag.Parent.Name != "Level"); Assert.IsFalse(loadedFile.RootTag.Contains("floatTest")); Assert.AreEqual(0.75f, loadedFile.RootTag["nested compound test"]["ham"]["value"].FloatValue); loadedFile.LoadFromFile("TestFiles/bigtest.nbt", NbtCompression.None, tag => tag.Name != "listTest (long)"); Assert.IsFalse(loadedFile.RootTag.Contains("listTest (long)")); Assert.IsTrue(loadedFile.RootTag.Contains("byteTest")); loadedFile.LoadFromFile("TestFiles/bigtest.nbt", NbtCompression.None, tag => false); Assert.AreEqual(0, loadedFile.RootTag.Count); }
public void Load(string regionFile) { var regionNbt = new NbtFile(); try { regionNbt.LoadFromFile(regionFile); } catch (Exception) { File.Delete(regionFile); File.Move(regionFile + ".bak", regionFile); regionNbt.LoadFromFile(regionFile); } finally { File.Delete(regionFile + ".bak"); } NbtCompound regionCompound = regionNbt.RootTag; var chunksNbt = regionCompound["Chunks"] as NbtList; foreach (var chunkNbt in chunksNbt) { var chunk = GetChunkFromNbt((NbtCompound)chunkNbt); var index = (Helpers.Modulo(chunk.X, cubicRegionSize), Helpers.Modulo(chunk.Z, cubicRegionSize)); LoadedChunks[index.Item1, index.Item2] = chunk; } regionNbt = null; regionCompound = null; GC.Collect(); IsDirty = false; }
public void SkippingTagsOnFileLoad() { TestFiles.RelocateTestFiles(); var loadedFile = new NbtFile(); loadedFile.LoadFromFile("TestFiles/bigtest.nbt", NbtCompression.None, tag => tag.Name != "nested compound test"); Assert.IsFalse(loadedFile.RootTag.Contains("nested compound test")); Assert.IsTrue(loadedFile.RootTag.Contains("listTest (long)")); loadedFile.LoadFromFile("TestFiles/bigtest.nbt", NbtCompression.None, tag => tag.TagType != NbtTagType.Float || tag.Parent.Name != "Level"); Assert.IsFalse(loadedFile.RootTag.Contains("floatTest")); Assert.AreEqual(0.75f, loadedFile.RootTag["nested compound test"]["ham"]["value"].FloatValue); loadedFile.LoadFromFile("TestFiles/bigtest.nbt", NbtCompression.None, tag => tag.Name != "listTest (long)"); Assert.IsFalse(loadedFile.RootTag.Contains("listTest (long)")); Assert.IsTrue(loadedFile.RootTag.Contains("byteTest")); loadedFile.LoadFromFile("TestFiles/bigtest.nbt", NbtCompression.None, tag => false); Assert.AreEqual(0, loadedFile.RootTag.Count); }
public void LoadingBigFileGZip() { var file = new NbtFile(); long length = file.LoadFromFile(TestFiles.BigGZip); TestFiles.AssertNbtBigFile(file); Assert.AreEqual(length, new FileInfo(TestFiles.BigGZip).Length); }
private void Start() { if (this._debugLoadSettings.instantLoad) { // Load world instantly. string name = this._debugLoadSettings.name; if (File.Exists(SAVE_DIR + name + SAVE_EXTENSION)) { NbtFile nbtFile = new NbtFile(); nbtFile.LoadFromFile(SAVE_DIR + name + SAVE_EXTENSION); this.createWorld(name, nbtFile.RootTag); } else { this.createWorld( this._debugLoadSettings.name, this._debugLoadSettings.settings); } } else { // Normal game startup. this.titleScreenPopup.open(); } }
public void Initialize() { if (_isInitialized) { return; // Quick exit } lock (_initializeSync) { if (_isInitialized) { return; } BasePath = BasePath ?? Config.GetProperty("PCWorldFolder", "World").Trim(); NbtFile file = new NbtFile(); file.LoadFromFile(Path.Combine(BasePath, "level.dat")); NbtTag dataTag = file.RootTag["Data"]; LevelInfo = new LevelInfo(dataTag); WaterOffsetY = WaterOffsetY == 0 ? (byte)Config.GetProperty("PCWaterOffset", 0) : WaterOffsetY; _isInitialized = true; } }
private static void ReadWorldNbt(ref World c) { var NbtPath = c.Path + "/level.dat"; var File = new NbtFile(); File.LoadFromFile(NbtPath); var compound = File.RootTag; if (compound.Tags.Count() > 1) { c.LevelData = compound; } else { c.LevelData = (NbtCompound)compound.Tags.ToArray()[0]; } if (c.LevelData == null) { throw new Exception(); } c.Name = c.LevelData.Get <NbtString>("LevelName").Value; try { c.Version = c.LevelData.Get <NbtCompound>("Version").Get("Name").StringValue; } catch { c.Version = "Unknown"; } }
//TODO public void Load() { var DataPath = Path.Combine(Name, "level.dat"); var DataFile = new NbtFile(); DataFile.LoadFromFile(DataPath); var levelcompound = DataFile.RootTag; this.Data = new Level() { Hardcore = levelcompound["hardcore"].ByteValue == 1, // lel lazy bool conversion I guess MapFeatures = levelcompound["MapFeatures"].ByteValue == 1, Raining = levelcompound["raining"].ByteValue == 1, Thundering = levelcompound["thundering"].ByteValue == 1, GameType = (Gamemode)levelcompound["GameType"].IntValue, GeneratorVersion = levelcompound["generatorVersion"].IntValue, RainTime = levelcompound["rainTime"].IntValue, SpawnX = levelcompound["SpawnX"].IntValue, SpawnY = levelcompound["SpawnY"].IntValue, SpawnZ = levelcompound["SpawnZ"].IntValue, ThunderTime = levelcompound["thunderTime"].IntValue, Version = levelcompound["version"].IntValue, LastPlayed = levelcompound["LastPlayed"].LongValue, RandomSeed = levelcompound["RandomSeed"].LongValue, Time = levelcompound["Time"].LongValue, GeneratorName = levelcompound["generatorName"].StringValue, LevelName = levelcompound["LevelName"].StringValue }; this.Loaded = true; }
public static NbtCompound LoadRootTagFromFile(string filePath, NbtCompression compression) { NbtFile file = new NbtFile(); file.LoadFromFile(filePath, compression, null); return(file.RootTag); }
private void button1_Click(object sender, EventArgs e) { if (openFileDialog1.ShowDialog() == DialogResult.OK) { reportFile.LoadFromFile(openFileDialog1.FileName); ticketni_log_text.Text = Encoding.UTF8.GetString(reportFile.RootTag.Get <NbtByteArray>("Ticketnik.log").Value, 0, reportFile.RootTag.Get <NbtByteArray>("Ticketnik.log").Value.Length); error_log_text.Text = Encoding.UTF8.GetString(reportFile.RootTag.Get <NbtByteArray>("Error.log").Value, 0, reportFile.RootTag.Get <NbtByteArray>("Error.log").Value.Length); user_config_file.Text = Encoding.UTF8.GetString(reportFile.RootTag.Get <NbtByteArray>("user.config").Value, 0, reportFile.RootTag.Get <NbtByteArray>("user.config").Value.Length); label2.Text = reportFile.RootTag.Get <NbtString>("user.config cesta").Value; label1.Text = reportFile.RootTag.Get <NbtString>("Cesta k tic").Value; File.WriteAllBytes(Path.GetTempPath() + "\\TicketnikCrashFile", reportFile.RootTag.Get <NbtByteArray>("Soubor").Value); /*NbtFile tic = new NbtFile(); * tic.LoadFromBuffer(reportFile.RootTag.Get<NbtByteArray>("Soubor").Value, 0, reportFile.RootTag.Get<NbtByteArray>("Soubor").Value.Length, NbtCompression.AutoDetect); * tic.SaveToFile(Path.GetTempPath() + "\\TicketnikCrashFile", NbtCompression.GZip);*/ form.jmenoSouboru = Path.GetTempPath() + "\\TicketnikCrashFile"; try { form.LoadFile(); } catch (Exception fileEx) { MessageBox.Show("Tic soubor je poškozený. Je třeba ho zkontrolovat ručně v NBT editoru."); MessageBox.Show(fileEx.Message); } } }
public void LoadingBigFileZLib() { var file = new NbtFile(); int length = file.LoadFromFile(TestFiles.BigZLib); TestFiles.AssertNbtBigFile(file); Assert.AreEqual(length, new FileInfo(TestFiles.BigZLib).Length); }
public void LoadPlayer(Guid uuid) { var playerfile = Path.Combine(Name, "players", $"{uuid}.dat"); var PFile = new NbtFile(); PFile.LoadFromFile(playerfile); var playercompound = PFile.RootTag; // filenames are player UUIDs. ??? var player = new Player(uuid, Path.GetFileNameWithoutExtension(playerfile), null)//TODO: changes { OnGround = playercompound["OnGround"].ByteValue == 1, Sleeping = playercompound["Sleeping"].ByteValue == 1, Air = playercompound["Air"].ShortValue, AttackTime = playercompound["AttackTime"].ShortValue, DeathTime = playercompound["DeathTime"].ShortValue, //Fire = playercompound["Fire"].ShortValue, Health = playercompound["Health"].ShortValue, HurtTime = playercompound["HurtTime"].ShortValue, SleepTimer = playercompound["SleepTimer"].ShortValue, Dimension = playercompound["Dimension"].IntValue, FoodLevel = playercompound["foodLevel"].IntValue, FoodTickTimer = playercompound["foodTickTimer"].IntValue, Gamemode = (Gamemode)playercompound["playerGameType"].IntValue, XpLevel = playercompound["XpLevel"].IntValue, XpTotal = playercompound["XpTotal"].IntValue, FallDistance = playercompound["FallDistance"].FloatValue, FoodExhastionLevel = playercompound["foodExhastionLevel"].FloatValue, FoodSaturationLevel = playercompound["foodSaturationLevel"].FloatValue, XpP = playercompound["XpP"].FloatValue // TODO: NBTCompound(inventory), NBTList(Motion), NBTList(Pos), NBTList(Rotation) }; this.Players.TryAdd(uuid, player); }
public RenderItem(string path) { this.Path = path; NbtFile file = new NbtFile(); file.LoadFromFile(path + "\\level.dat"); NbtCompound root = file.RootTag; //clean level name so it doesnt contain any non valid symbols Name = ""; string levelName = root["Data"]["LevelName"].StringValue; for (int i = 0; i < levelName.Length; i++) { int c = levelName[i]; if (c < 128 && !Utils.invalidWinChars.Contains(c)) { Name += (char)c; } } LastPlayed = root["Data"]["LastPlayed"].LongValue; DateTime when = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc) .AddMilliseconds(LastPlayed).ToLocalTime(); Content = Name + " - " + when.ToString("dd/MM/yyyy H:mm:ss"); RenderName = Name + " - " + when.ToString("dd/MM/yyyy"); }
public void LoadAnvilLevelLoadTest() { NbtFile file = new NbtFile(); file.LoadFromFile(@"D:\Downloads\KingsLanding1\KingsLanding1\level.dat"); NbtTag dataTag = file.RootTag["Data"]; Assert.NotNull(dataTag); Assert.NotNull(dataTag["version"]); Assert.AreEqual(19133, dataTag["version"].IntValue); Assert.NotNull(dataTag["initialized"]); var level = new LevelInfo(); level.GetPropertyValue(dataTag, () => level.Version); Assert.AreEqual(19133, level.Version); Assert.AreEqual(19133, level.GetPropertyValue(dataTag, () => level.Version)); Assert.AreEqual(true, level.GetPropertyValue(dataTag, () => level.Initialized)); Assert.AreEqual("WesterosCraft", level.GetPropertyValue(dataTag, () => level.LevelName)); var levelFromNbt = new LevelInfo(dataTag); Assert.AreEqual(19133, levelFromNbt.Version); Assert.AreEqual(true, levelFromNbt.Initialized); Assert.AreEqual("WesterosCraft", levelFromNbt.LevelName); }
public void ReloadUncompressed() { NbtFile loadedFile = new NbtFile( "TestFiles/bigtest.nbt", NbtCompression.AutoDetect ); loadedFile.SaveToFile( "TestTemp/bigtest.nbt", NbtCompression.None ); loadedFile.LoadFromFile( "TestTemp/bigtest.nbt", NbtCompression.AutoDetect ); AssertNbtBigFile( loadedFile ); }
public void LoadingBigFileZLib() { var file = new NbtFile(); int length = file.LoadFromFile( "TestFiles/bigtest.nbt.z" ); AssertNbtBigFile( file ); Assert.AreEqual( length, new FileInfo( "TestFiles/bigtest.nbt.z" ).Length ); }
internal static void Add(UpozorneniCls upozorneni) { NbtFile file = new NbtFile(); if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Ticketnik\\upozorneni")) { file.LoadFromFile(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Ticketnik\\upozorneni"); } else { file.RootTag = new NbtCompound("Upozorneni"); file.RootTag.Add(new NbtList("Upozorneni", NbtTagType.Compound)); } NbtCompound newUpo = new NbtCompound(); short typUpo = 0; if (upozorneni.TypUpozorneni == Typ.RDP) { typUpo = 1; } else if (upozorneni.TypUpozorneni == Typ.Upozorneni) { typUpo = 0; } newUpo.Add(new NbtShort("Typ", typUpo)); newUpo.Add(new NbtLong("Datum", upozorneni.Datum.Ticks)); newUpo.Add(new NbtString("Popis", upozorneni.Popis)); file.RootTag.Get <NbtList>("Upozorneni").Add(newUpo); file.SaveToFile(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Ticketnik\\upozorneni", NbtCompression.GZip); }
public void Load(string p) { var myFile = new NbtFile(); myFile.LoadFromFile(p); var root = myFile.RootTag; Width = root.Get("Width").ShortValue; Height = root.Get("Height").ShortValue; Length = root.Get("Length").ShortValue; _data = root.Get("Data").ByteArrayValue; _biomes = root.Get("Biomes").ByteArrayValue; _blocks = root.Get("Blocks").ByteArrayValue; Fill(); for (int y = 0; y < Height; y++) { for (int z = 0; z < Length; z++) { for (int x = 0; x < Width; x++) { SetBlock(x, y, z, new Block() { ID = _blocks[(y * Length + z) * Width + x], Metta = _data[(y * Length + z) * Width + x] & 0x0F }); } } } }
public void LoadingBigFileGZip() { var file = new NbtFile(); long length = file.LoadFromFile(TestFiles.BigGZip); TestFiles.AssertNbtBigFile(file); Assert.Equal(length, new FileInfo(TestFiles.BigGZip).Length); }
public void ReloadZLib() { NbtFile loadedFile = new NbtFile("TestFiles/bigtest.nbt", NbtCompression.AutoDetect); loadedFile.SaveToFile("TestTemp/bigtest.nbt.z", NbtCompression.ZLib); loadedFile.LoadFromFile("TestTemp/bigtest.nbt.z", NbtCompression.AutoDetect); AssertNbtBigFile(loadedFile); }
public void LoadingBigFileZLib() { var file = new NbtFile(); var length = file.LoadFromFile("TestFiles/bigtest.nbt.z"); AssertNbtBigFile(file); Assert.AreEqual(length, new FileInfo("TestFiles/bigtest.nbt.z").Length); }
public void LoadingBigFileZLib() { var file = new NbtFile(); long length = file.LoadFromFile(TestFiles.BigZLib); TestFiles.AssertNbtBigFile(file); Assert.AreEqual(length, new FileInfo(TestFiles.BigZLib).Length); }
public void LoadingBigFileUncompressed() { var file = new NbtFile(); int length = file.LoadFromFile("TestFiles/bigtest.nbt"); AssertNbtBigFile(file); Assert.AreEqual(length, new FileInfo("TestFiles/bigtest.nbt").Length); }
public void LoadingBigFileUncompressed() { TestFiles.RelocateTestFiles(); var file = new NbtFile(); long length = file.LoadFromFile(TestFiles.Big); TestFiles.AssertNbtBigFile(file); Assert.AreEqual(length, new FileInfo(TestFiles.Big).Length); }
public void ReloadGZip() { NbtFile loadedFile = new NbtFile("TestFiles/bigtest.nbt"); int bytesWritten = loadedFile.SaveToFile("TestTemp/bigtest.nbt.gz", NbtCompression.GZip); int bytesRead = loadedFile.LoadFromFile("TestTemp/bigtest.nbt.gz", NbtCompression.AutoDetect, null); Assert.AreEqual(bytesWritten, bytesRead); AssertNbtBigFile(loadedFile); }
public void ReloadZLib() { var loadedFile = new NbtFile("TestFiles/bigtest.nbt"); var bytesWritten = loadedFile.SaveToFile("TestTemp/bigtest.nbt.z", NbtCompression.ZLib); var bytesRead = loadedFile.LoadFromFile("TestTemp/bigtest.nbt.z", NbtCompression.AutoDetect, null); Assert.AreEqual(bytesWritten, bytesRead); AssertNbtBigFile(loadedFile); }
private static void Schematic2BlockCollection(string file) { #region Initialization var nbt = new NbtFile(); nbt.LoadFromFile(file); var root = nbt.RootTag; //Read File bcl = new BlockCollection(); bcl.SetWidth(root.Get <NbtShort>("Width").ShortValue); //Get Width bcl.SetHeight(root.Get <NbtShort>("Height").ShortValue); bcl.SetLength(root.Get <NbtShort>("Length").ShortValue); bcl.Comments = "Created by S2J"; //Set Comment var blocks = root.Get <NbtByteArray>("Blocks").ByteArrayValue; //Initialize Blocks var datas = root.Get <NbtByteArray>("Data").ByteArrayValue; //Initialize Datas bcl.level = new BlockCollection.Block[bcl.GetWidth(), bcl.GetHeight(), bcl.GetLength()]; #endregion var obj = new object(); Current.WriteLine(Environment.NewLine + "- Reading Schematic:"); Current.SetProgressBar(); int current = 0; int total = bcl.GetWidth(); #region Read Schematic Parallel.For(0, bcl.GetWidth(), x => { for (int y = 0; y < bcl.GetHeight(); y++) { for (int z = 0; z < bcl.GetLength(); z++) { var block = new BlockCollection.Block(); var index = y * bcl.GetWidth() * bcl.GetLength() + z * bcl.GetWidth() + x; if (blocks[index] != 0) { var blockInfo = res.GetBlockInfo(blocks[index].ToString(), datas[index].ToString(), version); if (blockInfo != null) { block.SetCoordinate(x, y, z); block.SetInfo(blockInfo); bcl.blocks.Add(block); bcl.level[x, y, z] = block; } } } } lock (obj) //Update Progress { current++; Current.DrawProgressBar(current * 100 / total); } }); #endregion }
public void loadMap() { if (File.Exists(this.getSaveFileName())) { NbtFile file = new NbtFile(); file.LoadFromFile(saveName); NbtCompound rootTag = file.RootTag; this.map.readFromNbt(rootTag); } }
/// <summary> /// Tries to read the player data from the disk, returning true if it was found. /// </summary> public bool readPlayerFromDisk(EntityPlayer player) { if (File.Exists(this.playerFileName)) { NbtFile file = new NbtFile(); file.LoadFromFile(this.playerFileName); player.readFromNbt(file.RootTag); return(true); } return(false); }
/// <summary> /// Tries to read the world data from the disk, returning true if it was found. /// </summary> public bool readGenerationData(WorldGeneratorBase generator) { if (File.Exists(this.generationDataFileName)) { NbtFile file = new NbtFile(); file.LoadFromFile(this.generationDataFileName); generator.readFromNbt(file.RootTag); return(true); } return(false); }
public void callback_load() { this.GetComponentInParent <PopupWindow>().close(); NbtFile nbtFile = new NbtFile(); nbtFile.LoadFromFile(this.saveFile.path); Main.instance.createWorld( Path.GetFileNameWithoutExtension(this.saveFile.path), nbtFile.RootTag); }
public void NullParameterTest() { Assert.Throws <ArgumentNullException>(() => new NbtFile((NbtCompound)null)); Assert.Throws <ArgumentNullException>(() => new NbtFile((string)null)); NbtFile file = new NbtFile(); Assert.Throws <ArgumentNullException>(() => file.LoadFromBuffer(null, 0, 1, NbtCompression.None)); Assert.Throws <ArgumentNullException>(() => file.LoadFromBuffer(null, 0, 1, NbtCompression.None, tag => true)); Assert.Throws <ArgumentNullException>(() => file.LoadFromFile(null)); Assert.Throws <ArgumentNullException>(() => file.LoadFromFile(null, NbtCompression.None, tag => true)); Assert.Throws <ArgumentNullException>(() => file.LoadFromStream(null, NbtCompression.AutoDetect)); Assert.Throws <ArgumentNullException>(() => file.LoadFromStream(null, NbtCompression.AutoDetect, tag => true)); Assert.Throws <ArgumentNullException>(() => file.SaveToBuffer(null, 0, NbtCompression.None)); Assert.Throws <ArgumentNullException>(() => file.SaveToFile(null, NbtCompression.None)); Assert.Throws <ArgumentNullException>(() => file.SaveToStream(null, NbtCompression.None)); Assert.Throws <ArgumentNullException>(() => NbtFile.ReadRootTagName(null)); Assert.Throws <ArgumentNullException>( () => NbtFile.ReadRootTagName((Stream)null, NbtCompression.None, true, 0)); }
public void readPlayerFromFile(Player player) { string s = this.getPlayerFileName(player); if (File.Exists(s)) { NbtFile file = new NbtFile(); file.LoadFromFile(s); NbtCompound rootTag = file.RootTag; player.readFromNbt(rootTag); } }
public Map LoadHeader(string fileName) { if (fileName == null) { throw new ArgumentNullException("fileName"); } NbtFile file = new NbtFile(); file.LoadFromFile(fileName, NbtCompression.None, HeaderTagSelector); NbtCompound root = file.RootTag; return(LoadHeaderInternal(root)); }
/// <summary> /// Tries to read the passed chunk from the disk, returning true if it was found. /// </summary> public bool readChunkFromDisk(Chunk chunk) { string saveFile = this.getChunkFileName(chunk.chunkPos); if (File.Exists(saveFile)) { NbtFile file = new NbtFile(); file.LoadFromFile(saveFile); chunk.readFromNbt(file.RootTag); return(true); } return(false); }
public void ReloadZLib() { NbtFile loadedFile = new NbtFile( "TestFiles/bigtest.nbt" ); int bytesWritten = loadedFile.SaveToFile( "TestTemp/bigtest.nbt.z", NbtCompression.ZLib ); int bytesRead = loadedFile.LoadFromFile( "TestTemp/bigtest.nbt.z", NbtCompression.AutoDetect, null ); Assert.AreEqual( bytesWritten, bytesRead ); AssertNbtBigFile( loadedFile ); }
void ReloadFileInternal(String fileName, NbtCompression compression, bool bigEndian, bool buffered) { var loadedFile = new NbtFile(Path.Combine(TestFiles.DirName, fileName)) { BigEndian = bigEndian }; if (!buffered) { loadedFile.BufferSize = 0; } long bytesWritten = loadedFile.SaveToFile(Path.Combine(TestDirName, fileName), compression); long bytesRead = loadedFile.LoadFromFile(Path.Combine(TestDirName, fileName), NbtCompression.AutoDetect, null); Assert.AreEqual(bytesWritten, bytesRead); TestFiles.AssertNbtBigFile(loadedFile); }
public void NullParameterTest() { Assert.Throws<ArgumentNullException>(() => new NbtFile((NbtCompound)null)); Assert.Throws<ArgumentNullException>(() => new NbtFile((string)null)); NbtFile file = new NbtFile(); Assert.Throws<ArgumentNullException>(() => file.LoadFromBuffer(null, 0, 1, NbtCompression.None)); Assert.Throws<ArgumentNullException>(() => file.LoadFromBuffer(null, 0, 1, NbtCompression.None, tag => true)); Assert.Throws<ArgumentNullException>(() => file.LoadFromFile(null)); Assert.Throws<ArgumentNullException>(() => file.LoadFromFile(null, NbtCompression.None, tag => true)); Assert.Throws<ArgumentNullException>(() => file.LoadFromStream(null, NbtCompression.AutoDetect)); Assert.Throws<ArgumentNullException>(() => file.LoadFromStream(null, NbtCompression.AutoDetect, tag => true)); Assert.Throws<ArgumentNullException>(() => file.SaveToBuffer(null, 0, NbtCompression.None)); Assert.Throws<ArgumentNullException>(() => file.SaveToFile(null, NbtCompression.None)); Assert.Throws<ArgumentNullException>(() => file.SaveToStream(null, NbtCompression.None)); Assert.Throws<ArgumentNullException>(() => NbtFile.ReadRootTagName(null)); Assert.Throws<ArgumentNullException>( () => NbtFile.ReadRootTagName((Stream)null, NbtCompression.None, true, 0)); }