コード例 #1
0
        /// <summary>
        /// Set type and optionally types of a JDF node.
        /// </summary>
        /// <param name="jdfNode"></param>
        /// <param name="isGrayBox">If true, makes a gray box (Process group with types set)</param>
        /// <param name="types"></param>
        /// <returns></returns>
        public static XElement SetTypeAndTypes(this XElement jdfNode, bool isGrayBox, params string[] types)
        {
            ParameterCheck.ParameterRequired(jdfNode, "jdfNode");
            ThrowExceptionIfNotJdfElement(jdfNode);

            if (types == null || types.Length == 0)
            {
                jdfNode.SetAttributeValue("Type", ProcessType.ProcessGroup);
                jdfNode.SetXsiType(ProcessType.XsiJdfElementType(ProcessType.ProcessGroup).ToString());
            }
            if (types.Length > 0 && isGrayBox)
            {
                MakeGrayBox(jdfNode, types);
            }
            else
            {
                if (types.Length == 1)
                {
                    MakeSimpleProcess(jdfNode, types);
                }
                else
                {
                    MakeCombinedProcess(jdfNode, types);
                }
            }


            return(jdfNode);
        }
コード例 #2
0
 static void MakeGrayBox(XElement jdfNode, string[] types)
 {
     jdfNode.SetAttributeValue("Type", ProcessType.ProcessGroup);
     jdfNode.SetXsiType(ProcessType.XsiJdfElementType(ProcessType.ProcessGroup).ToString());
     jdfNode.SetAttributeValue("Types", string.Join(" ", types));
 }
コード例 #3
0
 static void MakeSimpleProcess(XElement jdfNode, string[] types)
 {
     jdfNode.SetAttributeValue("Type", types[0]);
     jdfNode.SetXsiType(ProcessType.XsiJdfElementType(types[0]).ToString());
 }
コード例 #4
0
 static void MakeCombinedProcess(XElement jdfNode, string[] types)
 {
     jdfNode.SetAttributeValue("Type", ProcessType.Combined);
     jdfNode.SetXsiType(ProcessType.XsiJdfElementType(ProcessType.Combined));
     jdfNode.SetAttributeValue("Types", string.Join(" ", types));
 }