Exemple #1
0
        private void InitFrom(Field field)
        {
            var type = (HeaderTypes)field.Type;

            switch (type)
            {
            case HeaderTypes.Version:
                _version.SetValue(field);
                break;

            case HeaderTypes.Uuid:
                _uuid.SetValue(field);
                break;

            case HeaderTypes.NonDefaultUserPrefs:
                _nonDefaultUserPrefs.SetValue(field);
                break;

            case HeaderTypes.LastUpdateTime:
                _lastUpdateTime.SetValue(field);
                break;

            case HeaderTypes.LastUpdateApplication:
                _lastUpdateApplication.SetValue(field);
                break;

            case HeaderTypes.LastUpdateUser:
                _lastUpdateUser.SetValue(field);
                break;

            case HeaderTypes.LastUpdateHost:
                _lastUpdateHost.SetValue(field);
                break;

            case HeaderTypes.DbName:
                _name.SetValue(field);
                break;

            case HeaderTypes.DbDescription:
                _description.SetValue(field);
                break;

            case HeaderTypes.DisplayStatus:
            case HeaderTypes.Filters:
            case HeaderTypes.LastUpdateUserhost:
            case HeaderTypes.Reserved1:
            case HeaderTypes.Reserved2:
            case HeaderTypes.Reserved3:
            case HeaderTypes.Rue:
            case HeaderTypes.PasswordPolicies:
            case HeaderTypes.EmptyGroup:
            case HeaderTypes.Reserved4:
                var property = new Property(field.Type, "Not Implemented: " + field.Type);
                NotImplementedProperties.Add(property);
                break;

            case HeaderTypes.End:
                return;

            default:
                throw new ArgumentOutOfRangeException("type");
            }
            Fields.Add(field);
        }
Exemple #2
0
    public void SetValue(object value)
    {
        string typeName = value.GetType().ToString();

        switch (typeName)
        {
        case "byte":
        {
            if (type == EPropertyType.EPropertyType_Byte)
            {
                ByteProperty prop = this as ByteProperty;
                prop.SetValue((byte)value);
                return;
            }
        }
        break;

        case "bool":
        {
            if (type == EPropertyType.EPropertyType_Bool)
            {
                BoolProperty prop = this as BoolProperty;
                prop.SetValue((bool)value);
                return;
            }
        }
        break;

        case "short":
        {
            if (type == EPropertyType.EPropertyType_Short)
            {
                ShortProperty prop = this as ShortProperty;
                prop.SetValue((short)value);
                return;
            }
        }
        break;

        case "int":
        {
            if (type == EPropertyType.EPropertyType_Int)
            {
                IntProperty prop = this as IntProperty;
                prop.SetValue((int)value);
                return;
            }
        }
        break;

        case "long":
        {
            if (type == EPropertyType.EPropertyType_Long)
            {
                LongProperty prop = this as LongProperty;
                prop.SetValue((long)value);
                return;
            }
        }
        break;

        case "float":
        {
            if (type == EPropertyType.EPropertyType_Float)
            {
                FloatProperty prop = this as FloatProperty;
                prop.SetValue((float)value);
                return;
            }
        }
        break;

        case "double":
        {
            if (type == EPropertyType.EPropertyType_Double)
            {
                DoubleProperty prop = this as DoubleProperty;
                prop.SetValue((double)value);
                return;
            }
        }
        break;

        case "Vector2":
        {
            if (type == EPropertyType.EPropertyType_Vector2)
            {
                Vector2Property prop = this as Vector2Property;
                prop.SetValue((Vector2)value);
                return;
            }
        }
        break;

        case "Vector3":
        {
            if (type == EPropertyType.EPropertyType_Vector3)
            {
                Vector3Property prop = this as Vector3Property;
                prop.SetValue((Vector3)value);
                return;
            }
        }
        break;

        case "Vector4":
        {
            if (type == EPropertyType.EPropertyType_Vector4)
            {
                Vector4Property prop = this as Vector4Property;
                prop.SetValue((Vector4)value);
                return;
            }
        }
        break;

        case "Quaternion":
        {
            if (type == EPropertyType.EPropertyType_Quaternion)
            {
                QuaternionProperty prop = this as QuaternionProperty;
                prop.SetValue((Quaternion)value);
                return;
            }
        }
        break;

        case "Matrix4x4":
        {
            if (type == EPropertyType.EPropertyType_Matrix4x4)
            {
                Matrix4x4Property prop = this as Matrix4x4Property;
                prop.SetValue((Matrix4x4)value);
                return;
            }
        }
        break;

        case "Color":
        {
            if (type == EPropertyType.EPropertyType_Color)
            {
                ColorProperty prop = this as ColorProperty;
                prop.SetValue((Color)value);
                return;
            }
        }
        break;

        case "string":
        {
            if (type == EPropertyType.EPropertyType_String)
            {
                StringProperty prop = this as StringProperty;
                prop.SetValue((string)value);
                return;
            }
        }
        break;

        case "object":
        {
            if (type == EPropertyType.EPropertyType_Object)
            {
                m_value = value;
                return;
            }
        }
        break;
        }
        return;
    }
Exemple #3
0
        private void InitItem(Field field)
        {
            var type = (FieldTypes)field.Type;

            switch (type)
            {
            case FieldTypes.Start:
                break;

            case FieldTypes.Uuid:
                _uuid.SetValue(field);
                break;

            case FieldTypes.Group:
                _group.SetValue(field);
                break;

            case FieldTypes.Title:
                _title.SetValue(field);
                break;

            case FieldTypes.User:
                _user.SetValue(field);
                break;

            case FieldTypes.Notes:
                _notes.SetValue(field);
                break;

            case FieldTypes.Password:
                _password.SetValue(field);
                break;

            case FieldTypes.CreatedTime:
                _createdTime.SetValue(field);
                break;

            case FieldTypes.PasswordModified:
                _passwordModified.SetValue(field);
                break;

            case FieldTypes.AccessTime:
                _accessedTime.SetValue(field);
                break;

            case FieldTypes.PasswordExpires:
                _passwordExpires.SetValue(field);
                break;

            case FieldTypes.RecordModifiedTime:
                _modifiedTime.SetValue(field);
                break;

            case FieldTypes.Url:
                _url.SetValue(field);
                break;

            case FieldTypes.Autotype:
                _autoType.SetValue(field);
                break;

            case FieldTypes.Reserved:
            case FieldTypes.PasswordHistory:
            case FieldTypes.Policy:
            case FieldTypes.XtimeInt:
            case FieldTypes.RunCommand:
            case FieldTypes.DoubleClickAction:
            case FieldTypes.Email:
            case FieldTypes.Protected:
            case FieldTypes.Symbols:
            case FieldTypes.ShiftDoubleClickAction:
            case FieldTypes.PolicyName:
            case FieldTypes.KeyboardShortcuts:
                var property = new Property(field.Type, "Not Implemented: " + field.Type);
                NotImplementedProperties.Add(property);
                break;

            case FieldTypes.End:
                break;

            case FieldTypes.EntrySize:
            case FieldTypes.EntryType:
            case FieldTypes.EntryStatus:
            case FieldTypes.PasswordLength:
            case FieldTypes.UnknownFields:
            default:
                throw new ArgumentOutOfRangeException();
            }
            Fields.Add(field);
        }