Пример #1
0
 public ActionResult SaveRecording([FromBody] RecordDataDto dto)
 {
     if (recordingService.IsRecording)
     {
         throw new Exception("Service is recording please wait and try later");
     }
     if (!ModelState.IsValid)
     {
         throw new ArgumentException("invalid model state");
     }
     savingService.Save(false, 32);
     return(Ok());
 }
Пример #2
0
        static void Main(string[] args)
        {
            try
            {
                if (args.Length == 0)
                {
                    throw new WrongCommandLineArguments("Arguments are not specified.");
                }
                switch (args[0].Substring(1))
                {
                case "s":
                    if (args.Length < 2)
                    {
                        throw new WrongCommandLineArguments("Folder path is not specified.");
                    }
                    EstimatingService.EstimateWorkToSave(@args[1]);
                    if (args.Length < 3)
                    {
                        SavingService.Save(@args[1], null);
                    }
                    else
                    {
                        SavingService.Save(@args[1], @args[2]);
                    }
                    break;

                case "u":
                    if (args.Length < 2)
                    {
                        throw new WrongCommandLineArguments("File path is not specified.");
                    }
                    EstimatingService.EstimateWorkToUnpack(@args[1]);
                    if (args.Length < 3)
                    {
                        UnpackingService.Unpack(@args[1], null);
                    }
                    else
                    {
                        UnpackingService.Unpack(@args[1], @args[2]);
                    }
                    break;

                default:
                    throw new WrongCommandLineArguments("Arguments are not recognized.");
                }
            }
            catch (WrongCommandLineArguments e)
            {
                InfoService.ShowErrorMessage(e.Message);
                InfoService.ShowHelpMessage();
            }
            catch (Exception e)
            {
                InfoService.ShowErrorMessage(e.Message);
            }
        }