From bad2043e4cb41587754016fa286cd36068f1b647 Mon Sep 17 00:00:00 2001
From: miku-666 <74728189+NessieHax@users.noreply.github.com>
Date: Mon, 8 Aug 2022 22:57:37 +0200
Subject: [PATCH] Add Doc strings to PCKFile class and add `TryGetFile`
---
.../Classes/FileTypes/PCKFile.cs | 27 +++++++++++++------
1 file changed, 19 insertions(+), 8 deletions(-)
diff --git a/MinecraftUSkinEditor/Classes/FileTypes/PCKFile.cs b/MinecraftUSkinEditor/Classes/FileTypes/PCKFile.cs
index b212c407..4b82fd5c 100644
--- a/MinecraftUSkinEditor/Classes/FileTypes/PCKFile.cs
+++ b/MinecraftUSkinEditor/Classes/FileTypes/PCKFile.cs
@@ -12,7 +12,6 @@ namespace PckStudio.Classes.FileTypes
public class FileData
{
- // only apllys when the PCKFile is type 3
public enum EDLCType : int
{
DLCSkinFile = 0, // *.png
@@ -24,7 +23,7 @@ namespace PckStudio.Classes.FileTypes
///
DLCInfoFile = 4,
///
- /// (x16|x32|...)Info.pck
+ /// (x16|x32|x64)Info.pck
///
DLCTexturePackInfoFile = 5,
///
@@ -49,7 +48,6 @@ namespace PckStudio.Classes.FileTypes
DLCGameRulesHeader = 10,
///
/// Skins.pck
- /// made up name - Miku
///
DLCSkinDataFile = 11,
///
@@ -122,18 +120,31 @@ namespace PckStudio.Classes.FileTypes
/// Checks wether a file with and exists
///
/// Path to the file in the pck
- /// Type of the file to check
- /// when file exists, otherwise false
+ /// Type of the file
+ /// True when file exists, otherwise false
public bool HasFile(string filepath, int type)
{
- return GetFile(filepath, type) != null;
+ return GetFile(filepath, type) is FileData;
+ }
+
+ ///
+ /// Tries to get a file with and .
+ ///
+ /// Path to the file in the pck
+ /// Type of the file
+ ///
+ ///
+ public bool TryGetFile(string filepath, int type, out FileData file)
+ {
+ file = GetFile(filepath, type);
+ return file is FileData;
}
///
/// Gets the first file that Equals and
///
- /// file path of the file
- /// Type of the file
+ /// Path to the file in the pck
+ /// Type of the file
/// FileData if found, otherwise null
public FileData GetFile(string filepath, int type)
{