コード例 #1
0
        public int LoadItems(object p)
        {
            if (t != null)
            {
                if (t.IsAlive)
                {
                    t.Abort();
                }
            }
            string D = "";
            string a = ((string)p);

            //if (a.Length == 36 && Directory.IndexOf("\\") == -1)
            //{
            //}
            //else
            {
                if (a != null && a is string)
                {
                    D         = directory + a + "\\";
                    Directory = Directory + a + "\\";
                    string[] split = Directory.Split(new Char[] { '\\' });
                    if ((split.Length == 2 || split.Length == 1) && ShowSharefile.NewSock != null)
                    {
                        ShowSharefile.NewSock.Close();
                        ShowSharefile.NewSock = null;
                    }
                }
                else
                {
                    if (Directory.IndexOf("\\") == -1 || Directory.LastIndexOf("\\") != Directory.Length - 1)
                    {
                        Directory = Directory + "\\";
                    }
                    if (LoadIDName != "")
                    {
                        string Lname = "";
                        if (Directory.IndexOf("\\") == -1)
                        {
                            Lname = Directory;
                        }
                        else
                        {
                            Lname = Directory.Substring(Directory.IndexOf("\\"));
                        }
                        if (LoadIDName.CompareTo(Lname) != 0)
                        {
                            ShowSharefile.NewSock.Close();
                            ShowSharefile.NewSock = null;
                        }
                    }
                    D = Directory;
                }
            }
            if (ShowSharefile.NewSock == null)
            {
                ShowSharefile.CreatSocket(D);
                _client.RequestOpenShareFolder((string)p, ShowSharefile.Port);
            }
            else
            {
                ParseDirectoryThread(D);
            }
            return(ShowSharefile.Port);
        }