Пример #1
0
		private void ReadFooter()
		{
			footer = new Footer();

			if (bw != null)
				bw.ReportProgress((Int32)(((Single)progressPosition / stream.Length) * readWorldPerc)
					, "Reading Footer");

			footer.Active = reader.ReadBoolean();
			footer.Name = reader.ReadString();
			footer.Id = reader.ReadInt32();

			posEnd = stream.Position;
			progressPosition = stream.Position;
		}
Пример #2
0
		public void Clear()
		{
			header = new WorldHeader();
			tiles = null;
			chests = null;
			signs = null;
			footer = null;

			posChests = 0;
			posEnd = 0;
			posFooter = 0;
			posNpcs = 0;
			posSigns = 0;
			posTiles = 0;

			MaxX = 0;
			MaxY = 0;
			progress = 0;

			if (reader != null)
			{
				reader.Close();
				reader = null;
			}

			if (stream != null)
				stream = null;

			if (buffReader != null)
				buffReader = null;

			if (bw != null)
				bw = null;
		}
Пример #3
0
		private Boolean CompareFooter(String worldName, Int32 worldId)
		{
			Boolean returnVal = false;

			long position = this.stream.Position;

			this.stream.Seek(0, SeekOrigin.End);

#if (DEBUG == false)
			try
			{
#endif
			footer = new Footer();

			footer.Id = backReader.ReadBackwardsInt32();
			footer.Name = backReader.ReadBackwardsString();
			footer.Active = backReader.ReadBackwardsBoolean();

			if (footer.Active == true && footer.Name == worldName && footer.Id == worldId)
				returnVal = true;
#if (DEBUG == false)
			}
			catch (EndOfStreamException e)
			{
				// We don't need to do this but I do just so the compiler will not throw an warning
				// for never using it.
				e.GetType();

				// If we read past the end of the stream we know it did not match.
				returnVal = false;
			}
#endif
			// We set the position back to where it was when we were called.
			this.stream.Seek(position, SeekOrigin.Begin);
			return returnVal;
		}
Пример #4
0
		private Footer tryReadFooterBackwards()
		{
			Footer newFooter = new Footer();

			newFooter.Id = backReader.ReadBackwardsInt32();
			newFooter.Name = backReader.ReadBackwardsString();
			newFooter.Active = backReader.ReadBackwardsBoolean();

			return newFooter;
		}