Beispiel #1
0
        ProfileProperties IPropertiesInterface.this[UGUI user, PropertiesUpdateFlags flags]
        {
            set
            {
                var replaceVals = new Dictionary <string, object>
                {
                    ["useruuid"] = user.ID
                };
                if ((flags & PropertiesUpdateFlags.Properties) != 0)
                {
                    replaceVals["profileAllowPublish"]  = value.PublishProfile;
                    replaceVals["profileMaturePublish"] = value.PublishMature;
                    replaceVals["profileURL"]           = value.WebUrl;
                    replaceVals["profileImage"]         = value.ImageID;
                    replaceVals["profileAboutText"]     = value.AboutText;
                    replaceVals["profileFirstImage"]    = value.FirstLifeImageID;
                    replaceVals["profileFirstText"]     = value.FirstLifeText;
                }
                if ((flags & PropertiesUpdateFlags.Interests) != 0)
                {
                    replaceVals["profileWantToMask"] = value.WantToMask;
                    replaceVals["profileWantToText"] = value.WantToText;
                    replaceVals["profileSkillsMask"] = value.SkillsMask;
                    replaceVals["profileSkillsText"] = value.SkillsText;
                    replaceVals["profileLanguages"]  = value.Language;
                }

                using (var conn = new MySqlConnection(m_ConnectionString))
                {
                    conn.Open();
                    try
                    {
                        conn.InsertInto("userprofile", replaceVals);
                    }
                    catch
                    {
                        replaceVals.Remove("useruuid");
                        conn.UpdateSet("userprofile", replaceVals, "useruuid = '" + user.ID.ToString() + "'");
                    }
                }
            }
        }
        public ProfileProperties this[UGUI user, PropertiesUpdateFlags flags]
        {
            set
            {
                m_PropertiesLock.AcquireWriterLock(() =>
                {
                    ProfileProperties props;
                    if (!m_Properties.TryGetValue(user.ID, out props))
                    {
                        props      = value;
                        props.User = user;
                    }

                    if ((flags & PropertiesUpdateFlags.Properties) != 0)
                    {
                        props.PublishProfile   = value.PublishProfile;
                        props.PublishMature    = value.PublishMature;
                        props.WebUrl           = value.WebUrl;
                        props.ImageID          = value.ImageID;
                        props.AboutText        = value.AboutText;
                        props.FirstLifeImageID = value.FirstLifeImageID;
                        props.FirstLifeText    = value.FirstLifeText;
                    }
                    if ((flags & PropertiesUpdateFlags.Interests) != 0)
                    {
                        props.WantToMask = value.WantToMask;
                        props.WantToText = value.WantToText;
                        props.SkillsMask = value.SkillsMask;
                        props.SkillsText = value.SkillsText;
                        props.Language   = value.Language;
                    }

                    m_Properties[user.ID] = props;
                });
            }
        }
Beispiel #3
0
 public ProfileProperties this[UGUI user, PropertiesUpdateFlags flags]
 {
     set { throw new NotSupportedException(); }
 }