Inheritance: System.Web.UI.Page
Ejemplo n.º 1
0
 public object searchUserEmail(string user, string Email)
 {
     Results<string> result = new Results<string>();
     HelperData h = new HelperData();
     try
     {
         result.Value = h.searchUserEmail(user, Email);
         if (result.Value != "0" && result.Value != "-1")
         {
             result.IsSuccessfull = true;
             result.Message = "";
         }
         else
         {
             result.IsSuccessfull = false;
             result.Message = "نام کاربری یا آدرس ایمیل وارد شده اشتباه میباشد";
         }
         return result;
     }
     catch
     {
         result.IsSuccessfull = false;
         result.Message = "ارتباط با پایگاه داده برقرار نشد. خطای شماره 190";
         return result;
     }
 }
Ejemplo n.º 2
0
        public object sendEmail(string user, string email)
        {
            Results<string> result = new Results<string>();
            try
            {
                SmtpClient smtp = new SmtpClient("smtp.mail.yahoo.com");
                smtp.EnableSsl = true;
                smtp.Credentials = new NetworkCredential("*****@*****.**", "sally_bam66");
                MailMessage m = new MailMessage();
                m.SubjectEncoding = System.Text.Encoding.UTF8;
                m.BodyEncoding = System.Text.Encoding.UTF8;
                m.From = new MailAddress("*****@*****.**");
                m.To.Add(email);
                m.Subject = "تغییر رمز عبور سامانه ";
                m.Body = "با سلام.رمز عبور جدید شما برای ورود به سامانه ثبت شناسنامه ی نرم افزارها عبارت : "+user+" میباشد. ";
                smtp.Send(m);
                result.IsSuccessfull = true;
                return result;
            }

            catch (Exception error)
            {
                result.IsSuccessfull = false;
                result.Message = "امکان ارسال ایمیل نمیباشد. خطای شماره 192" + Environment.NewLine + error.Message;
                return result;
            }
        }
Ejemplo n.º 3
0
        public object changPass(string userName)
        {
            Results<string> result = new Results<string>();
            HelperData h = new HelperData();
            try
            {
                string  newPass = new CustomMembershipProvider().EncryptPassword(userName);
                result.Value = h.changPass(userName, newPass);
                if (result.Value != "0")
                {
                    result.IsSuccessfull = true;
                    result.Message = "";
                }
                else
                {
                    result.IsSuccessfull = false;

                }
                return result;
            }
            catch
            {
                result.IsSuccessfull = false;
                result.Message = "ارتباط با پایگاه داده برقرار نشد. خطای شماره 190";
                return result;
            }
        }
Ejemplo n.º 4
0
 private static void SecondPass(VersionHandler handler, int[] maxCharacters, List<DeviceResult> initialResults, Results results)
 {
     int lowestScore = int.MaxValue;
     foreach (DeviceResult current in initialResults)
     {
         // Calculate the score for this device.
         int deviceScore = 0;
         for (int segment = 0; segment < handler.VersionRegexes.Length; segment++)
         {
             deviceScore += (maxCharacters[segment] - current.Scores[segment].CharactersMatched + 1)*
                            (current.Scores[segment].Difference + maxCharacters[segment] -
                             current.Scores[segment].CharactersMatched);
         }
         // If the score is lower than the lowest so far then reset the list
         // of best matching devices.
         if (deviceScore < lowestScore)
         {
             results.Clear();
             lowestScore = deviceScore;
         }
         // If the device score is the same as the lowest score so far then add this
         // device to the list.
         if (deviceScore == lowestScore)
         {
             results.Add(current.Device);
         }
     }
 }
Ejemplo n.º 5
0
        protected internal override Results Match(string userAgent)
        {
            bool isMobile = false;

            // Use RIS to find a match first.
            Results results = base.Match(userAgent);

            // If no match with RIS then try edit distance.
            if (results == null || results.Count == 0)
                results = Matcher.Match(userAgent, this);

            // If a match other than edit distance was used then we'll have more confidence
            // and return the mobile version of the device.
            if (results.GetType() == typeof (Results))
                isMobile = true;

            Results newResults = new Results();

            // Look at the results for one that matches our isMobile setting based on the
            // matcher used.
            foreach (Result result in results)
            {
                if (result.Device.IsMobileDevice == isMobile)
                    newResults.Add(result.Device);
            }

            // Return the new results if any values are available.
            return newResults;
        }
Ejemplo n.º 6
0
        public object changePass(string oldPass, string newPass)
        {
            Results<string> result = new Results<string>();
            HelperData h = new HelperData();

            try
            {
                newPass = new CustomMembershipProvider().EncryptPassword(newPass);
                oldPass = new CustomMembershipProvider().EncryptPassword(oldPass);
                result.Value = h.changePass(oldPass, newPass, Convert.ToInt32(System.Web.HttpContext.Current.Session["userCode"]));
                if (result.Value == "1")
                {
                    result.IsSuccessfull = true;
                }
                else if (result.Value == "0")
                {
                    result.IsSuccessfull = false;
                    result.Message = "رمز عبور فعلی، اشتباه وارد شده است";
                }
                else
                {
                    result.IsSuccessfull = false;
                    result.Message = "امکان ویرایش اطلاعات نمیباشد/ خطای شماره 100";
                }
                return result;
            }
            catch (Exception error)
            {
                result.Message = error.Message;
                result.IsSuccessfull = false;
                return result;
            }
        }
Ejemplo n.º 7
0
        public void VisibleAppliedFilters_Should_Return_Only_Visible_Filters()
        {
            var visibleFilter1 = new Slice
                                     {
                                         Name = "Filtro 1",
                                         Visible = true
                                     };
            var visibleFilter2 = new Slice
                                     {
                                         Name = "Filtro 2",
                                         Visible = true
                                     };
            var invisibleFilter = new Slice
                                      {
                                          Name = "Filtro Invisible",
                                          Visible = false
                                      };

            var results = new Results<Publication>(1, 10);
            results.AddAppliedFilter(visibleFilter1);
            results.AddAppliedFilter(visibleFilter2);
            results.AddAppliedFilter(invisibleFilter);

            Assert.Contains(visibleFilter1, results.VisibleAppliedFilters);
            Assert.Contains(visibleFilter2, results.VisibleAppliedFilters);
            Assert.IsFalse(results.VisibleAppliedFilters.Contains(invisibleFilter));
        }
Ejemplo n.º 8
0
        public object creatReq(fieldInfo rn, List<tendencyInfo> rgr)
        {
            Results<string> result = new Results<string>();

            try
            {
                HelperData h = new HelperData();
              //  db.Connection.Open();
              //  using (db.Transaction = db.Connection.BeginTransaction())
                rn.deleted = false;
                int t = h.AddFieldInfo(rn);
                if (t != 0)
                {
                    bool s = h.AddTendency(rgr, t);
                    if (s)
                    {
                        //  db.Transaction.Commit();
                        result.IsSuccessfull = true;
                    }
                }
                else
                {
                    result.Message = "خطا!نام رشته وارد شده قبلا در سیستم ثبت شده است";
                }
            }
            catch (Exception error)
            {
              //  db.Transaction.Rollback();
                result.IsSuccessfull = false;
                result.Message = error.Message;
            }
            return result;
        }
Ejemplo n.º 9
0
        public object checkUserName(string userName)
        {
            Results<DataTable> result = new Results<DataTable>();
            try
            {

                HelperSearch h = new HelperSearch();
                int list = h.checkUniqUser(userName);

                if (list == 1)
                {
                    result.Message = "";
                    result.IsSuccessfull = true;
                }
                else if (list == 2)
                {
                    result.Message = "نام کاربری تکراری است.";
                    result.IsSuccessfull = false;
                }
                return result;
            }
            catch
            {
                return result;
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Returns the coefficient to be used in order to display the results according to the preferences of the IResult
        /// object used to create the instance of this object. Returns the prefered functional unit divided by the functional unit.
        /// 
        /// In case of the FunctionalUnit is null or the PreferedUnit is null, this method returns a ratio of 1. This is usefull to
        /// display the Inputs results and the TransportationSteps results which are accounted for all outputs and not a specific one.
        /// In these cases instead of defining a PreferedUnit for each output we prefer to define none to make things simpler (see InputResult.GetResults)
        /// 
        /// Before display all results must be multiplied by this coefficient
        /// 
        /// May return a NullReferenceExeption if the IResult object does not define FunctinoalUnit, PreferedDisplayedUnit or PreferedDisplayedAmount
        /// </summary>
        /// <param name="results"></param>
        /// <returns></returns>
        internal static double GetFunctionalRatio(GData data, Results results, int producedResourceId)
        {
            if (results != null && results.CustomFunctionalUnitPreference != null && results.CustomFunctionalUnitPreference.PreferredUnitExpression != null)
            {
                LightValue functionalUnit = new LightValue(1.0, results.BottomDim);
                LightValue preferedFunctionalUnit = GetPreferedVisualizationFunctionalUnit(data, results, producedResourceId);

                switch (preferedFunctionalUnit.Dim)
                {
                    case DimensionUtils.MASS: // HARDCODED
                        {
                            functionalUnit = data.ResourcesData[producedResourceId].ConvertToMass(functionalUnit);
                        } break;
                    case DimensionUtils.ENERGY: // HARDCODED
                        {
                            functionalUnit = data.ResourcesData[producedResourceId].ConvertToEnergy(functionalUnit);
                        } break;
                    case DimensionUtils.VOLUME: // HARDCODED
                        {
                            functionalUnit = data.ResourcesData[producedResourceId].ConvertToVolume(functionalUnit);
                        } break;
                }
                return preferedFunctionalUnit.Value / functionalUnit.Value;
            }
            else
                return 1;
        }
Ejemplo n.º 11
0
		public async override Task<Results> Run ()
		{
			var location = Location;
			if (location == null)
				return null;

			var container = CKContainer.DefaultContainer;
			var publicDB = container.PublicCloudDatabase;
			var query = new CKQuery ("Items", NSPredicate.FromValue (true)) {
				SortDescriptors = new NSSortDescriptor [] {
					new CKLocationSortDescriptor ("location", location)
				}
			};

			var defaultZoneId = new CKRecordZoneID (CKRecordZone.DefaultName, CKContainer.OwnerDefaultName);
			CKRecord [] recordArray = await publicDB.PerformQueryAsync (query, defaultZoneId);
			var results = new Results (alwaysShowAsList: true);

			var len = recordArray.Length;
			if(len == 0)
				ListHeading = "No matching items";
			else if (len == 1)
				ListHeading = "Found 1 matching item:";
			else
				ListHeading = $"Found {recordArray.Length} matching items:";

			results.Items.AddRange (recordArray.Select (r => new CKRecordWrapper (r)));
			return results;
		}
Ejemplo n.º 12
0
    /**
     * Tells the GUI what the current question's results are and to display them on the screen.
     * The results will contain each player's question, answer, and correctness of the answer.
     * The GUI will first display each player's answer along with the correct answeyth vhur.
     * A dramatic pause between the player's answer and correct answer can be added.
     * The GUI should signify which questions are correct and which ones aren't.
     *
     * The GUI should then enable a button to let the player continue to the next question.
     * When the button is pressed, the GUI will report to the Core.
     * Once all players are ready to move on, the Core will call nextQuestion for the GUI to ask the next question.
     * If there are no more questions, the Core will call displayFinalResults instead
     *
     * Just a note: This uses the viewNextButton, which currently has pretty bad ways of hiding
     * the button. We may need to refactor this code in the future to efficiently and more elegantly
     * hide and make the button appear.
     */
    public void displayQuestionResults(Results theResults)
    {
        // Audio to play on question load
        GameObject myViewGradeResult = GameObject.Find ("viewGradeResult");
        // Gives feedback on correctness
        GameObject myViewGradeText = GameObject.Find ("viewGradeText");
        // Moves on to next question ("Onwards!")
        GameObject myViewNextButton = GameObject.Find ("viewNextButton");

        //Image myViewGradeResultImage = myViewGradeResult.GetComponents<Image> ();
        Text myViewGradeTextComponent = myViewGradeText.GetComponent<Text> ();

        // Update the contents depending on whether you got it right or not
        if (theResults.isCorrect [0]) {
            myViewGradeTextComponent.text = "Hey, " + theResults.players [0].playerName + " got this correct!";
            myViewGradeTextComponent.color = Color.green;
            // Change the graphic to HAPPY
            //(GameObject.Find ("playerReaction")).GetComponent<Image>().sprite = Resources.Load("Cerulean_Happy") as Sprite;
        } else {
            myViewGradeTextComponent.text = theResults.players [0].playerName + " got this wrong. You suck.";
            myViewGradeTextComponent.color = Color.red;
            // Change the graphic to SAD
            //(GameObject.Find ("playerReaction")).GetComponent<Image>().sprite = Resources.Load ("Cerulean_Sad") as Sprite;
        }
        // Make things appear.
        // TODO: REFACTORING, I CALL DIBS, HANDS OFF NICK -- Watson
        myViewGradeTextComponent.enabled = true;
        (myViewNextButton.GetComponent<Image> ()).enabled = true;
        ((GameObject.Find ("viewNextButtonText")).GetComponent<Text>()).enabled = true;
    }
Ejemplo n.º 13
0
        public object DeleteZone(short zoneCode)
        {
            Results<DataTable> result = new Results<DataTable>();
               try
               {

               HelperData sHelper = new HelperData();
               int i = sHelper.DeleteZoneInfo(zoneCode);
               if (i == 1)
               {
                   result.Message = "";
                   result.IsSuccessfull = true;
               }
               else
               {
                   result.Message = "";
                   result.IsSuccessfull = false;
               }
                   return result;
               }
               catch
               {
               return result;
               }
        }
Ejemplo n.º 14
0
 public void NewResult_WithEmptyPoiList_ContainsZeroPoisInResult()
 {
     var pois = new List<Poi>();
     var result = new Results(pois);
     result.Value.Should().NotBeNull();
     result.Value.Should().HaveCount(0);
 }
Ejemplo n.º 15
0
        public object deleteVahed(short vahedCode)
        {
            Results<DataTable> result = new Results<DataTable>();
            try
            {

                HelperData sHelper = new HelperData();
                int list = sHelper.DeleteVahedInfo(vahedCode);

                if (list == 1)
                {
                    result.Message = "";
                    result.IsSuccessfull = true;
                }
                else
                {

                    result.IsSuccessfull = false;
                }
                return result;
            }
            catch
            {
                return result;
            }
        }
Ejemplo n.º 16
0
        public object SearchInTable(string Name, int firstRow)
        {
            DataTable list = new DataTable();
            Results<DataTable> result = new Results<DataTable>();
            try
            {

                helperSearch sHelper = new helperSearch();
                list = sHelper.searchVahed(Name, firstRow, firstRow +6 -1);

                if (list.Rows.Count == 0)
                {
                    result.Message = "";
                    result.IsSuccessfull = false;
                }
                else
                {
                    result.Value = list;
                    result.IsSuccessfull = true;
                }
                return result;
            }
            catch
            {
                return result;
            }
        }
        public Results<string> creatSoftReq(softwareInfo rn,upgrade up)
        {
            Results<string> result = new Results<string>();
            try
            {
                HelperData h = new HelperData();
                rn.userCode = Convert.ToInt16(System.Web.HttpContext.Current.Session["userCode"]);
                rn.deleted = false;
                up.deleted = false;
                Int16 t = h.AddSoftwareInfo(rn);
                if (t != 0)
                {
                    result.IsSuccessfull = true;
                    up.softwareCode = rn.softwareCode;
                    h.AddUpgrade(up);

                }
            }
            catch (Exception error)
            {
                result.IsSuccessfull = false;
                result.Message = error.Message;
            }
            return result;
        }
 public ReportCardFacade(Student aStudent)
 {
     student = aStudent;
     studentResult = new Results(aStudent);
     studentBehavior = new Behavior(aStudent);
     studentAttendance = new Attendance(aStudent);
 }
Ejemplo n.º 19
0
 public static void ResponseBuyItem(Client client, Results results)
 {
     using (var packet = new PacketWriter(Operation.MatchResponseBuyItem, CryptFlags.Decrypt))
     {
         packet.Write((Int32)results);
         client.Send(packet);
     }
 }
Ejemplo n.º 20
0
        public void FormatDetails_with_empty_detail_should_return_empty_string()
        {
            var results = new Results {
                DetailList = new IResultDetail[] { }
            };

            Assert.That(results.FormatDetails(), Is.Empty);
        }
Ejemplo n.º 21
0
		Results ProcessResult (CKRecord record)
		{
			var results = new Results ();
			if (record != null)
				results.Items.Add (new CKRecordWrapper (record));

			return results;
		}
Ejemplo n.º 22
0
 public XmlTestResult(TestResultInfo testResultInfo)
 {
     switch (testResultInfo.Result)
     {
         case TestResultInfo.TestResults.Passed: this.Status = Results.Passed; break;
         case TestResultInfo.TestResults.Failed: this.Status = Results.Failed; break;
         case TestResultInfo.TestResults.UnexpectedError: this.Status = Results.UnexpectedError; break;
     }
 }
    /**
     * Grades the player's answer and stores the result
     */
    void grade(Results myResults, Player myPlayer)
    {
        Debug.Log ("At grade");
        Debug.Log (myResults.players.Count);
        // Add player
        myResults.players.Add (myPlayer);

        Debug.Log (myResults.players.Count);

        if (myPlayer == null)
            Debug.Log ("Don't show me... >_<");

        // Add player's answer
        myResults.playerAnswers.Add (myPlayer.lastAnswer);

        Debug.Log ("Yatta!");

        Debug.Log ("You picked " + myResults.playerAnswers[0].textAnswer + " which is an awful answer.");

        Debug.Log (myResults.playerAnswers.Count + "WOW!");

        // Grade answer
        // The answers are case insensitive
        // If the function does not know how to grade the question, grades it false

        // For readability
        string playerAnswer;
        string correctAnswer;

        switch (myPlayer.lastAnswer.myQuestionType) {
            // Compare multiple choice answers
        case QuestionType.MultipleChoice:
            // Grab player's answer
            playerAnswer = myPlayer.lastAnswer.multipleChoiceAnswer.ToString().ToUpper();

            // Grab correct answer
            correctAnswer = myResults.originalQuestion.correctAnswer.multipleChoiceAnswer.ToString().ToUpper();

            // Grade answer and push to results List
            myResults.isCorrect.Add(playerAnswer == correctAnswer);
            break;
        case QuestionType.ShortAnswer:
            // Grab player's answer
            playerAnswer = myPlayer.lastAnswer.textAnswer.ToUpper();

            // Grab correct answer
            correctAnswer = myResults.originalQuestion.correctAnswer.textAnswer.ToUpper();

            // Grade answer and push to results List
            myResults.isCorrect.Add (playerAnswer == correctAnswer);
            break;
        default:
            myResults.isCorrect.Add(false);
            break;

        }
    }
Ejemplo n.º 24
0
        public bool DecodeTelemetryEvent(Results results, out string eventName, out KeyValuePair<string, object>[] properties)
        {
            properties = null;

            // NOTE: the message event is an MI Extension from clrdbg, though we could use in it the future for other debuggers
            eventName = results.TryFindString("event-name");
            if (string.IsNullOrEmpty(eventName) || !char.IsLetter(eventName[0]) || !eventName.Contains('/'))
            {
                Debug.Fail("Bogus telemetry event. 'Event-name' property is missing or invalid.");
                return false;
            }

            TupleValue tuple;
            if (!results.TryFind("properties", out tuple))
            {
                Debug.Fail("Bogus message event, missing 'properties' property");
                return false;
            }

            List<KeyValuePair<string, object>> propertyList = new List<KeyValuePair<string, object>>(tuple.Content.Count);
            foreach (NamedResultValue pair in tuple.Content)
            {
                ConstValue resultValue = pair.Value as ConstValue;
                if (resultValue == null)
                    continue;

                string content = resultValue.Content;
                if (string.IsNullOrEmpty(content))
                    continue;

                object value = content;
                int numericValue;
                if (content.Length >= 3 && content.StartsWith("0x", StringComparison.OrdinalIgnoreCase) && int.TryParse(content.Substring(2), NumberStyles.AllowHexSpecifier, CultureInfo.InvariantCulture, out numericValue))
                {
                    value = numericValue;
                }
                else if (int.TryParse(content, NumberStyles.None, CultureInfo.InvariantCulture, out numericValue))
                {
                    value = numericValue;
                }

                if (value != null)
                {
                    propertyList.Add(new KeyValuePair<string, object>(pair.Name, value));
                }
            }

            properties = propertyList.ToArray();

            // If we are processing a clrdbg ProcessCreate event, save the event properties so we can use them to send other events
            if (eventName == "VS/Diagnostics/Debugger/clrdbg/ProcessCreate")
            {
                _clrdbgProcessCreateProperties = properties;
            }

            return true;
        }
 /// <summary>
 /// Writes RemoteInstall output to an HTML file, uses formatting from an XSL file
 /// </summary>
 public void Write(Results results, string fileName)
 {
     XPathDocument xmlPathDocument = new XPathDocument(new XmlNodeReader(results.GetXml()));
     XslCompiledTransform xslTransform = new XslCompiledTransform();
     xslTransform.Load(XmlReader.Create(XslStream));
     XmlTextWriter writer = new XmlTextWriter(fileName, System.Text.Encoding.UTF8);
     xslTransform.Transform(xmlPathDocument, null, writer);
     writer.Close();
 }
Ejemplo n.º 26
0
 //Volver
 private void Button_Click_1(object sender, RoutedEventArgs e)
 {
     back = true;
     Results newWindow = new Results(dataList);
     newWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner;
     newWindow.Owner = this;
     newWindow.Show();
     Hide();
 }
 /// <summary>
 /// Writes RemoteInstall output to an XML file, also generates an XSL file in the same directory to use for XSLT
 /// </summary>
 public void Write(Results results, string fileName)
 {
     XmlDocument xml = results.GetXml();
     string xslFileName = Path.Combine(Path.GetDirectoryName(fileName), Path.GetFileNameWithoutExtension(fileName) + ".xsl");
     XmlProcessingInstruction pi = xml.CreateProcessingInstruction("xml-stylesheet", string.Format("type=\"text/xsl\" href=\"{0}\"", Path.GetFileName(xslFileName)));
     xml.InsertAfter(pi, xml.FirstChild);
     xml.Save(fileName);
     Xsl.Save(xslFileName);
 }
Ejemplo n.º 28
0
        public void should_throw_if_read_attempted_after_all_results_have_been_read()
        {
            // Arrange
            var reader = SetupPersonTable().CreateDataReader();
            var results = new Results(reader);
            results.Read<MockPerson>();

            // Act & Assert
            Assert.Throws<ResultsException>(() => results.Read<MockPerson>());
        }
Ejemplo n.º 29
0
        public override void Process(HttpContext context)
        {
            string query = context.Request.QueryString["q"];
            if (query == null)
                return;

            // Look for special searches
            if (SpecialSearches.ContainsKey(query))
            {
                string path = SpecialSearches[query];

                if (context.Request.QueryString["jsonp"] != null)
                {
                    // TODO: Does this include the JSONP headers?
                    SendFile(context, JsonConstants.MediaType, path);
                    return;
                }

                if (Accepts(context, JsonConstants.MediaType))
                {
                    SendFile(context, JsonConstants.MediaType, path);
                    return;
                }
                return;
            }

            //
            // Do the search
            //
            ResourceManager resourceManager = new ResourceManager(context.Server, context.Cache);
            SectorMap map = SectorMap.FromName(SectorMap.DefaultSetting, resourceManager);

            query = query.Replace('*', '%'); // Support * and % as wildcards
            query = query.Replace('?', '_'); // Support ? and _ as wildcards

            if (UWP_REGEXP.IsMatch(query))
                query = "uwp:" + query;

            const int NUM_RESULTS = 160;

            var searchResults = SearchEngine.PerformSearch(query, resourceManager, SearchEngine.SearchResultsType.Default, NUM_RESULTS);

            Results resultsList = new Results();

            if (searchResults != null)
            {
                resultsList.AddRange(searchResults
                    .Select(loc => Results.LocationToSearchResult(map, resourceManager, loc))
                    .OfType<Results.SearchResultItem>()
                    .OrderByDescending(item => item.Importance)
                    .Take(NUM_RESULTS));
            }

            SendResult(context, resultsList);
        }
Ejemplo n.º 30
0
        public void should_advance_to_next_result_after_every_read()
        {
            // Arrange
            var mockReader = new Mock<IDataReader>();
            mockReader.Setup(reader => reader.Read()).Returns(false);
            var results = new Results(mockReader.Object);

            results.Read<dynamic>();

            mockReader.Verify(reader => reader.NextResult(), Times.Once());
        }
Ejemplo n.º 31
0
        private async Task InternalFetchChildren()
        {
            this.VerifyNotDisposed();

            Results results = await _engine.DebuggedProcess.MICommandFactory.VarListChildren(_internalName, PropertyInfoFlags, ResultClass.None);

            if (results.ResultClass == ResultClass.done)
            {
                TupleValue[] children = results.Contains("children")
                    ? results.Find <ResultListValue>("children").FindAll <TupleValue>("child")
                    : new TupleValue[0];
                int  i       = 0;
                bool isArray = IsArrayType();
                if (isArray)
                {
                    CountChildren = results.FindUint("numchild");
                    Children      = new VariableInformation[CountChildren];
                    foreach (var c in children)
                    {
                        Children[i] = new VariableInformation(c, this);
                        i++;
                    }
                }
                else if (IsMapType())
                {
                    //
                    // support for gdb's pretty-printing built-in displayHint "map", from the gdb docs:
                    //      'Indicate that the object being printed is “map-like”, and that the
                    //      children of this value can be assumed to alternate between keys and values.'
                    //
                    List <VariableInformation> listChildren = new List <VariableInformation>();
                    for (int p = 0; (p + 1) < children.Length; p += 2)
                    {
                        if (children[p].TryFindUint("numchild") > 0)
                        {
                            var variable = new VariableInformation("[" + (p / 2).ToString() + "]", this);
                            variable.CountChildren = 2;
                            var first  = new VariableInformation(children[p], variable, "first");
                            var second = new VariableInformation(children[p + 1], this, "second");

                            variable.Children = new VariableInformation[] { first, second };
                            variable.TypeName = FormattableString.Invariant($"std::pair<{first.TypeName}, {second.TypeName}>");

                            listChildren.Add(variable);
                        }
                        else
                        {
                            // One Variable is created for each pair returned with the first element (p) being the name of the child
                            // and the second element (p+1) becoming the value.
                            string name     = children[p].TryFindString("value");
                            var    variable = new VariableInformation(children[p + 1], this, '[' + name + ']');
                            listChildren.Add(variable);
                        }
                    }
                    Children      = listChildren.ToArray();
                    CountChildren = (uint)Children.Length;
                }
                else
                {
                    List <VariableInformation> listChildren = new List <VariableInformation>();
                    foreach (var c in children)
                    {
                        var variable = new VariableInformation(c, this);
                        enum_DBG_ATTRIB_FLAGS access = enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_NONE;
                        if (variable.Name == "public")
                        {
                            access = enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_ACCESS_PUBLIC;
                            variable.VariableNodeType = NodeType.AccessQualifier;
                        }
                        else if (variable.Name == "private")
                        {
                            access = enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_ACCESS_PRIVATE;
                            variable.VariableNodeType = NodeType.AccessQualifier;
                        }
                        else if (variable.Name == "protected")
                        {
                            access = enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_ACCESS_PROTECTED;
                            variable.VariableNodeType = NodeType.AccessQualifier;
                        }
                        if (access != enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_NONE)
                        {
                            // Add this child's children
                            await variable.InternalFetchChildren();

                            foreach (var child in variable.Children)
                            {
                                ((VariableInformation)child).Access = access;
                                listChildren.Add(child);
                            }
                        }
                        else
                        {
                            listChildren.Add(variable);
                        }
                    }
                    Children      = listChildren.ToArray();
                    CountChildren = (uint)Children.Length;
                }
            }
            else
            {
                Children      = new VariableInformation[0];
                CountChildren = 0;
            }
            if (_format != null)
            {
                foreach (var child in Children)
                {
                    await child.Format();
                }
            }
        }
Ejemplo n.º 32
0
 public void error_is_recorded()
 {
     Results.ShouldHaveError();
 }
Ejemplo n.º 33
0
        public async Task <Results <ADBPerson> > PersonList(ADBPersonParamObj searchParams)
        {
            //column sort not needed

            var parishList = new List <ADBPerson>();

            var results = new Results <ADBPerson>();

            int totalRecs = 0;

            try
            {
                var a = new AzureDBContext(_imsConfigHelper.MSGGenDB01);

                var unpaged = a.Persons.WhereIfBirthCounty(searchParams.BirthCounty)
                              .WhereIfBirthLocation(searchParams.BirthLocation)
                              .WhereIfDeathCounty(searchParams.DeathCounty)
                              .WhereIfDeathLocation(searchParams.DeathLocation)
                              .WhereIfFatherChristianName(searchParams.FatherChristianName)
                              .WhereIfFatherOccupation(searchParams.FatherOccupation)
                              .WhereIfFatherSurname(searchParams.FatherSurname)
                              .WhereIfMotherChristianName(searchParams.MotherChristianName)
                              .WhereIfMotheSurname(searchParams.MotherSurname)
                              .WhereIfOccupation(searchParams.Occupation)
                              .WhereIfPersonWithinYears(searchParams.YearStart, searchParams.YearEnd)
                              .WhereIfSource(searchParams.Source)
                              .WhereIfSpouseName(searchParams.SpouseName)
                              .WhereIfSpouseSurname(searchParams.SpouseSurname)
                              .WhereIfSurname(searchParams.Surname)
                              .WhereIfFirstName(searchParams.FirstName)
                              .PersonSortIf(searchParams.SortColumn, searchParams.SortOrder);

                totalRecs = unpaged.Count();

                foreach (var app in unpaged.Skip(searchParams.Offset).Take(searchParams.Limit))
                {
                    parishList.Add(new ADBPerson()
                    {
                        Id                  = app.Id,
                        BapInt              = app.BapInt,
                        BaptismDateStr      = app.BaptismDateStr,
                        BirthCounty         = app.BirthCounty,
                        BirthDateStr        = app.BirthDateStr,
                        BirthInt            = app.BirthInt,
                        BirthLocation       = app.BirthLocation,
                        ChristianName       = app.ChristianName,
                        DateAdded           = app.DateAdded,
                        DateLastEdit        = app.DateLastEdit,
                        DeathCounty         = app.DeathCounty,
                        DeathDateStr        = app.DeathDateStr,
                        DeathInt            = app.DeathInt,
                        DeathLocation       = app.DeathLocation,
                        EstBirthYearInt     = app.EstBirthYearInt,
                        EstDeathYearInt     = app.EstDeathYearInt,
                        EventPriority       = app.EventPriority,
                        FatherChristianName = app.FatherChristianName,
                        //FatherId = app.FatherId,
                        FatherOccupation    = app.FatherOccupation,
                        FatherSurname       = app.FatherSurname,
                        IsDeleted           = app.IsDeleted,
                        IsEstBirth          = app.IsEstBirth,
                        IsEstDeath          = app.IsEstDeath,
                        IsMale              = app.IsMale,
                        MotherChristianName = app.MotherChristianName,
                        // MotherId = app.MotherId,
                        MotherSurname     = app.MotherSurname,
                        Notes             = app.Notes,
                        Occupation        = app.Occupation,
                        OrigFatherSurname = app.OrigFatherSurname,
                        OrigMotherSurname = app.OrigMotherSurname,
                        OrigSurname       = app.OrigSurname,
                        ReferenceDateInt  = app.ReferenceDateInt,
                        ReferenceDateStr  = app.ReferenceDateStr,
                        ReferenceLocation = app.ReferenceLocation,
                        Source            = app.Source,
                        SpouseName        = app.SpouseName,
                        SpouseSurname     = app.SpouseSurname,
                        Surname           = app.Surname,
                        TotalEvents       = app.TotalEvents,
                        UniqueRef         = app.UniqueRef
                    });
                }
            }
            catch (Exception e)
            {
                results.Error = e.Message;
            }



            results.results       = parishList;
            results.Page          = searchParams.Offset == 0 ? 0 : searchParams.Offset / searchParams.Limit;
            results.total_pages   = totalRecs / searchParams.Limit;
            results.total_results = totalRecs;

            return(results);
        }
Ejemplo n.º 34
0
 public void Dispose()
 {
     Source.Dispose();
     Results.Dispose();
 }
Ejemplo n.º 35
0
        protected override void Run(CancellationToken cancellationToken)
        {
            var solution = CreateOneRSolution(Problem.ProblemData, MinBucketSizeParameter.Value.Value);

            Results.Add(new Result("OneR solution", "The 1R classifier.", solution));
        }
Ejemplo n.º 36
0
        private void InitializeKeyCommands()
        {
            EscCommand = new RelayCommand(_ =>
            {
                if (ContextMenuVisibility.IsVisible())
                {
                    ContextMenuVisibility = Visibility.Collapsed;
                }
                else
                {
                    MainWindowVisibility = Visibility.Collapsed;
                }
            });

            SelectNextItemCommand = new RelayCommand(_ =>
            {
                if (ContextMenuVisibility.IsVisible())
                {
                    ContextMenu.SelectNextResult();
                }
                else
                {
                    Results.SelectNextResult();
                }
            });

            SelectPrevItemCommand = new RelayCommand(_ =>
            {
                if (ContextMenuVisibility.IsVisible())
                {
                    ContextMenu.SelectPrevResult();
                }
                else
                {
                    Results.SelectPrevResult();
                }
            });



            DisplayNextQueryCommand = new RelayCommand(_ =>
            {
                var nextQuery = _queryHistory.Next();
                DisplayQueryHistory(nextQuery);
            });

            DisplayPrevQueryCommand = new RelayCommand(_ =>
            {
                var prev = _queryHistory.Previous();
                DisplayQueryHistory(prev);
            });

            SelectNextPageCommand = new RelayCommand(_ =>
            {
                Results.SelectNextPage();
            });

            SelectPrevPageCommand = new RelayCommand(_ =>
            {
                Results.SelectPrevPage();
            });

            StartHelpCommand = new RelayCommand(_ =>
            {
                Process.Start("http://doc.getwox.com");
            });

            OpenResultCommand = new RelayCommand(o =>
            {
                var results = ContextMenuVisibility.IsVisible() ? ContextMenu : Results;

                if (o != null)
                {
                    var index = int.Parse(o.ToString());
                    results.SelectResult(index);
                }

                var result      = results.SelectedResult.RawResult;
                bool hideWindow = result.Action(new ActionContext
                {
                    SpecialKeyState = GlobalHotkey.Instance.CheckModifiers()
                });
                if (hideWindow)
                {
                    MainWindowVisibility = Visibility.Collapsed;
                }

                _userSelectedRecord.Add(result);
                _queryHistory.Add(result.OriginQuery.RawQuery);
            });

            LoadContextMenuCommand = new RelayCommand(_ =>
            {
                if (!ContextMenuVisibility.IsVisible())
                {
                    var result   = Results.SelectedResult.RawResult;
                    var pluginID = result.PluginID;

                    var contextMenuResults = PluginManager.GetContextMenusForPlugin(result);
                    contextMenuResults.Add(GetTopMostContextMenu(result));

                    ContextMenu.Clear();
                    ContextMenu.AddResults(contextMenuResults, pluginID);
                    ContextMenuVisibility = Visibility.Visible;
                }
                else
                {
                    ContextMenuVisibility = Visibility.Collapsed;
                }
            });

            BackCommand = new RelayCommand(_ =>
            {
                ListeningKeyPressed?.Invoke(this, new ListeningKeyPressedEventArgs(_ as KeyEventArgs));
            });
        }
Ejemplo n.º 37
0
 public void error_returned()
 {
     Results.First().ShouldBeOfType <Error>();
 }
Ejemplo n.º 38
0
 public override void Run()
 {
     // Behind the scenes, the creates an anonymous class, with a property called ColumnName.
     // The property called ColumnName has a value of RowValue.
     Results.Publish(TableName, new { ColumnName = RowValue });
 }
        /// <summary>
        /// Collect event logs on macOS using the 'log' utility
        /// </summary>
        public void ExecuteMacOs()
        {
            // New log entries start with a timestamp like so:
            // 2019-09-25 20:38:53.784594-0700 0xdbf47    Error       0x0                  0      0    kernel: (Sandbox) Sandbox: mdworker(15726) deny(1) mach-lookup com.apple.security.syspolicy
            Regex          MacLogHeader = new Regex("^([0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [0-2][0-9]:[0-5][0-9]:[0-5][0-9]).*?0x[0-9a-f]*[\\s]*([A-Za-z]*)[\\s]*0x[0-9a-f][\\s]*[0-9]*[\\s]*([0-9]*)[\\s]*(.*?):(.*)", RegexOptions.Compiled);
            EventLogObject?curObject    = null;

            using var process = new Process()
                  {
                      StartInfo = new ProcessStartInfo
                      {
                          FileName  = "log",
                          Arguments = opts.GatherVerboseLogs ? "show" : "show --predicate \"messageType == 16 || messageType == 17\"",
                          RedirectStandardOutput = true,
                          RedirectStandardError  = true,
                          UseShellExecute        = false,
                          CreateNoWindow         = true,
                          WindowStyle            = ProcessWindowStyle.Hidden
                      }
                  };

            var stdError = new StringBuilder();

            process.ErrorDataReceived += (sender, args) => stdError.AppendLine(args.Data);
            try
            {
                process.Start();
                //Throw away header
                process.StandardOutput.ReadLine();

                while (!process.StandardOutput.EndOfStream)
                {
                    var evt = process.StandardOutput.ReadLine();

                    if (evt != null && MacLogHeader.IsMatch(evt))
                    {
                        if (curObject != null)
                        {
                            StallIfHighMemoryUsageAndLowMemoryModeEnabled();
                            Results.Push(curObject);
                        }

                        curObject = new EventLogObject(evt)
                        {
                            Level   = MacLogHeader.Matches(evt).Single().Groups[2].Value,
                            Summary = $"{MacLogHeader.Matches(evt).Single().Groups[4].Captures[0].Value}:{MacLogHeader.Matches(evt).Single().Groups[5].Captures[0].Value}",
                            Source  = MacLogHeader.Matches(evt).Single().Groups[4].Captures[0].Value,
                        };
                        if (DateTime.TryParse(MacLogHeader.Matches(evt).Single().Groups[1].Captures[0].Value, out DateTime Timestamp))
                        {
                            curObject.Timestamp = Timestamp;
                        }
                    }
                    else
                    {
                        if (curObject != null)
                        {
                            if (curObject.Data == null)
                            {
                                curObject.Data = new List <string>();
                            }
                            curObject.Data.Append(evt);
                        }
                    }
                }
                process.WaitForExit();
                if (curObject != null)
                {
                    StallIfHighMemoryUsageAndLowMemoryModeEnabled();
                    Results.Push(curObject);
                }
            }
            catch (Exception e)
            {
                Log.Debug(e, "Failed to gather event logs on Mac OS. {0}", stdError);
            }
        }
Ejemplo n.º 40
0
 public override void AddResult(Document result)
 {
     Results.Add(result);
 }
Ejemplo n.º 41
0
        public async Task <bool> Stopped(Results results, int tid)
        {
            string         reason = results.TryFindString("reason");
            ThreadProgress s      = StateFromTid(tid);

            if (reason == "fork")
            {
                s                  = new ThreadProgress();
                s.State            = State.AtFork;
                s.Newpid           = results.FindInt("newpid");
                _threadStates[tid] = s;
                await _process.Step(tid, VisualStudio.Debugger.Interop.enum_STEPKIND.STEP_OUT, VisualStudio.Debugger.Interop.enum_STEPUNIT.STEP_LINE);

                return(true);
            }
            else if (reason == "vfork")
            {
                s                  = new ThreadProgress();
                s.State            = State.AtVfork;
                s.Newpid           = results.FindInt("newpid");
                _threadStates[tid] = s;
                await _process.MICommandFactory.SetOption("schedule-multiple", "on");

                await _process.MICommandFactory.Catch("exec", onlyOnce : true);

                var thread = await _process.ThreadCache.GetThread(tid);

                await _process.Continue(thread);

                return(true);
            }

            if (s == null)
            {
                return(false);   // no activity being tracked on this thread
            }

            switch (s.State)
            {
            case State.AtFork:
                await ProcessChild(s);

                break;

            case State.AtVfork:
                await _process.MICommandFactory.SetOption("schedule-multiple", "off");

                if ("exec" == results.TryFindString("reason"))
                {
                    // The process doesn't handle the SIGSTOP correctly (just ignores it) when the process is at the start of program
                    // (after exec). Let it run some code so that it will correctly respond to the SIGSTOP.
                    s.Exe = results.TryFindString("new-exec");
                    await RunChildToMain(s);
                }
                else
                {
                    // sometimes gdb misses the breakpoint at exec and execution will proceed to a breakpoint in the child
                    _process.Logger.WriteLine("Missed catching the exec after vfork. Spawning the child's debugger.");
                    s.State = State.AtExec;
                    goto missedExec;
                }
                break;

            case State.AtSignal:        // both child and parent are stopped
                s.State = State.Complete;
                return(await DetachAndContinue(s));

            case State.AtExec:
missedExec:
                if (tid == s.Newtid)        // stopped in the child
                {
                    await ProcessChild(s);
                }
                else     // sometime the parent will get a spurious signal before the child hits main
                {
                    await ContinueTheChild(s);
                }
                break;

            case State.Complete:
                _threadStates.Remove(tid);
                if (reason == "signal-received" && results.TryFindString("signal-name") == "SIGSTOP")
                {
                    // SIGSTOP was propagated to the parent
                    await _process.MICommandFactory.Signal("SIGCONT");

                    return(true);
                }
                return(false);

            default:
                return(false);
            }
            return(true);
        }
        internal GeocodingResponse Parse(GeocodingResponseData data)
        {
            Status = data?.status ?? GeocodingResponseStatus.None;

            if (Status == GeocodingResponseStatus.OK)
            {
                foreach (var r in data.results)
                {
                    List <AddressComponent> addressComponents = new List <AddressComponent>(r.address_components.Length);
                    foreach (var ac in r.address_components)
                    {
                        addressComponents.Add(new AddressComponent
                        {
                            LongName  = ac.long_name,
                            ShortName = ac.short_name,
                            Types     = ac.types
                        });
                    }

                    Geometry geometry = new Geometry()
                    {
                        LocationType = r.geometry.location_type
                    };

                    if (r.geometry.bounds != null)
                    {
                        geometry.Bounds = new Bounds
                        {
                            NorthEast = new LatLng
                            {
                                Latitude  = r.geometry.bounds.northeast.lat,
                                Longitude = r.geometry.bounds.northeast.lng
                            },
                            SouthWest = new LatLng
                            {
                                Latitude  = r.geometry.bounds.southwest.lat,
                                Longitude = r.geometry.bounds.southwest.lng
                            }
                        };
                    }

                    if (r.geometry.location != null)
                    {
                        geometry.Location = new LatLng
                        {
                            Latitude  = r.geometry.location.lat,
                            Longitude = r.geometry.location.lng
                        };
                    }

                    if (r.geometry.viewport != null)
                    {
                        geometry.Viewport = new Bounds
                        {
                            NorthEast = new LatLng
                            {
                                Latitude  = r.geometry.viewport.northeast.lat,
                                Longitude = r.geometry.viewport.northeast.lng
                            },
                            SouthWest = new LatLng
                            {
                                Latitude  = r.geometry.viewport.southwest.lat,
                                Longitude = r.geometry.viewport.southwest.lng
                            }
                        };
                    }

                    Results.Add(new GeocodingResult
                    {
                        AddressComponents = addressComponents,
                        FormattedAddress  = r.formatted_address,
                        Geometry          = geometry,
                        PartialMatch      = r.partial_match,
                        Types             = r.types
                    });
                }
            }

            return(this);
        }
Ejemplo n.º 43
0
        internal async Task Eval(enum_EVALFLAGS dwFlags = 0)
        {
            this.VerifyNotDisposed();

            await _engine.UpdateRadixAsync(_engine.CurrentRadix());    // ensure the radix value is up-to-date

            try
            {
                string consoleCommand;
                if (IsConsoleExecCmd(_strippedName, out consoleCommand))
                {
                    // special case for executing raw mi commands.
                    string consoleResults = null;

                    consoleResults = await MIDebugCommandDispatcher.ExecuteCommand(consoleCommand, _debuggedProcess, ignoreFailures : true);

                    Value         = String.Empty;
                    this.TypeName = null;

                    if (!String.IsNullOrEmpty(consoleResults))
                    {
                        _debuggedProcess.WriteOutput(consoleResults);
                    }
                }
                else
                {
                    int     threadId   = Client.GetDebuggedThread().Id;
                    uint    frameLevel = _ctx.Level;
                    Results results    = await _engine.DebuggedProcess.MICommandFactory.VarCreate(_strippedName, threadId, frameLevel, dwFlags, ResultClass.None);

                    if (results.ResultClass == ResultClass.done)
                    {
                        _internalName = results.FindString("name");
                        TypeName      = results.TryFindString("type");
                        if (results.Contains("dynamic"))
                        {
                            IsPreformatted = true;
                        }
                        if (results.Contains("dynamic") && results.Contains("has_more"))
                        {
                            CountChildren = results.FindUint("has_more");
                        }
                        else
                        {
                            CountChildren = results.FindUint("numchild");
                        }
                        if (results.Contains("displayhint"))
                        {
                            DisplayHint = results.FindString("displayhint");
                        }
                        if (results.Contains("attributes"))
                        {
                            if (results.FindString("attributes") == "noneditable")
                            {
                                _isReadonly = true;
                            }
                            _attribsFetched = true;
                        }
                        Value = results.TryFindString("value");
                        if ((Value == String.Empty || _format != null) && !string.IsNullOrEmpty(_internalName))
                        {
                            if (_format != null)
                            {
                                await Format();
                            }
                            else
                            {
                                results = await _engine.DebuggedProcess.MICommandFactory.VarEvaluateExpression(_internalName, ResultClass.None);

                                if (results.ResultClass == ResultClass.done)
                                {
                                    Value = results.FindString("value");
                                }
                                else if (results.ResultClass == ResultClass.error)
                                {
                                    SetAsError(results.FindString("msg"));
                                }
                                else
                                {
                                    Debug.Fail("Weird msg from -var-evaluate-expression");
                                }
                            }
                        }
                    }
                    else if (results.ResultClass == ResultClass.error)
                    {
                        SetAsError(results.FindString("msg"));
                    }
                    else
                    {
                        Debug.Fail("Weird msg from -var-create");
                    }
                }
            }
            catch (Exception e)
            {
                if (e.InnerException != null)
                {
                    e = e.InnerException;
                }

                UnexpectedMIResultException miException = e as UnexpectedMIResultException;
                string message;
                if (miException != null && miException.MIError != null)
                {
                    message = miException.MIError;
                }
                else
                {
                    message = e.Message;
                }

                SetAsError(string.Format(ResourceStrings.Failed_ExecCommandError, message));
            }
        }
Ejemplo n.º 44
0
 private void ResetQueryHistoryIndex()
 {
     Results.RemoveResultsFor(QueryHistoryStorage.MetaData);
     _queryHistory.Reset();
 }
Ejemplo n.º 45
0
        static void Main(string[] args)
        {
            //Environnement variables
            //Environment.SetEnvironmentVariable("RD_AGGREGATOR_SETTINGS", @"C:\Users\Psycho\Source\Repos\RDSearch4\settings.json");
            Environment.SetEnvironmentVariable("RD_AGGREGATOR_SETTINGS", @"C:\Users\CharlesCOUSYN\source\repos\Aggregator\settings.json");
            var path = Environment.GetEnvironmentVariable("RD_AGGREGATOR_SETTINGS");

            ConfigurationManager.Instance.Init(path);

            //Obtain all symptoms/phenotypes
            PhenotypeEngine phenotypeEngine = new PhenotypeEngine();

            phenotypeEngine.GetSymptomsList();

            /*
             * //TESTED AND DONE
             * //Update Orphanet (diseases/real datasets)
             * OrphaEngine orphaEngine = new OrphaEngine(phenotypeEngine);
             * orphaEngine.Start();*/



            //Retrieving diseases from DB
            List <Disease> lst_diseases = new List <Disease>();

            using (var db = new MongoRepository.DiseaseRepository())
            {
                //lst_diseases = db.selectAll().Take(50).ToList();
                lst_diseases = db.selectAll();
            }


            //TESTED AND DONE

            /*
             * //Update Publications
             * PubmedEngine pubmedEngine = new PubmedEngine();
             * Console.WriteLine("Starting requests at PMC this can take some time...");
             * pubmedEngine.Start2(lst_diseases);
             */

            /*
             * //Update number of publications per disease
             * Console.WriteLine("Update number of publications per disease.....");
             * using (var dbDisease = new MongoRepository.DiseaseRepository())
             * using (var dbPublication = new MongoRepository.PublicationRepository())
             * {
             *  //Update all diseases
             *  foreach (var disease in lst_diseases)
             *  {
             *      long numberPublications = dbPublication.countForOneDisease(disease.OrphaNumber);
             *      disease.NumberOfPublications = (int)numberPublications;
             *      dbDisease.updateDisease(disease);
             *  }
             * }
             * Console.WriteLine("Update number of publications per disease finished");
             */


            //Retrieving related entities by disease AND TextMine

            /*
             * TextMiningEngine textMiningEngine = new TextMiningEngine(phenotypeEngine);
             * RecupSymptomsAndTextMine(lst_diseases, textMiningEngine);*/


            //Retrieving PredictionData and RealData from DB (DiseasesData with type Symptom)
            DiseasesData PredictionData = null;
            DiseasesData RealData       = null;

            using (var dbPred = new MongoRepository.PredictionDataRepository())
                using (var dbReal = new MongoRepository.RealDataRepository())
                {
                    PredictionData = dbPred.selectByType(type.Symptom);
                    RealData       = dbReal.selectByType(type.Symptom);
                }


            //Evaluation...
            if (PredictionData != null && RealData != null)
            {
                Console.WriteLine("Evaluation....");

                //Testing all combinaisons
                MetaResults metaResults = Evaluator.MetaEvaluate(PredictionData, RealData, Evaluation.entities.Criterion.MeanRankRealPositives);
                Evaluator.WriteMetaResultsJSONFile(metaResults);

                //Having best combinaison and evaluate with it
                Tuple <TFType, IDFType> tupleToTest = new Tuple <TFType, IDFType>(metaResults.bestInfos.TFType, metaResults.bestInfos.IDFType);

                //Evaluate basically
                Results resultsOfBestCombinaison = Evaluator.Evaluate(PredictionData, RealData, tupleToTest);
                Evaluator.WriteResultsJSONFile(resultsOfBestCombinaison);

                //Evaluate best combinaison with threshold search
                MetaResultsWeight metaResultsWeight = Evaluator.MetaWeightEvaluate(PredictionData, RealData, tupleToTest, 0.0005, Evaluation.entities.Criterion.F_Score);
                Evaluator.WriteMetaResultsWeightJSONFile(metaResultsWeight);

                Console.WriteLine("Evaluation finished!");
            }


            Console.WriteLine("Finished :)");
            Console.ReadLine();
        }
Ejemplo n.º 46
0
 /// <summary>
 /// Gets database record with exact Id match
 /// </summary>
 /// <param name="id">Database Id of the record to pull</param>
 /// <returns>Single entity that matches by id, or an empty entity for not found</returns>
 public TEntity GetById(int id)
 {
     Results = Data.Where(x => x.Id == id);
     return(Results.FirstOrDefaultSafe());
 }
Ejemplo n.º 47
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="response">The low-level SSH command response.</param>
        internal XenResponse(CommandResponse response)
        {
            this.Response = response;
            this.Results  = new List <Dictionary <string, string> >();

            // We need to parse the [xe] results from the standard output.  This will
            // look something like:

            //uuid ( RO)                : c73af9a3-8f67-0c52-6c8e-fe3208aae490
            //          name-label ( RW): Removable storage
            //    name-description ( RW):
            //                host ( RO): xentest
            //                type ( RO): udev
            //        content-type ( RO): disk
            //
            //
            //uuid ( RO)                : 7a490025-7911-95f8-6058-2d4647d5f855
            //          name-label ( RW): DVD drives
            //    name-description ( RW): Physical DVD drives
            //                host ( RO): xentest
            //                type ( RO): udev
            //        content-type ( RO): iso
            //
            //
            //uuid ( RO)                : 1aedccc5-8b18-4fc8-b498-e776a5ae2702
            //          name-label ( RW): Local storage
            //    name-description ( RW):
            //                host ( RO): xentest
            //                type ( RO): lvm
            //        content-type ( RO): user
            //
            //
            //uuid ( RO)                : e24cd80a-f54a-4c5b-18e8-245c37b5b7e6
            //          name-label ( RW): XenServer Tools
            //    name-description ( RW): XenServer Tools ISOs
            //                host ( RO): xentest
            //                type ( RO): iso
            //        content-type ( RO): iso
            //
            //

            //
            // This appears to be a list of records with each record being terminated by
            // two blank lines.  Each line includes a read/write or read-only indicator
            // (which we'll strip out) followed by a colon and the property value.  I'm
            // not entirely sure if this fully describes the format so I'm going to be
            // a bit defensive below.

            using (var reader = new StringReader(response.OutputText))
            {
                var isEOF = false;

                while (!isEOF)
                {
                    // Read the next record.

                    var rawRecord = new Dictionary <string, string>();

                    while (true)
                    {
                        var line = reader.ReadLine();

                        if (line == null)
                        {
                            isEOF = true;
                            break;
                        }

                        line = line.Trim();

                        if (line == string.Empty)
                        {
                            // Looks like the end of the record, so read the
                            // second blank line.

                            line = reader.ReadLine();
                            Covenant.Assert(line.Trim() == string.Empty);

                            if (line == null)
                            {
                                isEOF = true;
                                break;
                            }
                            else if (line != string.Empty)
                            {
                                Covenant.Assert(line.Trim() == string.Empty, "Unexpected XenServer [xe] CLI output.");
                            }

                            break;
                        }

                        // Parse the property name and value.

                        var colonPos = line.IndexOf(':');

                        if (colonPos == -1)
                        {
                            continue;   // We shouldn't ever see this.
                        }

                        var namePart  = line.Substring(0, colonPos).Trim();
                        var valuePart = line.Substring(colonPos + 1).Trim();

                        var parenPos = namePart.IndexOf('(');

                        if (parenPos != -1)
                        {
                            namePart = namePart.Substring(0, parenPos).Trim();
                        }

                        rawRecord.Add(namePart, valuePart);
                    }

                    // Add the record to the results if it's not empty.

                    if (rawRecord.Count > 0)
                    {
                        Results.Add(rawRecord);
                    }
                }
            }
        }
Ejemplo n.º 48
0
        private void AddErrorsToVSErrorList(Window window, Results errors)
        {
            ErrorList errorList = this.ApplicationObject.ToolWindows.ErrorList;
            Window2   errorWin2 = (Window2)(errorList.Parent);

            if (errors.Count > 0)
            {
                if (!errorWin2.Visible)
                {
                    this.ApplicationObject.ExecuteCommand("View.ErrorList", " ");
                }
                errorWin2.SetFocus();
            }

            IDesignerHost    designer = (IDesignerHost)window.Object;
            ITaskListService service  = designer.GetService(typeof(ITaskListService)) as ITaskListService;

            //remove old task items from this document and BIDS Helper class
            System.Collections.Generic.List <ITaskItem> tasksToRemove = new System.Collections.Generic.List <ITaskItem>();
            foreach (ITaskItem ti in service.GetTaskItems())
            {
                ICustomTaskItem task = ti as ICustomTaskItem;
                if (task != null && task.CustomInfo == this && task.Document == window.ProjectItem.Name)
                {
                    tasksToRemove.Add(ti);
                }
            }
            foreach (ITaskItem ti in tasksToRemove)
            {
                service.Remove(ti);
            }


            foreach (Result result in errors)
            {
                if (result.Passed)
                {
                    continue;
                }
                ICustomTaskItem item = (ICustomTaskItem)service.CreateTaskItem(TaskItemType.Custom, result.ResultExplanation);
                item.Category   = TaskItemCategory.Misc;
                item.Appearance = TaskItemAppearance.Squiggle;
                switch (result.Severity)
                {
                case ResultSeverity.Low:
                    item.Priority = TaskItemPriority.Low;
                    break;

                case ResultSeverity.Normal:
                    item.Priority = TaskItemPriority.Normal;
                    break;

                case ResultSeverity.High:
                    item.Priority = TaskItemPriority.High;
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
                item.Document   = window.ProjectItem.Name;
                item.CustomInfo = this;
                service.Add(item);
            }
        }
Ejemplo n.º 49
0
        private static BindResult EvalBindResult(Results bindResult, AD7PendingBreakpoint pbreak)
        {
            string errormsg = "Unknown error";

            if (bindResult.ResultClass == ResultClass.error)
            {
                if (bindResult.Contains("msg"))
                {
                    errormsg = bindResult.FindString("msg");
                }
                if (String.IsNullOrWhiteSpace(errormsg))
                {
                    errormsg = "Unknown error";
                }
                return(new BindResult(errormsg));
            }
            else if (bindResult.ResultClass != ResultClass.done)
            {
                return(new BindResult(errormsg));
            }
            TupleValue     bkpt = null;
            ValueListValue list = null;

            if (bindResult.Contains("bkpt"))
            {
                ResultValue b = bindResult.Find("bkpt");
                if (b is TupleValue)
                {
                    bkpt = b as TupleValue;
                }
                else if (b is ValueListValue)
                {
                    // "<MULTIPLE>" sometimes includes a list of bound breakpoints
                    list = b as ValueListValue;
                    bkpt = list.Content[0] as TupleValue;
                }
            }
            else
            {
                // If the source file is not found, "done" is the result without a binding
                // (the error is sent via an "&" string and hence lost)
                return(new BindResult(errormsg));
            }
            Debug.Assert(bkpt.FindString("type") == "breakpoint");

            string number = bkpt.FindString("number");
            string addr   = bkpt.TryFindString("addr");

            PendingBreakpoint bp = new PendingBreakpoint(pbreak, number, StringToBreakpointState(addr));

            if (list == null)   // single breakpoint
            {
                BoundBreakpoint bbp = bp.GetBoundBreakpoint(bkpt);

                if (bbp == null)
                {
                    return(new BindResult(bp, MICoreResources.Status_BreakpointPending));
                }
                return(new BindResult(bp, bbp));
            }
            else   // <MULTIPLE> with list of addresses
            {
                BindResult res = new BindResult(bp);
                for (int i = 1; i < list.Content.Length; ++i)
                {
                    BoundBreakpoint bbp = bp.GetBoundBreakpoint(list.Content[i] as TupleValue);
                    res.BoundBreakpoints.Add(bbp);
                }
                return(res);
            }
        }
Ejemplo n.º 50
0
 private void cancelButton_Click(object sender, RoutedEventArgs e)
 {
     Result   = Results.Cancel;
     Response = null;
     Close();
 }
Ejemplo n.º 51
0
 /// <summary>
 /// Gets database record with exact Key match
 /// </summary>
 /// <param name="key">Database Key of the record to pull</param>
 /// <returns>Single entity that matches by Key, or an empty entity for not found</returns>
 public TEntity GetByKey(Guid key)
 {
     Results = Data.Where(x => x.Key == key);
     return(Results.FirstOrDefaultSafe());;
 }
 /// <summary>
 /// Returns an enumerator that iterates through the collection.
 /// </summary>
 /// <returns>
 /// A <see cref="T:System.Collections.Generic.IEnumerator`1"/> that can be used to iterate through the collection.
 /// </returns>
 public IEnumerator <GeocodingResult> GetEnumerator()
 {
     return(Results.GetEnumerator());
 }
Ejemplo n.º 53
0
 public void Add(InteractionVerificationResult interactionVerificationResult)
 {
     Results.Add(interactionVerificationResult);
 }
Ejemplo n.º 54
0
        public async Task <Results <ADBMarriage> > MarriageList(ADBMarriageParamObj searchParams)
        {
            var marriageList = new List <ADBMarriage>();

            var results = new Results <ADBMarriage>();

            int totalRecs = 0;

            try
            {
                var a = new AzureDBContext(_imsConfigHelper.MSGGenDB01);

                var unpaged = a.Marriages.WhereIfMatchParticipants(searchParams.MaleSurname, searchParams.FemaleSurname)
                              .WhereIfLocation(searchParams.Location)
                              .WhereIfYearBetween(searchParams.YearStart, searchParams.YearEnd)
                              .MarriageSortIf(searchParams.SortColumn, searchParams.SortOrder);

                totalRecs = unpaged.Count();

                foreach (var app in unpaged.Skip(searchParams.Offset).Take(searchParams.Limit))
                {
                    marriageList.Add(new ADBMarriage()
                    {
                        Id                 = app.Id,
                        Date               = app.Date,
                        DateAdded          = app.DateAdded,
                        DateLastEdit       = app.DateLastEdit,
                        EventPriority      = app.EventPriority,
                        FemaleBirthYear    = app.FemaleBirthYear,
                        FemaleCname        = app.FemaleCname,
                        FemaleInfo         = app.FemaleInfo,
                        FemaleIsKnownWidow = app.FemaleIsKnownWidow,
                        FemaleLocation     = app.FemaleLocation,
                        FemaleOccupation   = app.FemaleOccupation,
                        FemaleSname        = app.FemaleSname,
                        IsBanns            = app.IsBanns,
                        IsLicence          = app.IsLicence,
                        MaleBirthYear      = app.MaleBirthYear,
                        MaleCname          = app.MaleCname,
                        MaleInfo           = app.MaleInfo,
                        MaleIsKnownWidower = app.MaleIsKnownWidower,
                        MaleLocation       = app.MaleLocation,
                        MaleOccupation     = app.MaleOccupation,
                        MaleSname          = app.MaleSname,
                        MarriageCounty     = app.MarriageCounty,
                        MarriageLocation   = app.Location,
                        Source             = app.Source,
                        TotalEvents        = app.TotalEvents,
                        UniqueRef          = app.UniqueRef,
                        Witness1           = app.Witness1,
                        Witness2           = app.Witness2,
                        Witness3           = app.Witness3,
                        Witness4           = app.Witness4
                    });
                }
            }
            catch (Exception e)
            {
                results.Error = e.Message;
            }



            results.results       = marriageList;
            results.Page          = searchParams.Offset == 0 ? 0 : searchParams.Offset / searchParams.Limit;
            results.total_pages   = totalRecs / searchParams.Limit;
            results.total_results = totalRecs;

            return(results);
        }
Ejemplo n.º 55
0
 protected virtual Results <object> GetViewModel(Results <TItem> results)
 {
     return(results.AsObjects <object>());
 }
Ejemplo n.º 56
0
        /// <summary>
        /// Main method in order to find inflection points of a DG field
        /// </summary>
        /// <param name="seeding">Setup for seeding, <see cref="SeedingSetup"/>></param>
        /// <param name="patchRecoveryGradient">Enable patch recovery for the gradient of the DG field</param>
        /// <param name="patchRecoveryHessian">Enable patch recovery for the second derivatives of the DG field</param>
        /// <param name="eliminateNonConverged"> Eliminate non-converged points entirely</param>
        /// <param name="maxNumOfIterations">Maximum number of iterations when searching for the inflection point</param>
        /// <param name="eps">Threshold (inflection point is reached)</param>
        /// <returns></returns>
        public MultidimensionalArray FindPoints(SeedingSetup seeding = SeedingSetup.av, bool patchRecoveryGradient = true, bool patchRecoveryHessian = true, bool eliminateNonConverged = false, int maxNumOfIterations = 100, double eps = 1e-12)
        {
            this.patchRecoveryGradient = patchRecoveryGradient;
            this.patchRecoveryHessian  = patchRecoveryHessian;

            #region Create seedings points based on artificial viscosity
            int numOfPoints;

            switch (seeding)
            {
            case SeedingSetup.av:
                MultidimensionalArray avValues = ShockFindingExtensions.GetAVMeanValues(gridData, avField);
                numOfPoints = avValues.Lengths[0];
                Results     = MultidimensionalArray.Create(numOfPoints, maxNumOfIterations + 1, 5);

                // Seed points
                for (int i = 0; i < numOfPoints; i++)
                {
                    int      jLocal     = (int)avValues[i, 0];
                    double[] cellCenter = gridData.Cells.GetCenter(jLocal);
                    Results[i, 0, 0] = cellCenter[0];
                    Results[i, 0, 1] = cellCenter[1];
                }
                break;

            case SeedingSetup.av3x3:
                MultidimensionalArray avValues3x3 = ShockFindingExtensions.GetAVMeanValues(gridData, avField);

                int numOfCells         = avValues3x3.Lengths[0];
                int numOfPointsPerCell = 9;
                numOfPoints = numOfCells * numOfPointsPerCell;
                Results     = MultidimensionalArray.Create(numOfPoints, maxNumOfIterations + 1, 5);

                // Seed points
                for (int i = 0; i < numOfCells; i++)
                {
                    int jLocal = (int)avValues3x3[i, 0];
                    MultidimensionalArray grid = ShockFindingExtensions.Get3x3Grid(gridData, jLocal);
                    for (int j = 0; j < numOfPointsPerCell; j++)
                    {
                        Results[i * numOfPointsPerCell + j, 0, 0] = grid[j, 0];
                        Results[i * numOfPointsPerCell + j, 0, 1] = grid[j, 1];
                    }
                }
                break;

            case SeedingSetup.everywhere:
                numOfPoints = gridData.Cells.Count;
                Results     = MultidimensionalArray.Create(numOfPoints, maxNumOfIterations + 1, 5);

                // Seed points
                for (int i = 0; i < numOfPoints; i++)
                {
                    double[] cellCenter = gridData.Cells.GetCenter(i);
                    Results[i, 0, 0] = cellCenter[0];
                    Results[i, 0, 1] = cellCenter[1];
                }
                break;

            default:
                throw new NotSupportedException("This setting does not exist.");
            }

            ResultsExtended = MultidimensionalArray.Create(numOfPoints, 3);

            //IterationsNeeded = new int[numOfPoints];
            //Converged = new bool[numOfPoints];
            //jCell = new int[numOfPoints];

            Console.WriteLine("Total number of seeding points: " + Results.Lengths[0]);
            #endregion

            #region Find inflection point for every seeding point
            Console.WriteLine("WALKING ON CURVES: START");
            Console.WriteLine("(Counting starts with 0)");
            for (int i = 0; i < Results.Lengths[0]; i++)
            {
                WalkOnCurve(gridData, densityField, Results.ExtractSubArrayShallow(i, -1, -1), out int iter, out bool pointFound, out int jLocal);

                // Save more stuff
                ResultsExtended[i, 0] = iter;
                ResultsExtended[i, 1] = pointFound == true ? 1 : -1;
                ResultsExtended[i, 2] = jLocal;

                if (i == 0)
                {
                    Console.WriteLine("Point " + i + " (first)");
                }
                else if (i == Results.Lengths[0] - 1)
                {
                    Console.WriteLine("Point " + i + " (last)");
                }
                else if (i % 100 == 0)
                {
                    Console.WriteLine("Point " + i);
                }
#if DEBUG
                if (!pointFound)
                {
                    Console.WriteLine(String.Format("Point {0}: not converged", i));
                }
#endif
            }

            if (eliminateNonConverged)
            {
                ShockFindingExtensions.EliminateNonConvergedPoints(Results, ResultsExtended, out MultidimensionalArray results_SO, out MultidimensionalArray resultsExtended_SO);
                //Results_SO = results_SO;
                //ResultsExtended_SO = resultsExtended_SO;
                Results         = results_SO;
                ResultsExtended = resultsExtended_SO;
            }

            Console.WriteLine("WALKING ON CURVES: END");
            #endregion

            return(Results);
        }
Ejemplo n.º 57
0
        private void QueryResults()
        {
            if (_updateSource != null && !_updateSource.IsCancellationRequested)
            {
                // first condition used for init run
                // second condition used when task has already been canceled in last turn
                _updateSource.Cancel();
                Logger.WoxDebug($"cancel init {_updateSource.Token.GetHashCode()} {Thread.CurrentThread.ManagedThreadId} {QueryText}");
                _updateSource.Dispose();
            }
            var source = new CancellationTokenSource();

            _updateSource = source;
            var token = source.Token;

            ProgressBarVisibility = Visibility.Hidden;

            var queryText = QueryText.Trim();

            Task.Run(() =>
            {
                if (!string.IsNullOrEmpty(queryText))
                {
                    if (token.IsCancellationRequested)
                    {
                        return;
                    }
                    var query  = QueryBuilder.Build(queryText, PluginManager.NonGlobalPlugins);
                    _lastQuery = query;
                    if (query != null)
                    {
                        // handle the exclusiveness of plugin using action keyword
                        if (token.IsCancellationRequested)
                        {
                            return;
                        }

                        Task.Delay(200, token).ContinueWith(_ =>
                        {
                            Logger.WoxTrace($"progressbar visible 1 {token.GetHashCode()} {token.IsCancellationRequested}  {Thread.CurrentThread.ManagedThreadId}  {query} {ProgressBarVisibility}");
                            // start the progress bar if query takes more than 200 ms
                            if (!token.IsCancellationRequested)
                            {
                                ProgressBarVisibility = Visibility.Visible;
                            }
                        }, token);


                        if (token.IsCancellationRequested)
                        {
                            return;
                        }
                        var plugins = PluginManager.AllPlugins;

                        var option = new ParallelOptions()
                        {
                            CancellationToken = token,
                        };
                        CountdownEvent countdown = new CountdownEvent(plugins.Count);

                        foreach (var plugin in plugins)
                        {
                            Task.Run(() =>
                            {
                                if (token.IsCancellationRequested)
                                {
                                    Logger.WoxTrace($"canceled {token.GetHashCode()} {Thread.CurrentThread.ManagedThreadId}  {queryText} {plugin.Metadata.Name}");
                                    countdown.Signal();
                                    return;
                                }
                                var results = PluginManager.QueryForPlugin(plugin, query);
                                if (token.IsCancellationRequested)
                                {
                                    Logger.WoxTrace($"canceled {token.GetHashCode()} {Thread.CurrentThread.ManagedThreadId}  {queryText} {plugin.Metadata.Name}");
                                    countdown.Signal();
                                    return;
                                }

                                _resultsQueue.Add(new ResultsForUpdate(results, plugin.Metadata, query, token, countdown));
                            }, token).ContinueWith(ErrorReporting.UnhandledExceptionHandleTask, TaskContinuationOptions.OnlyOnFaulted);
                        }

                        Task.Run(() =>
                        {
                            Logger.WoxTrace($"progressbar visible 2 {token.GetHashCode()} {token.IsCancellationRequested}  {Thread.CurrentThread.ManagedThreadId}  {query} {ProgressBarVisibility}");
                            // wait all plugins has been processed
                            try
                            {
                                countdown.Wait(token);
                            }
                            catch (OperationCanceledException)
                            {
                                // todo: why we need hidden here and why progress bar is not working
                                ProgressBarVisibility = Visibility.Hidden;
                                return;
                            }
                            if (!token.IsCancellationRequested)
                            {
                                // used to cancel previous progress bar visible task
                                source.Cancel();
                                source.Dispose();
                                // update to hidden if this is still the current query
                                ProgressBarVisibility = Visibility.Hidden;
                            }
                        });
                    }
                }
                else
                {
                    Results.Clear();
                    Results.Visbility = Visibility.Collapsed;
                }
            }, token).ContinueWith(ErrorReporting.UnhandledExceptionHandleTask, TaskContinuationOptions.OnlyOnFaulted);
        }
Ejemplo n.º 58
0
        protected override void Run()
        {
            var solution = CreateNearestNeighbourRegressionSolution(Problem.ProblemData, K);

            Results.Add(new Result(NearestNeighbourRegressionModelResultName, "The nearest neighbour regression solution.", solution));
        }
 /// <summary>
 /// Returns an enumerator that iterates through a collection.
 /// </summary>
 /// <returns>
 /// An <see cref="T:System.Collections.IEnumerator"/> object that can be used to iterate through the collection.
 /// </returns>
 System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
 {
     return(Results.GetEnumerator());
 }
Ejemplo n.º 60
0
        private static void AddParticipantScore(string file, ExcelWorksheet correctResultsWorksheet, StringCollection tablePosistions, Results results, string sourceDirctory, List <UserScore> scoresForAllUsers)
        {
            var filename = Path.GetFileName(file);

            if (filename == null || !filename.StartsWith(FilePrefix))
            {
                return;
            }

            FakeConsole.WriteLine($"Processing {file}");

            var worksheet = ExcelService.GetWorksheet(file);

            if (!HasValidLanguage(worksheet, file))
            {
                Console.ReadLine();
            }

            var matchesInGroupStage = GroupStage.GetMatches();
            var score = 0;

            // innledende kamper
            foreach (var i in matchesInGroupStage)
            {
                var r = correctResultsWorksheet.Cells["F" + i.ToString(CultureInfo.InvariantCulture)];
                if (r.Value == null)
                {
                    continue;
                }

                if (worksheet.Cells["F" + i.ToString(CultureInfo.InvariantCulture)].Value == null || worksheet.Cells["G" + i.ToString(CultureInfo.InvariantCulture)].Value == null)
                {
                    FakeConsole.WriteLine($"Group stage not correctly filled out for: {filename}");
                    FakeConsole.WriteLine("Excel sheet will be omitted. Press enter to continue processing the next sheet");
                    Console.ReadLine();
                    return;
                }

                var fasitHome = correctResultsWorksheet.Cells["F" + i.ToString(CultureInfo.InvariantCulture)].Value.ToString();
                var fasitAway = correctResultsWorksheet.Cells["G" + i.ToString(CultureInfo.InvariantCulture)].Value.ToString();
                var home      = worksheet.Cells["F" + i.ToString(CultureInfo.InvariantCulture)].Value.ToString();
                var away      = worksheet.Cells["G" + i.ToString(CultureInfo.InvariantCulture)].Value.ToString();

                if (GetHub(fasitHome, fasitAway).Equals(GetHub(home, away)))
                {
                    PointCalculator.AddScoreForCorrectOutcomeInGroupMatch(ref score);
                }

                if (fasitHome.Equals(home) && fasitAway.Equals(away))
                {
                    PointCalculator.AddScoreForCorrectResultInGroupMatch(ref score);
                }
            }

            // The table postitions, only if all matches are played
            if (Tournament.IsGroupStageFinished(correctResultsWorksheet))
            {
                foreach (var tablePos in tablePosistions)
                {
                    var fasitPos = correctResultsWorksheet.Cells[tablePos].Value.ToString();
                    var pos      = worksheet.Cells[tablePos].Value.ToString();
                    if (fasitPos.Equals(pos))
                    {
                        PointCalculator.AddScoreForCorrectPlacementInGroup(ref score, pos);
                    }
                }

                // The 1/8 finals
                var eight = TeamPlacementReader.GetTeamsForEightFinal(worksheet);
                foreach (var eightfinalists in results.TeamsInEightFinal.Cast <string>().Where(eight.Contains))
                {
                    PointCalculator.AddScoreForEightFinals(ref score, eightfinalists);
                }

                // The quarterfinals
                var quarter = TeamPlacementReader.GetTeamsForQuarterFinals(worksheet);
                foreach (var quarterfinalist in results.TeamsInQuarterFinal.Cast <string>().Where(quarter.Contains))
                {
                    PointCalculator.AddScoreForQuarterfinals(ref score, quarterfinalist);
                }

                // The semifinals
                var semis = TeamPlacementReader.GetTeamsForSemiFinals(worksheet);
                foreach (var semifinalist in results.TeamsInSemiFinal.Cast <string>().Where(semis.Contains))
                {
                    PointCalculator.AddScoreForSemifinals(ref score, semifinalist);
                }

                // The bronze final
                var bronzeFinal = TeamPlacementReader.GetTeamsForBronzeFinals(worksheet);
                foreach (var finalist in results.TeamsInBronzeFinal.Cast <string>().Where(bronzeFinal.Contains))
                {
                    PointCalculator.AddScoreForTeamInBronzeFinals(ref score, finalist);
                }

                // The final
                var final = TeamPlacementReader.GetTeamsForFinals(worksheet);
                foreach (var finalist in results.TeamsInFinal.Cast <string>().Where(final.Contains))
                {
                    PointCalculator.AddScoreForTeamInFinals(ref score, finalist);
                }

                // The bronze final
                if (Tournament.IsBronzeWinnerDecided(correctResultsWorksheet))
                {
                    var fasitHome = correctResultsWorksheet.Cells["BS35"].Value.ToString();
                    var fasitAway = correctResultsWorksheet.Cells["BS36"].Value.ToString();

                    if (worksheet.Cells["BS35"].Value == null || worksheet.Cells["BS36"].Value == null)
                    {
                        FakeConsole.WriteLine($"Bronze final not correctly filled out for: {filename}");
                        FakeConsole.WriteLine("Excel sheet will be omitted. Press enter to continue processing the next sheet");
                        Console.ReadLine();
                        return;
                    }

                    var home = worksheet.Cells["BS35"].Value.ToString();
                    var away = worksheet.Cells["BS36"].Value.ToString();

                    if (GetHub(fasitHome, fasitAway) == "H" && GetHub(home, away) == "H" && bronzeFinal[0] == results.TeamsInBronzeFinal[0])
                    {
                        PointCalculator.AddScoreForBronzeWinner(ref score, results.TeamsInBronzeFinal[0]);
                    }

                    if (GetHub(fasitHome, fasitAway) == "B" && GetHub(home, away) == "B" && bronzeFinal[1] == results.TeamsInBronzeFinal[1])
                    {
                        PointCalculator.AddScoreForBronzeWinner(ref score, results.TeamsInBronzeFinal[1]);
                    }
                }

                // The winner
                if (Tournament.IsWinnerDecided(worksheet))
                {
                    PointCalculator.AddScoreForWinner(worksheet, results, ref score);
                }
            }

            var name = file.Replace(sourceDirctory, "").Replace(FilePrefix, "").Replace("_", " ").Replace(".xlsx", "").Replace("\\", "").Trim();

            scoresForAllUsers.Add(new UserScore {
                Name = name, Points = score, Winner = TeamPlacementReader.GetWinner(worksheet)
            });
        }