IsWorkgroup0() private method

private IsWorkgroup0 ( ) : bool
return bool
Beispiel #1
0
        /// <summary>
        /// Constructs an SmbFile representing a resource on an SMB network such
        /// as a file or directory.
        /// </summary>
        /// <remarks>
        /// Constructs an SmbFile representing a resource on an SMB network such
        /// as a file or directory. The second parameter is a relative path from
        /// the <code>context</code>. See the description above for examples of
        /// using the second <code>name</code> parameter. The <tt>shareAccess</tt>
        /// parameter controls what permissions other clients have when trying
        /// to access the same file while this instance is still open. This
        /// value is either <tt>FILE_NO_SHARE</tt> or any combination
        /// of <tt>FILE_SHARE_READ</tt>, <tt>FILE_SHARE_WRITE</tt>, and
        /// <tt>FILE_SHARE_DELETE</tt> logically OR'd together.
        /// </remarks>
        /// <param name="context">A base <code>SmbFile</code></param>
        /// <param name="name">A path string relative to the <code>context</code> file path</param>
        /// <param name="shareAccess">Specifies what access other clients have while this file is open.
        /// 	</param>
        /// <exception cref="System.UriFormatException">
        /// If the <code>context</code> and <code>name</code> parameters
        /// do not follow the prescribed syntax
        /// </exception>
        /// <exception cref="UnknownHostException"></exception>
        public SmbFile(SmbFile context, string name, int shareAccess)
            : this(context.IsWorkgroup0() ? new Uri("smb://" + name) : new Uri(
                          context.Url.AbsoluteUri + name), context.Auth)
        {
            if ((shareAccess & ~(FileShareRead | FileShareWrite | FileShareDelete)) !=
                0)
            {
                throw new RuntimeException("Illegal shareAccess parameter");
            }

            if (!context.IsWorkgroup0())
            {
                this.Addresses = context.Addresses;

                if (context._share != null || context.Tree != null)
                {
                    Tree = context.Tree;
                    _dfsReferral = context._dfsReferral;
                }
            }

            this._shareAccess = shareAccess;
            this._enableDfs = context.EnableDfs;
        }
Beispiel #2
0
        /// <exception cref="System.UriFormatException"></exception>
        /// <exception cref="UnknownHostException"></exception>
        /*internal SmbFile(Jcifs.Smb.SmbFile context, string name, int type, int attributes
            , long createTime, long lastModified, long size)
            : this(context.IsWorkgroup0() ?
                new Uri(null, "smb://" + name + "/") : new Uri(context.url,
                name + ((attributes & ATTR_DIRECTORY) > 0 ? "/" : string.Empty)))*/
        internal SmbFile(SmbFile context, string name, int type, int attributes
            , long createTime, long lastModified, long size)
            : this(context.IsWorkgroup0() ?
                new Uri("smb://" + name + "/") : new Uri(context.Url.AbsoluteUri +
                name + ((attributes & AttrDirectory) > 0 ? "/" : string.Empty)))
        {
            Auth = context.Auth;
            if (context._share != null)
            {
                Tree = context.Tree;
                _dfsReferral = context._dfsReferral;
            }
            int last = name.Length - 1;
            if (name[last] == '/')
            {
                name = Runtime.Substring(name, 0, last);
            }
            if (context._share == null)
            {
                Unc = "\\";
            }
            else
            {
                if (context.Unc.Equals("\\"))
                {
                    Unc = '\\' + name;
                }
                else
                {
                    Unc = context.Unc + '\\' + name;
                }
            }

            if (!context.IsWorkgroup0())
            {
                Addresses = context.Addresses;
            }

            this._enableDfs = context.EnableDfs;

            this.Type = type;
            this._attributes = attributes;
            this._createTime = createTime;
            this._lastModified = lastModified;
            this._size = size;
            _isExists = true;
            _attrExpiration = _sizeExpiration = Runtime.CurrentTimeMillis() + AttrExpirationPeriod;
        }
Beispiel #3
0
        /// <summary>
        /// Constructs an SmbFile representing a resource on an SMB network such
        /// as a file or directory.
        /// </summary>
        /// <remarks>
        /// Constructs an SmbFile representing a resource on an SMB network such
        /// as a file or directory. The second parameter is a relative path from
        /// the <code>parent SmbFile</code>. See the description above for examples
        /// of using the second <code>name</code> parameter.
        /// </remarks>
        /// <param name="context">A base <code>SmbFile</code></param>
        /// <param name="name">A path string relative to the <code>parent</code> paremeter</param>
        /// <exception cref="System.UriFormatException">
        /// If the <code>parent</code> and <code>child</code> parameters
        /// do not follow the prescribed syntax
        /// </exception>
        /// <exception cref="UnknownHostException">If the server or workgroup of the <tt>context</tt> file cannot be determined
        /// 	</exception>
        public SmbFile(SmbFile context, string name)
            : this(context.IsWorkgroup0
                () ? new Uri("smb://" + name) : new Uri(context.Url.AbsoluteUri + name),
                context.Auth)
        {

            this._enableDfs = context.EnableDfs;

            if (!context.IsWorkgroup0())
            {
                Addresses = context.Addresses;

                if (context._share != null)
                {
                    Tree = context.Tree;
                    _dfsReferral = context._dfsReferral;
                }                
            }
        }