Smartmobili.Cocoa.NSFileWrapper.InitWithPath C# (CSharp) Метод

InitWithPath() публичный Метод

public InitWithPath ( NSString path ) : id
path NSString
Результат id
        public virtual id InitWithPath(NSString path)
        {
            NSFileManager fm = NSFileManager.DefaultManager;
            NSString fileType;

            //NS.DebugLLog(@"NSFileWrapper", @"initWithPath: %@", path);

            // Store the full path in filename, the specification is unclear in this point
            SetFilename(path);
            SetPreferredFilename(path.LastPathComponent());
            SetFileAttributes(fm.FileAttributesAtPath(path, false));

            fileType = FileAttributes().FileType;
            if (fileType.IsEqualToString("NSFileTypeDirectory"))
            {
                NSString filename;
                NSMutableArray fileWrappers = NSMutableArray.Array();
                NSArray filenames = fm.DirectoryContentsAtPath(path);
                NSEnumerator enumerator = filenames.ObjectEnumerator();

                while ((filename = (NSString)enumerator.NextObject()) != null)
                {
                    NSFileWrapper w;

                    w = (NSFileWrapper)NSFileWrapper.Alloc().InitWithPath(path.StringByAppendingPathComponent(filename));
                    fileWrappers.AddObject(w);
                    //RELEASE(w);
                }
                this.InitDirectoryWithFileWrappers((NSDictionary)NSMutableDictionary.DictionaryWithObjectsForKeys(fileWrappers, filenames));
            }
            else if (fileType.IsEqualToString("NSFileTypeRegular"))
            {
                this.InitRegularFileWithContents(NSData.Alloc().InitWithContentsOfFile(path));
            }
            else if (fileType.IsEqualToString("NSFileTypeSymbolicLink"))
            {
                //this.InitSymbolicLinkWithDestination(fm.PathContentOfSymbolicLinkAtPath(path));
            }

            return this;
        }