Inheritance: NSObject
        //public virtual override InitForURL(NSURL forUrl, NSURL url, NSString type, ref NSError error)
        //{
        //}
        public override bool ReadFromFileWrapper(NSFileWrapper fileWrapper, NSString typeName, ref NSError outError)
        {
            NSData data = fileWrapper.RegularFileContents();
            if (data != null)
            {
                var unarc = GSXibKeyedUnarchiver.Alloc().InitForReadingWithData(data);
                SystemTarget = unarc.DecodeIntForKey(@"IBDocument.SystemTarget");
                SystemVersion = (NSString)unarc.DecodeObjectForKey(@"IBDocument.SystemVersion");
                InterfaceBuilderVersion = (NSString)unarc.DecodeObjectForKey(@"IBDocument.InterfaceBuilderVersion");
                AppKitVersion = (NSString)unarc.DecodeObjectForKey(@"IBDocument.AppKitVersion");
                HIToolboxVersion = (NSString)unarc.DecodeObjectForKey(@"IBDocument.HIToolboxVersion");
                PluginVersions = (NSMutableDictionary)unarc.DecodeObjectForKey(@"IBDocument.PluginVersions");
                IntegratedClassDependencies = (NSArray)unarc.DecodeObjectForKey(@"IBDocument.IntegratedClassDependencies");
                PluginDependencies = (NSArray)unarc.DecodeObjectForKey(@"IBDocument.PluginDependencies");
                Metadata = (NSMutableDictionary)unarc.DecodeObjectForKey(@"IBDocument.Metadata");
                RootObjects = (NSMutableArray)unarc.DecodeObjectForKey(@"IBDocument.RootObjects");
                Objects = (IBObjectContainer)unarc.DecodeObjectForKey(@"IBDocument.Objects");
                Classes = (IBClassDescriber)unarc.DecodeObjectForKey(@"IBDocument.Classes");
                LocalizationMode = unarc.DecodeIntForKey(@"IBDocument.LocalizationMode");
                TargetRuntimeIdentifier = (NSString)unarc.DecodeObjectForKey(@"IBDocument.TargetRuntimeIdentifier");
                PluginDeclaredDevelopmentDependencies = (NSMutableDictionary)unarc.DecodeObjectForKey(@"IBDocument.PluginDeclaredDevelopmentDependencies");
                PluginDeclaredDependenciesTrackSystemTargetVersion = unarc.DecodeBoolForKey(@"IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion");
                DefaultPropertyAccessControl = unarc.DecodeIntForKey(@"IBDocument.DefaultPropertyAccessControl");
                LastKnownImageSizes = (NSMutableDictionary)unarc.DecodeObjectForKey(@"IBDocument.LastKnownImageSizes");
            }

            return true;
        }
 protected virtual NSError _SetExpandedParserError(NSError error)
 {
     _reserved1.error = error;
     return _reserved1.error;
 }
示例#3
0
 public virtual bool CreateDirectoryAtPath(NSString path, bool createIntermediates, NSDictionary attributes, ref NSError error)
 {
     return false;
 }
示例#4
0
        public NSData InitWithContentsOfFile(string path, NSDataReadingOptions mask, ref NSError error)
        {
            NSData nsData = this;

            try
            {
                using (FileStream fs = File.OpenRead(path))
                {
                    Bytes = new byte[fs.Length];
                    fs.Read(Bytes, 0, Convert.ToInt32(fs.Length));
                    fs.Close();
                }

            }
            catch (Exception)
            {
                nsData = null;
            }

            return nsData;
        }
 public override id InitForReadingWithData(NSData data, ref NSError outError)
 {
     return null;
 }
示例#6
0
        public virtual bool ReadFromFileWrapper(NSFileWrapper fileWrapper, NSString typeName, ref NSError outError)
        {
            if (Objc.Overridden(this.GetType(), "LoadFileWrapperRepresentation"))
            {
                outError = null;
                return this.LoadFileWrapperRepresentation(fileWrapper, typeName);
            }

            if (fileWrapper.IsRegularFile())
            {
                return this.ReadFromData(fileWrapper.RegularFileContents(), typeName, ref outError);
            }

            outError = null;
            return false;
        }
示例#7
0
        public virtual bool ReadFromURL(NSURL url, NSString typeName, ref NSError outError)
        {
            if (url.isFileURL())
            {
                NSString fileName = url.Path;

                if (Objc.Overridden(this.GetType(), "ReadFromFile"))
                {
                    outError = null;
                    return this.ReadFromFile(fileName, typeName);
                }
                else
                {
                    NSFileWrapper wrapper = (NSFileWrapper)NSFileWrapper.Alloc().InitWithPath(fileName);
                    return this.ReadFromFileWrapper(wrapper, typeName, ref outError);
                }
            }
            else
            {
                //FIXME
                //return this.ReadFromData(url.ResourceDataUsingCache(true), typeName, ref outError);
                return false;
            }
        }
示例#8
0
        public virtual bool ReadFromData(NSData data, NSString typeName, ref NSError outError)
        {
            if (Objc.Overridden(this.GetType(), "LoadDataRepresentation"))
            {
                outError = null;
                return this.LoadDataRepresentation(data, typeName);
            }

            NSException.Raise("NSInternalInconsistencyException", @"%@ must implement %@",
                NS.StringFromClass(NSDocument.Class), SEL.StringFromSelector(new SEL("LoadDataRepresentation")));
            return false;
        }
示例#9
0
        public virtual id InitWithType(NSString type, ref NSError error)
        {
            id self = this.Init();
            if (self != null)
            {
                this.SetFileType(type);
            }

            return self;
        }
示例#10
0
        public virtual id InitWithContentsOfURL(NSURL url, NSString type, ref NSError error)
        {
            id self = null;

            self = this.InitForURL(url, url, type, ref error);
            //this.SetFileModificationDate(NSDate.Date);

             return self;
        }
示例#11
0
        //-(id)initForURL:(NSURL *)absoluteDocumentURL withContentsOfURL:(NSURL *)absoluteDocumentContentsURL ofType:(NSString *)typeName error:(NSError **)outError
        //-[IBCocoaDocument initForURL:withContentsOfURL:ofType:error:]
        public virtual id InitForURL(NSURL forUrl, NSURL url, NSString type, ref NSError error)
        {
            id self = this.InitWithType(type, ref error);
            if (self != null)
            {
                this.SetFileType(type);
                if (forUrl != null)
                    this.SetFileURL(forUrl);
                if (this.ReadFromURL(url, type, ref error))
                {
                    if (!url.IsEqual(forUrl))
                    {
                        //
                    }
                }
            }

            return self;
        }
示例#12
0
 public virtual id InitWithURL(NSURL url, NSFileWrapperReadingOptions options, ref NSError outError)
 {
     return this;
 }