Example #1
0
        public async Task SendTest()
        {
            // param
            string url = Environment.GetEnvironmentVariable("Filt");

            byte[] target = System.Text.Encoding.ASCII.GetBytes("hello\n");

            System.Console.WriteLine("url:" + url);

            // send to filt
            FiltClient   filt    = new FiltClient(url);
            FiltRequest  request = new FiltRequest(target);
            FiltResponse result  = await filt.Send(request, verify : false);

            // print
            System.Console.WriteLine("hit:" + result.Hit);
            System.Console.WriteLine("sucess:" + result.Success);
            System.Console.WriteLine("message:" + System.Text.Encoding.ASCII.GetString(result.Messages[1]));

            throw new Exception();
        }
Example #2
0
    private bool isSafe(String data)
    {
        byte[]       target   = System.Text.Encoding.UTF8.GetBytes(data);
        FiltRequest  request  = new FiltRequest(target);
        FiltResponse response = null;

        try {
            response = filt.Send(request, false);
        } catch {
            speaker.Talk("フィルト へのアクセスに失敗しました");
        }

        if (response != null && !response.Success)
        {
            speaker.Talk("フィルト での判定に失敗しました");
        }

        Debug.Log("hit:" + response.Hit);
        Debug.Log("success:" + response.Success);

        return((!response.Hit) && response.Success);
    }