Пример #1
0
        internal SwDm3rdPartyStream(ISwDMDocument19 doc, string name, AccessType_e access)
            : base(AccessTypeHelper.GetIsWriting(access), false)
        {
            m_Doc      = doc;
            m_Name     = name;
            m_IsActive = false;

            try
            {
                var stream = m_Doc.Get3rdPartyStorage(name, AccessTypeHelper.GetIsWriting(access)) as IStream;

                if (stream != null)
                {
                    Load(stream);
                    m_IsActive = true;
                }
                else
                {
                    throw new Exception("Stream doesn't exist");
                }
            }
            catch
            {
                m_Doc.Release3rdPartyStorage(m_Name);
                throw;
            }

            Seek(0, SeekOrigin.Begin);
        }
        internal SwDm3rdPartyStorage(ISwDMDocument19 doc, string name, AccessType_e access)
            : base(AccessTypeHelper.GetIsWriting(access))
        {
            m_Doc      = doc;
            m_Name     = name;
            m_IsActive = false;

            try
            {
                var storage = m_Doc.Get3rdPartyStorageStore(name, AccessTypeHelper.GetIsWriting(access)) as IComStorage;

                if (storage != null)
                {
                    Load(storage);
                    m_IsActive = true;
                }
                else
                {
                    throw new Exception("Storage doesn't exist");
                }
            }
            catch
            {
                m_Doc.Release3rdPartyStorageStore(m_Name);
                throw;
            }
        }