REFACTOR: Reformat code.

This commit is contained in:
2017-12-19 20:33:03 +00:00
parent 77edc7c91c
commit e6f6ace80b
704 changed files with 82627 additions and 83641 deletions

View File

@@ -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;
}
}
}
}