void ProcessDirectory(HttpListenerContext context, string path)
        {
            var  response   = context.Response;
            bool redirected = false;

            if (path.Length > 0)
            {
                if (path[path.Length - 1] == '/') // 末尾スラッシュ消し
                {
                    path = path.Remove(path.Length - 1, 1);
                }
                else
                {
                    redirected = true; // スラッシュ付きにリダイレクトする
                }
            }
            var sb     = new StringBuilder();
            var writer = HtmlUtil.CreateWriter(sb);
            var title  = "index of /" + path;

            HtmlUtil.WriteHeader(writer, title);
            writer.WriteStartElement("body");
            writer.WriteElementString("h1", title);

            var parentDirectory = FindDirectory(path);

            if (parentDirectory == null)
            {
                writer.WriteElementString("p", "not found in map. use MakeStreamingAssetsMap tool in Editor.");
            }
            else
            {
                writer.WriteStartElement("ul");
                var directoryIndex = parentDirectory.firstChild;
                while (directoryIndex >= 0)
                {
                    var directory = streamingAssetsMap.directories[directoryIndex];
                    writer.WriteStartElement("li");
                    HtmlUtil.WriteA(writer, directory.name + "/", directory.name);
                    writer.WriteEndElement(); //li
                    directoryIndex = directory.nextBrother;
                }

                var fileIndex = parentDirectory.firstFile;
                while (fileIndex >= 0)
                {
                    var file = streamingAssetsMap.files[fileIndex];
                    writer.WriteStartElement("li");
                    HtmlUtil.WriteA(writer, file.name, file.name);
                    writer.WriteEndElement(); //li
                    fileIndex = file.nextFile;
                }
                writer.WriteEndElement(); //ul
            }
            writer.WriteEndElement();     //body
            writer.WriteEndElement();     //html
            writer.Close();

            var bytes = System.Text.Encoding.UTF8.GetBytes(sb.ToString());

            if (redirected)
            {
                var url = DebugServerUtil.RemoveQueryString(context.Request.Url.ToString());
                url += "/";
                response.Redirect(url);
            }
            else
            {
                response.StatusCode = (int)HttpStatusCode.OK;
            }
            response.Close(bytes, willBlock: false);
        }
        IEnumerator CoProcessFileGet(HttpListenerContext context, string path)
        {
            var request = context.Request;

            Debug.Assert(request.HttpMethod == "GET");
            var ret = new CoroutineReturnValue <string>();

            yield return(DebugServerUtil.CoLoad(ret, path, overrideEnabled: true));

            var response = context.Response;

            if (ret.Exception != null)
            {
                response.StatusCode = (int)HttpStatusCode.InternalServerError;
                response.Close();
            }
            else
            {
                var ext    = System.IO.Path.GetExtension(path);
                var isText = (ext == ".txt") ||
                             (ext == ".json") ||
                             (ext == ".html") ||
                             (ext == ".htm") ||
                             (ext == ".xml") ||
                             (ext == ".yaml") ||
                             (ext == ".csv");
                var sb     = new StringBuilder();
                var writer = HtmlUtil.CreateWriter(sb);
                var title  = path;
                HtmlUtil.WriteHeader(writer, title);
                writer.WriteStartElement("body");
                writer.WriteElementString("h1", title);
                if (isText)
                {
                    HtmlUtil.WriteTextarea(writer, "text", 20, 60, ret.Value);
                    HtmlUtil.WriteBr(writer);
                    HtmlUtil.WriteInput(writer, "update", "button", "submit");
                }

                HtmlUtil.WriteInput(writer, "delete", "button", "delete file");
                HtmlUtil.WriteBr(writer);

                HtmlUtil.WriteInput(writer, "file", "file");
                HtmlUtil.WriteInput(writer, "upload", "button", "upload file");
                HtmlUtil.WriteA(writer, "#", "download", "download", "");
                HtmlUtil.WriteBr(writer);

                HtmlUtil.WriteOutput(writer, "log");

                writer.WriteStartElement("script");
                writer.WriteString(fileGetScript);
                writer.WriteEndElement(); //script
                writer.WriteEndElement(); //body
                writer.WriteEndElement(); //html
                writer.Close();

                var html  = sb.ToString();
                var bytes = Encoding.UTF8.GetBytes(html);
                response.Close(bytes, willBlock: false);
            }
        }