コード例 #1
0
        private void btn_tak_pcm_Click(object sender, EventArgs e)
        {
            if (SELECTED_FILES == null)
            {
                return;
            }

            var ffmp = new FFmpeg(prog.CDCRUSH.FFMPEG_PATH);
            var tak  = new Tak(prog.CDCRUSH.TOOLS_PATH);

            tak.onComplete = (s) => {
                LOG.log($"TAK Operation Complete - {s}");
            };

            ffmp.onComplete = (s) => {
                LOG.log($"FFMPEG Operation Complete - {s}");
            };

            string INPUT  = SELECTED_FILES[0];
            string OUTPUT = Path.ChangeExtension(INPUT, ".tak");

            // This will make FFMPEG read the PCM file, convert it to WAV on the fly
            // and feed it to TAK, which will convert and save it.

            ffmp.convertPCMStreamToWavStream((ffmpegIn, ffmpegOut) => {
                var sourceFile = File.OpenRead(INPUT);
                tak.encodeFromStream(OUTPUT, (takIn) => {
                    ffmpegOut.CopyTo(takIn);
                    takIn.Close();
                });
                sourceFile.CopyTo(ffmpegIn);                            // Feed PCM to FFMPEG
                ffmpegIn.Close();
            });
        }        // --
コード例 #2
0
        }        // --

        private void btn_untak_pcm_Click(object sender, EventArgs e)
        {
            if (SELECTED_FILES == null)
            {
                return;
            }

            string INPUT  = SELECTED_FILES[0];
            string OUTPUT = Path.ChangeExtension(INPUT, ".pcm");
            var    ffmp   = new FFmpeg(prog.CDCRUSH.FFMPEG_PATH);
            var    tak    = new Tak(prog.CDCRUSH.TOOLS_PATH);

            tak.onComplete = (s) => {
                LOG.log($"TAK Operation Complete - {s}");
            };

            ffmp.onComplete = (s) => {
                LOG.log($"FFMPEG Operation Complete - {s}");
            };

            tak.decodeToStream(INPUT, (_out) => {
                ffmp.convertWavStreamToPCM(OUTPUT, (_in) => {
                    _out.CopyTo(_in);
                    _in.Close();
                });
            });
        }        // --
コード例 #3
0
        public ActionResult DeleteConfirmed(int id)
        {
            Tak tak = db.Taks.Find(id);

            db.Taks.Remove(tak);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #4
0
        public async Task Cant_Place_Order_If_OrderedFor_Section_Cant_Use_Tab()
        {
            var section = new Tak()
            {
                TabIsAllowed = false
            };
            var person = new Leiding()
            {
                Tak = section
            };
            var account = new Account(AccountType.Tab);

            person.Accounts = new List <Account> {
                account
            };


            var order     = Order.Create(person);
            var orderline = Orderline.Create(_defaultDrank, person, order, 1);

            var orderRepository = new Mock <IOrderRepository>();
            var leidingRepo     = new Mock <ILeidingRepository>();

            leidingRepo.Setup(x => x.FindByEmailAsync(It.IsAny <string>())).Returns(Task.FromResult <Leiding>(person));
            leidingRepo.Setup(x => x.FindByIdAsync(It.IsAny <int>())).Returns(Task.FromResult <Leiding>(person));
            var drankRepo = new Mock <IDrankRepository>();

            drankRepo.Setup(x => x.FindByIdAsync(It.IsAny <int>())).Returns(Task.FromResult <Drank>(_defaultDrank));
            var orderlineRepo = new Mock <IOrderlineRepository>();

            var accountRepo = new Mock <IAccountRepository>();

            accountRepo.Setup(x => x.FindAccountAsync(It.IsAny <int>(), AccountType.Tab))
            .Returns(Task.FromResult <Account>(account));

            var accountService = new Mock <IAccountService>();

            var service = new OrderService(orderRepository.Object, leidingRepo.Object, drankRepo.Object, orderlineRepo.Object, accountRepo.Object, accountService.Object);

            var orderlines = new List <CreateOrderlineDTO>();

            orderlines.Add(item: new CreateOrderlineDTO
            {
                DrankId      = 10,
                OrderedForId = 10,
                Quantity     = 10
            });

            var orderDto = new CreateOrderDTO()
            {
                Orderlines = orderlines
            };


            await Assert.ThrowsAsync <InvalidOperationException>(() => service.CreateOrder(orderDto, String.Empty));
        }
コード例 #5
0
        }// -----------------------------------------

        // --
        public override void start()
        {
            base.start();

            p = (RestoreParams)jobData;

            INPUT             = Path.Combine(p.tempDir, track.storedFileName);
            OUTPUT            = Path.Combine(p.tempDir, track.getFilenameRaw());
            track.workingFile = OUTPUT;     // Point to the new file

            // -
            var fileExt = Path.GetExtension(track.storedFileName);

            requirePostSizeFix = AudioMaster.isLossyByExt(fileExt);

            // --
            if (track.isData)
            {
                var ecm = new EcmTools(CDCRUSH.TOOLS_PATH);
                setupHandlers(ecm);
                ecm.unecm(INPUT);
            }
            else
            {
                // No need to convert back, end the task
                if (p.mode == 2)
                {
                    // Point to correct file
                    track.workingFile = INPUT;
                    complete();
                    return;
                }

                var ffmp = new FFmpeg(CDCRUSH.FFMPEG_PATH);

                if (fileExt.ToLower() == ".tak")
                {
                    var tak = new Tak(CDCRUSH.TOOLS_PATH);
                    setupHandlers(tak);

                    tak.decodeToStream(INPUT, (_out) => {
                        ffmp.convertWavStreamToPCM(OUTPUT, (_in) => {
                            _out.CopyTo(_in);
                            _in.Close();
                        });
                    });
                }
                else
                {
                    setupHandlers(ffmp);
                    ffmp.audioToPCM(INPUT, track.workingFile);
                }
            }

            log("Restoring track -" + track.storedFileName);
        }// -----------------------------------------
コード例 #6
0
 public ActionResult Edit([Bind(Include = "tak_Id,tak_Naam")] Tak tak)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tak).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tak));
 }
コード例 #7
0
        public ActionResult Create([Bind(Include = "tak_Id,tak_Naam")] Tak tak)
        {
            if (ModelState.IsValid)
            {
                db.Taks.Add(tak);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(tak));
        }
コード例 #8
0
        private void btn_untak_Click(object sender, EventArgs e)
        {
            if (SELECTED_FILES == null)
            {
                return;
            }
            var app = new Tak(prog.CDCRUSH.TOOLS_PATH);

            app.onComplete = (s) => {
                LOG.log("--TAK to WAV Complete :: {0}", s);
            };
            app.decode(SELECTED_FILES[0], txt_files_2.Text);
        }
コード例 #9
0
        // GET: Taks/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Tak tak = db.Taks.Find(id);

            if (tak == null)
            {
                return(HttpNotFound());
            }
            return(View(tak));
        }
コード例 #10
0
        [HttpPost] //POST /api/tak
        public async Task <IActionResult> AddTak([FromBody] CreateSectionDTO viewmodel)
        {
            var tak = new Tak
            {
                Naam         = viewmodel.Naam,
                Volgorde     = viewmodel.Volgorde,
                TabIsAllowed = viewmodel.TabIsAllowed
            };
            await _takRepository.AddAsync(tak);

            await _takRepository.SaveChangesAsync();

            var model = _mapper.Map <BasicSectionDTO>(tak);

            return(CreatedAtRoute("GetTakById", new { id = model.Id }, model));
        }
コード例 #11
0
        public async Task <BasicLeaderDTO> CreateLeader(CreateLeaderDTO dto)
        {
            //Check if a section is provided for the leader
            Tak tak = null;

            if (dto.TakId != 0)
            {
                tak = await _takRepository.FindByIdAsync(dto.TakId);

                if (tak == null)
                {
                    throw new EntityNotFoundException($"Tak met id {dto.TakId} werd niet gevonden.");
                }
            }


            //Map the dto to the leader entity. TODO: This smells fishy. I don't like new()
            var leader = new Leiding
            {
                Naam         = dto.Naam.Trim(),
                Voornaam     = dto.Voornaam.Trim(),
                LeidingSinds = dto.LeidingSinds.ToLocalTime(),
                Tak          = tak,
                Email        = dto.Email?.Trim().ToLower(),
                Accounts     = new List <Account>(2)
            };

            //Only create accounts if needed. E.g.: leaders created through the totemdatabase probably shouldn't have an account at first.
            if (dto.CreateAccounts)
            {
                leader.Accounts.Add(new Account(AccountType.Debt));
                leader.Accounts.Add(new Account(AccountType.Tab));
            }


            await _leidingRepository.AddAsync(leader);

            await _leidingRepository.SaveChangesAsync();

            return(_mapper.Map <BasicLeaderDTO>(leader));
        }
コード例 #12
0
        }// -----------------------------------------

        // --
        public override void start()
        {
            base.start();

            p = (CrushParams)jobData;

            // Working file is already set and points to either TEMP or INPUT folder
            INPUT = track.workingFile;
            // NOTE: OUTPUT path is generated later with the setupfiles() function

            // Before compressing the tracks, get and store the MD5 of the track
            using (var md5 = System.Security.Cryptography.MD5.Create())
            {
                using (var str = File.OpenRead(INPUT))
                {
                    track.md5 = BitConverter.ToString(md5.ComputeHash(str)).Replace("-", "").ToLower();
                }
            }

            // --
            if (track.isData)
            {
                var ecm = new EcmTools(CDCRUSH.TOOLS_PATH);
                setupHandlers(ecm);

                // New filename that is going to be generated:
                setupFiles(".bin.ecm");
                ecm.ecm(INPUT, OUTPUT); // old .bin file from wherever it was to temp/bin.ecm
            }
            else                        // AUDIO TRACK :
            {
                // Get Audio Data. (codecID, codecQuality)
                Tuple <string, int> audioQ = p.audioQuality;

                // New filename that is going to be generated:
                setupFiles(AudioMaster.getCodecExt(audioQ.Item1));

                // I need ffmpeg for both occations
                var ffmp = new FFmpeg(CDCRUSH.FFMPEG_PATH);
                setupHandlers(ffmp);

                if (audioQ.Item1 == "TAK")
                {
                    var tak = new Tak(CDCRUSH.TOOLS_PATH);

                    // This will make FFMPEG read the PCM file, convert it to WAV on the fly
                    // and feed it to TAK, which will convert and save it.
                    ffmp.convertPCMStreamToWavStream((ffmpegIn, ffmpegOut) => {
                        var sourceFile = File.OpenRead(INPUT);
                        tak.encodeFromStream(OUTPUT, (takIn) => {
                            ffmpegOut.CopyTo(takIn);
                            takIn.Close();
                        });
                        sourceFile.CopyTo(ffmpegIn);                    // Feed PCM to FFMPEG
                        ffmpegIn.Close();
                    });
                }
                else
                {
                    // It must be FFMPEG
                    ffmp.encodePCM(audioQ.Item1, audioQ.Item2, INPUT, OUTPUT);
                }
            }    //- end if (track.isData)
        }// -----------------------------------------
コード例 #13
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (Blighchekbox.CheckState == CheckState.Checked)


            //if (comboBox1.Text == "bligh")
            {
                if (Tad <= 0.5)
                {
                    Tad        = 0.5;
                    texta.Text = Tad.ToString();
                }
                else
                {
                    texta.Text = Tad.ToString();
                }// end of tad

                if (Tbd <= 0.5)
                {
                    Tbd           = 0.5;
                    radtextb.Text = Tbd.ToString();
                }
                else
                {
                    radtextb.Text = Tbd.ToString();
                }// end of tbd


                if (Tcd <= 0.5)
                {
                    Tcd           = 0.5;
                    radtextc.Text = Tcd.ToString();
                }
                else
                {
                    radtextc.Text = Tcd.ToString();
                }  //end of tcd

                if (Tdd <= 0.5)
                {
                    Tdd           = 0.5;
                    radtextd.Text = Tdd.ToString();
                }

                else
                {
                    radtextd.Text = Tdd.ToString();
                }  //end of tdd


                if (Ted <= 0.5)
                {
                    Ted           = 0.5;
                    radtexte.Text = Ted.ToString();
                }

                else
                {
                    radtexte.Text = Ted.ToString();
                }  //end of ted

                if (Tfd <= 0.5)
                {
                    Tfd           = 0.5;
                    radtextf.Text = Tfd.ToString();
                }

                else
                {
                    radtextf.Text = Tfd.ToString();
                } //end of tfd
            }     //end of If
            if (Khoslachekbox.CheckState == CheckState.Checked)

            // if(comboBox1.Text=="khosla")
            {
                if (Tak <= 0.5)
                {
                    Tak        = 0.5;
                    texta.Text = Tak.ToString();
                }
                else
                {
                    texta.Text = Tak.ToString();
                }// end of tad

                if (Tbk <= 0.5)
                {
                    Tbk           = 0.5;
                    radtextb.Text = Tbk.ToString();
                }
                else
                {
                    radtextb.Text = Tbk.ToString();
                }// end of tbd


                if (Tck <= 0.5)
                {
                    Tck           = 0.5;
                    radtextc.Text = Tck.ToString();
                }
                else
                {
                    radtextc.Text = Tck.ToString();
                } //end of tcd

                if (Tdk <= 0.5)
                {
                    Tdk           = 0.5;
                    radtextd.Text = Tdk.ToString();
                }

                else
                {
                    radtextd.Text = Tdk.ToString();
                } //end of tdd


                if (Tek <= 0.5)
                {
                    Tek           = 0.5;
                    radtexte.Text = Tek.ToString();
                }

                else
                {
                    radtexte.Text = Tek.ToString();
                } //end of ted

                if (Tfk <= 0.5)
                {
                    Tfk           = 0.5;
                    radtextf.Text = Tfk.ToString();
                }

                else
                {
                    radtextf.Text = Tfk.ToString();
                } //end of tfd
            }
            Dynamicbtn.Visible = true;
        }