Ejemplo n.º 1
0
        public void AddSharedFolder(string sharedFolderUid)
        {
            if (IsFullSync)
            {
                return;
            }
            if (SharedFolders == null)
            {
                SharedFolders = new HashSet <string>();
            }

            SharedFolders.Add(sharedFolderUid);
        }
Ejemplo n.º 2
0
        public void RemoveFolder(FileData data)
        {
            FolderMap.Remove(data.Id);
            SharedFolders.Remove(data);

            try
            {
                Thread thread = new Thread(new ParameterizedThreadStart(RemoveFiles))
                {
                    Priority = ThreadPriority.BelowNormal, IsBackground = true
                };
                thread.Start(data);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Ejemplo n.º 3
0
        public override void Write(XmlWriter writer)
        {
            writer.WriteStartElement(XmlRoot);
            writer.WriteAttributeString(XmlTag.Enabled, Enabled.ToString());

            writer.WriteElementString(XmlTag.Id, Id);
            writer.WriteElementString(XmlTag.Name, Name);
            writer.WriteElementString(XmlTag.GroupImage, GroupPath);
            writer.WriteElementString(XmlTag.DownloadFolder, DownloadFolder);
            Router.Write(writer);

            SharedFolders.Sort();
            foreach (FileData data in SharedFolders)
            {
                writer.WriteElementString(XmlTag.Folder, data.Path);
            }

            writer.WriteEndElement();
        }
Ejemplo n.º 4
0
        // Interface
        public override void Clear()
        {
            base.Clear();

            Name = Default.Name;

            Group.Clear();
            Router.Clear();
            DownloadFolder = FileUtil.GetDownloadFolder();

            lock (SharedFolders)
                SharedFolders.Clear();

            lock (FileMap)
                FileMap.Clear();

            lock (FolderMap)
                FolderMap.Clear();
        }
Ejemplo n.º 5
0
 /// <summary>
 /// A shared folder enumerator.
 /// </summary>
 /// <returns>Shared folders enumerator.</returns>
 IEnumerator IEnumerable.GetEnumerator()
 {
     return(SharedFolders.GetEnumerator());
 }
Ejemplo n.º 6
0
 /// <summary>
 /// A shared folder enumerator.
 /// </summary>
 /// <returns>Shared folders enumerator.</returns>
 IEnumerator <VMWareSharedFolder> IEnumerable <VMWareSharedFolder> .GetEnumerator()
 {
     return(SharedFolders.GetEnumerator());
 }
Ejemplo n.º 7
0
 public string GetSharedFolderPathWithName(string name)
 {
     return(SharedFolders.ContainsKey(name) ? SharedFolders[name]: "");
 }
        public void PopulateGridView(SharedFolders[] results, string given_name, int rowcount)
        {

            foreach (var result in results)
            {
                bool isThereAlready = CheckFolderIDExist(result.shared_folder_id);

                if (!isThereAlready)
                {


                    if (chkTeamFoldersOnly.Checked == false)
                    {
                        if (result.owner == null || result.owner.same_team == true)
                        {
                            var rowcount2 = DVGResults.Rows.Add();

                            DVGResults.Rows[rowcount2].Cells[0].Value = result.shared_folder_name;
                            if (result.owner != null)
                            {
                                DVGResults.Rows[rowcount2].Cells[1].Value = result.owner.display_name;
                            }
                            else
                            {
                                DVGResults.Rows[rowcount2].Cells[1].Value = "No owner";
                            }
                            DVGResults.Rows[rowcount2].Cells[2].Value = result.shared_folder_id;

                            StringBuilder sb = new StringBuilder();

                            int differentteam = 0;
                            foreach (var member in result.membership)
                            {
                                User mem = (User)member.user;
                                if (mem.same_team == false)
                                {
                                    differentteam += 1;
                                }
                            }

                            if (result.membership.Count != 0)
                            {

                                int intcounter = 0;
                                foreach (var member in result.membership)
                                {
                                    User mem = (User)member.user;

                                    if (chkExternalAccess.Checked)
                                    {
                                        if (mem.same_team == false)
                                        {
                                            sb.Append(mem.display_name);

                                            if (intcounter != differentteam - 1 && differentteam != 1)
                                            {
                                                sb.Append(" | ");
                                                intcounter++;
                                            }
                                        }
                                    }
                                    else
                                    {
                                        sb.Append(mem.display_name);

                                        if (intcounter != result.membership.Count - 1 && result.membership.Count != 1)
                                        {
                                            sb.Append(" | ");
                                            intcounter++;
                                        }
                                    }

                                }
                            }
                            else
                            {
                                DVGResults.Rows.Remove(DVGResults.Rows[rowcount2]);
                            }

                            if (chkExternalAccess.Checked)
                            {
                                if (sb.ToString().Length != 0 || differentteam != 0)
                                {
                                    DVGResults.Rows[rowcount2].Cells[3].Value = sb.ToString();
                                }
                                else
                                {
                                    DVGResults.Rows.Remove(DVGResults.Rows[rowcount2]);
                                }

                            }
                            else
                            {
                                if (sb.ToString().Length != 0)
                                {
                                    DVGResults.Rows[rowcount2].Cells[3].Value = sb.ToString();
                                }
                                else
                                {
                                    DVGResults.Rows.Remove(DVGResults.Rows[rowcount2]);
                                }
                            }
                        }

                    }

                }

                if (chkTeamFoldersOnly.Checked)
                {
                    var rowcount2 = DVGResults.Rows.Add();

                    DVGResults.Rows[rowcount2].Cells[0].Value = result.shared_folder_name;
                    if (result.owner != null)
                    {
                        DVGResults.Rows[rowcount2].Cells[1].Value = result.owner.display_name;
                    }
                    else
                    {
                        DVGResults.Rows[rowcount2].Cells[1].Value = "No owner";
                    }
                    DVGResults.Rows[rowcount2].Cells[2].Value = result.shared_folder_id;

                    StringBuilder sb = new StringBuilder();

                    int differentteam = 0;
                    foreach (var member in result.membership)
                    {
                        User mem = (User)member.user;
                        if (mem.same_team == false)
                        {
                            differentteam += 1;
                        }
                    }

                    if (result.membership.Count != 0)
                    {
                        var intcounter = 0;

                        foreach (var member in result.membership)
                        {
                            User mem = (User)member.user;

                            if (chkExternalAccess.Checked)
                            {
                                if (mem.same_team == false)
                                {
                                    sb.Append(mem.display_name);

                                    if (intcounter != differentteam - 1 && differentteam != 1)
                                    {
                                        sb.Append(" | ");
                                        intcounter++;
                                    }
                                }
                            }
                            else
                            {
                                sb.Append(mem.display_name);

                                if (intcounter != result.membership.Count - 1 && result.membership.Count != 1)
                                {
                                    sb.Append(" | ");
                                    intcounter++;
                                }
                            }

                        }
                    }
                    else
                    {
                        DVGResults.Rows.Remove(DVGResults.Rows[rowcount2]);
                    }

                    if (chkExternalAccess.Checked)
                    {
                        if (sb.ToString().Length != 0 || differentteam != 0)
                        {
                            DVGResults.Rows[rowcount2].Cells[3].Value = sb.ToString();
                        }
                        else
                        {
                            DVGResults.Rows.Remove(DVGResults.Rows[rowcount2]);
                        }

                    }
                    else
                    {
                        if (sb.ToString().Length != 0)
                        {
                            DVGResults.Rows[rowcount2].Cells[3].Value = sb.ToString();
                        }
                        else
                        {
                            DVGResults.Rows.Remove(DVGResults.Rows[rowcount2]);
                        }
                    }


                }
            }

        }
 public async Task GridView(SharedFolders[] results, string given_name, int rowcount)
 {
     SetGridViewColumns();
     PopulateGridView(results,given_name, rowcount);
 }