/// <summary> /// Get the real or virtual stream name for \e version. /// </summary> /// <param name="version">The version to query.</param> /// <param name="request">Whether the real or virtual stream name should be returned.</param> /// <returns>The stream name as per \e request on success, otherwise \e null on error.</returns> /*! \sa [Stat.getElement](@ref AcUtils#Stat#getElement) */ public static string acxStreamName(this XElement version, RealVirtual request) { Debug.Assert(version.Name == "version", @"version.Name == ""version"""); string temp = (request == RealVirtual.Real) ? (string)version.Attribute("realNamedVersion") : (string)version.Attribute("virtualNamedVersion"); if (temp == null) { return(null); } string stream = temp.Substring(0, temp.IndexOf('/')); return(stream); }
/// <summary> /// Get the real or virtual stream and version numbers for \e version. /// </summary> /// <param name="version">The version to query.</param> /// <param name="request">Whether real or virtual values should be returned.</param> /// <returns>An array initialized as <tt>int[]={[real|virtual]StreamNumber, [real|virtual]VersionNumber}</tt> /// as per \e request on success, otherwise \e null on error.</returns> /*! \sa [Stat.getElement](@ref AcUtils#Stat#getElement) */ public static int[] acxStreamVersion(this XElement version, RealVirtual request) { Debug.Assert(version.Name == "version", @"version.Name == ""version"""); string temp = (request == RealVirtual.Real) ? (string)version.Attribute("real") : (string)version.Attribute("virtual"); if (temp == null) { return(null); } string[] val = temp.Split('/'); int[] arr = new int[2]; if (!Int32.TryParse(val[0], NumberStyles.Integer, null, out arr[0])) { return(null); } if (!Int32.TryParse(val[1], NumberStyles.Integer, null, out arr[1])) { return(null); } return(arr); }