public override id InitWithCoder(NSCoder aDecoder)
{
if (aDecoder.AllowsKeyedCoding)
{
NSData data = (NSData)aDecoder.DecodeObjectForKey("NSFileWrapperData");
return InitWithSerializedRepresentation(data);
}
else
{
int wrapperType;
NSString preferredFilename;
NSDictionary fileAttributes;
id wrapperData;
//NSImage iconImage;
aDecoder.DecodeValueOfObjCType2<int>(out wrapperType);
// Dont restore the file name
preferredFilename = (NSString)aDecoder.DecodeObject();
fileAttributes = (NSDictionary)aDecoder.DecodeObject();
wrapperData = aDecoder.DecodeObject();
//iconImage = aDecoder.DecodeObject();
switch ((GSFileWrapperType)wrapperType)
{
case GSFileWrapperType.GSFileWrapperRegularFileType:
{
InitRegularFileWithContents((NSData)wrapperData);
break;
}
case GSFileWrapperType.GSFileWrapperSymbolicLinkType:
{
InitSymbolicLinkWithDestination((NSString)wrapperData);
break;
}
case GSFileWrapperType.GSFileWrapperDirectoryType:
{
InitDirectoryWithFileWrappers((NSDictionary)wrapperData);
break;
}
}
if (preferredFilename != null)
{
SetPreferredFilename(preferredFilename);
}
if (fileAttributes != null)
{
SetFileAttributes(fileAttributes);
}
//if (iconImage != null)
//{
// SetIcon(iconImage);
//}
}
return this;
}