/// <summary> /// 클래스를 문자열로 변환 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="orderData"></param> /// <returns></returns> public static string ToString <T>(DiscData orderData) { Type elementType = typeof(T); StringBuilder sbStr = new StringBuilder(); //add a column to table for each public property on T foreach (var propInfo in elementType.GetProperties()) { sbStr.AppendLine(propInfo.Name + " : " + propInfo.GetValue(orderData, null) ?? "-"); } return(sbStr.ToString()); }
/// <summary> /// Create Production Order - burning /// </summary> /// <param name="orderData">attribute value class</param> /// <param name="serverIP">서버IP</param> /// <param name="RimageSystemFolder">RimageSystemFolder</param> /// <returns></returns> public static string CreateProductionOrder(DiscData orderData, string serverIP, string RimageSystemFolder) { // Create the XML string of production order XmlDocument dom = new XmlDocument(); XmlElement rootElem; XmlElement memberElem1; XmlElement memberElem2; XmlElement memberElem3; XmlElement memberElem4; XmlAttribute attribute; XmlProcessingInstruction newPI; XmlDocumentType doctype; // Create a procesing instruction. newPI = dom.CreateProcessingInstruction("xml", "version=\"1.0\""); // Add the processing instruction node to the document. dom.AppendChild(newPI); //Create a document type node and add it to the document. doctype = dom.CreateDocumentType("ProductionOrder", null, RimageSystemFolder + "\\XML\\ProductionOrder_1.10.DTD", null); dom.AppendChild(doctype); // Creates root element rootElem = dom.CreateElement("ProductionOrder"); dom.AppendChild(rootElem); // Creates Attribute to the root Element attribute = dom.CreateAttribute("OrderId"); attribute.Value = orderData.OrderID; rootElem.Attributes.SetNamedItem(attribute); // Creates Attribute to the root Element attribute = dom.CreateAttribute("ClientId"); attribute.Value = orderData.ClientID; rootElem.Attributes.SetNamedItem(attribute); // Creates Attribute to the root Element //attribute = dom.CreateAttribute("Originator"); //attribute.Value = orderData.Originator; //rootElem.Attributes.SetNamedItem(attribute); // Creates Attribute to the root Element attribute = dom.CreateAttribute("Copies"); attribute.Value = orderData.Copies; rootElem.Attributes.SetNamedItem(attribute); // Create element under root element memberElem1 = dom.CreateElement("Media"); rootElem.AppendChild(memberElem1); // Creates Attribute to the Member Element attribute = dom.CreateAttribute("Type"); attribute.Value = orderData.MediaType; memberElem1.Attributes.SetNamedItem(attribute); // Create element under root element memberElem1 = dom.CreateElement("Target"); rootElem.AppendChild(memberElem1); // Creates Attribute to the member Element attribute = dom.CreateAttribute("Server"); attribute.Value = "ANY"; memberElem1.Attributes.SetNamedItem(attribute); ////xw.WriteAttributeString("Cluster", "DefaultProductionCluster"); ////xw.WriteAttributeString("Server", targetServer); // Creates Attribute to the memeber Element attribute = dom.CreateAttribute("Line"); attribute.Value = "ANY"; memberElem1.Attributes.SetNamedItem(attribute); // Create element under root element memberElem1 = dom.CreateElement("Action"); rootElem.AppendChild(memberElem1); // Creates Member element memberElem2 = dom.CreateElement("Record"); memberElem1.AppendChild(memberElem2); // Create element under Member element memberElem3 = dom.CreateElement("WriteTrack"); memberElem2.AppendChild(memberElem3); // Creates Attribute to the Member Element attribute = dom.CreateAttribute("Filename"); attribute.Value = orderData.ImagePath; memberElem3.Attributes.SetNamedItem(attribute); // Creates Attribute to the Member Element attribute = dom.CreateAttribute("DeleteAfterRecording"); attribute.Value = "true"; memberElem3.Attributes.SetNamedItem(attribute); // Create element under Member element memberElem4 = dom.CreateElement("Data"); memberElem3.AppendChild(memberElem4); // Creates Attribute to the Member Element attribute = dom.CreateAttribute("Type"); attribute.Value = "Mode1"; memberElem4.Attributes.SetNamedItem(attribute); // Create element under Member element memberElem1 = dom.CreateElement("Action"); rootElem.AppendChild(memberElem1); // Creates Member element memberElem2 = dom.CreateElement("Record"); memberElem1.AppendChild(memberElem2); memberElem3 = dom.CreateElement("Fixate"); memberElem2.AppendChild(memberElem3); // Creates Attribute to the Member Element attribute = dom.CreateAttribute("Type"); attribute.Value = "SAO"; memberElem3.Attributes.SetNamedItem(attribute); // Creates Attribute to the Member Element attribute = dom.CreateAttribute("Final"); attribute.Value = "true"; memberElem3.Attributes.SetNamedItem(attribute); if (orderData.UseLabelPrint == true) { // Create element under Member element memberElem1 = dom.CreateElement("Action"); rootElem.AppendChild(memberElem1); // Create element under Member element memberElem2 = dom.CreateElement("Label"); memberElem1.AppendChild(memberElem2); // Creates Attribute to the Member Element attribute = dom.CreateAttribute("Filename"); attribute.Value = orderData.LabelName; memberElem2.Attributes.SetNamedItem(attribute); // Create element under Member element memberElem3 = dom.CreateElement("BTW"); memberElem2.AppendChild(memberElem3); attribute = dom.CreateAttribute("Merge_Filename"); attribute.Value = orderData.MergeName; memberElem3.Attributes.SetNamedItem(attribute); attribute = dom.CreateAttribute("DeleteMergeFileOnCompletion"); attribute.Value = "true"; memberElem3.Attributes.SetNamedItem(attribute); } return(dom.OuterXml.ToString()); }
/// <summary> /// Create Image Order - burning /// </summary> /// <param name="orderData">attribute value class</param> /// <param name="serverIP">서버IP</param> /// <param name="RimageSystemFolder">RimageSystemFolder</param> /// <returns></returns> public static string CreateImageOrder(DiscData orderData, string serverIP, string RimageSystemFolder) { //Declare Variables: XmlDocument pXMLDoc = new XmlDocument(); XmlElement pRootElement; XmlElement memberElement1; XmlElement memberElement2; XmlAttribute pAttribute; XmlProcessingInstruction newPI; XmlDocumentType doctype; // Create a procesing instruction. newPI = pXMLDoc.CreateProcessingInstruction("xml", "version=\"1.0\""); // Add the processing instruction node to the document. pXMLDoc.AppendChild(newPI); //Create a document type node and add it to the document. doctype = pXMLDoc.CreateDocumentType("ImageOrder", null, RimageSystemFolder + "\\XML\\ImageOrder_1.8.DTD", null); pXMLDoc.AppendChild(doctype); //Create Image Order Root Element: pRootElement = pXMLDoc.CreateElement("ImageOrder"); pXMLDoc.AppendChild(pRootElement); //Create Attribute to Root Element: pAttribute = pXMLDoc.CreateAttribute("OrderId"); pAttribute.Value = orderData.OrderID; pRootElement.Attributes.SetNamedItem(pAttribute); //Create Attribute to Root Element: pAttribute = pXMLDoc.CreateAttribute("ClientId"); pAttribute.Value = orderData.ClientID; pRootElement.Attributes.SetNamedItem(pAttribute); //Create Attribute to Root Element: pAttribute = pXMLDoc.CreateAttribute("Originator"); pAttribute.Value = orderData.Originator; pRootElement.Attributes.SetNamedItem(pAttribute); //Create Target Element under Root: memberElement1 = pXMLDoc.CreateElement("Target"); pRootElement.AppendChild(memberElement1); //Create Format Element under Root: memberElement1 = pXMLDoc.CreateElement("Format"); pRootElement.AppendChild(memberElement1); if (orderData.MediaType.Equals("CDR")) { //Create UDFFormat Member Element: memberElement2 = pXMLDoc.CreateElement("PCMACFormat"); memberElement1.AppendChild(memberElement2); //Create Attribute to Member Element: //Set to iso level 2 pAttribute = pXMLDoc.CreateAttribute("ISO"); pAttribute.Value = "none"; memberElement2.Attributes.SetNamedItem(pAttribute); pAttribute = pXMLDoc.CreateAttribute("Joliet"); pAttribute.Value = "true"; memberElement2.Attributes.SetNamedItem(pAttribute); } else if (orderData.MediaType.Equals("DVDR")) { memberElement2 = pXMLDoc.CreateElement("UDFFormat"); memberElement1.AppendChild(memberElement2); pAttribute = pXMLDoc.CreateAttribute("UDF"); pAttribute.Value = "102ISO"; memberElement2.Attributes.SetNamedItem(pAttribute); pAttribute = pXMLDoc.CreateAttribute("Apple"); pAttribute.Value = "none"; memberElement2.Attributes.SetNamedItem(pAttribute); } else if (orderData.MediaType.Equals("DVDR-DL")) { memberElement2 = pXMLDoc.CreateElement("UDFFormat"); memberElement1.AppendChild(memberElement2); pAttribute = pXMLDoc.CreateAttribute("UDF"); pAttribute.Value = "102ISO"; memberElement2.Attributes.SetNamedItem(pAttribute); pAttribute = pXMLDoc.CreateAttribute("Apple"); pAttribute.Value = "none"; memberElement2.Attributes.SetNamedItem(pAttribute); } //Create FormatOptions Member Element: memberElement2 = pXMLDoc.CreateElement("FormatOptions"); memberElement1.AppendChild(memberElement2); pAttribute = pXMLDoc.CreateAttribute("Zip"); pAttribute.Value = "false"; memberElement2.Attributes.SetNamedItem(pAttribute); pAttribute = pXMLDoc.CreateAttribute("ForceDot"); pAttribute.Value = "false"; memberElement2.Attributes.SetNamedItem(pAttribute); pAttribute = pXMLDoc.CreateAttribute("Versions"); pAttribute.Value = "false"; memberElement2.Attributes.SetNamedItem(pAttribute); pAttribute = pXMLDoc.CreateAttribute("AllowBootableCD"); pAttribute.Value = "false"; memberElement2.Attributes.SetNamedItem(pAttribute); //Create Source Element under Root: memberElement1 = pXMLDoc.CreateElement("Source"); pRootElement.AppendChild(memberElement1); //Create EditList Member Element: //memberElement2 = pXMLDoc.CreateElement("ParentFolder"); //memberElement1.AppendChild(memberElement2); //Create Attribute to Member Element: //pAttribute = pXMLDoc.CreateAttribute("ParentFolderPath"); //pAttribute.Value = orderData.ParentFolder; //memberElement2.Attributes.SetNamedItem(pAttribute); memberElement2 = pXMLDoc.CreateElement("XMLEditList"); memberElement1.AppendChild(memberElement2); pAttribute = pXMLDoc.CreateAttribute("EditListPath"); pAttribute.Value = orderData.EditListPath; memberElement2.Attributes.SetNamedItem(pAttribute); // Create Output Element under Root: memberElement1 = pXMLDoc.CreateElement("Output"); pRootElement.AppendChild(memberElement1); // Create Attribute to Member Element: pAttribute = pXMLDoc.CreateAttribute("ImageFile"); pAttribute.Value = RimageSystemFolder + "\\" + orderData.OrderID + ".img"; memberElement1.Attributes.SetNamedItem(pAttribute); // Create Attribute to Member Element: pAttribute = pXMLDoc.CreateAttribute("Type"); pAttribute.Value = "PowerImage"; memberElement1.Attributes.SetNamedItem(pAttribute); //Create Attribute to Member Element: pAttribute = pXMLDoc.CreateAttribute("Size"); if (orderData.MediaType.Equals("CDR")) { pAttribute.Value = "80"; } else if (orderData.MediaType.Equals("DVDR")) { pAttribute.Value = "500"; } else if (orderData.MediaType.Equals("DVDR-DL")) { pAttribute.Value = "DVD-DL"; } memberElement1.Attributes.SetNamedItem(pAttribute); // Create VolumeName element under root memberElement1 = pXMLDoc.CreateElement("VolumeName"); pRootElement.AppendChild(memberElement1); // Creates Attribute to the Member Element pAttribute = pXMLDoc.CreateAttribute("VolName"); pAttribute.Value = orderData.VolumeName; memberElement1.Attributes.SetNamedItem(pAttribute); return(pXMLDoc.OuterXml); }