コード例 #1
0
        internal void Configure(WSSource Source, WSJson json)
        {
            try
            {
                if (Source != null && json != null)
                {
                    if (json is WSJProperty && ((WSJProperty)json).Value is WSJValue)
                    {
                        WSJValue vJson = (WSJValue)((WSJProperty)json).Value;
                        switch (((WSJProperty)json).Key)
                        {
                        case "readaccess":
                            byte readAccessValue = byte.TryParse(vJson.Value, out readAccessValue) ? readAccessValue : READ_ACCESS_MODE.ACCESS_LEVEL;
                            READ_ACCESS_MODE = new WSAccessMode(readAccessValue, READ_ACCESS_MODE.OWNER_ACCESS_ALLOWED);
                            break;

                        case "writeaccess":
                            byte writeAccessValue = byte.TryParse(vJson.Value, out writeAccessValue) ? writeAccessValue : WRITE_ACCESS_MODE.ACCESS_LEVEL;
                            WRITE_ACCESS_MODE = new WSAccessMode(writeAccessValue, WRITE_ACCESS_MODE.OWNER_ACCESS_ALLOWED);
                            break;

                        case "skipempty":
                            bool skipempty = vJson.Value.IsTrue() ? true : vJson.Value.IsFalse() ? false : SkipEmpty;
                            SkipEmpty = skipempty;
                            break;

                        default: break;
                        }
                    }
                }
            }
            catch (Exception) { }
        }
コード例 #2
0
        internal void Merge(WSAccessMode src)
        {
            try
            {
                //allow to lock it
                OWNER_ACCESS_ALLOWED = OWNER_ACCESS_ALLOWED ? src.OWNER_ACCESS_ALLOWED : OWNER_ACCESS_ALLOWED;

                //allow to make it less accessible
                ACCESS_LEVEL = src.ACCESS_LEVEL > ACCESS_LEVEL ? src.ACCESS_LEVEL : ACCESS_LEVEL;
            }
            catch (Exception) { }
        }