UltimateZoneBuilder/Source/Core/IO/DirectoryFileEntry.cs

87 lines
2.6 KiB
C#
Raw Normal View History

#region ================== Copyright (c) 2007 Pascal vd Heiden
/*
* Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
* This program is released under GNU General Public License
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#endregion
#region ================== Namespaces
using System.IO;
#endregion
namespace CodeImp.DoomBuilder.IO
{
internal struct DirectoryFileEntry
{
// Example for: C:\WADs\Foo\Bar.WAD
// Created from: C:\WADs
// Members
public string filename; // bar.wad
public string filetitle; // bar
public string extension; // wad
Textures Browser form: empty texture sets are no longer shown when mixed textures & flats is disabled in the current game configuration. Textures Browser form: PK3/Directory TEXTURES images are now shown in a separate folder in the resources tree. Fixed, Textures Browser form: fixed a logic error when trying to select initial flat when mix textures & flats was disabled in the current game configuration (this resulted in the blank textures list after opening the form). Fixed, Textures Browser form: resources tree showed textures count even when browsing flats. Fixed, Textures Browser form: PK3/Directory textures took precedence even when browsing flats (this means when there were a flat and a texture with the same name, a texture was displayed when browsing flats). Fixed, Classic modes: actor's scale set in DECORATE was ignored when rendering models. Fixed, MODELDEF parser: in some cases, several model definitions were skipped when trying to skip the current one. Fixed, resource management: flat and sprite TEXTURES definitions were loaded only from TEXTURES files named "TEXTURES". Fixed/added, PK3/folder resource management: patch locations for sprites defined in TEXTURES are now checked the same way as in ZDoom (previously only the "sprites" folder was checked). Fixed/added, PK3/folder resource management: patch locations for textures defined in TEXTURES are now checked the same way as in ZDoom (previously only the "textures" folder was checked). Fixed, PK3/folder resource management: flats defined in TEXTURES were not added to the global Flats image list. Fixed, PK3/folder resource management: in some cases, the image search algorithm could find flats, textures, patches or sprites in incorrect folders (for example, it could find a flat in "flats_backup" folder).
2014-10-07 00:23:02 +00:00
public string path; // foo\
public string filepathname; // Foo\Bar.WAD
public string filepathtitle; // Foo\Bar
// Constructor
public DirectoryFileEntry(string fullname, string frompath)
{
// Get the information we need
filename = Path.GetFileName(fullname);
filetitle = Path.GetFileNameWithoutExtension(fullname);
extension = Path.GetExtension(fullname);
if(extension.Length > 1)
extension = extension.Substring(1);
else
extension = "";
path = Path.GetDirectoryName(fullname);
if(path.Length > (frompath.Length + 1))
Textures Browser form: empty texture sets are no longer shown when mixed textures & flats is disabled in the current game configuration. Textures Browser form: PK3/Directory TEXTURES images are now shown in a separate folder in the resources tree. Fixed, Textures Browser form: fixed a logic error when trying to select initial flat when mix textures & flats was disabled in the current game configuration (this resulted in the blank textures list after opening the form). Fixed, Textures Browser form: resources tree showed textures count even when browsing flats. Fixed, Textures Browser form: PK3/Directory textures took precedence even when browsing flats (this means when there were a flat and a texture with the same name, a texture was displayed when browsing flats). Fixed, Classic modes: actor's scale set in DECORATE was ignored when rendering models. Fixed, MODELDEF parser: in some cases, several model definitions were skipped when trying to skip the current one. Fixed, resource management: flat and sprite TEXTURES definitions were loaded only from TEXTURES files named "TEXTURES". Fixed/added, PK3/folder resource management: patch locations for sprites defined in TEXTURES are now checked the same way as in ZDoom (previously only the "sprites" folder was checked). Fixed/added, PK3/folder resource management: patch locations for textures defined in TEXTURES are now checked the same way as in ZDoom (previously only the "textures" folder was checked). Fixed, PK3/folder resource management: flats defined in TEXTURES were not added to the global Flats image list. Fixed, PK3/folder resource management: in some cases, the image search algorithm could find flats, textures, patches or sprites in incorrect folders (for example, it could find a flat in "flats_backup" folder).
2014-10-07 00:23:02 +00:00
path = path.Substring(frompath.Length + 1) + Path.DirectorySeparatorChar;
else
path = "";
filepathname = Path.Combine(path, filename);
filepathtitle = Path.Combine(path, filetitle);
// Make some lowercase
filename = filename.ToLowerInvariant();
filetitle = filetitle.ToLowerInvariant();
extension = extension.ToLowerInvariant();
path = path.ToLowerInvariant();
}
// Constructor
public DirectoryFileEntry(string fullname)
{
// Get the information we need
filename = Path.GetFileName(fullname);
filetitle = Path.GetFileNameWithoutExtension(fullname);
extension = Path.GetExtension(fullname);
if(extension.Length > 1)
extension = extension.Substring(1);
else
extension = "";
path = Path.GetDirectoryName(fullname);
Textures Browser form: empty texture sets are no longer shown when mixed textures & flats is disabled in the current game configuration. Textures Browser form: PK3/Directory TEXTURES images are now shown in a separate folder in the resources tree. Fixed, Textures Browser form: fixed a logic error when trying to select initial flat when mix textures & flats was disabled in the current game configuration (this resulted in the blank textures list after opening the form). Fixed, Textures Browser form: resources tree showed textures count even when browsing flats. Fixed, Textures Browser form: PK3/Directory textures took precedence even when browsing flats (this means when there were a flat and a texture with the same name, a texture was displayed when browsing flats). Fixed, Classic modes: actor's scale set in DECORATE was ignored when rendering models. Fixed, MODELDEF parser: in some cases, several model definitions were skipped when trying to skip the current one. Fixed, resource management: flat and sprite TEXTURES definitions were loaded only from TEXTURES files named "TEXTURES". Fixed/added, PK3/folder resource management: patch locations for sprites defined in TEXTURES are now checked the same way as in ZDoom (previously only the "sprites" folder was checked). Fixed/added, PK3/folder resource management: patch locations for textures defined in TEXTURES are now checked the same way as in ZDoom (previously only the "textures" folder was checked). Fixed, PK3/folder resource management: flats defined in TEXTURES were not added to the global Flats image list. Fixed, PK3/folder resource management: in some cases, the image search algorithm could find flats, textures, patches or sprites in incorrect folders (for example, it could find a flat in "flats_backup" folder).
2014-10-07 00:23:02 +00:00
if(!string.IsNullOrEmpty(path)) path += Path.DirectorySeparatorChar; //mxd
filepathname = Path.Combine(path, filename);
filepathtitle = Path.Combine(path, filetitle);
// Make some lowercase
filename = filename.ToLowerInvariant();
filetitle = filetitle.ToLowerInvariant();
extension = extension.ToLowerInvariant();
path = path.ToLowerInvariant();
}
}
}