コード例 #1
0
 public NSMutableDictionary(NSMutableDictionary <TKey, TValue> other)
     : base(other)
 {
 }
コード例 #2
0
 protected DictionaryContainer()
 {
     Dictionary = new NSMutableDictionary();
 }
コード例 #3
0
 public virtual AnyObject ExpressionValueWithObject([Optional] AnyObject @object, [Optional] NSMutableDictionary context)
 {
     return(default(AnyObject));
 }
コード例 #4
0
        internal NSDictionary ToDictionary()
        {
            NSFileType?type;
            NSString   v    = null;
            var        dict = new NSMutableDictionary();

            if (AppendOnly.HasValue)
            {
                dict.SetObject(NSNumber.FromBoolean(AppendOnly.Value), NSFileManager.AppendOnly);
            }
            if (Busy.HasValue)
            {
                dict.SetObject(NSNumber.FromBoolean(Busy.Value), NSFileManager.Busy);
            }
#if XAMCORE_2_0
            if (ExtensionHidden.HasValue)
            {
                dict.SetObject(NSNumber.FromBoolean(ExtensionHidden.Value), NSFileManager.ExtensionHidden);
            }
#else
            if (FileExtensionHidden.HasValue)
            {
                dict.SetObject(NSNumber.FromBoolean(FileExtensionHidden.Value), NSFileManager.ExtensionHidden);
            }
#endif
            if (CreationDate != null)
            {
                dict.SetObject(CreationDate, NSFileManager.CreationDate);
            }
            if (OwnerAccountName != null)
            {
                dict.SetObject(new NSString(OwnerAccountName), NSFileManager.OwnerAccountName);
            }
            if (GroupOwnerAccountName != null)
            {
                dict.SetObject(new NSString(GroupOwnerAccountName), NSFileManager.GroupOwnerAccountName);
            }
            if (SystemNumber.HasValue)
            {
                dict.SetObject(NSNumber.FromLong(SystemNumber.Value), NSFileManager.SystemNumber);
            }
            if (DeviceIdentifier.HasValue)
            {
                dict.SetObject(NSNumber.FromUnsignedLong(DeviceIdentifier.Value), NSFileManager.DeviceIdentifier);
            }
#if XAMCORE_2_0
            if (GroupOwnerAccountID.HasValue)
            {
                dict.SetObject(NSNumber.FromUnsignedLong(GroupOwnerAccountID.Value), NSFileManager.GroupOwnerAccountID);
            }
#else
            if (FileGroupOwnerAccountID.HasValue)
            {
                dict.SetObject(NSNumber.FromUnsignedLong(FileGroupOwnerAccountID.Value), NSFileManager.GroupOwnerAccountID);
            }
#endif
            if (Immutable.HasValue)
            {
                dict.SetObject(NSNumber.FromBoolean(Immutable.Value), NSFileManager.Immutable);
            }
            if (ModificationDate != null)
            {
                dict.SetObject(ModificationDate, NSFileManager.ModificationDate);
            }
#if XAMCORE_2_0
            if (OwnerAccountID.HasValue)
            {
                dict.SetObject(NSNumber.FromUnsignedLong(OwnerAccountID.Value), NSFileManager.OwnerAccountID);
            }
#else
            if (FileOwnerAccountID.HasValue)
            {
                dict.SetObject(NSNumber.FromUnsignedLong(FileOwnerAccountID.Value), NSFileManager.OwnerAccountID);
            }
#endif
            if (HfsCreatorCode.HasValue)
            {
                dict.SetObject(NSNumber.FromUnsignedLong(HfsCreatorCode.Value), NSFileManager.HfsCreatorCode);
            }
            if (HfsTypeCode.HasValue)
            {
                dict.SetObject(NSNumber.FromUnsignedLong(HfsTypeCode.Value), NSFileManager.HfsTypeCode);
            }
            if (PosixPermissions.HasValue)
            {
                dict.SetObject(NSNumber.FromInt16((short)PosixPermissions.Value), NSFileManager.PosixPermissions);
            }
#if XAMCORE_2_0
            if (ReferenceCount.HasValue)
            {
                dict.SetObject(NSNumber.FromUnsignedLong(ReferenceCount.Value), NSFileManager.ReferenceCount);
            }
            if (SystemFileNumber.HasValue)
            {
                dict.SetObject(NSNumber.FromUnsignedLong(SystemFileNumber.Value), NSFileManager.SystemFileNumber);
            }
            if (Size.HasValue)
            {
                dict.SetObject(NSNumber.FromUInt64(Size.Value), NSFileManager.Size);
            }

            type = Type;
#else
            if (FileReferenceCount.HasValue)
            {
                dict.SetObject(NSNumber.FromUnsignedLong(FileReferenceCount.Value), NSFileManager.ReferenceCount);
            }
            if (FileSystemFileNumber.HasValue)
            {
                dict.SetObject(NSNumber.FromUnsignedLong(FileSystemFileNumber.Value), NSFileManager.SystemFileNumber);
            }
            if (FileSize.HasValue)
            {
                dict.SetObject(NSNumber.FromUInt64(FileSize.Value), NSFileManager.Size);
            }

            type = FileType;
#endif

            if (type.HasValue)
            {
                v = null;
                switch (type.Value)
                {
                case NSFileType.Directory:
                    v = NSFileManager.TypeDirectory; break;

                case NSFileType.Regular:
                    v = NSFileManager.TypeRegular; break;

                case NSFileType.SymbolicLink:
                    v = NSFileManager.TypeSymbolicLink; break;

                case NSFileType.Socket:
                    v = NSFileManager.TypeSocket; break;

                case NSFileType.CharacterSpecial:
                    v = NSFileManager.TypeCharacterSpecial; break;

                case NSFileType.BlockSpecial:
                    v = NSFileManager.TypeBlockSpecial; break;

                default:
                    v = NSFileManager.TypeUnknown; break;
                }
                dict.SetObject(v, NSFileManager.NSFileType);
            }

#if !MONOMAC
            if (ProtectionKey.HasValue)
            {
                v = null;
                switch (ProtectionKey.Value)
                {
                case NSFileProtection.None:
                    v = NSFileManager.FileProtectionNone; break;

                case NSFileProtection.Complete:
                    v = NSFileManager.FileProtectionComplete; break;

                case NSFileProtection.CompleteUnlessOpen:
                    v = NSFileManager.FileProtectionCompleteUnlessOpen; break;

                case NSFileProtection.CompleteUntilFirstUserAuthentication:
                    v = NSFileManager.FileProtectionCompleteUntilFirstUserAuthentication; break;
                }
                dict.SetObject(v, NSFileManager.FileProtectionKey);
            }
#endif
            return(dict);
        }
コード例 #5
0
        void CreateCookie(string name, string value, string path, string domain, string comment, string commentUrl, bool?discard, DateTime?expires, int?maximumAge, string ports, bool?secure, int?version)
        {
            // mandatory checks or defaults
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            if (value == null)
            {
                throw new ArgumentNullException("value");
            }
            if (String.IsNullOrEmpty(path))
            {
                path = "/";                 // default in .net
            }
            if (String.IsNullOrEmpty(domain))
            {
                domain = "*";
            }

            using (var properties = new NSMutableDictionary()) {
                // mandatory to create the cookie
                properties.Add(NSHttpCookie.KeyName, new NSString(name));
                properties.Add(NSHttpCookie.KeyValue, new NSString(value));
                properties.Add(NSHttpCookie.KeyPath, new NSString(path));
                properties.Add(NSHttpCookie.KeyDomain, new NSString(domain));

                // optional to create the cookie
                if (!String.IsNullOrEmpty(comment))
                {
                    properties.Add(NSHttpCookie.KeyComment, new NSString(comment));
                }
                if (!String.IsNullOrEmpty(commentUrl))
                {
                    properties.Add(NSHttpCookie.KeyCommentUrl, new NSString(commentUrl));
                }
                if (discard.HasValue)
                {
                    properties.Add(NSHttpCookie.KeyDiscard, new NSString(discard.Value ? "TRUE" : "FALSE"));
                }
                if (expires.HasValue && expires.Value != DateTime.MinValue)
                {
                    properties.Add(NSHttpCookie.KeyExpires, (NSDate)expires.Value);
                }
                if (maximumAge.HasValue)
                {
                    properties.Add(NSHttpCookie.KeyMaximumAge, new NSString(maximumAge.Value.ToString()));
                }
                if (!String.IsNullOrEmpty(ports))
                {
                    properties.Add(NSHttpCookie.KeyPort, new NSString(ports.Replace("\"", String.Empty)));
                }
                // any value means secure is true
                if (secure.HasValue && secure.Value)
                {
                    properties.Add(NSHttpCookie.KeySecure, new NSString("1"));
                }
                if (version.HasValue)
                {
                    properties.Add(NSHttpCookie.KeyVersion, new NSString(version.Value.ToString()));
                }

                if (IsDirectBinding)
                {
                    Handle = Messaging.IntPtr_objc_msgSend_IntPtr(this.Handle, Selector.GetHandle("initWithProperties:"), properties.Handle);
                }
                else
                {
                    Handle = Messaging.IntPtr_objc_msgSendSuper_IntPtr(this.SuperHandle, Selector.GetHandle("initWithProperties:"), properties.Handle);
                }
            }
        }