示例#1
0
        internal override async Task <bool> ChangePermissionsync(SmartItem item, string permission)
        {
            SmartItem eitem;

            if (await _commandChmodAsync(item.FullName, permission))
            {
                eitem = GetServerItem(item.ItemName, item.ItemFolder);
                if (eitem != null)
                {
                    eitem.Status = ItemStatus.PermissionChanged;
                    TransferEvents.ItemStatusChanged(eitem);
                }

                AppHistory.Add(item.ItemName, item.ItemFolder, item.Permissions, permission, ItemStatus.PermissionChanged);
                item.Permissions = permission;
                return(true);
            }
            else if (await retryAsync())
            {
                return(await ChangePermissionsync(item, permission));
            }

            AppHistory.Add(item.ItemName, item.ItemFolder, item.Permissions, permission, ItemStatus.PermissionError);

            eitem = GetServerItem(item.ItemName, item.ItemFolder);
            if (eitem != null)
            {
                eitem.Status = ItemStatus.PermissionError;
                TransferEvents.ItemStatusChanged(eitem);
            }

            return(false);
        }
示例#2
0
        internal override async Task <bool> CreateFolderAsync(string name, string path, bool replaceSpaces = true)
        {
            if (path.NullEmpty())
            {
                return(false);
            }

            SmartItem item = GetServerItem(name, path);

            if (item == null)
            {
                item = InsertItem(new SmartItem(name, path, DateTime.Now.Ticks));
            }

            if (item != null)
            {
                item.Status = ItemStatus.Creating;
                TransferEvents.ItemStatusChanged(item);
            }

            bool created = await _createServerFolderAsync(path + name);

            AppHistory.Add(name, path, " ", path + name, (created) ? ItemStatus.Created : ItemStatus.CreateError);
            item = GetServerItem(name, path);
            if (item != null)
            {
                item.HasError = !created;
                item.Status   = (created) ? ItemStatus.Created : ItemStatus.CreateError;
                TransferEvents.ItemStatusChanged(item);
            }

            return(created);
        }
示例#3
0
        private void updateCurrentItem()
        {
            SmartItem item = client.TransferEvent.Item;

            LabelItemName.Text       = item.ItemName;
            ProgressBarCurrent.Value = 0.0;

            if (item.IsFile)
            {
                if (!ended)
                {
                    ButtonSkip.Visibility = Visibility.Visible;
                }
                GroupBoxCurrentX.Header    = AppLanguage.Get("LangGroupBoxCurrent_X").FormatC(0);
                cacher.CurrentSize         = item.FileSize;
                LabelCurrentSizeXY.Content = AppLanguage.Get("LangLabelTransferredSize_X_FromTotal_Y").FormatC(0, cacher.CurrentSize);
            }
            else
            {
                GroupBoxCurrentX.Header = AppLanguage.Get("LangGroupBoxCurrent_X").FormatC(100);
                ButtonSkip.Visibility   = Visibility.Hidden;
            }

            if (pathChanged.Changed)
            {
                LabelItemFrom.Text = pathChanged.From;
                LabelItemTo.Text   = pathChanged.To.Length > 1 ? pathChanged.To.TrimEnd('/') : pathChanged.To;
            }
        }
示例#4
0
        private void UpdateProgress()
        {
            SmartItem item = client.TransferEvent.Item;

            ProgressBarTotal.Value = (((client.TransferEvent.TotalTransferredFolders + client.TransferEvent.TotalTransferredFiles + client.TransferEvent.TotalSent) * 100) / maximum);

            if (!ended && (ProgressBarTotal.Value > 0))
            {
                if (client.TransferEvent.IsUpload)
                {
                    Title = AppLanguage.Get("LangTitleUploading_x").FormatC(ProgressBarTotal.Value);
                }
                else
                {
                    Title = AppLanguage.Get("LangTitleDownloading_x").FormatC(ProgressBarTotal.Value);
                }
            }

            if (!shrink.Shrinked)
            {
                ProgressBarCurrent.Value     = (item.Length == 0) ? 100 : client.TransferEvent.ItemSent * 100 / item.Length;
                GroupBoxCurrentX.Header      = AppLanguage.Get("LangGroupBoxCurrent_X").FormatC(ProgressBarCurrent.Value);
                LabelCurrentSizeXY.Content   = AppLanguage.Get("LangLabelTransferredSize_X_FromTotal_Y").FormatC(SizeUnit.Parse(client.TransferEvent.ItemSent), cacher.CurrentSize);
                LabelCurrentRemainsX.Content = AppLanguage.Get("LangLabelRemains_X").FormatC(SizeUnit.Parse(item.Length - client.TransferEvent.ItemSent));
                LabelTotalSizeXY.Content     = AppLanguage.Get("LangLabelTransferredSize_X_FromTotal_Y").FormatC(SizeUnit.Parse(client.TransferEvent.TotalSent), cacher.TotalSize);
                LabelTotalRemainsX.Content   = AppLanguage.Get("LangLabelRemains_X").FormatC(SizeUnit.Parse(client.TransferEvent.TotalSize - client.TransferEvent.TotalSent));
            }
        }
示例#5
0
        internal static void Rename(Window owner, SmartItem item, bool isLocal)
        {
            RenameWindow RW = new RenameWindow(owner, item.ItemName, item.Extension, isLocal);

            if ((bool)RW.ShowDialog())
            {
                if (isLocal)
                {
                    string newFullname = LocalHelper.CurrentPath + @"\" + RW.newName;

                    if (item.IsFile)
                    {
                        FileHelper.Rename(item.FullName, newFullname);
                    }
                    else
                    {
                        DirectoryHelper.Rename(item.FullName, newFullname);
                    }
                }
                else
                {
                    ClientHelper.RenameAsync(item, RW.newName);
                }
            }
        }
示例#6
0
        private async void goToLocalItem()
        {
            SmartItem item = LocalList.SelectedItem();

            if (item == null)
            {
                return;
            }

            if (item.IsFile)
            {
                if (item.Extension == "lnk")
                {
                    string path = ShellLinkHelper.GetPath(item.FullName);
                    if ((path != null) && DirectoryHelper.Exists(path))
                    {
                        await setLocalList(path);
                    }
                    else
                    {
                        try { System.Diagnostics.Process.Start(item.FullName); }
                        catch (Exception exp) { ExceptionHelper.Log(exp); }
                    }
                }
            }
            else
            {
                await setLocalList(item.FullName);
            }
        }
示例#7
0
 void ArchiveSearchForm_MouseDown(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Right)
     {
         m_currentContextItem = sender as SmartItem;
         contextMenuStrip1.Show(m_currentContextItem.ParentSmartControl.PointToScreen(new Point(e.X, e.Y)));
     }
 }
示例#8
0
            internal static async Task <SmartItem[]> ParseAsync(FTPClient client, string path, string rawItems)
            {
                if ((rawItems == null) || client.IsCanceled)
                {
                    return(null);
                }
                List <SmartItem> folders = new List <SmartItem>(0);

                await Task.Run(() =>
                {
                    string[] lines = rawItems.Split(rawSplit, StringSplitOptions.RemoveEmptyEntries);
                    rawItems       = null;

                    if (lines.Length != 0)
                    {
                        folders.Capacity = lines.Length;
                        Match match;
                        SmartItem item;

                        for (int j = 0; j < lines.Length; j++)
                        {
                            if (client.IsCanceled)
                            {
                                break;
                            }

                            string[] line = lines[j].Split(lineSplit, StringSplitOptions.None);

                            if (line.Length > 1)
                            {
                                if (line[1] == "." || line[1] == "..")
                                {
                                    continue;
                                }

                                try
                                {
                                    match = reg.Match(line[0]);
                                    while (match.Success)
                                    {
                                        if ((match.Groups["Key"].Value == "type") && (match.Groups["Value"].Value != "file"))
                                        {
                                            item        = new SmartItem(line[1], path);
                                            item.IsLink = (match.Groups["Value"].Value == "OS.unix=slink:");
                                            folders.Add(item);
                                        }
                                        match = match.NextMatch();
                                    }
                                }
                                catch (Exception exp) { ExceptionHelper.Log(exp); }
                            }
                        }
                    }
                    lines = null;
                });

                return(client.IsCanceled ? null : folders.ToArray());
            }
示例#9
0
        internal override async Task <bool> DeleteItemAsync(SmartItem item)
        {
            SmartItem eitem = GetServerItem(item.ItemName, item.ItemFolder);

            if (eitem != null)
            {
                eitem.Status = ItemStatus.Deleting;
                TransferEvents.ItemStatusChanged(eitem);
            }

            bool deleted = false;

            if (item.IsFile)
            {
                if (await _commandDeleAsync(item.FullName))
                {
                    deleted = true;
                }
            }
            else if (isRMDA)
            {
                if (await _commandRmdaAsync(item.FullName))
                {
                    deleted = true;
                }
            }
            else if (await _deleteFolderAsync(item.FullName))
            {
                deleted = true;
            }

            if (deleted)
            {
                AppHistory.Add(item.ItemName, item.ItemFolder, item.ItemFolder, " ", ItemStatus.Deleted);
                eitem = GetServerItem(item.ItemName, item.ItemFolder);
                if (eitem != null)
                {
                    Items.Remove(eitem);
                }

                return(true);
            }
            else if (await retryAsync())
            {
                return(await DeleteItemAsync(item));
            }

            AppHistory.Add(item.ItemName, item.ItemFolder, item.ItemFolder, " ", ItemStatus.DeleteError);

            eitem = GetServerItem(item.ItemName, item.ItemFolder);
            if (eitem != null)
            {
                eitem.Status = ItemStatus.DeleteError;
                TransferEvents.ItemStatusChanged(eitem);
            }

            return(false);
        }
示例#10
0
        private void goToServerItem()
        {
            SmartItem item = ServerList.SelectedItem();

            if ((item != null) && !item.IsFile)
            {
                goToServerPath(ClientHelper.CurrentPath + item.ItemName);
            }
        }
示例#11
0
            internal static async Task <SmartItem[]> ParseAsync(FTPClient client, string path, string rawItems)
            {
                if (rawItems == null)
                {
                    return(null);
                }
                List <SmartItem> folders = new List <SmartItem>();

                await Task.Run(() =>
                {
                    if (rawItems.Length > 8)
                    {
                        Match match;
                        SmartItem item;

                        try
                        {
                            if (!client.IsUnix.HasValue)
                            {
                                client.IsUnix = !isWinRegex.IsMatch(rawItems.Substring(0, 8));
                            }
                            match    = client.IsUnix.Value ? unix.Match(rawItems) : win.Match(rawItems);
                            rawItems = null;

                            while (match.Success)
                            {
                                if (client.IsCanceled)
                                {
                                    break;
                                }

                                if (client.IsUnix.Value && (match.Value[0] == 'l'))
                                {
                                    item        = new SmartItem(match.Groups["Name"].Value.Split(new string[] { "->" }, StringSplitOptions.RemoveEmptyEntries)[0].Trim(), path);
                                    item.IsLink = true;
                                }
                                else
                                {
                                    if ((match.Groups["Name"].Value.Length < 3) && ((match.Groups["Name"].Value == ".") || (match.Groups["Name"].Value == "..")))
                                    {
                                        match = match.NextMatch(); continue;
                                    }
                                    item = new SmartItem(match.Groups["Name"].Value, path);
                                }

                                folders.Add(item);
                                match = match.NextMatch();
                            }
                            match = null;
                        }
                        catch (Exception exp) { ExceptionHelper.Log(exp); }
                        match = null;
                    }
                });

                return(client.IsCanceled ? null : folders.ToArray());
            }
示例#12
0
        private async Task <SmartItem[]> _getServerItems(SmartItem dir, string destination, int parentID, int count)
        {
            List <SmartItem> downloadList = new List <SmartItem>();

            await Task.Run(async delegate
            {
                dir.Destination = destination;
                dir.ParentId    = parentID;
                downloadList.Add(dir);

                TransferEvent.TotalFolders++;
                parentID          = parentID + count + 1;
                SmartItem[] items = await getServerItemsAsync(dir.FullName + '/');

                if (items != null)
                {
                    for (int i = 0; i < items.Length; i++)
                    {
                        if (Paused)
                        {
                            while (Paused && !IsCanceled)
                            {
                                await Task.Delay(200);
                            }
                        }
                        if (IsCanceled)
                        {
                            break;
                        }
                        if (items[i].IsFile)
                        {
                            items[i].Destination = destination + dir.ItemName + '\\';
                            items[i].ParentId    = parentID;
                            downloadList.Add(items[i]);

                            TransferEvent.TotalSize += items[i].Length;
                            TransferEvent.TotalFiles++;
                        }
                        else
                        {
                            downloadList.AddRange(await _getServerItems(items[i], destination + dir.ItemName + '\\', parentID, downloadList.Count - 1));
                        }
                    }
                }
                items = null;
            });

            if (IsCanceled)
            {
                return new SmartItem[] { }
            }
            ;
            return(downloadList.ToArray());
        }
    }
示例#13
0
        private void MenuItemServerRename_Click(object sender, RoutedEventArgs e)
        {
            SmartItem item = ServerList.SelectedItem();

            if (item == null)
            {
                return;
            }

            RenameWindow.Rename(this, item, false);
        }
示例#14
0
        private void MenuItemLocalRename_Click(object sender, RoutedEventArgs e)
        {
            SmartItem item = LocalList.SelectedItem();

            if (item == null)
            {
                return;
            }

            RenameWindow.Rename(this, item, true);
        }
示例#15
0
        private void tsmCopyHistory_Click(object sender, EventArgs e)
        {
            if (m_currentContextItem == null)
            {
                return;
            }

            SearchHistoryInfo his = m_currentContextItem.Tag as SearchHistoryInfo;

            ClipboardHelper.CopyTextToClipboard(his.Expression);

            m_currentContextItem = null;
        }
示例#16
0
        List <SmartItem> FlattenTree(SmartItem root)
        {
            List <SmartItem> itemList = new List <SmartItem>();

            itemList.Add(root);
            SmartItem item = root.Items.GetFirstItem(SmartItemState.Any);

            while (item != null)
            {
                itemList.AddRange(FlattenTree(item).ToArray());
                item = root.Items.GetNextItem(item, SmartItemState.Any);
            }
            return(itemList);
        }
示例#17
0
        private async void MenuItemServerNewFolder_Click(object sender, RoutedEventArgs e)
        {
            ServerList.UnselectAll();
            string newFolder = await NewFolderWindow.New(this, false);

            if (!newFolder.NullEmpty())
            {
                SmartItem item = ClientHelper.GetItem(newFolder);
                if (item != null)
                {
                    ServerList.Focus();
                    ServerList.SelectedItem = item;
                }
            }
        }
示例#18
0
        internal void OnRequestingAction(SmartItem EItem, bool canResume)
        {
            timer1000.Stop();
            timer200.Stop();

            MiniProgressBar.SetStateColor(ProgressBarExtension.ProgressState.Paused);
            ButtonResume.Visibility = Visibility.Visible;
            ButtonPause.Visibility  = Visibility.Collapsed;
            ButtonSkip.Visibility   = Visibility.Hidden;

            new FileExistWindow(this, EItem, canResume).ShowDialog();

            ButtonSkip.Visibility   = Visibility.Visible;
            ButtonResume.Visibility = Visibility.Collapsed;
            ButtonPause.Visibility  = Visibility.Visible;
            MiniProgressBar.SetStateColor(ProgressBarExtension.ProgressState.Normal);
            timer1000.Start();
            timer200.Start();
        }
示例#19
0
        internal FileExistWindow(TransferWindow parent, SmartItem eItem, bool canResume)
        {
            this.Owner = TW = parent;
            InitializeComponent();

            this.ButtonResume.IsEnabled = canResume;

            SmartItem tItem = TW.client.TransferEvent.Item;

            if (eItem == null)
            {
                eItem = new SmartItem();
            }

            this.GroupBoxFileExist.Header = tItem.ItemName;

            TextBoxSource.DataContext = tItem;
            TextBoxTarget.DataContext = eItem;
        }
示例#20
0
        private bool searchServerItemName(object obj)
        {
            string search = TextBoxHostSearch.Text.Trim().Lower();

            if (search.Length == 0)
            {
                return(true);                    // the filter is empty - pass all items
            }
            SmartItem item = obj as SmartItem;

            if (item == null)
            {
                return(true);
            }

            if (item.ItemName.Lower().Contains(search))
            {
                return(true);
            }
            return(false);
        }
示例#21
0
        internal override async Task <bool> RenameItemAsync(SmartItem item, string toName)
        {
            string newName = item.ItemFolder + toName;

            SmartItem eitem = GetServerItem(item.ItemName, item.ItemFolder);

            if (eitem != null)
            {
                eitem.Status = ItemStatus.Renaming;
                TransferEvents.ItemStatusChanged(eitem);
            }

            if (await commandRnfrAsync(item.FullName) && await commandRntoAsync(newName))
            {
                AppHistory.Add(toName, item.ItemFolder, item.ItemName, toName, ItemStatus.Renamed);
                eitem = GetServerItem(item.ItemName, item.ItemFolder, null, true);
                if (eitem != null)
                {
                    eitem.ItemName = toName;
                    eitem.FullName = newName;
                    eitem.Status   = ItemStatus.Renamed;
                    TransferEvents.ItemStatusChanged(eitem);
                }
                return(true);
            }
            else if (await retryAsync())
            {
                return(await RenameItemAsync(item, toName));
            }
            AppHistory.Add(item.ItemName, item.ItemFolder, item.ItemName, toName, ItemStatus.RenameError);

            eitem = GetServerItem(item.ItemName, item.ItemFolder);
            if (eitem != null)
            {
                eitem.Status = ItemStatus.RenameError;
                TransferEvents.ItemStatusChanged(eitem);
            }

            return(false);
        }
示例#22
0
        internal override async Task <bool> MoveItemAsync(SmartItem item, string toPath)
        {
            SmartItem eitem = GetServerItem(item.ItemName, item.ItemFolder);

            if (eitem != null)
            {
                eitem.Status = ItemStatus.Moving;
                TransferEvents.ItemStatusChanged(eitem);
            }

            if (await commandRnfrAsync(item.FullName) && await commandRntoAsync(toPath + item.ItemName))
            {
                AppHistory.Add(item.ItemName, toPath, item.ItemFolder, toPath, ItemStatus.Moved);
                eitem = GetServerItem(item.ItemName, item.ItemFolder);
                if (eitem != null)
                {
                    Items.Remove(eitem);
                }
                return(true);
            }
            else if (await retryAsync())
            {
                return(await MoveItemAsync(item, toPath));
            }

            AppHistory.Add(item.ItemName, item.ItemFolder, item.ItemFolder, toPath, ItemStatus.MoveError);

            eitem = GetServerItem(item.ItemName, item.ItemFolder);
            if (eitem != null)
            {
                eitem.Status = ItemStatus.MoveError;
                TransferEvents.ItemStatusChanged(eitem);
            }

            return(false);
        }
        private void tsmCopyHistory_Click(object sender, EventArgs e)
        {
            if (m_currentContextItem == null)
                return;

            SearchHistoryInfo his = m_currentContextItem.Tag as SearchHistoryInfo;

            ClipboardHelper.CopyTextToClipboard(his.Expression);

            m_currentContextItem = null;
        }
 void ArchiveSearchForm_MouseDown(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Right)
     {
         m_currentContextItem = sender as SmartItem;
         contextMenuStrip1.Show(m_currentContextItem.ParentSmartControl.PointToScreen(new Point(e.X, e.Y)));
     }
 }
示例#25
0
            internal static async Task <SmartItem[]> ParseAsync(FTPClient client, string path, string rawItems)
            {
                if ((rawItems == null) || client.IsCanceled)
                {
                    return(null);
                }

                List <SmartItem> list = new List <SmartItem>();

                if (rawItems.Length > 8)
                {
                    await Task.Run(() =>
                    {
                        SmartItem item;
                        Match match;
                        DateTime date;
                        string[] dateFormats;
                        string nowYear  = ' ' + DateTime.UtcNow.Year.StringInv();
                        string modified = string.Empty;

                        try
                        {
                            if (!client.IsUnix.HasValue)
                            {
                                client.IsUnix = !isWinRegex.IsMatch(rawItems.Substring(0, 8));
                            }

                            if (client.IsUnix.Value)
                            {
                                match       = unix.Match(rawItems);
                                dateFormats = dateFormatsUnix;
                            }
                            else
                            {
                                match       = win.Match(rawItems);
                                dateFormats = dateFormatsWin;
                            }

                            rawItems = null;

                            int x = -1;
                            while (match.Success)
                            {
                                if (client.IsCanceled)
                                {
                                    break;
                                }

                                item     = new SmartItem(match.Groups["Name"].Value, path);
                                modified = match.Groups["Modified"].Value;
                                if (client.IsUnix.Value)
                                {
                                    int t = modified.Index(":");
                                    if ((t > 0) && (t > 3))
                                    {
                                        modified = modified.Insert(6, nowYear);
                                    }

                                    switch (match.Value[0])
                                    {
                                    case 'd':
                                        if ((match.Groups["Name"].Value.Length < 3) && ((match.Groups["Name"].Value == ".") || (match.Groups["Name"].Value == "..")))
                                        {
                                            match = match.NextMatch(); continue;
                                        }
                                        break;

                                    case 'l':
                                        item        = new SmartItem(match.Groups["Name"].Value.Split(new string[] { "->" }, StringSplitOptions.RemoveEmptyEntries)[0].Trim(), path);
                                        item.IsLink = true;
                                        break;

                                    default:
                                        item.IsFile = true;
                                        break;
                                    }

                                    item.Permissions = PermParser.ParseText(match.Groups["Permissions"].Value);
                                }
                                else
                                {
                                    item.IsFile = (match.Groups["Length"].Value != "<DIR>");
                                }

                                if (modified.DateInvCulture(dateFormats, out date))
                                {
                                    item.Modified = date.ToLocalTime().Ticks;
                                }

                                if (item.IsFile)
                                {
                                    item.Length = match.Groups["Length"].Value.Long();
                                    list.Add(item);
                                }
                                else
                                {
                                    list.Insert(++x, item);
                                }

                                match = match.NextMatch();
                            }
                        }
                        catch (Exception exp) { ExceptionHelper.Log(exp); }
                        match = null;
                    });
                }

                return(client.IsCanceled ? null : list.ToArray());
            }
示例#26
0
            internal static async Task <SmartItem[]> ParseAsync(FTPClient client, string path, string rawItems)
            {
                if ((rawItems == null) || client.IsCanceled)
                {
                    return(null);
                }

                List <SmartItem> list = new List <SmartItem>(0);

                await Task.Run(() =>
                {
                    string[] lines = rawItems.Split(rawSplit, StringSplitOptions.None);
                    rawItems       = null;

                    if (lines.Length != 0)
                    {
                        list.Capacity = lines.Length;
                        Match match;
                        SmartItem item;
                        DateTime date;
                        int x = -1;

                        for (int j = 0; j < lines.Length; j++)
                        {
                            if (client.IsCanceled)
                            {
                                break;
                            }

                            string[] line = lines[j].Split(lineSplit, StringSplitOptions.None);

                            if (line.Length > 1)
                            {
                                if (line[1] == "." || line[1] == "..")
                                {
                                    continue;
                                }
                                item = new SmartItem(line[1], path);

                                try
                                {
                                    match = reg.Match(line[0]);
                                    while (match.Success)
                                    {
                                        switch (match.Groups["Key"].Value)
                                        {
                                        case "type":
                                            item.IsFile = (match.Groups["Value"].Value == "file");
                                            item.IsLink = (!item.IsFile && (match.Groups["Value"].Value == "OS.unix=slink:"));
                                            break;

                                        case "modify":
                                            if (match.Groups["Value"].Value.DateInvCulture("yyyyMMddHHmmss", out date))
                                            {
                                                item.Modified = date.ToLocalTime().Ticks;
                                            }
                                            break;

                                        case "size":
                                            item.Length = match.Groups["Value"].Value.Long();
                                            break;

                                        case "UNIX.mode":
                                            item.Permissions = match.Groups["Value"].Value.Remove(0, 1);
                                            break;
                                        }
                                        match = match.NextMatch();
                                    }

                                    if (item.IsFile)
                                    {
                                        list.Add(item);
                                    }
                                    else
                                    {
                                        list.Insert(++x, item);
                                    }
                                }
                                catch (Exception exp) { ExceptionHelper.Log(exp); }
                            }
                        }

                        if (!client.IsUnix.HasValue && (list.Count > 0))
                        {
                            client.IsUnix = !list[0].Permissions.NullEmpty();
                        }
                    }
                    lines = null;
                });

                return(client.IsCanceled ? null : list.ToArray());
            }
        private void CreateShortcutBar(IEnumerable<MenuInfo> topMenuInfos, SmartItem parent)
        {
            foreach (MenuInfo info in topMenuInfos)
            {
                if (!Authority.AuthorizeByRule(info.Visible))
                {
                    continue;
                }

                SmartItem nowItem;
                if (info.ChildMenus.Count == 0 && info.Action != null)
                {
                    if (parent == null)
                    {
                        if (m_defaultGroup == null)
                        {
                            m_defaultGroup = new Group("Default");
                            m_defaultGroup.Text = "Default";
                            m_defaultGroup.ToolTipText = "Default";
                            m_defaultGroup.TextPosition = TextPosition.Bottom;
                            m_defaultGroup.Items.VerticalScrollBarVisibility = ScrollBarVisibility.VisibleWhenNeeded;
                            m_defaultGroup.Items.ScrollBarStyle = ScrollBarStyle.Standard;
                            this.smartOutlookShortcutBar1.Items.Add(m_defaultGroup);
                            nowItem = m_defaultGroup;
                        }
                        parent = m_defaultGroup;
                    }
                }

                if (parent == null)
                {
                    Group group = new Group(info.Name);
                    group.Text = info.Text;
                    group.ToolTipText = info.Help;
                    group.TextPosition = TextPosition.Bottom;
                    group.Items.VerticalScrollBarVisibility = ScrollBarVisibility.VisibleWhenNeeded;
                    group.Items.ScrollBarStyle = ScrollBarStyle.Standard;
                    this.smartOutlookShortcutBar1.Items.Add(group);
                    nowItem = group;
                }
                else
                {
                    Xceed.SmartUI.Controls.OutlookShortcutBar.Shortcut item = new Xceed.SmartUI.Controls.OutlookShortcutBar.Shortcut(info.Name);
                    item.Text = info.Text;
                    item.ToolTipText = info.Help;
                    parent.Items.Add(item);
                    nowItem = item;

                    if (info.ChildMenus.Count == 0)
                    {
                        item.Click += new SmartItemClickEventHandler(ShortCutItem_Click);
                    }
                }

                if (!string.IsNullOrEmpty(info.ImageName))
                {
                    nowItem.Image = Feng.Windows.ImageResource.Get("Icons." + info.ImageName + ".png").Reference;
                }
                if (nowItem.Image == null)
                {
                    nowItem.Image = GetDefaultImage(info);
                }

                nowItem.Visible = Authority.AuthorizeByRule(info.Visible);
                //if (info.Shortcut.HasValue)
                //{
                //    nowItem.ShortcutKeys = info.Shortcut.Value;
                //}

                nowItem.Tag = info;

                CreateShortcutBar(info.ChildMenus, nowItem);
            }
        }