コード例 #1
0
    public void OnDragLeave(string data)
    {
        if (_controller.OnDragExit == null)
        {
            return;
        }

        WebGLData webData = new WebGLData();

        if (!GetData(data, ref webData))
        {
            return;
        }

        _controller.OnDragExit(webData.FileName, webData.X, webData.Y);
    }
コード例 #2
0
    public void OnDropData(string data)
    {
        if (_controller.OnDroppedData == null)
        {
            return;
        }

        WebGLData webData = new WebGLData();

        if (!GetData(data, ref webData))
        {
            return;
        }

        _controller.OnDroppedData(webData.FileName, webData.X, webData.Y, Encoding.UTF8.GetBytes(webData.Blob));
    }
コード例 #3
0
    private bool GetData(string data, ref WebGLData output)
    {
        string[] bits = data.Split('|');
        if (bits.Length != 3 && bits.Length != 4)
        {
            return(false);
        }

        output.FileName = bits[0];
        if (!int.TryParse(bits[1], out output.X) || !int.TryParse(bits[2], out output.Y))
        {
            return(false);
        }

        if (bits.Length == 4)
        {
            output.Blob = bits[3];
        }

        return(true);
    }