Exemple #1
0
        /// <summary>
        /// Updates internally cached profile with data from profile info
        /// </summary>
        /// <param name="pi">Interface to Profile Info</param>
        /// <param name="AllowCreation">True allows to add a new profile when it does not exist in cache already</param>
        public void SaveProfile(IProfileInfo pi, bool AllowCreation = false)
        {
            Profile prof;

            // look for existing one and create if not exists
            if (!_FindProfile(pi.GetProfileName(), out prof))
            {
                if (!AllowCreation)
                {
                    return;
                }

                prof      = new Profile();
                prof.Name = pi.GetProfileName();
                _Profiles.Add(prof);
            }

            prof.Rows.Clear();

            // collecting data, nom nom nom
            prof.Attempts = pi.GetAttemptsCount();
            for (int r = 0; r < pi.GetSplitCount(); r++)
            {
                ProfileRow ProfileRow = new ProfileRow();
                ProfileRow.Title = pi.GetSplitTitle(r);
                ProfileRow.Hits  = pi.GetSplitHits(r);
                ProfileRow.Diff  = pi.GetSplitDiff(r);
                ProfileRow.PB    = pi.GetSplitPB(r);
                prof.Rows.Add(ProfileRow);
            }
        }
Exemple #2
0
        /// <summary>
        /// Updates internally cached profile with data from profile info
        /// </summary>
        /// <param name="pi_src">Source ProfileInfo interface</param>
        public void SaveProfile(IProfileInfo pi_src)
        {
            if (null == pi_src)
            {
                return;                 // just for safety should never happen
            }
            if (null == pi_src.ProfileName)
            {
                return;
            }

            Profile prof;

            // look for existing one and create if not exists
            if (!_FindProfile(pi_src.ProfileName, out prof))
            {
                prof      = new Profile();
                prof.Name = pi_src.ProfileName;
                _Profiles.Add(prof);
            }

            prof.Rows.Clear();

            // collecting data, nom nom nom
            prof.Attempts    = pi_src.AttemptsCount;
            prof.ActiveSplit = pi_src.ActiveSplit;
            for (int r = 0; r < pi_src.SplitCount; r++)
            {
                ProfileRow ProfileRow = new ProfileRow();
                ProfileRow.Title        = pi_src.GetSplitTitle(r);
                ProfileRow.Hits         = pi_src.GetSplitHits(r);
                ProfileRow.WayHits      = pi_src.GetSplitWayHits(r);
                ProfileRow.PB           = pi_src.GetSplitPB(r);
                ProfileRow.Duration     = pi_src.GetSplitDuration(r);
                ProfileRow.DurationPB   = pi_src.GetSplitDurationPB(r);
                ProfileRow.DurationGold = pi_src.GetSplitDurationGold(r);
                prof.Rows.Add(ProfileRow);
            }
            prof.SetSessionProgress(pi_src.GetSessionProgress());
        }
Exemple #3
0
        /// <summary>
        /// Updates internally cached profile with data from profile info
        /// </summary>
        /// <param name="AllowCreation">True allows to add a new profile when it does not exist in cache already</param>
        public void SaveProfile(bool AllowCreation)
        {
            if (null == _pi)
            {
                return;              // just for safety should never happen
            }
            Profile prof;

            // look for existing one and create if not exists
            if (!_FindProfile(_pi.ProfileName, out prof))
            {
                if (!AllowCreation)
                {
                    return;
                }

                prof      = new Profile();
                prof.Name = _pi.ProfileName;
                _Profiles.Add(prof);
            }

            prof.Rows.Clear();

            // collecting data, nom nom nom
            prof.Attempts    = _pi.AttemptsCount;
            prof.ActiveSplit = _pi.ActiveSplit;
            for (int r = 0; r < _pi.SplitCount; r++)
            {
                ProfileRow ProfileRow = new ProfileRow();
                ProfileRow.Title   = _pi.GetSplitTitle(r);
                ProfileRow.Hits    = _pi.GetSplitHits(r);
                ProfileRow.WayHits = _pi.GetSplitWayHits(r);
                ProfileRow.PB      = _pi.GetSplitPB(r);
                prof.Rows.Add(ProfileRow);
            }
        }