public string Modify(string valueToModify, CustomizationContextData context)
        {
            var icadetails = new IcaFile(valueToModify);

            // If the request is detected as having come via a gateway, then treat as remote access:
            bool isRemoteAccess = context.RequestGateway != null;

            icadetails.SetPropertyValue(IcaFile.ApplicationSection, "SFRAllowed", isRemoteAccess ? "Off" : "On");

            // get modified string back from helper breakdown class.
            string modifiedIcaFile = icadetails.ToString();

            Tracer.TraceInfo("Launch Customisation: check modifications to ICA File");
            Tracer.TraceInfo(modifiedIcaFile);
            return(modifiedIcaFile);
        }
        public string Modify(string originalIcaFileContent, CustomizationContextData context)
        {
            var icaFile = new IcaFile(originalIcaFileContent);

            // Get the client ip address (detected from the request HTTP headers)
            var clientIpAddress = context.DeviceInfo.DetectedAddress;

            if (clientsNeedingSocksProxyPattern.IsMatch(clientIpAddress))
            {
                // the client ip address matches the range of addresses for which we want the client to use a SOCKS proxy.
                SetProxySetting(icaFile, "ProxyType", "Socks");
                SetProxySetting(icaFile, "ProxyHost", "socksproxy.mycompany.com:1080");
            }
            else
            {
                // otherwise let the client auto detect the proxy server.
                SetProxySetting(icaFile, "ProxyType", "Auto");
            }

            string customizedIcaContent = icaFile.ToString();

            return(customizedIcaContent);
        }