public void ImportingTaskStart()
        {
            var temporaryDirectory = TemporaryFileService.AllocateTemporaryDirectory(TimeSpan.FromHours(1));

            DirectoryHelpers.DirectoryCopy(Modification.RepositoryPath, temporaryDirectory, true);
            Directory.Move(temporaryDirectory, finalRepositoryPath);
            Modification = ModificationLoader.FromPath(finalRepositoryPath);
            PhaseFactory.SetModification(Modification);
            ViewModel.SetModification(Modification);

            var enabledComponent = Modification.GetComponent <EnabledComponent>();

            enabledComponent.IsEnabled = true;

            var thumbnailDirectory = Path.Combine(finalRepositoryPath, "thumbnails");

            FileSystemProxy.PrepareDirectory(thumbnailDirectory);
            var thumbnailGenerationTask = Task.Factory.StartNew(() => {
                using (var ms = new MemoryStream())
                    using (var writer = new BinaryWriter(ms)) {
                        PofSerializer.Serialize(writer, new ThumbnailGenerationParameters {
                            DestinationDirectory = thumbnailDirectory,
                            SourceDirectory      = importedDirectoryPath,
                            ThumbnailsToGenerate = 3
                        });
                        ExeggutorService.SpawnHatchling(
                            "thumbnail-generator",
                            new SpawnConfiguration {
                            InstanceName = "thumbnail-generator-" + DateTime.UtcNow.GetUnixTime(),
                            Arguments    = ms.GetBuffer()
                        });
                        var thumbnailComponent = Modification.GetComponent <ThumbnailComponent>();
                        thumbnailComponent.SelectThumbnailIfUnselected();
                    }
            }, TaskCreationOptions.LongRunning);

            var contentDirectory = Path.Combine(finalRepositoryPath, "content");

            FileSystemProxy.PrepareDirectory(contentDirectory);
            for (var i = 0; i < relativeImportedFilePaths.Length; i++)
            {
                var sourceFile      = Path.Combine(importedDirectoryPath, relativeImportedFilePaths[i]);
                var destinationFile = Path.Combine(contentDirectory, relativeImportedFilePaths[i]);
                FileSystemProxy.PrepareParentDirectory(destinationFile);
                FileSystemProxy.CopyFile(sourceFile, destinationFile);
                UpdateProgress(0.333 * ((double)i / relativeImportedFilePaths.Length));
            }

            LeagueBuildUtilities.ResolveModification(Modification, CancellationToken.None);
            UpdateProgress(0.666);

            LeagueBuildUtilities.CompileModification(Modification, CancellationToken.None);
            UpdateProgress(1);
            thumbnailGenerationTask.Wait();
            PhaseManager.Transition(PhaseFactory.Idle());
        }
Ejemplo n.º 2
0
 public ModificationListingSynchronizer(IPofSerializer pofSerializer, IFileSystemProxy fileSystemProxy, IClientConfiguration clientConfiguration, TemporaryFileService temporaryFileService, ExeggutorService exeggutorService, ModificationLoader modificationLoader, ObservableCollection <ModificationViewModel> modificationViewModels, LeagueBuildUtilities leagueBuildUtilities)
 {
     this.pofSerializer          = pofSerializer;
     this.fileSystemProxy        = fileSystemProxy;
     this.clientConfiguration    = clientConfiguration;
     this.temporaryFileService   = temporaryFileService;
     this.exeggutorService       = exeggutorService;
     this.modificationLoader     = modificationLoader;
     this.modificationViewModels = modificationViewModels;
     this.leagueBuildUtilities   = leagueBuildUtilities;
 }
 public ModificationListingSynchronizer(IPofSerializer pofSerializer, IFileSystemProxy fileSystemProxy, IClientConfiguration clientConfiguration, TemporaryFileService temporaryFileService, ExeggutorService exeggutorService, ModificationLoader modificationLoader, ObservableCollection<ModificationViewModel> modificationViewModels, LeagueBuildUtilities leagueBuildUtilities)
 {
     this.pofSerializer = pofSerializer;
      this.fileSystemProxy = fileSystemProxy;
      this.clientConfiguration = clientConfiguration;
      this.temporaryFileService = temporaryFileService;
      this.exeggutorService = exeggutorService;
      this.modificationLoader = modificationLoader;
      this.modificationViewModels = modificationViewModels;
      this.leagueBuildUtilities = leagueBuildUtilities;
 }
 public ModificationPhaseFactory(IPofSerializer pofSerializer, IFileSystemProxy fileSystemProxy, TemporaryFileService temporaryFileService, ExeggutorService exeggutorService, ModificationPhaseManager phaseManager, ModificationLoader modificationLoader, ModificationViewModel viewModel, LeagueBuildUtilities leagueBuildUtilities, Modification modification)
 {
     this.pofSerializer = pofSerializer;
      this.fileSystemProxy = fileSystemProxy;
      this.temporaryFileService = temporaryFileService;
      this.exeggutorService = exeggutorService;
      this.phaseManager = phaseManager;
      this.modificationLoader = modificationLoader;
      this.viewModel = viewModel;
      this.leagueBuildUtilities = leagueBuildUtilities;
      this.modification = modification;
 }
Ejemplo n.º 5
0
 public ModificationPhaseFactory(IPofSerializer pofSerializer, IFileSystemProxy fileSystemProxy, TemporaryFileService temporaryFileService, ExeggutorService exeggutorService, ModificationPhaseManager phaseManager, ModificationLoader modificationLoader, ModificationViewModel viewModel, LeagueBuildUtilities leagueBuildUtilities, Modification modification)
 {
     this.pofSerializer        = pofSerializer;
     this.fileSystemProxy      = fileSystemProxy;
     this.temporaryFileService = temporaryFileService;
     this.exeggutorService     = exeggutorService;
     this.phaseManager         = phaseManager;
     this.modificationLoader   = modificationLoader;
     this.viewModel            = viewModel;
     this.leagueBuildUtilities = leagueBuildUtilities;
     this.modification         = modification;
 }
 public ModificationImportController(IPofSerializer pofSerializer, string repositoriesDirectory, TemporaryFileService temporaryFileService, ExeggutorService exeggutorService, ModificationComponentFactory modificationComponentFactory, IFileSystemProxy fileSystemProxy, RiotSolutionLoader riotSolutionLoader, ModificationImportViewModelFactory modificationImportViewModelFactory, ObservableCollection<ModificationViewModel> modificationViewModels, ModificationLoader modificationLoader, LeagueBuildUtilities leagueBuildUtilities)
 {
     this.pofSerializer = pofSerializer;
      this.repositoriesDirectory = repositoriesDirectory;
      this.temporaryFileService = temporaryFileService;
      this.exeggutorService = exeggutorService;
      this.modificationComponentFactory = modificationComponentFactory;
      this.fileSystemProxy = fileSystemProxy;
      this.riotSolutionLoader = riotSolutionLoader;
      this.modificationImportViewModelFactory = modificationImportViewModelFactory;
      this.modificationViewModels = modificationViewModels;
      this.modificationLoader = modificationLoader;
      this.leagueBuildUtilities = leagueBuildUtilities;
 }
Ejemplo n.º 7
0
 public ModificationImportController(IPofSerializer pofSerializer, string repositoriesDirectory, TemporaryFileService temporaryFileService, ExeggutorService exeggutorService, ModificationComponentFactory modificationComponentFactory, IFileSystemProxy fileSystemProxy, RiotSolutionLoader riotSolutionLoader, ModificationImportViewModelFactory modificationImportViewModelFactory, ObservableCollection <ModificationViewModel> modificationViewModels, ModificationLoader modificationLoader, LeagueBuildUtilities leagueBuildUtilities)
 {
     this.pofSerializer                      = pofSerializer;
     this.repositoriesDirectory              = repositoriesDirectory;
     this.temporaryFileService               = temporaryFileService;
     this.exeggutorService                   = exeggutorService;
     this.modificationComponentFactory       = modificationComponentFactory;
     this.fileSystemProxy                    = fileSystemProxy;
     this.riotSolutionLoader                 = riotSolutionLoader;
     this.modificationImportViewModelFactory = modificationImportViewModelFactory;
     this.modificationViewModels             = modificationViewModels;
     this.modificationLoader                 = modificationLoader;
     this.leagueBuildUtilities               = leagueBuildUtilities;
 }
 public TrinketSpawnerImpl(IStreamFactory streamFactory, IPofSerializer pofSerializer, ExeggutorService exeggutorService)
 {
     this.streamFactory = streamFactory;
      this.pofSerializer = pofSerializer;
      this.exeggutorService = exeggutorService;
 }
 public TrinketSpawnerImpl(IStreamFactory streamFactory, IPofSerializer pofSerializer, ExeggutorService exeggutorService)
 {
     this.streamFactory    = streamFactory;
     this.pofSerializer    = pofSerializer;
     this.exeggutorService = exeggutorService;
 }