Esempio n. 1
0
 private Dictionary <string, string> GetPropertiesDictionary()
 {
     return(new Dictionary <string, string>
     {
         { "UserGuid", UserGuid.ToString() },
         { "SessionGuid", SessionGuid.ToString() },
     });
 }
        protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
        {
            using (new TimedLog(UserGuid.ToString(), "Activity: Get User Setting"))
            {
                var userSetting = DatabaseHelper.GetSingle <UserSetting, Guid>(DatabaseHelper.SubsystemEnum.User,
                                                                               this.UserGuid, LinqQueries.CompiledQuery_GetUserSettingByUserGuid);

                if (userSetting == default(UserSetting))
                {
                    // No setting saved before. Create default setting

                    userSetting = DatabaseHelper.Insert <UserSetting>(DatabaseHelper.SubsystemEnum.User,
                                                                      (newSetting) =>
                    {
                        newSetting.UserId        = UserGuid;
                        newSetting.CreatedDate   = DateTime.Now;
                        newSetting.CurrentPageId = DatabaseHelper.GetQueryResult <int, Guid, int>(
                            DatabaseHelper.SubsystemEnum.Page,
                            this.UserGuid, LinqQueries.CompiledQuery_GetPageIdByUserGuid,
                            (query) => query.First <int>());
                    });
                }

                this.UserSetting = userSetting;

                // Get users current page and if not available, get the first page
                this.CurrentPage = DatabaseHelper.GetSingle <Page, int>(DatabaseHelper.SubsystemEnum.Page,
                                                                        userSetting.CurrentPageId, LinqQueries.CompiledQuery_GetPageById)
                                   ?? DatabaseHelper.GetQueryResult <Page, Guid, Page>(
                    DatabaseHelper.SubsystemEnum.Page,
                    this.UserGuid, LinqQueries.CompiledQuery_GetPagesByUserId,
                    (query) => query.First <Page>());

                return(ActivityExecutionStatus.Closed);
            }
        }
Esempio n. 3
0
 public override string ToString()
 {
     return($"User: {UserGuid.ToString()} - Match: {MatchGuid.ToString()} - Move: {Move} -");
 }
        public void Save()
        {
            try
            {
                using (var r = UserAppDataRegistryForWriting)
                {
                    SetBoolean(r, "AutoStart", AutoStart);

                    SetBoolean(r, "AutoMinimize", AutoMinimize);

                    //SetBoolean(r, "DetailedErrorResponse", DetailedErrorResponse);

                    SetBoolean(r, "BindToWorld", BindToWorld);

                    SetEnum(r, "UsePlainTextConverterEnum", UsePlainTextConverter);

                    SetBoolean(r, "PostsAreAlwaysFormatFlowed", PostsAreAlwaysFormatFlowed);

                    SetInt32(r, "Port", Port);

                    SetInt32(r, "ListPageSize", ListPageSize);

                    SetInt32(r, "ArticlePageSize", ArticlePageSize);

                    SetString(r, "DomainName", DomainName);

                    SetString(r, "UserEmail", UserEmail);

                    SetString(r, "UserName", UserName);

#if LIVECONNECT
                    SetString(r, "ClientId", ClientId);
                    SetString(r, "RefreshToken", RefreshToken);
                    SetString(r, "Scopes", Scopes);
#else
                    SetString(r, "AuthenticationBlob", AuthenticationBlob);
#endif

                    SetInt32(r, "AutoLineWrap", AutoLineWrap);

                    SetString(r, "EncodingForClient", EncodingForClient);

                    SetString(r, "UserGuid", UserGuid.ToString());

                    SetEnum(r, "InMimeUse", InMimeUse);

                    SetBoolean(r, "UseAnswersForums", UseAnswersForums);

                    SetBoolean(r, "UseSocialForums", UseSocialForums);

                    SetString(r, "UserDefinedTags", UserDefinedTags.GetString());

                    SetString(r, "UserMappings", UserMappings.GetString());

                    SetBoolean(r, "DisableUserAgentInfo", DisableUserAgentInfo);

                    SetBoolean(r, "DisableLISTGROUP", DisableLISTGROUP);

                    SetBoolean(r, "ShowUserNamePostfix", ShowUserNamePostfix);

                    SetInt32(r, "TabAsSpace", TabAsSpace);

                    SetBoolean(r, "AddHistoryToArticle", AddHistoryToArticle);

                    SetEnum(r, "UseAppInsights", UseAppInsights);
                }
            }
            catch (Exception exp)
            {
                Traces.Main_TraceEvent(TraceEventType.Critical, 1, "Error saving settings to the registry: {0}", NNTPServer.Traces.ExceptionToString(exp));
            }
        }