コード例 #1
0
        public JsonResult Load(int id, bool simpleMode)
        {
            Services.EditorService editor = new Services.EditorService();
            EditorDictionary[id] = editor;
            string libFolder = Server.MapPath("~/bin/Core/");
            string filename  = Services.FileManagerLoader.GetFileManager().GetFile(id);

            if (filename == null)
            {
                Logging.Log.InfoFormat("Invalid game {0}", id);
                return(Json(new { error = "Invalid ID" }, JsonRequestBehavior.AllowGet));
            }
            var result = editor.Initialise(id, filename, libFolder, simpleMode);

            if (!result.Success)
            {
                Logging.Log.InfoFormat("Failed to load game {0} - {1}", id, result.Error);
                return(Json(new { error = result.Error.Replace(Environment.NewLine, "<br/>") }, JsonRequestBehavior.AllowGet));
            }

            string playFilename = Services.FileManagerLoader.GetFileManager().GetPlayFilename(id);

            return(Json(new {
                tree = editor.GetElementTreeForJson(),
                editorstyle = editor.Style,
                playurl = ConfigurationManager.AppSettings["PlayURL"] + "?id=editor/" + HttpUtility.UrlEncode(playFilename),
            }, JsonRequestBehavior.AllowGet));
        }
コード例 #2
0
ファイル: EditController.cs プロジェクト: JatinR/quest
 public JsonResult Load(int id, bool simpleMode)
 {
     Logging.Log.DebugFormat("{0}: Load (simpleMode={1})", id, simpleMode);
     Services.EditorService editor = new Services.EditorService();
     EditorDictionary[id] = editor;
     string libFolder = ConfigurationManager.AppSettings["LibraryFolder"];
     string filename = Services.FileManagerLoader.GetFileManager().GetFile(id);
     if (filename == null)
     {
         return Json(new { error = "Invalid ID" }, JsonRequestBehavior.AllowGet);
     }
     var result = editor.Initialise(id, filename, libFolder, simpleMode);
     if (!result.Success)
     {
         return Json(new { error = result.Error.Replace(Environment.NewLine, "<br/>") }, JsonRequestBehavior.AllowGet);
     }
     
     return Json(new {
         tree = editor.GetElementTreeForJson(),
         editorstyle = editor.Style
     }, JsonRequestBehavior.AllowGet);
 }
コード例 #3
0
        public JsonResult Load(int id, bool simpleMode)
        {
            Logging.Log.DebugFormat("{0}: Load (simpleMode={1})", id, simpleMode);
            Services.EditorService editor = new Services.EditorService();
            EditorDictionary[id] = editor;
            string libFolder = ConfigurationManager.AppSettings["LibraryFolder"];
            string filename  = Services.FileManagerLoader.GetFileManager().GetFile(id);

            if (filename == null)
            {
                return(Json(new { error = "Invalid ID" }, JsonRequestBehavior.AllowGet));
            }
            var result = editor.Initialise(id, filename, libFolder, simpleMode);

            if (!result.Success)
            {
                return(Json(new { error = result.Error.Replace(Environment.NewLine, "<br/>") }, JsonRequestBehavior.AllowGet));
            }

            return(Json(new {
                tree = editor.GetElementTreeForJson(),
                editorstyle = editor.Style
            }, JsonRequestBehavior.AllowGet));
        }
コード例 #4
0
ファイル: EditController.cs プロジェクト: hyrmedia/quest
        public JsonResult Load(int id, bool simpleMode)
        {
            Services.EditorService editor = new Services.EditorService();
            EditorDictionary[id] = editor;
            string libFolder = Server.MapPath("~/bin/Core/");
            string filename = Services.FileManagerLoader.GetFileManager().GetFile(id);
            if (filename == null)
            {
                Logging.Log.InfoFormat("Invalid game {0}", id);
                return Json(new { error = "Invalid ID" }, JsonRequestBehavior.AllowGet);
            }
            var result = editor.Initialise(id, filename, libFolder, simpleMode);
            if (!result.Success)
            {
                Logging.Log.InfoFormat("Failed to load game {0} - {1}", id, result.Error);
                return Json(new { error = result.Error.Replace(Environment.NewLine, "<br/>") }, JsonRequestBehavior.AllowGet);
            }

            string playFilename = Services.FileManagerLoader.GetFileManager().GetPlayFilename(id);

            return Json(new {
                tree = editor.GetElementTreeForJson(),
                editorstyle = editor.Style,
                playurl = ConfigurationManager.AppSettings["PlayURL"] + "?id=editor/" + playFilename,
            }, JsonRequestBehavior.AllowGet);
        }