示例#1
0
        private void LoadFiles()
        {
            ResourcePacks.Clear();

            foreach (var file in Directory.GetFiles(_pathService.ResourcePackDirectory, "*.rpk"))
            {
                ResourcePacks.Add(Path.GetFileNameWithoutExtension(file));
            }
        }
示例#2
0
        private void AddPackage()
        {
            if (string.IsNullOrWhiteSpace(SelectedAvailableResourcePack) ||
                ResourcePacks.Contains(SelectedAvailableResourcePack))
            {
                return;
            }

            ResourcePacks.Add(SelectedAvailableResourcePack);
            SelectedResourcePack = ResourcePacks.Last();
        }
示例#3
0
        private void LoadData()
        {
            ModuleData moduleData = _domainService.GetLoadedModuleData();

            ResourcePacks.Clear();

            foreach (var pack in moduleData.ResourcePacks)
            {
                ResourcePacks.Add(pack);
            }

            SelectedAvailableResourcePack = AvailableResourcePacks.First();
        }
示例#4
0
        private void FileSystemWatcherOnCreated(object sender, FileSystemEventArgs e)
        {
            string name = Path.GetFileNameWithoutExtension(e.Name);

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

            Application.Current.Dispatcher.Invoke(() =>
            {
                ResourcePacks.Add(name);
            });
        }
示例#5
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);
                }
            });
        }