public static void addShortcut(BoxFile _boxFile, string _groupName)
        {
            _boxFile.Key = BoxFileData.getUniqueKey(_boxFile.Name);
            if (existShortcut(_boxFile.Key, _groupName))
            {
                return;
            }

            var data     = BoxFileData.STATIC_Shortcuts.Where(o => o.Key.Key == BoxFileData.getUniqueKey(_groupName)).FirstOrDefault();
            var boxGroup = data.Key;
            var boxFiles = data.Value;

            if (boxFiles == null)
            {
                BoxFileData.STATIC_Shortcuts.Remove(boxGroup);

                boxFiles = new List <BoxFile>();
                boxFiles.Add(_boxFile);

                BoxFileData.STATIC_Shortcuts.Add(boxGroup, boxFiles);
            }
            else
            {
                boxFiles.Add(_boxFile);
            }

            BoxFileData.SaveShortcut();
        }
        public static void deleteBoxGroup(string oldGroupName)
        {
            var data        = BoxFileData.STATIC_Shortcuts.Where(o => o.Key.Key == BoxFileData.getUniqueKey(oldGroupName)).FirstOrDefault();
            var oldBoxGroup = data.Key;

            BoxFileData.STATIC_Shortcuts.Remove(oldBoxGroup);

            BoxFileData.SaveShortcut();
        }
        public static void addBoxGroup(string _groupName)
        {
            BoxFileData.STATIC_Shortcuts.Add(new BoxGroup()
            {
                Key = BoxFileData.getUniqueKey(_groupName), Name = _groupName
            }, null);

            BoxFileData.SaveShortcut();
        }
示例#4
0
        public static void deleteLikeShortcut(BoxFile _boxFile)
        {
            if (!existLikeShortcut(_boxFile.Key))
            {
                return;
            }

            BoxFileData.STATIC_LikeShortcuts.Remove(_boxFile);

            BoxFileData.SaveLikeShortcut();
        }
示例#5
0
        public static void addLikeShortcut(BoxFile _boxFile)
        {
            _boxFile.Key = BoxFileData.getUniqueKey(_boxFile.Name);

            if (existLikeShortcut(_boxFile.Key))
            {
                return;
            }

            BoxFileData.STATIC_LikeShortcuts.Add(_boxFile);

            BoxFileData.SaveLikeShortcut();
        }
        public static void updateShortcut(string _fileKey, string name, string _groupName)
        {
            if (!existShortcut(_fileKey, _groupName))
            {
                return;
            }

            var data     = BoxFileData.STATIC_Shortcuts.Where(o => o.Key.Key == BoxFileData.getUniqueKey(_groupName)).FirstOrDefault();
            var _boxFile = data.Value.Where(o => o.Key == _fileKey).FirstOrDefault();

            _boxFile.Name = name;

            BoxFileData.SaveShortcut();
        }
        private static bool existShortcut(string _fileKey, string _groupName)
        {
            var data     = BoxFileData.STATIC_Shortcuts.Where(o => o.Key.Key == BoxFileData.getUniqueKey(_groupName)).FirstOrDefault();
            var boxGroup = data.Key;
            var boxFiles = data.Value;

            if (boxFiles == null)
            {
                return(false);
            }
            else
            {
                return(boxFiles.Where(o => o.Key == _fileKey).FirstOrDefault() != null);
            }
        }
        public static void updateShortcut(string _fileKey, Bitmap largeIcon, Bitmap smallIcon, string _groupName)
        {
            if (!existShortcut(_fileKey, _groupName))
            {
                return;
            }

            var data     = BoxFileData.STATIC_Shortcuts.Where(o => o.Key.Key == BoxFileData.getUniqueKey(_groupName)).FirstOrDefault();
            var _boxFile = data.Value.Where(o => o.Key == _fileKey).FirstOrDefault();

            _boxFile.LargeIcon = largeIcon;
            _boxFile.SmallIcon = smallIcon;

            BoxFileData.SaveShortcut();
        }
        public static void updateBoxGroup(string oldGroupName, string newGroupName)
        {
            var data        = BoxFileData.STATIC_Shortcuts.Where(o => o.Key.Key == BoxFileData.getUniqueKey(oldGroupName)).FirstOrDefault();
            var oldBoxGroup = data.Key;
            var newBoxGroup = new BoxGroup()
            {
                Key = BoxFileData.getUniqueKey(newGroupName), Name = newGroupName
            };
            var newBoxFileItems = data.Value;

            BoxFileData.STATIC_Shortcuts.Remove(oldBoxGroup);
            BoxFileData.STATIC_Shortcuts.Add(newBoxGroup, newBoxFileItems);

            BoxFileData.SaveShortcut();
        }
示例#10
0
        public static IList <BoxFile> getShortcuts(string _groupName)
        {
            var boxFiles = BoxFileData.STATIC_Shortcuts.Where(o => o.Key.Key == BoxFileData.getUniqueKey(_groupName)).FirstOrDefault().Value;

            return(boxFiles == null ? null : boxFiles.OrderBy(o => o.Name).ToList());
        }