private EditSession GetEditSession(string fileId) { var sessionId = /*Context.Session.GetString("SessionID"); if (string.IsNullOrEmpty(sessionId)) { sessionId = Guid.NewGuid().ToString(); Context.Session.SetString("SessionID", sessionId); } sessionId += "|" +*/ fileId; EditSession editSession = SessionManager.Current.GetSession(sessionId); if (editSession == null) { IWopiFile file = FileProvider.GetWopiFile(fileId); //TODO: remove hardcoded action 'Edit' if (WopiDiscoverer.RequiresCobalt(file.Extension, WopiActionEnum.Edit)) { editSession = new CobaltSession(file, sessionId); } else { editSession = new FileSession(file, sessionId); } SessionManager.Current.AddSession(editSession); } return editSession; }
private async Task<AbstractEditSession> GetEditSessionAsync(string fileId) { var sessionId = /*Context.Session.GetString("SessionID"); if (string.IsNullOrEmpty(sessionId)) { sessionId = Guid.NewGuid().ToString(); Context.Session.SetString("SessionID", sessionId); } sessionId += "|" +*/ fileId; AbstractEditSession editSession = SessionManager.Current.GetSession(sessionId); if (editSession == null) { IWopiFile file = StorageProvider.GetWopiFile(fileId); //TODO: remove hardcoded action 'Edit' //TODO: handle all requirements in a generic way (requires="cobalt,containers,update") //TODO: http://wopi.readthedocs.io/en/latest/discovery.html#action-requirements if (await WopiDiscoverer.RequiresCobaltAsync(file.Extension, WopiActionEnum.Edit)) { editSession = new CobaltSession(file, sessionId); } else { editSession = new FileSession(file, sessionId); } SessionManager.Current.AddSession(editSession); } return editSession; }
private EditSession GetEditSession(string fileId) { var sessionId = /*Context.Session.GetString("SessionID"); * if (string.IsNullOrEmpty(sessionId)) * { * sessionId = Guid.NewGuid().ToString(); * Context.Session.SetString("SessionID", sessionId); * } * sessionId += "|" +*/fileId; EditSession editSession = SessionManager.Current.GetSession(sessionId); if (editSession == null) { IWopiFile file = FileProvider.GetWopiFile(fileId); //TODO: remove hardcoded action 'Edit' if (WopiDiscoverer.RequiresCobalt(file.Extension, WopiActionEnum.Edit)) { editSession = new CobaltSession(file, sessionId); } else { editSession = new FileSession(file, sessionId); } SessionManager.Current.AddSession(editSession); } return(editSession); }
public CobaltHostLockingStore(CobaltSession session) { m_session = session; }