コード例 #1
0
 /// <summary>
 /// Execute a project.
 /// </summary>
 /// <param name="uid">Id for project.</param>
 /// <param name="owner">Owner of a project.</param>
 /// <param name="project">Project domain model.</param>
 public static void Execute(Guid uid, UserDM owner, PythonProjectDM project)
 {
     //PyProject p = projects[uid];
     //if (p != null)
     //{
     //    dynamic r = p.Execute(code);
     //    if (r != null)
     //    {
     //        p.notify(Convert.ToString(r));
     //    }
     //}
 }
コード例 #2
0
ファイル: ProjectController.cs プロジェクト: theCstokes/spann
        public IHttpActionResult TestDTO([FromBody] PythonProjectDTO obj)
        {
            PythonProjectDM project = obj.Map();

            //if (PatchTools.IsPatch(project))
            //{
            //    RC.PythonProjectManager.Commit(CommitTypeEnum.PATCH, project);
            //}
            //else
            //{
            //    /// TODO - return error
            //}
            RC.PythonProjectManager.Commit(CommitTypeEnum.PATCH, project);
            return(ResponseUtils.CreateResponse(HttpStatusCode.OK, project.Map()));
        }
コード例 #3
0
        /// <summary>
        /// Execute a project.
        /// </summary>
        /// <param name="uid">Id for project.</param>
        /// <param name="fileDM">File domain model.</param>
        public static void Execute(Guid uid, PythonProjectDM projectDM)
        {
            PyProject project = projects[uid];

            project.Create(SERVER_LOCATION, projectDM.ID.ToString());
            var location = PyTools.CreatePath(SERVER_LOCATION, projectDM.ID.ToString());

            projectDM.Files.ForEach((fileDM) =>
            {
                var file = new PyFile(fileDM.ID, location, fileDM.Name, fileDM.SourceCode);
                project.AddFile(file);
                if (projectDM.StartFileName == fileDM.Name)
                {
                    project.StartUpFileID = fileDM.ID;
                }
            });
            project.Run();
        }
コード例 #4
0
ファイル: ProjectController.cs プロジェクト: theCstokes/spann
        public HttpResponseMessage RunProject()
        {
            HttpContext currentContext = HttpContext.Current;

            if (currentContext.IsWebSocketRequest ||
                currentContext.IsWebSocketRequestUpgrading)
            {
                WebSocketHandler handler = new WebSocketHandler(currentContext);
                handler.OnOpen = uid =>
                {
                    PyProjectManager.Register(uid, (sender, e) => handler.Send(e.Value));
                };
                handler.OnReceive = (uid, msg) =>
                {
                    PythonProjectDM project = JsonUtils.DeserializeObject <PythonProjectDM>(msg);
                    PyProjectManager.Execute(uid, project);
                };
                handler.OnClose = uid => PyProjectManager.Remove(uid);
            }
            return(Request.CreateResponse(HttpStatusCode.SwitchingProtocols));
        }
コード例 #5
0
ファイル: ProjectController.cs プロジェクト: theCstokes/spann
 public IHttpActionResult UpdateProject([FromUri] int id, [FromBody] PythonProjectDM project)
 {
     RC.PythonProjectManager.Commit(CommitTypeEnum.UPDATE, project, id: id);
     return(ResponseUtils.CreateResponse(HttpStatusCode.OK, project.Map()));
 }
コード例 #6
0
ファイル: ProjectController.cs プロジェクト: theCstokes/spann
 public IHttpActionResult CreateProject([FromBody] PythonProjectDM project)
 {
     RC.PythonProjectManager.Commit(CommitTypeEnum.ADD, project);
     return(ResponseUtils.CreateResponse(HttpStatusCode.OK, project.Map()));
 }