コード例 #1
0
ファイル: FileStorageProvider.cs プロジェクト: alex765022/IBN
        /// <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);
        }
コード例 #2
0
ファイル: FileStorageProvider.cs プロジェクト: alex765022/IBN
        /// <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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        /// <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());
        }
コード例 #5
0
        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));
        }
コード例 #6
0
        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));
        }
コード例 #7
0
        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));
        }
コード例 #8
0
        /// <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);
        }
コード例 #9
0
        /// <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");
            }
        }
コード例 #10
0
 public override void Delete(Mediachase.Net.Wdom.WebDavElementInfo element)
 {
     throw new Exception("The method or operation is not implemented.");
 }
コード例 #11
0
 public override void Delete(Mediachase.Net.Wdom.WebDavElementInfo element)
 {
     throw new NotImplementedException();
 }
コード例 #12
0
 public override void CopyTo(Mediachase.Net.Wdom.WebDavElementInfo srcElement, Mediachase.Net.Wdom.WebDavElementInfo destElInfo)
 {
     throw new NotImplementedException();
 }
コード例 #13
0
 public override Mediachase.Net.Wdom.WebDavElementInfo[] GetChildElements(Mediachase.Net.Wdom.WebDavElementInfo element)
 {
     return(new WebDavElementInfo[] { });
 }
コード例 #14
0
 public override void Unlock(Mediachase.Net.Wdom.WebDavElementInfo element, OpaqueLockToken lockToken)
 {
     throw new NotImplementedException();
 }
コード例 #15
0
 public override System.IO.Stream OpenRead(Mediachase.Net.Wdom.WebDavElementInfo element)
 {
     throw new NotImplementedException();
 }
コード例 #16
0
 public override System.IO.Stream OpenWrite(Mediachase.Net.Wdom.WebDavElementInfo element, long contentLength)
 {
     throw new NotImplementedException();
 }
コード例 #17
0
ファイル: FileStorageProvider.cs プロジェクト: alex765022/IBN
 public override Mediachase.Net.Wdom.WebDavElementInfo[] GetChildElements(Mediachase.Net.Wdom.WebDavElementInfo element)
 {
     throw new NotImplementedException();
 }
コード例 #18
0
        /// <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));
        }
コード例 #19
0
        /// <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);
        }
コード例 #20
0
 public override Mediachase.Net.Wdom.WebDavElementInfo[] GetChildElements(Mediachase.Net.Wdom.WebDavElementInfo element)
 {
     throw new Exception("The method or operation is not implemented.");
 }
コード例 #21
0
 public override void RefreshLock(Mediachase.Net.Wdom.WebDavElementInfo element, OpaqueLockToken lockToken, string timeout)
 {
     throw new NotImplementedException();
 }
コード例 #22
0
 public override IEnumerable <ActiveLockElement> GetActiveLocks(Mediachase.Net.Wdom.WebDavElementInfo element)
 {
     throw new NotImplementedException();
 }
コード例 #23
0
        /// <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);
        }
コード例 #24
0
 public override void CopyTo(Mediachase.Net.Wdom.WebDavElementInfo srcElement, Mediachase.Net.Wdom.WebDavElementInfo destElInfo)
 {
     throw new Exception("The method or operation is not implemented.");
 }
コード例 #25
0
 public override OpaqueLockToken Lock(Mediachase.Net.Wdom.DepthValue depth, string timeout, Mediachase.Net.Wdom.LockInfoElement lockInfoEl, Mediachase.Net.Wdom.WebDavElementInfo element)
 {
     throw new NotImplementedException();
 }