mirror of
https://github.com/aaru-dps/Aaru.Server.git
synced 2025-12-16 19:24:27 +00:00
REFACTOR: Reformat code.
This commit is contained in:
@@ -45,34 +45,26 @@ namespace DiscImageChef.Filesystems.AppleDOS
|
||||
/// <param name="xattrs">List of extended attributes, alternate data streams and forks.</param>
|
||||
public override Errno ListXAttr(string path, ref List<string> xattrs)
|
||||
{
|
||||
if(!mounted)
|
||||
return Errno.AccessDenied;
|
||||
if(!mounted) return Errno.AccessDenied;
|
||||
|
||||
string[] pathElements = path.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
if(pathElements.Length != 1)
|
||||
return Errno.NotSupported;
|
||||
string[] pathElements = path.Split(new char[] {'/'}, StringSplitOptions.RemoveEmptyEntries);
|
||||
if(pathElements.Length != 1) return Errno.NotSupported;
|
||||
|
||||
string filename = pathElements[0].ToUpperInvariant();
|
||||
if(filename.Length > 30)
|
||||
return Errno.NameTooLong;
|
||||
if(filename.Length > 30) return Errno.NameTooLong;
|
||||
|
||||
xattrs = new List<string>();
|
||||
|
||||
if(debug &&
|
||||
(string.Compare(path, "$", StringComparison.InvariantCulture) == 0
|
||||
|| string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0
|
||||
|| string.Compare(path, "$Vtoc", StringComparison.InvariantCulture) == 0))
|
||||
{
|
||||
}
|
||||
if(debug && (string.Compare(path, "$", StringComparison.InvariantCulture) == 0 ||
|
||||
string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 ||
|
||||
string.Compare(path, "$Vtoc", StringComparison.InvariantCulture) == 0)) { }
|
||||
else
|
||||
{
|
||||
if(!catalogCache.ContainsKey(filename))
|
||||
return Errno.NoSuchFile;
|
||||
if(!catalogCache.ContainsKey(filename)) return Errno.NoSuchFile;
|
||||
|
||||
xattrs.Add("com.apple.dos.type");
|
||||
|
||||
if(debug)
|
||||
xattrs.Add("com.apple.dos.tracksectorlist");
|
||||
if(debug) xattrs.Add("com.apple.dos.tracksectorlist");
|
||||
}
|
||||
|
||||
return Errno.NoError;
|
||||
@@ -87,33 +79,28 @@ namespace DiscImageChef.Filesystems.AppleDOS
|
||||
/// <param name="buf">Buffer.</param>
|
||||
public override Errno GetXattr(string path, string xattr, ref byte[] buf)
|
||||
{
|
||||
if(!mounted)
|
||||
return Errno.AccessDenied;
|
||||
if(!mounted) return Errno.AccessDenied;
|
||||
|
||||
string[] pathElements = path.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
if(pathElements.Length != 1)
|
||||
return Errno.NotSupported;
|
||||
string[] pathElements = path.Split(new char[] {'/'}, StringSplitOptions.RemoveEmptyEntries);
|
||||
if(pathElements.Length != 1) return Errno.NotSupported;
|
||||
|
||||
string filename = pathElements[0].ToUpperInvariant();
|
||||
if(filename.Length > 30)
|
||||
return Errno.NameTooLong;
|
||||
if(filename.Length > 30) return Errno.NameTooLong;
|
||||
|
||||
if(debug &&
|
||||
(string.Compare(path, "$", StringComparison.InvariantCulture) == 0
|
||||
|| string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0
|
||||
|| string.Compare(path, "$Vtoc", StringComparison.InvariantCulture) == 0))
|
||||
if(debug && (string.Compare(path, "$", StringComparison.InvariantCulture) == 0 ||
|
||||
string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 ||
|
||||
string.Compare(path, "$Vtoc", StringComparison.InvariantCulture) == 0))
|
||||
{
|
||||
return Errno.NoSuchExtendedAttribute;
|
||||
}
|
||||
|
||||
if(!catalogCache.ContainsKey(filename))
|
||||
return Errno.NoSuchFile;
|
||||
if(!catalogCache.ContainsKey(filename)) return Errno.NoSuchFile;
|
||||
|
||||
if(string.Compare(xattr, "com.apple.dos.type", StringComparison.InvariantCulture) == 0)
|
||||
{
|
||||
byte type;
|
||||
if(!fileTypeCache.TryGetValue(filename, out type))
|
||||
return Errno.InvalidArgument;
|
||||
if(!fileTypeCache.TryGetValue(filename, out type)) return Errno.InvalidArgument;
|
||||
|
||||
buf = new byte[1];
|
||||
buf[0] = type;
|
||||
return Errno.NoError;
|
||||
@@ -122,8 +109,8 @@ namespace DiscImageChef.Filesystems.AppleDOS
|
||||
if(string.Compare(xattr, "com.apple.dos.tracksectorlist", StringComparison.InvariantCulture) == 0 && debug)
|
||||
{
|
||||
byte[] ts;
|
||||
if(!extentCache.TryGetValue(filename, out ts))
|
||||
return Errno.InvalidArgument;
|
||||
if(!extentCache.TryGetValue(filename, out ts)) return Errno.InvalidArgument;
|
||||
|
||||
buf = new byte[ts.Length];
|
||||
Array.Copy(ts, 0, buf, 0, buf.Length);
|
||||
return Errno.NoError;
|
||||
@@ -132,4 +119,4 @@ namespace DiscImageChef.Filesystems.AppleDOS
|
||||
return Errno.NoSuchExtendedAttribute;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user