internal static unsafe FrequencyBasedBackupPolicy FromNative(NativeBackupRestoreTypes.FABRIC_BACKUP_POLICY backupPolicy)
        {
            var frequencyBasedPolicy = new FrequencyBasedBackupPolicy();

            frequencyBasedPolicy.PopulateBackupPolicyFromNative(backupPolicy);

            var frequencyBasedPolicyDescription =
                *(NativeBackupRestoreTypes.FABRIC_FREQUENCY_BASED_BACKUP_POLICY *)backupPolicy.PolicyDescription;

            frequencyBasedPolicy.RunFrequencyType =
                (BackupPolicyRunFrequency)frequencyBasedPolicyDescription.RunFrequencyType;
            frequencyBasedPolicy.RunFrequency = frequencyBasedPolicyDescription.Value;

            return(frequencyBasedPolicy);
        }
Beispiel #2
0
        internal static unsafe BackupPolicy FromNative(IntPtr pointer)
        {
            var nativeBackupPolicy = *(NativeBackupRestoreTypes.FABRIC_BACKUP_POLICY *)pointer;

            if (nativeBackupPolicy.PolicyType ==
                NativeBackupRestoreTypes.FABRIC_BACKUP_POLICY_TYPE.FABRIC_BACKUP_POLICY_TYPE_FREQUENCY_BASED)
            {
                return(FrequencyBasedBackupPolicy.FromNative(nativeBackupPolicy));
            }
            else if (nativeBackupPolicy.PolicyType ==
                     NativeBackupRestoreTypes.FABRIC_BACKUP_POLICY_TYPE.FABRIC_BACKUP_POLICY_TYPE_SCHEDULE_BASED)
            {
                return(ScheduleBasedBackupPolicy.FromNative(nativeBackupPolicy));
            }

            return(null);
        }