Esempio n. 1
0
        KaiTrade.Interfaces.IProduct GetProductFromXML(string xmlData)
        {
            K2DataObjects.Product product = null;
            try
            {
                System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
                doc.LoadXml(xmlData);

                product = new K2DataObjects.Product();

                System.Xml.XmlElement productElem = doc.GetElementById("Product");

                foreach (System.Xml.XmlAttribute attribute in doc.DocumentElement.Attributes)
                {
                    SetProductValue(product, attribute);

                }

            }
            catch (Exception myE)
            {
                m_Log.Error("runPlayBack", myE);
            }
            return product;
        }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="rop"></param>
        /// <returns></returns>
        public string GetRopFilter(long rop)
        {
            string name = null;

            System.Xml.XmlDocument doc = _gdi.Document;

            if (rop == (int)Gdi.GdiEnum.BLACKNESS)
            {
                name = "BLACKNESS_FILTER";
                System.Xml.XmlElement filter = doc.GetElementById(name);
                if (filter == null)
                {
                    filter = _gdi.Document.CreateElement("filter");
                    filter.SetAttribute("id", name);
                    //filter.setIdAttribute("id", true);

                    System.Xml.XmlElement feColorMatrix = doc.CreateElement("feColorMatrix");
                    feColorMatrix.SetAttribute("type", "matrix");
                    feColorMatrix.SetAttribute("in", "SourceGraphic");
                    feColorMatrix.SetAttribute("values", "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0");
                    filter.AppendChild(feColorMatrix);

                    _gdi.DefsElement.AppendChild(filter);
                }
            }
            else if (rop == (int)Gdi.GdiEnum.NOTSRCERASE)
            {
                name = "NOTSRCERASE_FILTER";
                System.Xml.XmlElement filter = doc.GetElementById(name);
                if (filter == null)
                {
                    filter = _gdi.Document.CreateElement("filter");
                    filter.SetAttribute("id", name);
                    //filter.setIdAttribute("id", true);

                    System.Xml.XmlElement feComposite = doc.CreateElement("feComposite");
                    feComposite.SetAttribute("in", "SourceGraphic");
                    feComposite.SetAttribute("in2", "BackgroundImage");
                    feComposite.SetAttribute("operator", "arithmetic");
                    feComposite.SetAttribute("k1", "1");
                    feComposite.SetAttribute("result", "result0");
                    filter.AppendChild(feComposite);

                    System.Xml.XmlElement feColorMatrix = doc.CreateElement("feColorMatrix");
                    feColorMatrix.SetAttribute("in", "result0");
                    feColorMatrix.SetAttribute("values", "-1 0 0 0 1 0 -1 0 0 1 0 0 -1 0 1 0 0 0 1 0");
                    filter.AppendChild(feColorMatrix);

                    _gdi.DefsElement.AppendChild(filter);
                }
            }
            else if (rop == (int)Gdi.GdiEnum.NOTSRCCOPY)
            {
                name = "NOTSRCCOPY_FILTER";
                System.Xml.XmlElement filter = doc.GetElementById(name);
                if (filter == null)
                {
                    filter = _gdi.Document.CreateElement("filter");
                    filter.SetAttribute("id", name);
                    //filter.setIdAttribute("id", true);

                    System.Xml.XmlElement feColorMatrix = doc.CreateElement("feColorMatrix");
                    feColorMatrix.SetAttribute("type", "matrix");
                    feColorMatrix.SetAttribute("in", "SourceGraphic");
                    feColorMatrix.SetAttribute("values", "-1 0 0 0 1 0 -1 0 0 1 0 0 -1 0 1 0 0 0 1 0");
                    filter.AppendChild(feColorMatrix);

                    _gdi.DefsElement.AppendChild(filter);
                }
            }
            else if (rop == (int)Gdi.GdiEnum.SRCERASE)
            {
                name = "SRCERASE_FILTER";
                System.Xml.XmlElement filter = doc.GetElementById(name);
                if (filter == null)
                {
                    filter = _gdi.Document.CreateElement("filter");
                    filter.SetAttribute("id", name);
                    //filter.setIdAttribute("id", true);

                    System.Xml.XmlElement feColorMatrix = doc.CreateElement("feColorMatrix");
                    feColorMatrix.SetAttribute("type", "matrix");
                    feColorMatrix.SetAttribute("in", "BackgroundImage");
                    feColorMatrix.SetAttribute("values", "-1 0 0 0 1 0 -1 0 0 1 0 0 -1 0 1 0 0 0 1 0");
                    feColorMatrix.SetAttribute("result", "result0");
                    filter.AppendChild(feColorMatrix);

                    System.Xml.XmlElement feComposite = doc.CreateElement("feComposite");
                    feComposite.SetAttribute("in", "SourceGraphic");
                    feComposite.SetAttribute("in2", "result0");
                    feComposite.SetAttribute("operator", "arithmetic");
                    feComposite.SetAttribute("k2", "1");
                    feComposite.SetAttribute("k3", "1");
                    filter.AppendChild(feComposite);

                    _gdi.DefsElement.AppendChild(filter);
                }
            }
            else if (rop == (int)Gdi.GdiEnum.PATINVERT)
            {
                // TODO
            }
            else if (rop == (int)Gdi.GdiEnum.SRCINVERT)
            {
                // TODO
            }
            else if (rop == (int)Gdi.GdiEnum.DSTINVERT)
            {
                name = "DSTINVERT_FILTER";
                System.Xml.XmlElement filter = doc.GetElementById(name);
                if (filter == null)
                {
                    filter = _gdi.Document.CreateElement("filter");
                    filter.SetAttribute("id", name);
                    //filter.SetIdAttribute("id", true);

                    System.Xml.XmlElement feColorMatrix = doc.CreateElement("feColorMatrix");
                    feColorMatrix.SetAttribute("type", "matrix");
                    feColorMatrix.SetAttribute("in", "BackgroundImage");
                    feColorMatrix.SetAttribute("values", "-1 0 0 0 1 0 -1 0 0 1 0 0 -1 0 1 0 0 0 1 0");
                    filter.AppendChild(feColorMatrix);

                    _gdi.DefsElement.AppendChild(filter);
                }
            }
            else if (rop == (int)Gdi.GdiEnum.SRCAND)
            {
                name = "SRCAND_FILTER";
                System.Xml.XmlElement filter = doc.GetElementById(name);
                if (filter == null)
                {
                    filter = _gdi.Document.CreateElement("filter");
                    filter.SetAttribute("id", name);
                    //filter.setIdAttribute("id", true);

                    System.Xml.XmlElement feComposite = doc.CreateElement("feComposite");
                    feComposite.SetAttribute("in", "SourceGraphic");
                    feComposite.SetAttribute("in2", "BackgroundImage");
                    feComposite.SetAttribute("operator", "arithmetic");
                    feComposite.SetAttribute("k1", "1");
                    filter.AppendChild(feComposite);

                    _gdi.DefsElement.AppendChild(filter);
                }
            }
            else if (rop == (int)Gdi.GdiEnum.MERGEPAINT)
            {
                name = "MERGEPAINT_FILTER";
                System.Xml.XmlElement filter = doc.GetElementById(name);
                if (filter == null)
                {
                    filter = _gdi.Document.CreateElement("filter");
                    filter.SetAttribute("id", name);
                    //filter.setIdAttribute("id", true);

                    System.Xml.XmlElement feColorMatrix = doc.CreateElement("feColorMatrix");
                    feColorMatrix.SetAttribute("type", "matrix");
                    feColorMatrix.SetAttribute("in", "SourceGraphic");
                    feColorMatrix.SetAttribute("values", "-1 0 0 0 1 0 -1 0 0 1 0 0 -1 0 1 0 0 0 1 0");
                    feColorMatrix.SetAttribute("result", "result0");
                    filter.AppendChild(feColorMatrix);

                    System.Xml.XmlElement feComposite = doc.CreateElement("feComposite");
                    feComposite.SetAttribute("in", "result0");
                    feComposite.SetAttribute("in2", "BackgroundImage");
                    feComposite.SetAttribute("operator", "arithmetic");
                    feComposite.SetAttribute("k1", "1");
                    filter.AppendChild(feComposite);

                    _gdi.DefsElement.AppendChild(filter);
                }
            }
            else if (rop == (int)Gdi.GdiEnum.MERGECOPY)
            {
                // TODO
            }
            else if (rop == (int)Gdi.GdiEnum.SRCPAINT)
            {
                name = "SRCPAINT_FILTER";
                System.Xml.XmlElement filter = doc.GetElementById(name);
                if (filter == null)
                {
                    filter = _gdi.Document.CreateElement("filter");
                    filter.SetAttribute("id", name);
                    //filter.setIdAttribute("id", true);

                    System.Xml.XmlElement feComposite = doc.CreateElement("feComposite");
                    feComposite.SetAttribute("in", "SourceGraphic");
                    feComposite.SetAttribute("in2", "BackgroundImage");
                    feComposite.SetAttribute("operator", "arithmetic");
                    feComposite.SetAttribute("k2", "1");
                    feComposite.SetAttribute("k3", "1");
                    filter.AppendChild(feComposite);

                    _gdi.DefsElement.AppendChild(filter);
                }
            }
            else if (rop == (int)Gdi.GdiEnum.PATCOPY)
            {
                // TODO
            }
            else if (rop == (int)Gdi.GdiEnum.PATPAINT)
            {
                // TODO
            }
            else if (rop == (int)Gdi.GdiEnum.WHITENESS)
            {
                name = "WHITENESS_FILTER";
                System.Xml.XmlElement filter = doc.GetElementById(name);
                if (filter == null)
                {
                    filter = _gdi.Document.CreateElement("filter");
                    filter.SetAttribute("id", name);
                    //filter.SetIdAttribute("id", true);

                    System.Xml.XmlElement feColorMatrix = doc.CreateElement("feColorMatrix");
                    feColorMatrix.SetAttribute("type", "matrix");
                    feColorMatrix.SetAttribute("in", "SourceGraphic");
                    feColorMatrix.SetAttribute("values", "1 0 0 0 1 0 1 0 0 1 0 0 1 0 1 0 0 0 1 0");
                    filter.AppendChild(feColorMatrix);

                    _gdi.DefsElement.AppendChild(filter);
                }
            }

            if (name != null)
            {
                if (!doc.DocumentElement.HasAttribute("enable-background"))
                {
                    doc.DocumentElement.SetAttribute("enable-background", "new");
                }
                return("url(#" + name + ")");
            }
            return(null);
        }