Esempio n. 1
0
        private bool TransformXML(string xslFilePath, string sourceXml, ref string targetXml, ILogging log)
        {
            XMLTransformer t = XMLTransformer.CreateFromFileWithCache(xslFilePath, log, true);

            if (t == null)
            {
                return(false);
            }
            return(t.TransformString(sourceXml, ref targetXml, XSLTExtensionTypes.XmlNodeTransformer));
        }
Esempio n. 2
0
        public StorageSCP(Stream stream, Logger log)
            : base(stream, log)
        {
            foreach (StorageServiceUID uid in Program.ConfigMgt.Config.StorageServiceUIDs)
            {
                _StorageServiceUID.Add(uid.UID);
            }

            var pi = stream.GetType().GetProperty("Socket", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);

            if (pi != null)
            {
                var endPoint = ((System.Net.Sockets.Socket)pi.GetValue(stream, null)).RemoteEndPoint as System.Net.IPEndPoint;
                RemoteIP = endPoint.Address;
            }
            else
            {
                RemoteIP = new System.Net.IPAddress(new byte[] { 127, 0, 0, 1 });
            }
            _SOAPClient = new SOAPClientEx(Program.ConfigMgt.Config.SOAPClientSetting, Application.StartupPath, Program.Log);
            _reqTran    = HYS.Common.Soap.XMLTransformer.CreateFromFile(ConfigHelper.GetFullPath(Application.StartupPath, Program.ConfigMgt.Config.XSLTFileToTransformDICOMtoSOAP), Program.Log);
        }
Esempio n. 3
0
        /// <summary>
        /// If your XSLT file need to include/import other XLST file, you cannot use script or call any extension in the XSLT. So set enableExtension as false.
        /// </summary>
        /// <param name="xslFileName"></param>
        /// <param name="log"></param>
        /// <param name="enableExtension"></param>
        /// <returns></returns>
        public static XMLTransformer CreateFromFileWithCache(string xslFileName, ILogging log, bool enableExtension)
        {
            if (xslFileName == null)
            {
                return(null);
            }
            XMLTransformer t = null;

            lock (_transformerList.SyncRoot)
            {
                t = _transformerList[xslFileName] as XMLTransformer;
                if (t == null)
                {
                    t = CreateFromFile(xslFileName, log, enableExtension);
                    if (t != null)
                    {
                        _transformerList.Add(xslFileName, t);
                    }
                }
            }
            return(t);
        }