コード例 #1
0
        public static PathSpawnerModel spawner()
        {
            SplitterModel sm = new SplitterModel("", new string[]
            {
                "track1",
                "track2",
                "track3",
                "track4",
                "track5",
                "track6",
                "track7",
                "track8",
                "track9",
                "track10",
                "track11",
                "track12",
                "track13",
                "track14",
                "track15",
            });


            return(new PathSpawnerModel("", sm, sm));

            //return new PathSpawnerModel("", new SplitterModel("", new string[]
            //        {
            //            "Path1",
            //        }), new SplitterModel("", new string[]
            //        {
            //            "Path1",
            //        }));
        }
コード例 #2
0
        public HttpResponseMessage GetParseData()
        {
            string textData = Request.Content.ReadAsStringAsync().Result;

            string[]             parseData;
            List <SplitterModel> parseDataList = new List <SplitterModel>();
            SplitterModel        SM;
            HttpResponseMessage  res;

            try
            {
                SubtitleSplitter.SubtitleParser sp = new SubtitleParser();
                parseData = sp.Parse(textData);
                foreach (string s in parseData)
                {
                    SM             = new SplitterModel();
                    SM.titleString = s;
                    parseDataList.Add(SM);
                }

                res = Request.CreateResponse(HttpStatusCode.OK);
                var json = JsonConvert.SerializeObject(parseDataList);
                res.Content = new StringContent(json.ToString(), Encoding.UTF8, "application/json");
            }
            catch (Exception e)
            {
                res = Request.CreateResponse(HttpStatusCode.InternalServerError);
            }

            return(res);
        }