SharpCifs.Smb.SmbFile.GetType C# (CSharp) Method

GetType() public method

Returns type of of object this SmbFile represents.
Returns type of of object this SmbFile represents.
public GetType ( ) : int
return int
        public new virtual int GetType()
        {
            if (Type == 0)
            {
                if (GetUncPath0().Length > 1)
                {
                    Type = TypeFilesystem;
                }
                else
                {
                    if (_share != null)
                    {
                        // treeConnect good enough to test service type
                        Connect0();
                        if (_share.Equals("IPC$"))
                        {
                            Type = TypeNamedPipe;
                        }
                        else
                        {
                            if (Tree.Service.Equals("LPT1:"))
                            {
                                Type = TypePrinter;
                            }
                            else
                            {
                                if (Tree.Service.Equals("COMM"))
                                {
                                    Type = TypeComm;
                                }
                                else
                                {
                                    Type = TypeShare;
                                }
                            }
                        }
                    }
                    else
                    {
                        if (string.IsNullOrEmpty(Url.Authority))
                        {
                            Type = TypeWorkgroup;
                        }
                        else
                        {
                            UniAddress addr;
                            try
                            {
                                addr = GetAddress();
                            }
                            catch (UnknownHostException uhe)
                            {
                                throw new SmbException(Url.ToString(), uhe);
                            }
                            if (addr.GetAddress() is NbtAddress)
                            {
                                int code = ((NbtAddress)addr.GetAddress()).GetNameType();
                                if (code == 0x1d || code == 0x1b)
                                {
                                    Type = TypeWorkgroup;
                                    return Type;
                                }
                            }
                            Type = TypeServer;
                        }
                    }
                }
            }
            return Type;
        }