Ejemplo n.º 1
0
        private void LoadTemplate(string selectedPath)
        {
            loadedEditorEngine = MainForm.GetOmrEngine().CreateTemplateForm();

            loadedEditorEngine.Load(new FileStream(selectedPath, FileMode.Open, FileAccess.Read));
        }
Ejemplo n.º 2
0
        // this prepares a recently deserialized workspace for use
        internal void Unpack()
        {
            InitializeDefaults();

            using (MemoryStream ms = new MemoryStream(filepathDictionaryBytes))
            {
                BinaryFormatter bf = new BinaryFormatter();
                myImages = (Dictionary <string, string>)bf.Deserialize(ms);

                ms.Close();
            }

            foreach (string key in myImages.Keys)
            {
                imageManager.Add(key, myImages[key]);
            }

            if (string.IsNullOrWhiteSpace(myAnswerkeyPath) == false)
            {
                imageManager.Add(IMGMGR_ANSWERS, myAnswerkeyPath);
            }

            template = MainForm.GetOmrEngine().CreateTemplateForm();

            results = new List <IRecognitionForm>();

            using (MemoryStream ms = new MemoryStream(templateBytes))
            {
                template.Load(ms);
            }

            templateImage = template.Pages[0].Image;
            for (int i = 1; i < template.Pages.Count; i++)
            {
                templateImage.AddPage(template.Pages[i].Image);
            }

            if (answerBytes != null)
            {
                answers = MainForm.GetOmrEngine().CreateRecognitionForm();
                using (MemoryStream ms = new MemoryStream(answerBytes))
                {
                    answers.Load(ms);
                }
                answerReviewCounts = GetManualReviewCollection(answers, VerificationParameters.AllParameters);
            }

            resultReviewCounts = new ReviewCounter();

            for (int i = 0; i < resultsBytes.Length; i++)
            {
                using (MemoryStream ms = new MemoryStream(resultsBytes[i]))
                {
                    IRecognitionForm frm = MainForm.GetOmrEngine().CreateRecognitionForm();

                    frm.Load(ms);

                    resultReviewCounts += GetManualReviewCollection(frm, VerificationParameters.AllParameters, answers, reviewRequiredStatus[i]);

                    results.Add(frm);
                }
            }
        }