mirror of
https://mirror.ghproxy.com/https://github.com/dexyfex/CodeWalker
synced 2026-05-15 07:04:55 +08:00
R28_dev1 - Turkish weather bug fix, .rel progress
This commit is contained in:
@@ -195,6 +195,45 @@ namespace CodeWalker.GameFiles
|
||||
}
|
||||
}
|
||||
|
||||
[TypeConverter(typeof(ExpandableObjectConverter))] public struct FlagsUshort
|
||||
{
|
||||
public ushort Value { get; set; }
|
||||
|
||||
public string Hex
|
||||
{
|
||||
get
|
||||
{
|
||||
return Convert.ToString(Value, 16).ToUpper().PadLeft(4, '0');
|
||||
}
|
||||
}
|
||||
|
||||
public string Bin
|
||||
{
|
||||
get
|
||||
{
|
||||
return Convert.ToString(Value, 2).PadLeft(16, '0');
|
||||
}
|
||||
}
|
||||
|
||||
public FlagsUshort(ushort v)
|
||||
{
|
||||
Value = v;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return Bin + " | 0x" + Hex + " | " + Value.ToString();
|
||||
}
|
||||
public string ToShortString()
|
||||
{
|
||||
return Bin + " | 0x" + Hex;
|
||||
}
|
||||
|
||||
public static implicit operator FlagsUshort(ushort v)
|
||||
{
|
||||
return new FlagsUshort(v);
|
||||
}
|
||||
}
|
||||
|
||||
[TypeConverter(typeof(ExpandableObjectConverter))] public struct FlagsUint
|
||||
{
|
||||
|
||||
@@ -65,8 +65,8 @@ namespace CodeWalker.GameFiles
|
||||
{
|
||||
FileInfo fi = new FileInfo(fpath);
|
||||
Name = fi.Name;
|
||||
NameLower = Name.ToLower();
|
||||
Path = relpath.ToLower();
|
||||
NameLower = Name.ToLowerInvariant();
|
||||
Path = relpath.ToLowerInvariant();
|
||||
FilePath = fpath;
|
||||
FileSize = fi.Length;
|
||||
IsCompressed = false;
|
||||
@@ -77,8 +77,8 @@ namespace CodeWalker.GameFiles
|
||||
public RpfFile(string name, string path, string filepath, long filesize, bool compressed, bool encrypted, string rootfn, long rootfs)
|
||||
{
|
||||
Name = name;
|
||||
NameLower = Name.ToLower();
|
||||
Path = path.ToLower();
|
||||
NameLower = Name.ToLowerInvariant();
|
||||
Path = path.ToLowerInvariant();
|
||||
FilePath = filepath;
|
||||
FileSize = filesize;
|
||||
IsCompressed = compressed;
|
||||
@@ -197,7 +197,7 @@ namespace CodeWalker.GameFiles
|
||||
|
||||
namesrdr.Position = e.NameOffset;
|
||||
e.Name = namesrdr.ReadString();
|
||||
e.NameLower = e.Name.ToLower();
|
||||
e.NameLower = e.Name.ToLowerInvariant();
|
||||
|
||||
if ((e is RpfFileEntry) && string.IsNullOrEmpty(e.Name))
|
||||
{
|
||||
@@ -214,7 +214,7 @@ namespace CodeWalker.GameFiles
|
||||
|
||||
|
||||
Root = (RpfDirectoryEntry)AllEntries[0];
|
||||
Root.Path = Path.ToLower();// + "\\" + Root.Name;
|
||||
Root.Path = Path.ToLowerInvariant();// + "\\" + Root.Name;
|
||||
var stack = new Stack<RpfDirectoryEntry>();
|
||||
stack.Push(Root);
|
||||
while (stack.Count > 0)
|
||||
@@ -308,7 +308,6 @@ namespace CodeWalker.GameFiles
|
||||
GrandTotalResourceCount += subfile.GrandTotalResourceCount;
|
||||
GrandTotalBinaryFileCount += subfile.GrandTotalBinaryFileCount;
|
||||
|
||||
|
||||
Children.Add(subfile);
|
||||
}
|
||||
else
|
||||
@@ -330,7 +329,7 @@ namespace CodeWalker.GameFiles
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
errorLog(entry.Path + ": " + ex.ToString());
|
||||
errorLog?.Invoke(entry.Path + ": " + ex.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -795,7 +794,7 @@ namespace CodeWalker.GameFiles
|
||||
public List<RpfFileEntry> GetFiles(string folder, bool recurse)
|
||||
{
|
||||
List<RpfFileEntry> result = new List<RpfFileEntry>();
|
||||
string[] parts = folder.ToLower().Split(new[] { '\\' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
string[] parts = folder.ToLowerInvariant().Split(new[] { '\\' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
RpfDirectoryEntry dir = Root;
|
||||
for (int i = 0; i < parts.Length; i++)
|
||||
{
|
||||
@@ -833,7 +832,7 @@ namespace CodeWalker.GameFiles
|
||||
for (int i = 0; i < dir.Directories.Count; i++)
|
||||
{
|
||||
var cdir = dir.Directories[i];
|
||||
if (cdir.Name.ToLower() == name)
|
||||
if (cdir.Name.ToLowerInvariant() == name)
|
||||
{
|
||||
return cdir;
|
||||
}
|
||||
@@ -960,20 +959,20 @@ namespace CodeWalker.GameFiles
|
||||
[TypeConverter(typeof(ExpandableObjectConverter))] public class RpfBinaryFileEntry : RpfFileEntry
|
||||
{
|
||||
public uint FileUncompressedSize { get; set; }
|
||||
public uint EncryptionType { get; set; }
|
||||
|
||||
public override void Read(DataReader reader)
|
||||
{
|
||||
NameOffset = reader.ReadUInt16();
|
||||
|
||||
var buf1 = reader.ReadBytes(3);
|
||||
FileSize = (uint)buf1[0] + (uint)(buf1[1] << 8) + (uint)(buf1[2] << 16);
|
||||
|
||||
var buf2 = reader.ReadBytes(3);
|
||||
FileOffset = (uint)buf2[0] + (uint)(buf2[1] << 8) + (uint)(buf2[2] << 16);
|
||||
ulong buf = reader.ReadUInt64();
|
||||
NameOffset = (uint)buf & 0xFFFF;
|
||||
FileSize = (uint)(buf >> 16) & 0xFFFFFF;
|
||||
FileOffset = (uint)(buf >> 40) & 0xFFFFFF;
|
||||
|
||||
FileUncompressedSize = reader.ReadUInt32();
|
||||
|
||||
switch (reader.ReadUInt32())
|
||||
EncryptionType = reader.ReadUInt32();
|
||||
|
||||
switch (EncryptionType)
|
||||
{
|
||||
case 0: IsEncrypted = false; break;
|
||||
case 1: IsEncrypted = true; break;
|
||||
|
||||
@@ -218,7 +218,7 @@ namespace CodeWalker.GameFiles
|
||||
return file;
|
||||
}
|
||||
|
||||
string lpath = path.ToLower(); //try look at names etc
|
||||
string lpath = path.ToLowerInvariant(); //try look at names etc
|
||||
foreach (RpfFile tfile in AllRpfs)
|
||||
{
|
||||
if (tfile.NameLower == lpath)
|
||||
@@ -238,7 +238,7 @@ namespace CodeWalker.GameFiles
|
||||
public RpfEntry GetEntry(string path)
|
||||
{
|
||||
RpfEntry entry;
|
||||
string pathl = path.ToLower();
|
||||
string pathl = path.ToLowerInvariant();
|
||||
if (EnableMods && ModEntryDict.TryGetValue(pathl, out entry))
|
||||
{
|
||||
return entry;
|
||||
|
||||
@@ -192,7 +192,7 @@ namespace CodeWalker.GameFiles
|
||||
|
||||
if (!string.IsNullOrEmpty(Name))
|
||||
{
|
||||
NameHash = JenkHash.GenHash(Name.ToLower());
|
||||
NameHash = JenkHash.GenHash(Name.ToLowerInvariant());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user