RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Changing path SDK uses for MUL files

HellRazor

Knight
Changing path SDK uses for MUL files

I want to create a utility that will compare the contents between 2 sets of MUL files. The SDK gets the UO installation path from the registry,

Is it possible to dynamically change the directory the SDK uses to read the MUL files via code?
 

Malaperth

Wanderer
Well, if the SDK has the capability to read mul files, I would expect that the reading routines are separate from the path definition code (however, I could easily be wrong since I've never looked at it). It should be possible to simply specify a path in the code, then read the muls.
 

HellRazor

Knight
Currently the SDK gets the UO path from the registry and uses that for its MUL access.

What I'm not sure about is whether or not there is a way to change the path it reads from via code, or if its possible to read from 2 seperate paths.
 

Malaperth

Wanderer
Right, but does it do it all in one method? If not, you should be able to call the code that does things with the mul files directly instead of starting from the point where it finds the path.
 

Zippy

Razor Creator
In what universe would it *not* be possible to change what path it is reading by editing the code which reads the files?
 

Jeff

Lord
I modified them myself, for my project. All i had to change was the contructor. Where uofolder is, just make it whatever folder you want the idx and mul file to be in.

Code:
public FileIndex(string uoFolder, string idxFile, string mulFile, int length)
		{
			m_Index = new Entry3D[length];

			string idxPath = Path.Combine(uoFolder, idxFile);
			string mulPath = Path.Combine(uoFolder, mulFile);

			if( idxPath != null && mulPath != null )
			{
				using( FileStream index = new FileStream(idxPath, FileMode.Open, FileAccess.Read, FileShare.Read) )
				{
					BinaryReader bin = new BinaryReader(index);
					m_Stream = new FileStream(mulPath, FileMode.Open, FileAccess.Read, FileShare.Read);

					int count = (int)( index.Length / 12 );

					for( int i = 0; i < count && i < length; ++i )
					{
						m_Index[i].lookup = bin.ReadInt32();
						m_Index[i].length = bin.ReadInt32();
						m_Index[i].extra = bin.ReadInt32();
					}

					for( int i = count; i < length; ++i )
					{
						m_Index[i].lookup = -1;
						m_Index[i].length = -1;
						m_Index[i].extra = -1;
					}
				}
			}
		}
 
Top