Esempio n. 1
0
        private void FileSystemWatcherOnDeleted(object sender, FileSystemEventArgs e)
        {
            string name = Path.GetFileNameWithoutExtension(e.Name);

            if (Path.GetExtension(e.Name) != ".rpk")
            {
                return;
            }

            Application.Current.Dispatcher.Invoke(() =>
            {
                ResourcePacks.Remove(name);
            });
        }
Esempio n. 2
0
        private void RemoveSelected()
        {
            if (string.IsNullOrWhiteSpace(SelectedResourcePack))
            {
                return;
            }

            int index = ResourcePacks.IndexOf(SelectedResourcePack) - 1;

            ResourcePacks.Remove(SelectedResourcePack);
            if (index < 0)
            {
                return;
            }
            SelectedResourcePack = ResourcePacks[index];
        }
Esempio n. 3
0
        private void FileSystemWatcherOnRenamed(object sender, RenamedEventArgs e)
        {
            string oldName = Path.GetFileNameWithoutExtension(e.OldName);
            string newName = Path.GetFileNameWithoutExtension(e.Name);

            Application.Current.Dispatcher.Invoke(() =>
            {
                if (Path.GetExtension(e.OldName) == ".rpk")
                {
                    ResourcePacks.Remove(oldName);
                }
                if (Path.GetExtension(e.Name) == ".rpk")
                {
                    ResourcePacks.Add(newName);
                }
            });
        }