public ScriptS3DProperties(S3DProperties item) { S3DFormat = item.S3DFormat.ToString(); S3DContent = item.S3DContent.ToString(); S3DEyePriority = item.S3DEyePriority.ToString(); S3DSubsamplingModes = item.S3DSubsamplingModes.ToString(); S3DSubsamplingOrders = item.S3DSubsamplingOrders.ToString(); S3DLeftEyePAR = item.S3DLeftEyePAR; S3DRightEyePAR = item.S3DRightEyePAR; }
private static S3DProperties ImportHTMLS3DProperties(XElement s3DPropItems) { S3DProperties s3DProperties = new S3DProperties(); foreach (XElement s3DPropSubItem in s3DPropItems.Elements()) { switch (s3DPropSubItem.Name.ToString()) { case "S3DContent": { s3DProperties.S3DContent = Enum.IsDefined(typeof(S3D_Contents), s3DPropSubItem.Value) ? (S3D_Contents)Enum.Parse(typeof(S3D_Contents), s3DPropSubItem.Value, true) : S3D_Contents.None; break; } case "S3DEyePriority": { s3DProperties.S3DEyePriority = Enum.IsDefined(typeof(S3D_EyePriorities), s3DPropSubItem.Value) ? (S3D_EyePriorities)Enum.Parse(typeof(S3D_EyePriorities), s3DPropSubItem.Value, true) : S3D_EyePriorities.LeftFirst; break; } case "S3DFormat": { s3DProperties.S3DFormat = Enum.IsDefined(typeof(S3D_Formats), s3DPropSubItem.Value) ? (S3D_Formats)Enum.Parse(typeof(S3D_Formats), s3DPropSubItem.Value, true) : S3D_Formats.DiscreteTrack; break; } case "S3DLeftEyePAR": { s3DProperties.S3DLeftEyePAR = (double)s3DPropSubItem.GetValueAsDouble(); break; } case "S3DRightEyePAR": { s3DProperties.S3DRightEyePAR = (double)s3DPropSubItem.GetValueAsDouble(); break; } case "S3DSubsamplingModes": { s3DProperties.S3DSubsamplingModes = Enum.IsDefined(typeof(S3D_SubsamplingModes), s3DPropSubItem.Value) ? (S3D_SubsamplingModes)Enum.Parse(typeof(S3D_SubsamplingModes), s3DPropSubItem.Value, true) : S3D_SubsamplingModes.None; break; } case "S3DSubsamplingOrders": { s3DProperties.S3DSubsamplingOrders = Enum.IsDefined(typeof(S3D_SubsamplingOrders), s3DPropSubItem.Value) ? (S3D_SubsamplingOrders)Enum.Parse(typeof(S3D_SubsamplingOrders), s3DPropSubItem.Value, true) : S3D_SubsamplingOrders.None; break; } } } return s3DProperties; }
/// <summary> /// Converts this ScriptS3DProperties to a proper S3DProperties object /// </summary> /// <returns></returns> public S3DProperties ConvertToS3DProperties() { S3DProperties s3DProperties = new S3DProperties(); s3DProperties.S3DContent = Enum.IsDefined(typeof(S3D_Contents),S3DContent) ? (S3D_Contents)Enum.Parse(typeof(S3D_Contents), S3DContent, true) : S3D_Contents.None; s3DProperties.S3DEyePriority = Enum.IsDefined(typeof(S3D_EyePriorities),S3DEyePriority) ? (S3D_EyePriorities)Enum.Parse(typeof(S3D_EyePriorities), S3DEyePriority, true) : S3D_EyePriorities.LeftFirst; s3DProperties.S3DFormat = Enum.IsDefined(typeof(S3D_Formats), S3DFormat) ? (S3D_Formats)Enum.Parse(typeof(S3D_Formats), S3DFormat, true) : S3D_Formats.DiscreteTrack; s3DProperties.S3DLeftEyePAR = S3DLeftEyePAR; s3DProperties.S3DRightEyePAR = S3DRightEyePAR; s3DProperties.S3DSubsamplingModes = Enum.IsDefined(typeof(S3D_SubsamplingModes), S3DSubsamplingModes) ? (S3D_SubsamplingModes)Enum.Parse(typeof(S3D_SubsamplingModes), S3DSubsamplingModes, true) : S3D_SubsamplingModes.None; s3DProperties.S3DSubsamplingOrders = Enum.IsDefined(typeof(S3D_SubsamplingOrders), S3DSubsamplingOrders) ? (S3D_SubsamplingOrders)Enum.Parse(typeof(S3D_SubsamplingOrders), S3DSubsamplingOrders, true) : S3D_SubsamplingOrders.None; return s3DProperties; }