/// <summary> /// Opens the read. /// </summary> /// <param name="element">The element.</param> /// <returns></returns> public override System.IO.Stream OpenRead(Mediachase.Net.Wdom.WebDavElementInfo element) { FileStorageAutoCommitedTransactedStream result = null; if (element != null && !(element is CollectionInfo)) { DummyFileInfoWrapper fileInfo = element.Tag as DummyFileInfoWrapper; if (fileInfo != null) { CheckRight(fileInfo, "Read"); //update download counter Mediachase.IBN.Database.ControlSystem.DBFile.FileBinaryModifyCounter(fileInfo.FileBinaryId); try { result = new FileStorageAutoCommitedTransactedStream(DataContext.Current.BeginTransaction(), 0); result.InnerStream = Mediachase.IBN.Database.ControlSystem.DBFile.OpenRead(fileInfo.FileBinaryId); } catch (Exception) { throw new HttpException(404, "Not Found"); } } } return(result); }
/// <summary> /// Opens the write. /// </summary> /// <param name="element">The element.</param> /// <returns></returns> public override System.IO.Stream OpenWrite(Mediachase.Net.Wdom.WebDavElementInfo element, long contentLength) { FileStorageAutoCommitedTransactedStream result = null; if (element != null && !(element is CollectionInfo)) { DummyFileInfoWrapper fileInfo = element.Tag as DummyFileInfoWrapper; if (fileInfo != null) { CheckRight(fileInfo, "Write"); try { //Auto committed transaction stream wrapper result = new FileStorageAutoCommitedTransactedStream(DataContext.Current.BeginTransaction(), fileInfo.ContainerKey, fileInfo.ParrentDirectoryId, fileInfo.Name, contentLength); result.InnerStream = new MemoryStream(); } catch (Exception) { throw new HttpException(404, "Not Found"); } } } return(result); }
public override Mediachase.Net.Wdom.PropertyInfoCollection GetProperties(Mediachase.Net.Wdom.WebDavElementInfo element) { PropertyInfoCollection retVal = new PropertyInfoCollection(); PropertyInfo prop = null; #region CreateDefaultProperties foreach (PropertyInfo defaultProp in PropertyInfo.CreateDefaultProperties(element)) { SetProperty(retVal, defaultProp, false); } #endregion //Add <supportedlock> property if (((int)(WebDavApplication.Class & WebDavServerClass.Class2)) != 0) { prop = PropertyInfo.CreateSupportedLockProperty(); prop.Calculated = false; SetProperty(retVal, prop, false); } //Add <resourcetype> property prop = PropertyInfo.CreateResourceTypeProperty(element); SetProperty(retVal, prop, false); retVal.ElementInfo = element; return(retVal); }
/// <summary> /// Opens the read. /// </summary> /// <param name="element">The element.</param> /// <returns></returns> public override System.IO.Stream OpenRead(Mediachase.Net.Wdom.WebDavElementInfo element) { if (element == null || element is CollectionInfo) { return(null); } Mediachase.Ibn.Data.Meta.FileInfo fileInfo = (Mediachase.Ibn.Data.Meta.FileInfo)element.Tag; return(fileInfo.OpenRead()); }
public override System.IO.Stream OpenRead(Mediachase.Net.Wdom.WebDavElementInfo element) { if (element == null || element is CollectionInfo) { return(null); } Mediachase.IBN.Business.EMail.EMailMessageInfo.AttachmentData entry = element.Tag as Mediachase.IBN.Business.EMail.EMailMessageInfo.AttachmentData; return(new MemoryStream(entry.Data)); }
public override System.IO.Stream OpenRead(Mediachase.Net.Wdom.WebDavElementInfo element) { if (element == null || element is CollectionInfo) { return(null); } object[] param = (object[])element.Tag; MetaFile metaFile = (MetaFile)param[1]; return(new MemoryStream(metaFile.Buffer)); }
public override System.IO.Stream OpenWrite(Mediachase.Net.Wdom.WebDavElementInfo element, long contentLength) { if (element == null || element is CollectionInfo) { return(null); } object[] param = (object[])element.Tag; MetaFile metaFile = (MetaFile)param[1]; MetaObject metaObj = (MetaObject)param[0]; MetaDataPlusAbsolutePath absPath = (MetaDataPlusAbsolutePath)param[2]; return(new MetaFileStream(metaObj, metaFile, absPath.MetaFieldName, contentLength)); }
/// <summary> /// Gets the properties. /// </summary> /// <param name="element">The element.</param> /// <returns></returns> public override Mediachase.Net.Wdom.PropertyInfoCollection GetProperties(Mediachase.Net.Wdom.WebDavElementInfo element) { PropertyInfoCollection retVal = null; PropertyInfo prop = null; WebDavDocument tmpDoc = WebDavDocument.CreateDocument(); if (element == null) { return(retVal); } retVal = new PropertyInfoCollection(); //FileInfo fileInfo = !!!!(FileInfo)element.Tag;!!! WebDavTicket ticket = WebDavTicket.Parse(element.AbsolutePath); WebDavStorageElementPropertiesRow row = GetWebDavStoragePropertyRow(ticket.AbsolutePath.StorageType, ticket.AbsolutePath.UniqueId); if (row != null) { retVal = Mediachase.Ibn.Data.McXmlSerializer.GetObject <PropertyInfoCollection>(row.Value); } #region CreateDefaultProperties foreach (PropertyInfo defaultProp in PropertyInfo.CreateDefaultProperties(element)) { SetPropertyAndSave(retVal, defaultProp, false, false); } #endregion //Add <supportedlock> property if (((int)(WebDavApplication.Class & WebDavServerClass.Class2)) != 0) { prop = PropertyInfo.CreateSupportedLockProperty(); prop.Calculated = false; SetPropertyAndSave(retVal, prop, false, false); } //Add <resourcetype> property prop = PropertyInfo.CreateResourceTypeProperty(element); SetPropertyAndSave(retVal, prop, false, false); //Assign context and set closure to class member retVal.ElementInfo = element; return(retVal); }
/// <summary> /// Opens the write. /// </summary> /// <param name="element">The element.</param> /// <returns></returns> public override System.IO.Stream OpenWrite(Mediachase.Net.Wdom.WebDavElementInfo element, long contentLength) { if (element == null || element is CollectionInfo) { return(null); } Mediachase.Ibn.Data.Meta.FileInfo fileInfo = (Mediachase.Ibn.Data.Meta.FileInfo)element.Tag; try { AutoCommitedTransactedStream tranStream = new AutoCommitedTransactedStream(DataContext.Current.BeginTransaction(), contentLength); tranStream.InnerStream = fileInfo.OpenWrite(); tranStream.SetLength(0); return(tranStream); } catch (Exception) { throw new HttpException(404, "Not Found"); } }
public override void Delete(Mediachase.Net.Wdom.WebDavElementInfo element) { throw new Exception("The method or operation is not implemented."); }
public override void Delete(Mediachase.Net.Wdom.WebDavElementInfo element) { throw new NotImplementedException(); }
public override void CopyTo(Mediachase.Net.Wdom.WebDavElementInfo srcElement, Mediachase.Net.Wdom.WebDavElementInfo destElInfo) { throw new NotImplementedException(); }
public override Mediachase.Net.Wdom.WebDavElementInfo[] GetChildElements(Mediachase.Net.Wdom.WebDavElementInfo element) { return(new WebDavElementInfo[] { }); }
public override void Unlock(Mediachase.Net.Wdom.WebDavElementInfo element, OpaqueLockToken lockToken) { throw new NotImplementedException(); }
public override System.IO.Stream OpenRead(Mediachase.Net.Wdom.WebDavElementInfo element) { throw new NotImplementedException(); }
public override System.IO.Stream OpenWrite(Mediachase.Net.Wdom.WebDavElementInfo element, long contentLength) { throw new NotImplementedException(); }
public override Mediachase.Net.Wdom.WebDavElementInfo[] GetChildElements(Mediachase.Net.Wdom.WebDavElementInfo element) { throw new NotImplementedException(); }
/// <summary> /// Locks the specified depth. /// </summary> /// <param name="depth">The depth.</param> /// <param name="timeout">The timeout.</param> /// <param name="lockInfoEl">The lock info el.</param> /// <param name="element">The element.</param> /// <returns></returns> public override OpaqueLockToken Lock(Mediachase.Net.Wdom.DepthValue depth, string timeout, Mediachase.Net.Wdom.LockInfoElement lockInfoEl, Mediachase.Net.Wdom.WebDavElementInfo element) { ReplaceLockOwner(lockInfoEl); PropertyInfoCollection collection = GetProperties(element); return(WebDavLockManager.Lock(this, depth, timeout, lockInfoEl, collection)); }
/// <summary> /// Unlocks the specified element. /// </summary> /// <param name="element">The element.</param> /// <param name="lockToken">The lock token.</param> public override void Unlock(Mediachase.Net.Wdom.WebDavElementInfo element, OpaqueLockToken lockToken) { PropertyInfoCollection collection = GetProperties(element); WebDavLockManager.Unlock(this, collection, lockToken); }
public override Mediachase.Net.Wdom.WebDavElementInfo[] GetChildElements(Mediachase.Net.Wdom.WebDavElementInfo element) { throw new Exception("The method or operation is not implemented."); }
public override void RefreshLock(Mediachase.Net.Wdom.WebDavElementInfo element, OpaqueLockToken lockToken, string timeout) { throw new NotImplementedException(); }
public override IEnumerable <ActiveLockElement> GetActiveLocks(Mediachase.Net.Wdom.WebDavElementInfo element) { throw new NotImplementedException(); }
/// <summary> /// Refreshes the lock. /// </summary> /// <param name="element">The element.</param> /// <param name="lockToken">The lock token.</param> /// <param name="timeout">The timeout.</param> public override void RefreshLock(Mediachase.Net.Wdom.WebDavElementInfo element, OpaqueLockToken lockToken, string timeout) { PropertyInfoCollection collection = GetProperties(element); WebDavLockManager.RefreshLock(this, collection, lockToken, timeout); }
public override void CopyTo(Mediachase.Net.Wdom.WebDavElementInfo srcElement, Mediachase.Net.Wdom.WebDavElementInfo destElInfo) { throw new Exception("The method or operation is not implemented."); }
public override OpaqueLockToken Lock(Mediachase.Net.Wdom.DepthValue depth, string timeout, Mediachase.Net.Wdom.LockInfoElement lockInfoEl, Mediachase.Net.Wdom.WebDavElementInfo element) { throw new NotImplementedException(); }