示例#1
0
        public async Task StartupWithCallerConfigurationWhenConfigurationFileExists(ConfigurationSelection selection)
        {
            using (var disposableDirectory = new DisposableDirectory(FileSystem))
            {
                var rootPath = disposableDirectory.Path;
                var context  = new Context(Logger);

                var configurationExisting = ContentStoreConfiguration.CreateWithMaxSizeQuotaMB(5);
                await configurationExisting.Write(FileSystem, rootPath);

                var configurationNew   = ContentStoreConfiguration.CreateWithMaxSizeQuotaMB(7);
                var configurationModel = new ConfigurationModel(configurationNew, selection);

                using (var store = new TestFileSystemContentStore(FileSystem, Clock, rootPath, configurationModel))
                {
                    try
                    {
                        var r = await store.StartupAsync(context);

                        r.ShouldBeSuccess();

                        var expectedQuota = selection == ConfigurationSelection.UseFileAllowingInProcessFallback
                            ? 5 * MB
                            : 7 * MB;

                        store.Configuration.MaxSizeQuota.Hard.Should().Be(expectedQuota);
                    }
                    finally
                    {
                        await store.ShutdownAsync(context).ShouldBeSuccess();
                    }
                }
            }
        }
示例#2
0
        public JsonResult SetConfigurationSelection(string f, int cs, int np, int la, double nm, int cm, string cl, string nv)
        {
            ConfigurationSelection conf = new ConfigurationSelection();

            conf.Filiere         = f;
            conf.CoeffMath       = cm;
            conf.CoeffSpecialite = cs;
            conf.NbrPlace        = np;
            conf.NoteMin         = nm;
            conf.NbrPlaceListAtt = la;
            conf.TypeClassement  = cl;
            conf.Niveau          = nv;



            selection.updateConfigurationSelection(conf);
            if (nv == "3")
            {
                selection.calculeNoteGlobale(f);
            }

            var data = selection.selectStudents(f, nv);

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
 public ModelConfigurationSelection(ConfigurationSelection selection)
 {
     VisibilityShowInfo = Visibility.Collapsed;
     Selection          = selection;
     Filters            = new ObservableCollection <ModelConfigurationSelectionPass>(selection.Filters.Select(e => new ModelConfigurationSelectionPass(e)));
     DeleteItemCommand  = new DelegateCommand(DeleteFilter);
 }
示例#4
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="ConfigurationModel"/> class.
 /// </summary>
 public ConfigurationModel(
     ContentStoreConfiguration inProcessConfiguration = null,
     ConfigurationSelection selection = ConfigurationSelection.UseFileAllowingInProcessFallback,
     MissingConfigurationFileOption missingFileOption = MissingConfigurationFileOption.DoNotWrite)
 {
     InProcessConfiguration = inProcessConfiguration;
     Selection         = selection;
     MissingFileOption = missingFileOption;
 }
示例#5
0
        private List <string> Validate(ConfigurationSelection cs, List <string> list)
        {
            var result = list.Where(cs.GetValidation).ToList();

            TestContext.WriteLine("Result:");
            foreach (var str in result)
            {
                TestContext.WriteLine("{0}", str);
            }
            return(result);
        }
示例#6
0
        public void SelectionTestIncludeOccurenceLess()
        {
            TestContext.WriteLine("SelectionTestIncludeOccurenceLess");
            var cs = new ConfigurationSelection();

            cs.AddFilter(TypeSelection.IncludeOccurenceLess, ".", 4);
            cs.CalculateStartFileValidation();
            //
            var result = Validate(cs, StringListForOccurence);

            Assert.IsTrue(result.Count == 2, "2 left");
        }
示例#7
0
        public void SelectionTestIncludeStart()
        {
            TestContext.WriteLine("SelectionTestIncludeStart");
            var cs = new ConfigurationSelection();

            cs.AddFilter(TypeSelection.IncludeStart, "e", 0);
            cs.CalculateStartFileValidation();
            //
            var result = Validate(cs, StringListForPattern);

            Assert.IsTrue(result.Count == 2, "e included");
        }
示例#8
0
        public void SelectionTestExcludeEnd()
        {
            TestContext.WriteLine("SelectionTestExcludeEnd");
            var cs = new ConfigurationSelection();

            cs.AddFilter(TypeSelection.ExcludeEnd, "9", 0);
            cs.CalculateStartFileValidation();
            //
            var result = Validate(cs, StringListForPattern);

            Assert.IsTrue(result.Count == StringListForPattern.Count - 1, "9 excluded");
        }
        public void calculeNoteGlobale(string filiere)
        {
            Console.WriteLine("the filiere is " + filiere);

            ConfigurationSelection conf = db.ConfigurationSelections.Where(a => a.Filiere.Equals(filiere) && a.Niveau == "3").SingleOrDefault();
            var data = db.Candidats.Where(c => c.Filiere.Nom.Equals(filiere) && c.Niveau == 3);

            foreach (var person in data)
            {
                ConcourEcrit concours = db.CouncourEcrits.Where(c => c.Cne.Equals(person.Cne)).SingleOrDefault();
                concours.NoteGenerale = (concours.NoteMath * conf.CoeffMath + concours.NoteSpecialite * conf.CoeffSpecialite) / (conf.CoeffMath + conf.CoeffSpecialite);
            }
            db.SaveChanges();
        }
示例#10
0
        public ProjectSettingsWindow(AsmProject project)
        {
            Project = project;
            InitializeComponent();

            ProjectName.Text = project.Name;
            foreach (var configuration in project.BuildConfigurations)
            {
                var item = new ConfigurationSelection(configuration);
                ConfigurationSelector.Items.Add(item);
                if (project.CurrentConfiguration == configuration)
                {
                    ConfigurationSelector.SelectedItem = item;
                    LoadSelection(item);
                }
            }
            ConfigurationSelector.Items.Add(new ConfigurationSelection(null));

            ConfigurationSelector.SelectedIndexChanged += (sender, args) =>
            {
                var selection = ConfigurationSelector.SelectedItem as ConfigurationSelection;
                if (selection == null)
                {
                    return;
                }

                if (selection.Configuration == null)
                {
                    using (var newConfigurationWindow = new ConfigurationManager(Project))
                    {
                        newConfigurationWindow.StartPosition = FormStartPosition.CenterParent;
                        var result = newConfigurationWindow.ShowDialog();
                        if (result == DialogResult.OK)
                        {
                            Project.BuildConfigurations.Add(newConfigurationWindow.Configuration);
                            Project.Pristine = false;
                            selection        = new ConfigurationSelection(newConfigurationWindow.Configuration);
                            ConfigurationSelector.Items.Insert(ConfigurationSelector.Items.Count - 1, selection);
                            ConfigurationSelector.SelectedItem = selection;
                        }
                        else
                        {
                            ConfigurationSelector.SelectedItem = _currentSelection;
                            return;
                        }
                    }
                }
                LoadSelection(selection);
            };
        }
示例#11
0
 private void LoadSelection(ConfigurationSelection selection)
 {
     _currentSelection = selection;
     if (selection.SettingsControl == null)
     {
         selection.SettingsControl = new ConfigurationSettings(selection.Configuration, Project)
         {
             Location = configurationSettings1.Location,
             Size     = configurationSettings1.Size
         };
     }
     ConfigurationBox.Controls.Remove(configurationSettings1);
     ConfigurationBox.Controls.Add(configurationSettings1 = selection.SettingsControl);
     ConfigurationBox.Controls.SetChildIndex(selection.SettingsControl, 0);
 }
示例#12
0
        public void SelectionTestAfterReset()
        {
            TestContext.WriteLine("SelectionTestAfterReset");
            var cs = new ConfigurationSelection();

            cs.RemoveFilter(cs.AddFilter(TypeSelection.Exclude, "g1", 0));
            cs.RemoveFilter(cs.AddFilter(TypeSelection.Include, "Ag", 0));
            cs.RemoveFilter(cs.AddFilter(TypeSelection.ExcludeEnd, "35", 0));
            cs.RemoveFilter(cs.AddFilter(TypeSelection.IncludeEnd, "89", 0));
            cs.RemoveFilter(cs.AddFilter(TypeSelection.ExcludeStart, "Ml", 0));
            cs.RemoveFilter(cs.AddFilter(TypeSelection.IncludeStart, "Y", 0));
            cs.CalculateStartFileValidation();
            //
            var result = Validate(cs, StringListForPattern);

            Assert.IsTrue(result.Count == StringListForPattern.Count, "All initial list recovered");
        }
        public void updateConfigurationSelection(ConfigurationSelection configurationSelection)
        {
            var data = db.ConfigurationSelections.Where(c => c.Filiere == configurationSelection.Filiere && c.Niveau == configurationSelection.Niveau).SingleOrDefault();

            if (data == null)
            {
                db.ConfigurationSelections.Add(configurationSelection);
            }
            else
            {
                data.CoeffMath       = configurationSelection.CoeffMath;
                data.CoeffSpecialite = configurationSelection.CoeffSpecialite;
                data.NbrPlace        = configurationSelection.NbrPlace;
                data.NoteMin         = configurationSelection.NoteMin;
                data.TypeClassement  = configurationSelection.TypeClassement;
                data.NbrPlaceListAtt = configurationSelection.NbrPlaceListAtt;
            }

            db.SaveChanges();
        }
 public MasterInterpreterResult[] RunInTransactionWithConfig(ConfigurationSelection config)
 {
     return this.RunInTransactionOnMultipleConfigs(
         config.Context,
         config.SelectedConfigurations,
         config.PostToJobManager,
         config.KeepTemporaryModels);
 }
        public ConfigurationSelection ShowConfigurationSelectionForm(IMgaModel context)
        {
            if (context == null)
            {
                throw new ArgumentNullException();
            }

            ConfigurationSelection results = new ConfigurationSelection()
            {
                Context = context
            };

            var configurationGroups = this.GetConfigurationGroups(context);
            ConfigurationSelectionInput configurationSelectionInput = new ConfigurationSelectionInput();

            AnalysisModelProcessor analysisModelProcessor = null;

            this.ExecuteInTransaction(context, () =>
            {
                analysisModelProcessor = AnalysisModelProcessor.GetAnalysisModelProcessor(context);
                configurationSelectionInput.Context = GMELightObject.GetGMELightFromMgaObject(context);
                configurationSelectionInput.Groups = configurationGroups.Select(x => x.ConvertToLight()).ToArray();
                configurationSelectionInput.IsDesignSpace = configurationGroups.Any(x => x.Owner == null) == false;

                configurationSelectionInput.OperationModeInformation = string.Format("{0} - {1}",
                    SplitCamelCase(analysisModelProcessor.GetInvokedObject().MetaBase.Name),
                    SplitCamelCase(analysisModelProcessor.OriginalSystemUnderTest.Referred.DesignEntity.Kind));

                configurationSelectionInput.OutputDirectory = analysisModelProcessor.GetResultsDirectory();

                configurationSelectionInput.Target = GMELightObject.GetGMELightFromMgaObject(analysisModelProcessor.OriginalSystemUnderTest.Impl);
            });

            var interpreters = analysisModelProcessor.GetWorkflow();
            configurationSelectionInput.InterpreterNames = interpreters.Select(x => x.Name).ToArray();

            using (ConfigurationSelectionForm selectionForm = new ConfigurationSelectionForm(configurationSelectionInput))
            {
                System.Windows.Forms.DialogResult dialogResult = System.Windows.Forms.DialogResult.None;
                if (this.IsInteractive)
                {
                    dialogResult = selectionForm.ShowDialog();
                    this.Logger.GMEConsoleLoggingLevel = selectionForm.ConfigurationSelectionResult.VerboseLogging ?
                        CyPhyGUIs.GMELogger.MessageType_enum.Debug :
                        CyPhyGUIs.SmartLogger.MessageType_enum.Info;
                }
                else
                {
                    selectionForm.SaveSettingsAndResults();
                    dialogResult = System.Windows.Forms.DialogResult.OK;
                }

                if (dialogResult == System.Windows.Forms.DialogResult.OK)
                {
                    var selectionResult = selectionForm.ConfigurationSelectionResult;
                    results.KeepTemporaryModels = selectionResult.KeepTemporaryModels;
                    results.OpenDashboard = selectionResult.OpenDashboard;
                    results.PostToJobManager = selectionResult.PostToJobManager;
                    results.SelectedConfigurations = (MgaFCOs)Activator.CreateInstance(Type.GetTypeFromProgID("Mga.MgaFCOs"));

                    this.ExecuteInTransaction(context, () =>
                    {
                        foreach (var selectedId in selectionResult.SelectedConfigurations.Select(x => x.GMEId))
                        {
                            var selectedGmeObject = context.Project.GetObjectByID(selectedId);
                            if (selectedGmeObject == null)
                            {
                                throw new NullReferenceException("Selected configuration was not found in the project tree.");
                            }

                            results.SelectedConfigurations.Append(selectedGmeObject as MgaFCO);
                        }
                    });
                }
                else
                {
                    throw new ExecutionCanceledByUserException("Main form was canceled.");
                }
            }

            return results;
        }
示例#16
0
        public static List <InformationRepackBsa> GetIntelligentPacking(ConfigurationSelection passBsaSelection, string pathSource, string gameParameter, bool isCreateDummy, bool isVerbose)
        {
            var source = new DirectoryInfo(pathSource);
            var result = new List <InformationRepackBsa>();

            //
            //
            foreach (DirectoryInfo directoryInfo in source.GetDirectories())
            {
                if (!passBsaSelection.GetValidation(directoryInfo.Name))
                {
                    continue;
                }
                //
                //auto correction when doing bullshit
                var correctThese = directoryInfo.GetDirectories().Where(d => d.Name.EndsWith("octatempdir", StringComparison.OrdinalIgnoreCase));
                foreach (DirectoryInfo info in correctThese)
                {
                    MoveFiles(info, directoryInfo);
                    DeleteEmptyDirectory(info);
                }
                directoryInfo.Refresh();
                //dummy esp

                //
                if (!directoryInfo.GetFiles().Any(f => string.Equals(f.Extension, ".bsa", StringComparison.OrdinalIgnoreCase)) &&
                    directoryInfo.GetDirectories().Any(d => PossibleBsaDirs.Any(e => string.Equals(e, d.Name, StringComparison.OrdinalIgnoreCase))) &&
                    SearchAnyFilesOkForArchive(directoryInfo))
                {
                    //
                    var espFile = directoryInfo.GetFiles().FirstOrDefault(f => string.Equals(f.Extension, ".esp", StringComparison.OrdinalIgnoreCase) ||
                                                                          string.Equals(f.Extension, ".esm", StringComparison.OrdinalIgnoreCase) ||
                                                                          string.Equals(f.Extension, ".esl", StringComparison.OrdinalIgnoreCase));
                    //
                    if (isCreateDummy && espFile == null)
                    {
                        FileInfo fDummy = new FileInfo("dummy.esp");
                        if (fDummy.Exists)
                        {
                            File.Copy(fDummy.FullName, Path.Combine(directoryInfo.FullName, string.Format("{0}.esp", directoryInfo.Name)));
                            espFile = directoryInfo.GetFiles().FirstOrDefault(f => string.Equals(f.Extension, ".esp", StringComparison.OrdinalIgnoreCase));
                        }
                    }
                    //
                    if (espFile != null)
                    {
                        bool isSound = directoryInfo.GetDirectories().Any(d =>
                                                                          string.Equals(d.Name, "music", StringComparison.OrdinalIgnoreCase) ||
                                                                          string.Equals(d.Name, "sound", StringComparison.OrdinalIgnoreCase));
                        bool isTextureOnly = directoryInfo.GetDirectories().Length == 1 && directoryInfo.GetDirectories()
                                             .Any(d => string.Equals(d.Name, "textures", StringComparison.OrdinalIgnoreCase));
                        var repackCfg  = GetGoodRepackConfiguration(Path.GetFileNameWithoutExtension(espFile.FullName), gameParameter, isSound, isTextureOnly);
                        var listResult = PrepareForPacking(repackCfg, directoryInfo.FullName, gameParameter, false, isVerbose);
                        result.AddRange(listResult);
                    }
                }
                //
            }
            //
            return(result);
        }
        public IEnumerable <AdmisModel> selectStudents(string filiere, string nv)
        {
            if (nv == "3")
            {
                ConfigurationSelection conf = db.ConfigurationSelections.Where(a => a.Filiere.Equals(filiere) && a.Niveau.Equals(nv)).SingleOrDefault();
                int nombreTotal             = conf.NbrPlace + conf.NbrPlaceListAtt;
                // les persones deja admis deviens non admis
                var data = db.Candidats.Where(c => c.Filiere.Nom.Equals(filiere) && c.Admis == true && c.Niveau == 3);
                foreach (var person in data)
                {
                    person.Admis = false;
                }
                // les persones deja selection en liste d'att deviens non selectionee
                var data1 = db.Candidats.Where(c => c.Filiere.Nom.Equals(filiere) && c.listDatt == true && c.Niveau == 3);
                foreach (var person in data1)
                {
                    person.listDatt = false;
                }

                //      var total = db.CouncourEcrits.Include("Candidat").Take(nombreTotal).OrderByDescending(c=>c.NoteGenerale).Where(c => c.NoteGenerale > conf.NoteMin);

                // Take(NbrePlace)
                var admis = db.CouncourEcrits.Include("Candidat").Where(c => c.NoteGenerale > conf.NoteMin).OrderByDescending(c => c.NoteGenerale).Take(conf.NbrPlace);
                foreach (var a in admis)
                {
                    a.Candidat.Admis = true;
                }
                // Take(NbrePlace) for liste d'attente
                var listeAtt = db.CouncourEcrits.Include("Candidat").Where(c => c.NoteGenerale > conf.NoteMin).OrderByDescending(c => c.NoteGenerale).Take(conf.NbrPlaceListAtt + 1);
                foreach (var a in listeAtt)
                {
                    a.Candidat.listDatt = true;
                }

                db.SaveChanges();

                var x = (from c in db.Candidats
                         join a in db.AnneeUniversitaires on c.Cne equals a.Cne
                         join fi in db.Filieres on c.ID equals fi.ID
                         join b in db.Baccalaureats on c.Cne equals b.Cne
                         join concour in db.CouncourEcrits on c.Cne equals concour.Cne
                         where concour.NoteGenerale > conf.NoteMin
                         join d in db.Diplomes on c.Cne equals d.Cne
                         where !db.Corbeilles.Select(g => g.CNE).ToList().Contains(c.Cne)
                         where c.Niveau == 3
                         where fi.Nom == filiere
                         where c.Conforme == false
                         where (a.Redoublant1.Equals("Non") && a.Redoublant2.Equals("Non"))
                         orderby concour.NoteGenerale
                         descending


                         select new AdmisModel
                {
                    Nom = c.Nom,
                    Prenom = c.Prenom,
                    Sexe = c.Sexe,
                    NoteBac = b.NoteBac,
                    Note1 = a.Semestre1,
                    Note2 = a.Semestre2,
                    Note3 = a.Semestre3,
                    Note4 = a.Semestre4,
                    Note5 = a.Semestre5,
                    Note6 = a.Semestre6,
                    Dossier = c.Num_dossier,

                    Math = concour.NoteMath,
                    Specialite = concour.NoteSpecialite,
                    Globale = concour.NoteGenerale,
                    Matricule = c.Matricule,

                    Type_dip = d.Type,
                    note_Diplome = d.NoteDiplome,
                    Etablissement = d.Etablissement,
                    Ville_dip = d.VilleObtention,

                    Admis = c.Admis,
                    Filiere = db.Filieres.Where(f => f.ID == c.ID).FirstOrDefault().Nom,
                    Cin = c.Cin,
                    Cne = c.Cne,
                }).ToList();

                int NombrePlaceTotal = conf.NbrPlaceListAtt + conf.NbrPlace;
                x = x.Take(NombrePlaceTotal).ToList();
                string classement = db.ConfigurationSelections.Where(c => c.Filiere.Equals(filiere) && c.Niveau == nv).SingleOrDefault().TypeClassement;

                if (classement.Equals("noteGlobal"))
                {
                    x = x.OrderByDescending(critere => critere.Globale).ToList();
                }

                else if (classement.Equals("noteMath"))
                {
                    x = x.OrderByDescending(critere => critere.Math).ToList();
                }

                else if (classement.Equals("noteBac"))
                {
                    x = x.OrderByDescending(critere => critere.NoteBac).ToList();
                }


                return(x);
            }

            else if (nv == "4")
            {
                ConfigurationSelection conf = db.ConfigurationSelections.Where(a => a.Filiere.Equals(filiere) && a.Niveau == nv).SingleOrDefault();
                int nombreTotal             = conf.NbrPlace + conf.NbrPlaceListAtt;
                // les persones deja admis deviens non admis
                var data = db.Candidats.Where(c => c.Filiere.Nom.Equals(filiere) && c.Admis == true && c.Niveau == 4);
                foreach (var person in data)
                {
                    person.Admis = false;
                }

                //      var total = db.CouncourEcrits.Include("Candidat").Take(nombreTotal).OrderByDescending(c=>c.NoteGenerale).Where(c => c.NoteGenerale > conf.NoteMin);

                // Take(NbrePlace)
                var admis = db.CouncourOrals.Include("Candidat").OrderBy(c => c.Classement).Take(conf.NbrPlace + 1);
                foreach (var a in admis)
                {
                    a.Candidat.Admis = true;
                }

                db.SaveChanges();

                var x = (from c in db.Candidats
                         join a in db.AnneeUniversitaires on c.Cne equals a.Cne
                         join fi in db.Filieres on c.ID equals fi.ID
                         join b in db.Baccalaureats on c.Cne equals b.Cne
                         join concour in db.CouncourOrals on c.Cne equals concour.Cne

                         join d in db.Diplomes on c.Cne equals d.Cne
                         where !db.Corbeilles.Select(g => g.CNE).ToList().Contains(c.Cne)
                         where c.Niveau == 4
                         where fi.Nom == filiere
                         where c.Conforme == false
                         where (a.Redoublant1.Equals("Non") && a.Redoublant2.Equals("Non") && a.Redoublant3.Equals("Non"))
                         orderby concour.Classement


                         select new AdmisModel
                {
                    Nom = c.Nom,
                    Prenom = c.Prenom,
                    Sexe = c.Sexe,
                    NoteBac = b.NoteBac,
                    Note1 = a.Semestre1,
                    Note2 = a.Semestre2,
                    Note3 = a.Semestre3,
                    Note4 = a.Semestre4,
                    Note5 = a.Semestre5,
                    Note6 = a.Semestre6,
                    Dossier = c.Num_dossier,

                    Math = 0,
                    Specialite = 0,
                    Globale = 0,
                    Matricule = c.Matricule,

                    Type_dip = d.Type,
                    note_Diplome = d.NoteDiplome,
                    Etablissement = d.Etablissement,
                    Ville_dip = d.VilleObtention,

                    Admis = c.Admis,
                    Filiere = db.Filieres.Where(f => f.ID == c.ID).FirstOrDefault().Nom,
                    Cin = c.Cin,
                    Cne = c.Cne,
                }).ToList();

                int NombrePlaceTotal = conf.NbrPlaceListAtt + conf.NbrPlace;
                x = x.Take(NombrePlaceTotal).ToList();



                return(x);
            }

            return(null);
        }