public static bool Extract(Job job, Motif motif)
        {
            IOHelper.CreateDirectory(JobPathHelper.GetLocalJobAnimatedMotifDiretory(job.Production, motif));

            string sourcePath = JobPathHelper.GetLocalJobMotifPath(job, motif);
            string targetPath = Path.Combine(JobPathHelper.GetLocalJobAnimatedMotifDiretory(job.Production, motif), @"motif_F%04d.tga");

            string parameters = "-i " + sourcePath + " " + targetPath;

            VCProcess process = new VCProcess(job);

            process.StartInfo.FileName               = Settings.LocalFfmpegExePath;
            process.StartInfo.Arguments              = parameters;
            process.StartInfo.CreateNoWindow         = true;
            process.StartInfo.UseShellExecute        = false;
            process.StartInfo.RedirectStandardError  = false;
            process.StartInfo.RedirectStandardOutput = false;
            process.StartInfo.WindowStyle            = System.Diagnostics.ProcessWindowStyle.Hidden;
            process.Execute();
            process.WaitForExit();

            motif.Frames = Directory.GetFiles(JobPathHelper.GetLocalJobAnimatedMotifDiretory(job.Production, motif), "*.tga").Length;
            //motif.Extension = ".tga";

            return(motif.Frames > 0);
        }
        private void OnMotifTransferSuccess(object obj, EventArgs ea)
        {
            TransferPacket motifTransferPacket = obj as TransferPacket;

            motifTransferPacket.FailureEvent -= OnMotifTransferFailure;
            motifTransferPacket.SuccessEvent -= OnMotifTransferSuccess;

            Motif motif = motifTransferPacket.Parent as Motif;

            if (motif != null)
            {
                motif.IsInTransit = false;
                if (motif.IsMovie)
                {
                    if (MotifTranscoder.Extract(job, motif) != true)
                    {
                        job.ErrorStatus = JobErrorStatus.JES_EXTRACT_MOTIF;
                        return;
                    }
                }
                else if (MotifTranscoder.Transcode(job, motif) != true)
                {
                    job.ErrorStatus = JobErrorStatus.JES_MODIFY_MOTIF;
                    return;
                }
            }

            job.Production.SetMotifAvailable(motif);
        }
Ejemplo n.º 3
0
        public void restoreMotif(Motif motif, Dictionary <int, Variation> childVariationList, List <Duration>[] motifInstances)
        {
            int motifId = motif.getId();

            //Add motif to list
            this.tune.addMotif(motif);

            //Restore motif instances
            for (int i = 0; i < tune.trackCount(); i++)
            {
                Track t = tune.getTrack(i);
                foreach (Duration d in motifInstances[i])
                {
                    t.insert(motifId, d);
                }
            }

            //Update childs
            foreach (KeyValuePair <int, Variation> child in childVariationList)
            {
                Motif m = this.getMotif(child.Key);
                m.setVariation(child.Value, motifId);
            }

            //Update tree
            this.treeview_restoreMotif(motif.getName(), motif.getParentId(), childVariationList);
        }
        public override Motif variate(Motif motif)
        {
            Motif m = motif.Clone();

            m.RachmaninoffInvert();
            return(m);
        }
Ejemplo n.º 5
0
        public override Motif variate(Motif motif)
        {
            Motif m = motif.Clone();

            m.transport(this.transport);
            return(m);
        }
Ejemplo n.º 6
0
        public override Motif variate(Motif motif)
        {
            Motif m = motif.Clone();

            m.ornamentation(pitch);
            return(m);
        }
        private void mnLoadMotif_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.InitialDirectory = StringConstants.ABC_DIR;
            ofd.Filter           = "ABC file (*.abc)|*.abc|All files (*.*)|*.*";
            ofd.FilterIndex      = 1;
            ofd.RestoreDirectory = true;

            if (ofd.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            string name = controller.generateDefaultMotifName(System.IO.Path.GetFileNameWithoutExtension(ofd.FileName));
            Motif  m    = AbcFileReader.readFromFile(ofd.FileName);

            m.setName(name);

            ProgramAction action = new CreateMotifAction(this.controller, m);

            this.controller.executeAction(action);

            controller.treeview_selectNode(m);
        }
Ejemplo n.º 8
0
        public override Motif variate(Motif motif)
        {
            Motif m = motif.Clone();

            m.elision();
            return(m);
        }
Ejemplo n.º 9
0
        private void LoadMotif()
        {
            DialogResult dlg = dlgOpenMotif.ShowDialog();

            if (dlg != DialogResult.OK)
            {
                return;
            }
            SetText(dlgOpenMotif);
            string filename = dlgOpenMotif.FileName;

            try
            {
                Motif = Motif.ReadFromFile(filename);
            }
            catch
            {
                MessageBox.Show("The file may be corrupted or not a valid PeSA motif file.", Analyzer.ProgramName);
                return;
            }
            Validator = new MotifValidator();
            Settings settings    = Settings.Load("default.settings");
            int      heightImage = 200;
            int      widthImage  = 800;

            if (settings != null)
            {
                heightImage = settings.MotifHeight;
                widthImage  = settings.MotifWidth;
            }
            mdPositive.Image = Motif.GetPositiveMotif(widthImage, heightImage);
            mdNegative.Image = Motif.GetNegativeMotif(widthImage, heightImage);
            mdChart.Image    = Motif.GetBarChart(pMotif.Width - 6);
            eWildtype.Text   = Motif.WildTypePeptide;
        }
Ejemplo n.º 10
0
 public RenameMotifAction(Controller controller, Motif motif, string newName)
 {
     this.controller = controller;
     this.motifId    = motif.getId();
     this.oldName    = motif.getName();
     this.newName    = newName;
 }
Ejemplo n.º 11
0
        private void btnSaveMotif_Click(object sender, EventArgs e)
        {
            if (OA == null)
            {
                return;
            }
            dlgSaveMotif.FileName = ProjectName;
            DialogResult dlg = dlgSaveMotif.ShowDialog();

            if (dlg != DialogResult.OK)
            {
                return;
            }

            string filename = dlgSaveMotif.FileName;

            if (Motif == null)
            {
                Motif = new Motif(OA.NormalizedPeptideWeights, OA.PositionCaptions, OA.PositiveThreshold, OA.NegativeThreshold);
            }

            if (Motif.SaveToFile(filename, Motif))
            {
                MessageBox.Show(filename + " is saved", Analyzer.ProgramName);
            }
        }
Ejemplo n.º 12
0
        public void GetNbRetardsExcusesTest()
        {
            Etudiant et1 = new Etudiant(1, "Enzo");
            Etudiant et2 = new Etudiant(2, "Noa");

            Motif motif1 = new Motif(1, "Malade grippe");
            Motif motif2 = new Motif(2, "Pas envie");

            Retard retard1 = new Retard(1, DateTime.Now.ToShortDateString(), motif1, false);
            Retard retard2 = new Retard(2, DateTime.Now.ToShortDateString(), motif2, true);
            Retard retard3 = new Retard(3, DateTime.Now.ToShortDateString(), motif2, true);
            Retard retard4 = new Retard(4, DateTime.Now.ToShortDateString(), motif2, true);
            Retard retard5 = new Retard(5, DateTime.Now.ToShortDateString(), motif2, true);


            et1.AjouterRetard(retard1);

            et1.AjouterRetard(retard2);
            et1.AjouterRetard(retard3);

            et1.AjouterRetard(retard4);
            et1.AjouterRetard(retard5);


            Assert.AreEqual(4, et1.GetNbRetardsExcuses());
        }
        public override Motif variate(Motif motif)
        {
            Motif m = motif.Clone();

            m.interpolate();
            return(m);
        }
Ejemplo n.º 14
0
        private bool DrawMotifs()
        {
            try
            {
                ClearMotifs();
                if (PA == null)
                {
                    return(true);
                }
                Settings settings    = Settings.Load("default.settings");
                int      heightImage = 200;
                int      widthImage  = 800;
                if (settings != null)
                {
                    heightImage = settings.MotifHeight;
                    widthImage  = settings.MotifWidth;
                }
                Motif = new Motif(PA.NormalizedPeptideWeights, PA.NormalizedWildtypeWeights, PA.WildTypePeptide, PA.PositiveThreshold, PA.NegativeThreshold);

                mdPositive.Image = Motif.GetPositiveMotif(widthImage, heightImage);

                mdNegative.Image = Motif.GetNegativeMotif(widthImage, heightImage);

                mdChart.Image = Motif.GetBarChart(pMotif.Width - 6);
                return(true);
            }
            catch { return(false); }
        }
        private void SavePattern(object sender, RoutedEventArgs e)
        {
            //vers tableau d'entiers
            bool[,] tab = new bool[Hauteur, Largeur];

            for (int i = 0; i < Hauteur; i++)
            {
                for (int j = 0; j < Largeur; j++)
                {
                    tab[i, j] = TabCellules[i, j].State;
                }
            }

            //nouveau motif
            string nom     = NameBox.Text;
            string categ   = CategBox.Text;
            var    shape   = new [] { Hauteur, Largeur };
            Motif  pattern = new Motif(tab, nom, categ, shape);

            //ajout aux ressources
            var             f = File.Create("Resources/motifs/" + pattern.Nom + ".dat");
            BinaryFormatter b = new BinaryFormatter();

            b.Serialize(f, pattern);
            f.Close();
            this.Close();

            Main.SetMenuPatterns();
        }
        public override Motif variate(Motif motif)
        {
            Motif m = motif.Clone();

            m.tonaltransport(this.gradeOrigin, this.gradeDest);
            return(m);
        }
Ejemplo n.º 17
0
        public override Motif variate(Motif motif)
        {
            Motif m = motif.Clone();

            m.modulate(this.tonality);
            return(m);
        }
        public override Motif variate(Motif motif)
        {
            Motif m = motif.Clone();

            m.changeDuration(this.multiplier);
            return(m);
        }
Ejemplo n.º 19
0
        private void paintMotif(PaintEventArgs e, Motif motif, Duration start, int track, int motifPosition)
        {
            Duration  length = motif.getDuration();
            string    name   = motif.getName();
            Rectangle rect   = new Rectangle(this.track_header + (zoom * start).ToInt(), track * track_height + HEADER_SIZE, (zoom * length).ToInt(), track_height);

            Color color = getMotifBaseColor(motif);

            SolidBrush br  = new SolidBrush(ColorUtil.decreaseBrightness(color, 70));
            Pen        pen = new Pen(color, 2);

            if (motifPosition == this.selectedMotifIndex && start == this.currentPosition && track == this.selectedTrack)
            {
                br = new SolidBrush(ColorUtil.increaseBrightness(color, 40));
            }
            if (motif == this.selectedMotif)
            {
                pen = new Pen(Color.Yellow, 3);
            }

            e.Graphics.FillRectangle(br, rect);
            e.Graphics.DrawRectangle(pen, rect);
            StringFormat stringFormat = new StringFormat();

            stringFormat.Alignment     = StringAlignment.Center;
            stringFormat.LineAlignment = StringAlignment.Center;
            e.Graphics.DrawString(name, this.motifFont, Brushes.White, rect, stringFormat);
        }
    public static void saveToFile(Motif motif, string fileName, bool midi)
    {
        using (System.IO.StreamWriter streamWriter = new System.IO.StreamWriter(fileName, false))
        {
            Tonality      tonality = motif.getTonality();
            AbcNoteParser anp      = new AbcNoteParser(tonality);
            streamWriter.WriteLine("X:1");
            streamWriter.WriteLine("L:1/4");
            streamWriter.WriteLine("K:" + tonality.ToString());

            int voiceIterator = 0;
            for (int j = 0; j < motif.voiceCount(); j++)
            {
                streamWriter.WriteLine("V:" + voiceIterator);
                voiceIterator++;
                Voice v = motif.getVoice(j);
                anp.resetAccidentals();
                for (int k = 0; k < v.size(); k++)
                {
                    streamWriter.Write(anp.toABC(v.get(k)));
                    streamWriter.Write(" ");
                }
                if (midi)
                {
                    streamWriter.Write("z");
                }
                streamWriter.WriteLine("|]");
            }
        }
    }
Ejemplo n.º 21
0
        public override Motif variate(Motif motif)
        {
            Motif m = motif.Clone();

            m.permutate();
            return(m);
        }
Ejemplo n.º 22
0
        public bool pickElement(int x, int y)
        {
            this.relativeStart = 0;

            //Get selected track
            int      track         = (y - HEADER_SIZE) / track_height;
            Duration selectedStart = (x - this.track_header) / zoom;
            int      motifIndex    = controller.getMotifIndexFromTrack(track, selectedStart);

            if (motifIndex < 0)
            {
                this.selectedMotifIndex = -1;
                this.selectedMotif      = null;
                return(false);
            }
            else
            {
                this.currentPosition    = this.controller.getStartTimeFromTrack(track, motifIndex);
                this.relativeStart      = selectedStart - this.currentPosition;
                this.selectedMotifIndex = motifIndex;
                this.selectedTrack      = track;
                Motif m = controller.getMotifFromTrack(selectedTrack, selectedMotifIndex);
                this.selectedMotif = m;
                controller.selectMotifOnTreeView(m.getName());
                return(true);
            }
        }
Ejemplo n.º 23
0
        /// <summary>
        /// Gestion des infomrations concernant la demande frais
        /// </summary>
        private void ChargerInfoDemande()
        {
            //recherche de la ligne concerné
            LigneFrais laLigne = RechercheLigneFrais();

            //si laLigne existe
            if (laLigne != null)
            {
                //recherche du Motif de la ligne
                Motif leMotif = RechercheMotif(laLigne);

                //affichage des infomration concernant la demande
                if (leMotif != null)
                {
                    this.txtMotif.Text = leMotif.Libelle;
                }
                else
                {
                    this.txtMotif.Text = "Erreur de motif";
                }

                this.txtTrajet.Text             = laLigne.Trajet;
                this.txtKmDemande.Text          = laLigne.Km.ToString();
                this.txtPeageDemande.Text       = laLigne.CoutPeage.ToString();
                this.txtRepasDemande.Text       = laLigne.CoutRepas.ToString();
                this.txtHebergementDemande.Text = laLigne.CoutHeberge.ToString();

                //empeche le depassement des valeurs maximum demander
                this.SetMaximum();

                //calcule du total de la demande
                this.txtTotalDemande.Text = this.CalculCout(long.Parse(this.txtKmDemande.Text), decimal.Parse(this.txtPeageDemande.Text), decimal.Parse(this.txtRepasDemande.Text), decimal.Parse(this.txtHebergementDemande.Text)).ToString();
            }
        }
Ejemplo n.º 24
0
        public override Motif variate(Motif motif)
        {
            Motif m = motif.Clone();

            m.retrogradation();
            return(m);
        }
Ejemplo n.º 25
0
        private void btnSaveMotif_Click(object sender, EventArgs e)
        {
            if (PA == null)
            {
                return;
            }
            if (MotifMain == null)
            {
                DrawMotifs();
            }
            if (MotifMain == null)
            {
                return;
            }
            dlgSaveMotif.FileName = ProjectName;
            DialogResult dlg = dlgSaveMotif.ShowDialog();

            if (dlg != DialogResult.OK)
            {
                return;
            }

            string filename = dlgSaveMotif.FileName;

            if (Motif.SaveToFile(filename, MotifMain))
            {
                MessageBox.Show(filename + " is saved", Analyzer.ProgramName);
            }
        }
        public ActionResult AddOrEditMotif(Motif motif)
        {
            string query  = "SELECT * FROM Motif WHERE nomMotif = @p0";
            var    motifs = dbContext.Motifs.SqlQuery(query, motif.nomMotif).ToList();
            int    count  = motifs.Count();

            if (count == 0)
            {
                if (motif.idMotif == 0)
                {
                    dbContext.Configuration.ProxyCreationEnabled = false;
                    dbContext.Motifs.Add(motif);
                    dbContext.SaveChanges();
                    return(Json(new { success = true, message = "Ajout : Succés" }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    dbContext.Configuration.ProxyCreationEnabled = false;
                    dbContext.Entry(motif).State = EntityState.Modified;
                    dbContext.SaveChanges();
                    return(Json(new { success = true, message = "Mise à jour : Succés" }, JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                return(Json(new { success = false, message = "Ce motif existe déjà" }, JsonRequestBehavior.AllowGet));
            }
        }
        public override Motif variate(Motif motif)
        {
            Motif m = motif.Clone();

            m.delay(this.delay);
            return(m);
        }
        public override Motif variate(Motif motif)
        {
            Motif m = motif.Clone();

            m.harmonizate();
            return(m);
        }
        private void mcmSplit_Click(object sender, EventArgs e)
        {
            Motif m = controller.getMotifFromName(this.motifTreeView.SelectedNode.Text);

            ProgramAction action = new SplitMotifOnTreeViewAction(controller, m);

            this.controller.executeAction(action);
        }
Ejemplo n.º 30
0
 public UntieMotifAction(Controller controller, int oldMotifId, Motif newMotif, int track, Duration startTime)
 {
     this.controller = controller;
     this.oldMotifId = oldMotifId;
     this.newMotif   = newMotif;
     this.track      = track;
     this.startTime  = startTime;
 }
Ejemplo n.º 31
0
 public bool MotifGagne(Motif motif)
 {
     List<string> combinaisonsGagnantes = new List<string> { "123", "456", "789", "147", "258", "369", "159", "357" };
     var croix = Cases.Where(x => x.motif == motif).SelectMany(x => x.Position.ToString()).ToArray();
     foreach (var c in combinaisonsGagnantes)
     {
         if (croix.Contains(c[0]) && croix.Contains(c[1]) && croix.Contains(c[2])) return true;
     }
     return false;
     //return combinaisonsGagnantes.Any(y => y.All(z => croix.Contains(z)));
 }
Ejemplo n.º 32
0
 internal static extern IntPtr TNK_GetWidgetClass(Motif.WidgetClass glass);