private void Initialize()
 {
     commandExecutor.Initialize(commandsToExecute);
     commandExecutor.OnCommandStartedExecution += (c) => OnCommandStartedExecution?.Invoke(c);
     commandExecutor.OnCommandCompleted        += (c) => OnCommandCompleted?.Invoke(c);
     commandExecutor.OnCommandFailed           += (c, e) => OnCommandFailed?.Invoke(c, e);
     commandExecutor.OnCommandProgressChanged  += (c, p) => OnCommandProgressChanged?.Invoke(c, p);
     commandExecutor.OnAllCompleted            += (wasErrors) => OnLoadingCompleted?.Invoke();
 }
Beispiel #2
0
        public void QueueCommand(byte[] commandBytes, LUNStructure lun, byte[] data, object task, OnCommandCompleted OnCommandCompleted)
        {
            SCSICommand command = new SCSICommand();

            command.CommandBytes       = commandBytes;
            command.LUN                = lun;
            command.Data               = data;
            command.OnCommandCompleted = OnCommandCompleted;
            command.Task               = task;
            m_commandQueue.Enqueue(command);
        }
Beispiel #3
0
 public void QueueCommand(byte[] commandBytes, LUNStructure lun, byte[] data, object task, OnCommandCompleted OnCommandCompleted)
 {
     m_target.QueueCommand(commandBytes, lun, data, task, OnCommandCompleted);
 }
Beispiel #4
0
        protected override async void Execute(object parameter)
        {
            try
            {
                var location = parameter as string;
                var filter   = "Witcher 3 Project (*.w3modproj)|*.w3modproj| Cyberpunk 2077 Project (*.cpmodproj)|*.cpmodproj";
                if (location == null && parameter is ProjectWizardModel.TypeAndPath)
                {
                    var res = parameter as ProjectWizardModel.TypeAndPath;
                    location = res.Path;
                    if (res.Type == ProjectWizardModel.WitcherGameName)
                    {
                        filter = "Witcher 3 Project (*.w3modproj)|*.w3modproj";
                    }
                    else if (res.Type == ProjectWizardModel.CyberpunkGameName)
                    {
                        filter = "Cyberpunk 2077 Project (*.cpmodproj)|*.cpmodproj";
                    }
                }

                var result = await _saveFileService.DetermineFileAsync(new DetermineSaveFileContext()
                {
                    Filter           = filter,
                    Title            = "Please select a location to save your WolvenKit project",
                    InitialDirectory = location,
                });

                if (result.Result)
                {
                    location = result.FileName;
                }

                if (!string.IsNullOrWhiteSpace(location) && result.Result)
                {
                    using (_pleaseWaitService.PushInScope())
                    {
                        switch (Path.GetExtension(location))
                        {
                        case ".w3modproj":
                        {
                            var np = new Tw3Project(location)
                            {
                                Name = Path.GetFileNameWithoutExtension(location),
                                Data = new W3Mod()
                                {
                                    FileName = location,
                                    Name     = Path.GetFileNameWithoutExtension(location),
                                    Author   = "WolvenKit",
                                    Email    = "",
                                    Version  = "1.0"
                                }
                            };
                            np.Save(location);
                            np.CreateDefaultDirectories();
                            break;
                        }

                        case ".cpmodproj":
                        {
                            var np = new Cp77Project(location)
                            {
                                Name = Path.GetFileNameWithoutExtension(location),
                                Data = new CP77Mod()
                                {
                                    FileName = location,
                                    Name     = Path.GetFileNameWithoutExtension(location),
                                    Author   = "WolvenKit",
                                    Email    = "",
                                    Version  = "1.0"
                                }
                            };
                            np.Save(location);
                            np.CreateDefaultDirectories();
                            break;
                        }

                        default:
                            _loggerService.LogString("Invalid project path!", Logtype.Error);
                            break;
                        }
                    }
                    await _projectManager.LoadAsync(location);
                }
            }
            catch (Exception ex)
            {
                _loggerService.LogString(ex.Message, Logtype.Error);
                _loggerService.LogString("Failed to create a new project!", Logtype.Error);
            }

            OnCommandCompleted?.Invoke();
        }
Beispiel #5
0
 private void OnCommandCompletedHandler()
 {
     UnsubscribeCommand(Current);
     OnCommandCompleted?.Invoke(Current);
     StartExecution();
 }