Пример #1
0
        public override void Perform(Sim sim, DiseaseVector vector)
        {
            if (sim.SimDescription.IsPregnant)
            {
                return;
            }

            if (mClone)
            {
                Pregnancies.Start(sim, sim.SimDescription, mHandlePlantSim);
            }
            else if (vector.Infector != 0)
            {
                SimDescription other = SimDescription.Find(vector.Infector);
                if (other != null)
                {
                    if (!mAllowCloseRelations)
                    {
                        if (Relationships.IsCloselyRelated(sim.SimDescription, other, false))
                        {
                            return;
                        }
                    }

                    Pregnancies.Start(sim, other, mHandlePlantSim);
                }
            }
        }
Пример #2
0
        private static Pregnancy StartPregnancy(Sim woman, Sim man, bool isAutonomous, bool playChimes)
        {
            string reason;
            GreyedOutTooltipCallback callback = null;

            if (!CanGetPreggers(woman, isAutonomous, ref callback, out reason))
            {
                if (callback != null)
                {
                    Common.DebugNotify("Pregnancy: " + callback(), woman);
                }
                return(null);
            }
            else if (woman.SimDescription.IsPregnant)
            {
                Common.DebugNotify("Already Pregnant", woman);
                return(woman.SimDescription.Pregnancy);
            }

            Pregnancy p = Pregnancies.Start(woman, man.SimDescription, !Woohooer.Settings.mAllowPlantSimPregnancy);

            if (p != null)
            {
                if ((playChimes) && ((woman.IsSelectable) || (man.IsSelectable)))
                {
                    Audio.StartSound("sting_baby_conception");
                }

                Common.DebugNotify("Pregnancy: Success", woman);
            }

            return(p);
        }
Пример #3
0
        protected override bool CommonAllow(SimDescription sim)
        {
            if (Sims.HasEnough(this, sim))
            {
                IncStat("Maximum Reached");
                return(false);
            }
            else if (sim.IsPregnant)
            {
                IncStat("Couple Pregnant");
                return(false);
            }
            else if (!Pregnancies.Allow(this, sim))
            {
                IncStat("User Denied");
                return(false);
            }

            if (GetValue <MaximumNumberOfChildrenOption, int>(sim) > 0)
            {
                if (AddScoring("PreferredBabyCount", sim) <= Relationships.GetChildren(sim).Count)
                {
                    IncStat("Enough");
                    return(false);
                }
            }

            return(base.CommonAllow(sim));
        }
Пример #4
0
        public static bool Perform(SimDescription a, SimDescription b, bool applyAll)
        {
            if (b == a)
            {
                return(Perform(a, (SimDescription)null, applyAll));
            }
            else if (a == null)
            {
                if (b == null)
                {
                    return(true);
                }

                return(Perform(b, a, applyAll));
            }

            Sim woman = a.CreatedSim;

            if (woman == null)
            {
                return(true);
            }

            Sim man = null;

            if (b != null)
            {
                man = b.CreatedSim;
            }
            else
            {
                man = woman;
            }

            string reason = null;

            if (!Pollinate.Allow(woman, ref reason))
            {
                Common.Notify(reason);
                return(true);
            }

            if (Pregnancies.Start(woman, man.SimDescription, false) != null)
            {
                if (!applyAll)
                {
                    SimpleMessageDialog.Show(Common.Localize("Pollinate:MenuName"), Common.Localize("Pollinate:Success", woman.IsFemale, new object[] { woman }));
                }
                else
                {
                    Common.Notify(Common.Localize("Pollinate:Success", woman.IsFemale, new object[] { woman }));
                }
            }
            return(true);
        }
Пример #5
0
        protected override bool Allow(SimDescription sim)
        {
            if (!base.Allow(sim))
            {
                return(false);
            }

            if (SimTypes.IsDead(sim))
            {
                IncStat("Dead");
                return(false);
            }
            else if (SimTypes.IsTourist(sim))
            {
                IncStat("Tourist");
                return(false);
            }
            else if ((sim.AgingState != null) && (sim.AgingState.IsAgingInProgress()))
            {
                IncStat("Aging");
                return(false);
            }
            else if (sim.Household == null)
            {
                IncStat("No Household");
                return(false);
            }
            else if (HouseholdHasAgelessBaby(sim.Household))
            {
                IncStat("Unaging Baby");
                return(false);
            }
            else if (HouseholdsEx.IsFull(this, sim.Household, sim.Species, 0, true, true))
            {
                IncStat("House Full");
                return(false);
            }
            else if ((sim.CreatedSim != null) && (sim.CreatedSim.BuffManager.HasTransformBuff()))
            {
                IncStat("Transformed");
                return(false);
            }
            else if (!Pregnancies.AllowImpregnation(this, sim, Managers.Manager.AllowCheck.Active))
            {
                IncStat("User Denied");
                return(false);
            }

            return(true);
        }
        protected ICollection <SimDescription> FindPotentialMothers(int additionalBabyCount)
        {
            List <SimDescription> choices = new List <SimDescription>();

            foreach (SimDescription sim in Sims.All)
            {
                using (Common.TestSpan span = new Common.TestSpan(Scenarios, "FindPotentialMothers"))
                {
                    if (!AllowSpecies(sim))
                    {
                        continue;
                    }

                    IncStat(sim.FullName, Common.DebugLevel.Logging);

                    if ((sim.IsHuman) && (sim.Partner == null))
                    {
                        IncStat("Unpartnered");
                    }
                    else if (sim.IsPregnant)
                    {
                        IncStat("Already Pregnant");
                    }
                    else if (!Pregnancies.Allow(this, sim, sim.Partner, Managers.Manager.AllowCheck.Active))
                    {
                        //IncStat("Allow Fail");
                        continue;
                    }
                    else if (!TestPreferredBaby(this, sim, additionalBabyCount))
                    {
                        //IncStat("Preferred Fail");
                        continue;
                    }
                    else if (!Pregnancies.TestCooldown(this, sim))
                    {
                        //IncStat("Cooldown Fail");
                        continue;
                    }
                    else
                    {
                        choices.Add(sim);
                    }
                }
            }

            AddStat("Fertile Choices", choices.Count);

            return(new SimScoringList(this, "PotentialMother", choices, false).GetBestByMinScore(0));
        }
Пример #7
0
        protected override bool Allow()
        {
            if (!GetValue <Option, bool>())
            {
                return(false);
            }

            if (!Pregnancies.RandomChanceOfAttempt(this, GetValue <BaseChanceOption, int>() + GetValue <CurrentIncreasedChanceOption, int>()))
            {
                AddValue <CurrentIncreasedChanceOption, int>(GetValue <IncreasedChanceOption, int>());

                IncStat("Chance Fail");
                return(false);
            }

            return(base.Allow());
        }
Пример #8
0
        protected override bool TargetAllow(SimDescription target)
        {
            if (target.IsFrankenstein)
            {
                IncStat("Partner Simbot");
                return(false);
            }
            else if ((Sim.CreatedSim != null) && (Stylist.IsStyleeJobTargetOfAnyStyler(Sim.CreatedSim)))
            {
                IncStat("Stylee");
                return(false);
            }
            else if (!Pregnancies.Allow(this, Sim, Target, Managers.Manager.AllowCheck.Active))
            {
                return(false);
            }

            return(base.TargetAllow(target));
        }
        protected override bool CommonAllow(SimDescription sim)
        {
            if (Sims.HasEnough(this, sim))
            {
                IncStat("Maximum Reached");
                return(false);
            }
            else if (sim.IsPregnant)
            {
                IncStat("Couple Pregnant");
                return(false);
            }
            else if (!Pregnancies.Allow(this, sim))
            {
                IncStat("User Denied");
                return(false);
            }

            return(base.CommonAllow(sim));
        }
Пример #10
0
        public override bool InRabbitHole()
        {
            try
            {
                SimDescription male;
                int            num;
                if (!PetAdoption.BreedMare(Actor, Target, Horse.FullName, out male, out num))
                {
                    return(false);
                }

                CancellableByPlayer = false;

                Pregnancies.Start(Horse, male, false);

                Actor.ModifyFunds(-num);

                EventTracker.SendEvent(new WooHooEvent(EventTypeId.kWooHooed, Horse, null, Target));

                StartStages();
                BeginCommodityUpdates();

                bool succeeded = DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached));

                AssignHorseAndPosture(Horse, RabbitHole.SimRabbitHoleState.Leading);

                EndCommodityUpdates(succeeded);

                return(succeeded);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }
Пример #11
0
        public void AddWoohooerNotches(SimDescription a, SimDescription b, bool risky, bool tryForBaby)
        {
            if (sWoohooAddNotch.Valid)
            {
                bool allow = false;

                if ((Households.AllowGuardian(a)) || (Pregnancies.Allow(this, a)))
                {
                    allow = true;
                }
                else if ((Households.AllowGuardian(b)) || (Pregnancies.Allow(this, b)))
                {
                    allow = true;
                }

                if (!allow)
                {
                    return;
                }

                sWoohooAddNotch.Invoke <object>(new object[] { a, b, risky, tryForBaby });
            }
        }
Пример #12
0
        protected override bool Allow(SimDescription sim)
        {
            if (!base.Allow(sim))
            {
                return(false);
            }

            if (sim.Elder)
            {
                if (!ManagerPregnancy.TestNearElderLimit(this, sim, GetValue <NearDeathLimitOption, int>()))
                {
                    IncStat("Near Death Denied");
                    return(false);
                }
                else if (ExpectedPregnancyBaseScenario.GetNumLiveChildren(sim) > 0)
                {
                    IncStat("Has Children");
                    return(false);
                }
                else if (AddScoring("PreferredBabyCount", sim) <= 0)
                {
                    IncStat("Score Fail");
                    return(false);
                }
                else if (sim.Partner != null)
                {
                    if (Pregnancies.Allow(this, sim, sim.Partner, Managers.Manager.AllowCheck.Active))
                    {
                        IncStat("Partner Too Young");
                        return(false);
                    }
                    else if (!GetValue <AllowAdoptionOption, bool>(sim.Partner))
                    {
                        IncStat("Partner Adoption Denied");
                        return(false);
                    }
                    else if (AddScoring("Partner", ScoringLookup.GetScore("PreferredBabyCount", sim.Partner)) <= 0)
                    {
                        IncStat("Partner Score Fail");
                        return(false);
                    }
                }

                foreach (SimDescription other in HouseholdsEx.Humans(sim.Household))
                {
                    if (other.ChildOrBelow)
                    {
                        IncStat("Child in Home");
                        return(false);
                    }
                }
            }
            else if ((sim.Partner != null) && (sim.Gender == sim.Partner.Gender))
            {
                // If the sims can have children normally, then don't allow adoption
                if (Pregnancies.Allow(this, sim, sim.Partner, Managers.Manager.AllowCheck.Active))
                {
                    return(false);
                }
                else if (!GetValue <AllowAdoptionOption, bool>(sim.Partner))
                {
                    IncStat("Partner Adoption Denied");
                    return(false);
                }
                else if (!ExpectedPregnancyBaseScenario.TestPreferredBaby(this, sim, 0))
                {
                    IncStat("Preferred Fail");
                    return(false);
                }
                else if (!Pregnancies.TestCooldown(this, sim))
                {
                    IncStat("Cooldown Fail");
                    return(false);
                }
            }
            else
            {
                IncStat("Too Young");
                return(false);
            }

            return(true);
        }
Пример #13
0
        protected override bool Allow(SimDescription sim)
        {
            if (!sim.Elder)
            {
                IncStat("Too Young");
                return(false);
            }
            else if (sim.Household == null)
            {
                IncStat("No Home");
                return(false);
            }
            else if (!Households.Allow(this, sim))
            {
                IncStat("Move Denied");
                return(false);
            }
            else if ((sim.Partner != null) && (!SimTypes.IsDead(sim.Partner)) && (Pregnancies.Allow(this, sim, sim.Partner, Managers.Manager.AllowCheck.Active)))
            {
                IncStat("Fertile Partnered");
                return(false);
            }
            else if (!GetValue <EmigrationOption, bool>(sim))
            {
                IncStat("Emigrate Denied");
                return(false);
            }
            else if (HouseholdsEx.NumHumansIncludingPregnancy(sim.Household) < GetValue <MaximumSizeOption, int>(sim.Household))
            {
                IncStat("House Empty");
                return(false);
            }
            else
            {
                bool found = false;
                foreach (SimDescription other in HouseholdsEx.Humans(sim.Household))
                {
                    if (other == sim)
                    {
                        continue;
                    }

                    if (other == sim.Partner)
                    {
                        continue;
                    }

                    if (other.Partner == null)
                    {
                        continue;
                    }

                    if (!Pregnancies.Allow(this, other))
                    {
                        continue;
                    }

                    if (ExpectedPregnancyBaseScenario.GetNumLiveChildren(other) > 0)
                    {
                        continue;
                    }

                    if (AddScoring("PreferredBabyCount", other) <= 0)
                    {
                        continue;
                    }

                    if ((!Relationships.IsCloselyRelated(other, sim, false)) ||
                        (!Relationships.IsCloselyRelated(other, sim.Partner, false)))
                    {
                        continue;
                    }

                    found = true;
                }

                if (!found)
                {
                    IncStat("Not Necessary");
                    return(false);
                }
            }

            return(base.Allow(sim));
        }
Пример #14
0
        protected override ICollection <SimDescription> GetSims()
        {
            Pregnancies.ResetPregnantSims();

            return(Pregnancies.PregnantSims);
        }
        public override void BuildEntity(string _data)
        {
            string[] data = _data.Split(Environment.NewLine);

            if (data.Length - 1 == 6)
            {
                #region Core Journal data [Line 0]
                string[] coreJournalData = data[0].Split(",");

                if (int.TryParse(coreJournalData[0].Replace("JournalID", string.Empty), out int _id) && int.TryParse(coreJournalData[2], out int _journalDest))
                {
                    if (int.TryParse(coreJournalData[1].Replace("PatientID", string.Empty), out int _patientID))
                    {
                        ID = _id;
                    }
                    else
                    {
                        Debug.LogWarning($"Invalid Journal ({ID}) build from storage; No Patient Attached!");
                    }

                    JournalDestination = ( JournalDest )_journalDest;
                    PatientData        = PatientRepo.Link.GetDataByIdentifier(_patientID);
                    JournalDestination = ( JournalDest )_journalDest;
                }
                else
                {
                    throw new Exception($"One or more fields couldn't be retrived from: { ( data[ 0 ] ?? "Null" )}");
                }
                #endregion

                if (PatientData != null)
                {
                    #region Pregnancy History Record [Line 1]
                    string[] pEntries = data[1].Split(COLITEMSEPERATOR);

                    foreach (string pEntryDataStream in pEntries)
                    {
                        string[] pEntryData = pEntryDataStream.Split(",");
                        if (pEntryDataStream != string.Empty)
                        {
                            if (pEntryData.Length == 10 && bool.TryParse(pEntryData[0], out bool _bornAlive) && bool.TryParse(pEntryData[3], out bool _male) && int.TryParse(pEntryData[5], out int _pregnancyExperience) && bool.TryParse(pEntryData[7], out bool _stillBorn) && double.TryParse(pEntryData[8], NumberStyles.AllowDecimalPoint, new CultureInfo("en-US"), out double _weight) && int.TryParse(pEntryData[9], out int _year))
                            {
                                PregnancyHistoryEntry pEntry = new PregnancyHistoryEntry()
                                {
                                    BornAlive            = _bornAlive,
                                    CurrentStatusOfChild = pEntryData[1].Replace(COMMAIDENTIFIER, ","),
                                    GestationAge         = pEntryData[2].Replace(COMMAIDENTIFIER, ","),
                                    Male                = _male,
                                    PlaceOfBirth        = pEntryData[4].Replace(COMMAIDENTIFIER, ","),
                                    PregnancyExperience = ( Experience )_pregnancyExperience,
                                    PregnancyProgress   = pEntryData[6].Replace(COMMAIDENTIFIER, ","),
                                    StillBorn           = _stillBorn,
                                    Weight              = _weight,
                                    Year                = _year
                                };

                                Pregnancies.AddHistory(pEntry);
                            }
                            else
                            {
                                throw new Exception($"One or more fields couldn't be retrived from: { ( data[ 1 ] ?? "Null" )}");
                            }
                        }
                    }
                    #endregion

                    #region Abortion History Record [Line 2]
                    string[] aEntries = data[2].Split(COLITEMSEPERATOR);

                    foreach (string aEntryDataStream in aEntries)
                    {
                        string[] aEntryData = aEntryDataStream.Split(",");

                        if (aEntryDataStream != string.Empty)
                        {
                            if (aEntryData.Length == 3 && int.TryParse(aEntryData[2], out int _year))
                            {
                                AbortionHistoryEntry aEntry = new AbortionHistoryEntry()
                                {
                                    PlannedAbortionGA   = aEntryData[0].Replace(COMMAIDENTIFIER, ","),
                                    UnplannedAbortionGA = aEntryData[1].Replace(COMMAIDENTIFIER, ","),
                                    Year = _year
                                };

                                Abortions.AddHistory(aEntry);
                            }
                            else
                            {
                                throw new Exception($"One or more fields couldn't be retrived from: { ( data[ 2 ] ?? "Null" )}");
                            }
                        }
                    }
                    #endregion

                    #region Anamnese [Line 3]
                    string[] anamDataStream = data[3].Split(OBJECTSEPERATOR);
                    if (anamDataStream.Length == 14)
                    {
                        #region Alcohol History [Line 0]
                        string[] alcoHistoryStream = anamDataStream[0].Split(",");
                        if (alcoHistoryStream.Length == 3 && int.TryParse(alcoHistoryStream[0], out int _amountPrWeek) && bool.TryParse(alcoHistoryStream[1], out bool _duringPregnancy) && bool.TryParse(alcoHistoryStream[2], out bool _multiplePrSession))
                        {
                            Anamnese.AlcoholInfo = new AlcoholHistory(_duringPregnancy, _amountPrWeek, _multiplePrSession);
                        }
                        else
                        {
                            throw new Exception($"One or more fields couldn't be retrived from (Anamnese): { ( anamDataStream[ 0 ] ?? "Null" )}");
                        }
                        #endregion

                        #region Allergies [Line 1]
                        string[] allergyStream = anamDataStream[1].Split(",");
                        if (allergyStream.Length == 2 && int.TryParse(allergyStream[1], out int _childAllergyRisk))
                        {
                            Anamnese.Allergies = new AllergyAssessement(allergyStream[0].Replace(COMMAIDENTIFIER, ","), ( ChildDisposedAllergy )_childAllergyRisk);
                        }
                        else
                        {
                            throw new Exception($"One or more fields couldn't be retrived from (Anamnese): { ( anamDataStream[ 1 ] ?? "Null" )}");
                        }
                        #endregion

                        #region Chronic Medical Data [Line 2]
                        string[] chronicDataStream = anamDataStream[2].Split(",");
                        if (chronicDataStream.Length == 8 && bool.TryParse(chronicDataStream[0], out bool _airways) && bool.TryParse(chronicDataStream[1], out bool _circulation) && bool.TryParse(chronicDataStream[2], out bool _diabetes) && bool.TryParse(chronicDataStream[3], out bool _epilepsy) && bool.TryParse(chronicDataStream[4], out bool _herpesGenitalis) && bool.TryParse(chronicDataStream[5], out bool _psychologicalIllness) && bool.TryParse(chronicDataStream[6], out bool _recurrentUTI) && bool.TryParse(chronicDataStream[7], out bool _thyroidea))
                        {
                            Anamnese.ChronicMedicalData = new ChronicMedicalHistory(_circulation, _airways, _thyroidea, _diabetes, _epilepsy, _psychologicalIllness, _herpesGenitalis, _recurrentUTI);
                        }
                        else
                        {
                            throw new Exception($"One or more fields couldn't be retrived from (Anamnese): { ( anamDataStream[ 2 ] ?? "Null" )}");
                        }
                        #endregion

                        Anamnese.DietAndActivity = anamDataStream[3].Replace(COMMAIDENTIFIER, ",");

                        #region Fertility Info [Line 4]
                        string[] fertilityStream = anamDataStream[4].Split(",");
                        if (fertilityStream.Length == 2 && bool.TryParse(fertilityStream[0], out bool _recievedFertilityTreatment))
                        {
                            Anamnese.FertilityInfo = new FertilityTreatmentData(_recievedFertilityTreatment, fertilityStream[1].Replace(COMMAIDENTIFIER, ","));
                        }
                        else
                        {
                            throw new Exception($"One or more fields couldn't be retrived from (Anamnese): { ( anamDataStream[ 4 ] ?? "Null" )}");
                        }
                        #endregion

                        Anamnese.Medicin = anamDataStream[5].Replace(COMMAIDENTIFIER, ",");

                        #region MMR Vaccinated [Line 6]
                        if (int.TryParse(anamDataStream[6], out int _mMRVaccinated))
                        {
                            Anamnese.MMRVaccinated = ( MMRVaccinationStatus )_mMRVaccinated;
                        }
                        else
                        {
                            throw new Exception($"One or more fields couldn't be retrived from (Anamnese): { ( anamDataStream[ 6 ] ?? "Null" )}");
                        }
                        #endregion

                        #region Other Drugs [Line 7]
                        if (bool.TryParse(anamDataStream[7], out bool _otherDrugs))
                        {
                            Anamnese.OtherDrugs = _otherDrugs;
                        }
                        else
                        {
                            throw new Exception($"One or more fields couldn't be retrived from (Anamnese): { ( anamDataStream[ 7 ] ?? "Null" )}");
                        }
                        #endregion

                        Anamnese.OtherDrugsComment = anamDataStream[8].Replace(COMMAIDENTIFIER, ",");
                        Anamnese.PastAdmittance    = anamDataStream[9].Replace(COMMAIDENTIFIER, ",");

                        #region Risk Assessement [Line 10]
                        string[] riskStream = anamDataStream[10].Split(",");
                        if (riskStream.Length == 5 && bool.TryParse(riskStream[0], out bool _doubleTestTaken) && bool.TryParse(riskStream[2], out bool _requestedMalformationScan) && bool.TryParse(riskStream[3], out bool _requestedNuchalFoldScan) && bool.TryParse(riskStream[4], out bool _tripleTestTaken))
                        {
                            Anamnese.RiskAssessment = new PrenatalRiskAssessment(riskStream[1].Replace(COMMAIDENTIFIER, ","), _doubleTestTaken, _tripleTestTaken, _requestedNuchalFoldScan, _requestedMalformationScan);
                        }
                        else
                        {
                            throw new Exception($"One or more fields couldn't be retrived from (Anamnese): { ( anamDataStream[ 10 ] ?? "Null" )}");
                        }
                        #endregion

                        #region Term Data [Line 11]
                        string[] termStream = anamDataStream[11].Split(",");
                        if (termStream.Length == 3 && DateTime.TryParse(termStream[1], out DateTime _expectedBirthDate))
                        {
                            #region Menstrual Cycle Info [Line 0]
                            string[]           mensInfoStream = termStream[0].Split(COLITEMSEPERATOR);
                            MenstrualCycleInfo mensInfo;
                            if (bool.TryParse(mensInfoStream[0], out bool _isCalculationSafe) && DateTime.TryParse(mensInfoStream[1], out DateTime _lastMenstrualDay))
                            {
                                mensInfo = new MenstrualCycleInfo(_lastMenstrualDay, mensInfoStream[2].Replace(COMMAIDENTIFIER, ","), _isCalculationSafe);
                            }
                            else
                            {
                                throw new Exception($"One or more fields couldn't be retrived from (Term Data): { ( termStream[ 0 ] ?? "Null" )}");
                            }
                            #endregion

                            Anamnese.TermInfo = new TermData(mensInfo, _expectedBirthDate, termStream[2].Replace(COMMAIDENTIFIER, ","));
                        }
                        else
                        {
                            throw new Exception($"One or more fields couldn't be retrived from (Anamnese): { ( anamDataStream[ 11 ] ?? "Null" )}");
                        }
                        #endregion

                        #region TobaccoInfo [Line 12]
                        string[] tobaccoStream = anamDataStream[12].Split(",");
                        if (tobaccoStream.Length == 4 && int.TryParse(tobaccoStream[0], out int _amountPrDay) && DateTime.TryParse(tobaccoStream[1], out DateTime _quitDate) && bool.TryParse(tobaccoStream[2], out bool _requestedRehab) && bool.TryParse(tobaccoStream[3], out bool _smoker))
                        {
                            Anamnese.TobaccoInfo = new TobaccoHistory(_smoker, _amountPrDay, _quitDate, _requestedRehab);
                        }
                        else
                        {
                            throw new Exception($"One or more fields couldn't be retrived from (Anamnese): { ( anamDataStream[ 12 ] ?? "Null" )}");
                        }
                        #endregion

                        #region WorkEnvironment [Line 13]
                        string[] environmentStream = anamDataStream[13].Split(",");
                        if (environmentStream.Length >= 8 && bool.TryParse(environmentStream[1], out bool _leaveNotification) && bool.TryParse(environmentStream[3], out bool _partialLeaveNotification) && bool.TryParse(environmentStream[4], out bool _referedToOMClinic) && int.TryParse(environmentStream[6], out int _workHoursPrWeek))
                        {
                            Anamnese.WorkEnvironment.FathersWorkPosition      = environmentStream[0].Replace(COMMAIDENTIFIER, ",");
                            Anamnese.WorkEnvironment.LeaveNotification        = _leaveNotification;
                            Anamnese.WorkEnvironment.NatureAndPeriod          = environmentStream[2].Replace(COMMAIDENTIFIER, ",");
                            Anamnese.WorkEnvironment.PartialLeaveNotification = _partialLeaveNotification;
                            Anamnese.WorkEnvironment.ReferedToOMClinic        = _referedToOMClinic;

                            #region WorkEnvironment flag build [Line 5]
                            string[] environmentflags = environmentStream[5].Split(COLITEMSEPERATOR);
                            for (int i = 0; i < environmentflags.Length; i++)
                            {
                                if (int.TryParse(environmentflags[i], out int _flag))
                                {
                                    Anamnese.WorkEnvironment.WorkEnvironments[i] = ( WorkEnvironment )_flag;
                                }
                                else
                                {
                                    throw new Exception($"One or more fields couldn't be retrived from (Environment Flags): { ( environmentStream[ 5 ] ?? "Null" )}");
                                }
                            }
                            #endregion

                            Anamnese.WorkEnvironment.WorkHoursPrWeek = _workHoursPrWeek;
                            Anamnese.WorkEnvironment.WorkPosition    = environmentStream[7].Replace(COMMAIDENTIFIER, ",");
                        }
                        else
                        {
                            throw new Exception($"One or more fields couldn't be retrived from (Anamnese): { ( anamDataStream[ 13 ] ?? "Null" )}");
                        }
                        #endregion
                    }
                    else
                    {
                        throw new Exception($"One or more fields couldn't be retrived from (Anamnese): { ( data[ 3 ] ?? "Null" )}");
                    }
                    #endregion

                    #region Investigations [Line 4]
                    string[] investigationStream = data[4].Split(OBJECTSEPERATOR);
                    if (investigationStream.Length == 9)
                    {
                        #region Clamydia Data [Line 0]
                        string[] claDataStream = investigationStream[0].Split(",");
                        if (DateTime.TryParse(claDataStream[0], out DateTime _claDate) && int.TryParse(claDataStream[1], out int _claResult))
                        {
                            Investegations.Clamydia = new Screening(_claDate, ( ScreeningInfo )_claResult);
                        }
                        else
                        {
                            throw new Exception($"One or more fields couldn't be retrived from (Investigations): { ( investigationStream[ 0 ] ?? "Null" )}");
                        }
                        #endregion

                        #region DVataminReadingDate Data [Line 1]
                        if (DateTime.TryParse(investigationStream[1], out DateTime _dVatDate))
                        {
                            Investegations.DVataminReadingDate = _dVatDate;
                        }
                        else
                        {
                            throw new Exception($"One or more fields couldn't be retrived from (Investigations): { ( investigationStream[ 1 ] ?? "Null" )}");
                        }
                        #endregion

                        Investegations.DVataminReadingResult = investigationStream[2].Replace(COMMAIDENTIFIER, ",");

                        #region Gonore Data [Line 3]
                        string[] gonDataStream = investigationStream[3].Split(",");
                        if (DateTime.TryParse(gonDataStream[0], out DateTime _gonDate) && int.TryParse(gonDataStream[1], out int _gonResult))
                        {
                            Investegations.Gonorrhea = new Screening(_gonDate, ( ScreeningInfo )_gonResult);
                        }
                        else
                        {
                            throw new Exception($"One or more fields couldn't be retrived from (Investigations): { ( investigationStream[ 3 ] ?? "Null" )}");
                        }
                        #endregion

                        #region Hemoglobinopathy Data [Line 4]
                        string[] hemDataStream = investigationStream[0].Split(",");
                        if (DateTime.TryParse(hemDataStream[0], out DateTime _hemDate) && int.TryParse(hemDataStream[1], out int _hemResult))
                        {
                            Investegations.Hemoglobinopathy = new Screening(_hemDate, ( ScreeningInfo )_hemResult);
                        }
                        else
                        {
                            throw new Exception($"One or more fields couldn't be retrived from (Investigations): { ( investigationStream[ 4 ] ?? "Null" )}");
                        }
                        #endregion

                        #region HepB Data [Line 5]
                        string[] hepDataStream = investigationStream[5].Split(",");
                        if (DateTime.TryParse(hepDataStream[0], out DateTime _hepDate) && int.TryParse(hepDataStream[1], out int _hepResult))
                        {
                            Investegations.HepB = new Screening(_hepDate, ( ScreeningInfo )_hepResult);
                        }
                        else
                        {
                            throw new Exception($"One or more fields couldn't be retrived from (Investigations): { ( investigationStream[ 5 ] ?? "Null" )}");
                        }
                        #endregion

                        #region HIV Data [Line 6]
                        string[] hivDataStream = investigationStream[6].Split(",");
                        if (DateTime.TryParse(hivDataStream[0], out DateTime _hivDate) && int.TryParse(hivDataStream[1], out int _hivResult))
                        {
                            Investegations.HIV = new Screening(_hivDate, ( ScreeningInfo )_hivResult);
                        }
                        else
                        {
                            throw new Exception($"One or more fields couldn't be retrived from (Investigations): { ( investigationStream[ 6 ] ?? "Null" )}");
                        }
                        #endregion

                        #region Syphilis Data [Line 7]
                        string[] sypDataStream = investigationStream[7].Split(",");
                        if (DateTime.TryParse(sypDataStream[0], out DateTime _sypDate) && int.TryParse(sypDataStream[1], out int _sypResult))
                        {
                            Investegations.Clamydia = new Screening(_sypDate, ( ScreeningInfo )_sypResult);
                        }
                        else
                        {
                            throw new Exception($"One or more fields couldn't be retrived from (Investigations): { ( investigationStream[ 7 ] ?? "Null" )}");
                        }
                        #endregion
                    }
                    else
                    {
                        throw new Exception($"One or more fields couldn't be retrived from (Investigation): { ( data[ 4 ] ?? "Null" )}");
                    }
                    #endregion

                    #region Resource and Risk Assessement [Line 5]
                    string[] resAndRiskStream = data[5].Split(",");
                    if (bool.TryParse(resAndRiskStream[1], out bool _needObstetricAssessement) && bool.TryParse(resAndRiskStream[2], out bool _needSocialAndHealthAdministration) && int.TryParse(resAndRiskStream[3], out int _niveauDistrubution))
                    {
                        ResAndRiskAssessement.Assessment = resAndRiskStream[0].Replace(COMMAIDENTIFIER, ",");
                        ResAndRiskAssessement.NeedObstetricAssessement          = _needObstetricAssessement;
                        ResAndRiskAssessement.NeedSocialAndHealthAdministration = _needSocialAndHealthAdministration;
                        ResAndRiskAssessement.NiveauDistrubution                = ( NiveauDist )_niveauDistrubution;
                        ResAndRiskAssessement.ObstetricAssessmentNote           = resAndRiskStream[4].Replace(COMMAIDENTIFIER, ",");
                        ResAndRiskAssessement.SocialAndHealthAdministrationNote = resAndRiskStream[5].Replace(COMMAIDENTIFIER, ",");
                    }
                    else
                    {
                        throw new Exception($"One or more fields couldn't be retrived from (Resource and Risk Assessement): { ( data[ 5 ] ?? "Null" )}");
                    }
                    #endregion
                }
                else
                {
                    try
                    {
                        throw new Exception($"No Patient found!");
                    }
                    catch (Exception _e)
                    {
                        Debug.LogWarning(_e.ToString());
                    }
                }

                return;
            }

            throw new Exception($"One or more fields couldn't be retrived from: { ( _data ?? "Null" )}");
        }