public static void RecordSecurityData(DirectoryInfo di, List <DirSec> dirs, string path, string fullPath)
        {
            DirSec            me = new DirSec(fullPath);
            DirectorySecurity ds;
            NetworkDrive      nd = null;

            if (path.Length <= 248)
            {
                ds = Directory.GetAccessControl(path);
            }
            else
            {
                nd            = new NetworkDrive();
                nd.LocalDrive = "X:";
                nd.ShareName  = path;
                nd.MapDrive();
                path = @"X:\";
                di   = new DirectoryInfo(path);
                ds   = Directory.GetAccessControl(path);
            }
            foreach (AuthorizationRule ar in ds.GetAccessRules(true, true, typeof(System.Security.Principal.NTAccount)))
            {
                me.AddUser(ar.IdentityReference.Value);
            }
            dirs.Add(me);
            foreach (DirectoryInfo child in di.GetDirectories())
            {
                RecordSecurityData(child, dirs, path + @"\" + child.Name, fullPath + @"\" + child.Name);
            }
            if (nd != null)
            {
                nd.UnMapDrive();
            }
        }
            public bool IsSameUserList(DirSec other)
            {
                bool isSame = false;

                if (this.UserList.Count == other.UserList.Count)
                {
                    isSame = true;
                    foreach (string myUser in this.UserList)
                    {
                        if (!other.UserList.Contains(myUser))
                        {
                            isSame = false;
                            break;
                        }
                    }
                }
                return(isSame);
            }