2024年2月

public static str SendPostWithHeader(str url, str param, System.Net.WebHeaderCollection _headers, str contentType = "application/json", str encoding = "utf-8")
{
    System.Net.HttpWebRequest request = null;
    System.IO.Stream requestStream;
    str  dataString;
    if (strStartsWith(url, "https"))
    {
        request = System.Net.WebRequest::Create(url)as System.Net.HttpWebRequest;
    }
    else
    {
        request = System.Net.WebRequest::CreateHttp(url)as System.Net.HttpWebRequest;
    }
    request.Method = "POST";
    request.Headers = _headers;
    request.ContentType = contentType;
    System.Byte[] postData = System.Text.Encoding::GetEncoding( encoding ).GetBytes(param);
    request.ContentLength = postData.Length;
    try
    {
        System.IO.Stream outputStream = request.GetRequestStream();
        outputStream.Write(postData,0,postData.Length);
        outputStream.Close();

        System.Net.HttpWebResponse response = request.GetResponse() as System.Net.HttpWebResponse;
        System.IO.Stream responseStream = response.GetResponseStream();
        System.IO.StreamReader reader=new System.IO.StreamReader(responseStream,System.Text.Encoding::GetEncoding("GBK"));
        dataString = reader.ReadToEnd();
        reader.Close();

        if(!dataString)
            throw error("接口数据返回异常");
    }
    catch (Exception::CLRError)
    {
        System.Exception ex;
        ex = ClrInterop::getLastException();
        if (ex != null)
        {
            ex = ex.get_InnerException();
            if (ex != null)
            {
                dataString = ex.ToString();
            }
        }
    }
    catch
    {
        SysInfoLogEnumerator infoLogEnum;
        infoLogEnum = SysInfoLogEnumerator::newData(infolog.copy(1, infologLine()));
        while(infoLogEnum.moveNext())
        {
            dataString += infoLogEnum.currentMessage();
        }
    }

    return dataString;
}

  container fileCon = DocumentManagement::getAttachmentAsContainer(_docuRef);
  

System.IO.Stream stream = Binary::constructFromContainer(fileCon).getMemoryStream();

  DocumentManagement::attachFile(tableNum(IWS_DeliveryForecastTable), recId, DataAreaId, '文件', stream, name, '', name);

@echo off 
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0 /f 
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /d "" /f 
reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyOverride /f
ipconfig /flushdns
start "" "C:\Program Files\Internet Explorer\iexplore.exe"
taskkill /f /im iexplore.exe
pause>nul

private str jsonKey2Lower(str _jStr)
{
    str jStr;
    str item;

    System.Text.RegularExpressions.Regex regex;
    System.Text.RegularExpressions.Match match;
    
    regex = new System.Text.RegularExpressions.Regex("\"([A-Za-z0-9]*)\"\:");
    match = regex.Match(_jStr);

    jStr = _jStr;
    while(match.Success)
    {
        item = match.Value;
        jStr = strReplace(jStr, item, strLwr(item));
        match = match.NextMatch();
    }
    return jStr;
}

refer from

origin = System.Text.RegularExpressions.Regex::Replace(origin,'<([A-Za-z0-9]*)>(\\s*|\n|\t|\r)</[A-Za-z0-9]*>','<$1/>');//压缩空节点。