ExtensionFile.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ DotNET / DotNET / 8.0 / untmp / Orcas / RTM / ndp / fx / src / xsp / System / Web / Extensions / Compilation / WCFModel / ExtensionFile.cs / 1 / ExtensionFile.cs

                            //------------------------------------------------------------------------------ 
// 
//   Copyright (C) Microsoft Corporation. All Rights Reserved.
// 
//----------------------------------------------------------------------------- 
//
// This code is shared between ndp\fx\src\xsp\System\Web\Extensions\Compilation\WCFModel 
//   and wizard\vsdesigner\designer\microsoft\vsdesigner\WCFModel. 
//    Please make sure the code files between those two directories are alway in sync when you make any changes to this code.
//    And always test these code in both places before check in. 
//  The code under ndp\fx\src\xsp\System\Web\Extensions\Compilation\XmlSerializer might have to be regerenated when
//   the format of the svcmap file is changed, or class structure has been changed in this directory. Please follow the HowTo file
//   under Compilation directory to see how to regerenate that code.
// 

using System; 
using System.Collections; 
using System.Diagnostics;
using System.Globalization; 
using System.IO;

using XmlSerialization = System.Xml.Serialization;
 
#if WEB_EXTENSIONS_CODE
namespace System.Web.Compilation.WCFModel 
#else 
namespace Microsoft.VSDesigner.WCFModel
#endif 
{

    /// 
    /// This class presents a single file referenced by a svcmap file 
    /// 
    ///  
#if WEB_EXTENSIONS_CODE 
    internal class ExtensionFile : ExternalFile
#else 
    [CLSCompliant(true)]
    public class ExtensionFile : ExternalFile
#endif
    { 
        // Extension Item Name
        private string m_Name; 
 
        // content buffer
        private byte[] m_ContentBuffer; 

        /// 
        /// Constructor
        ///  
        ///  Must support a default construct for XmlSerializer
        public ExtensionFile() 
        { 
            m_Name = string.Empty;
        } 

        /// 
        /// Constructor
        ///  
        /// name of extension item
        /// Suggested File Name 
        public ExtensionFile(string name, string fileName, byte[] content) : base(fileName) 
        {
            this.Name = name; 
            m_ContentBuffer = content;

            IsExistingFile = false;
        } 

        ///  
        /// Content of the extension file 
        /// 
        ///  
        /// 
        [XmlSerialization.XmlIgnore()]
        public byte[] ContentBuffer
        { 
            get
            { 
                return m_ContentBuffer; 
            }
            set 
            {
                m_ContentBuffer = value;
                ErrorInLoading = null;
            } 
        }
 
        ///  
        /// whether the content is buffered
        ///  
        /// 
        /// 
        internal bool IsBufferValid
        { 
            get
            { 
                return (m_ContentBuffer != null); 
            }
        } 

        /// 
        /// Name in the storage
        ///  
        /// 
        ///  
        [XmlSerialization.XmlAttribute()] 
        public string Name
        { 
            get
            {
                return m_Name;
            } 
            set
            { 
                if (value == null) 
                {
                    throw new ArgumentNullException("value"); 
                }
                m_Name = value;
            }
        } 

        ///  
        ///  the function is called when the metadata is removed, and we need clean up the content 
        /// 
        ///  
        internal void CleanUpContent()
        {
            ErrorInLoading = null;
            m_ContentBuffer = null; 
        }
 
    } 
}
 

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.


                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK