示例#1
0
        protected void CtrlItemCommand(object source, RepeaterCommandEventArgs e)
        {
            var cArg          = e.CommandArgument.ToString();
            var param         = new string[3];
            var redirecttabid = "";
            var emailtemplate = "";

            switch (e.CommandName.ToLower())
            {
            case "saveprofile":
                _profileData.UpdateProfile(rpInp, DebugMode);

                emailtemplate = ModSettings.Get("emailtemplate");
                if (emailtemplate != "")
                {
                    NBrightBuyUtils.SendEmailToManager(emailtemplate, _profileData.GetProfile(), "profileupdated_emailsubject.Text");
                }

                param[0] = "msg=" + NotifyRef + "_" + NotifyCode.ok;
                NBrightBuyUtils.SetNotfiyMessage(ModuleId, NotifyRef, NotifyCode.ok);
                Response.Redirect(Globals.NavigateURL(TabId, "", param), true);
                break;

            case "register":

                var notifyCode = NotifyCode.fail;
                var failreason = "";

                var cap = (DotNetNuke.UI.WebControls.CaptchaControl)rpInp.Controls[0].FindControl("captcha");;
                if (cap == null || cap.IsValid)
                {
                    //create a new user and login
                    if (!this.UserInfo.IsInRole("Registered Users"))
                    {
                        // Create and hydrate User
                        var objUser = new UserInfo();
                        objUser.Profile.InitialiseProfile(this.PortalId, true);
                        objUser.PortalID                = PortalId;
                        objUser.DisplayName             = GenXmlFunctions.GetField(rpInp, "DisplayName");
                        objUser.Email                   = GenXmlFunctions.GetField(rpInp, "Email");
                        objUser.FirstName               = GenXmlFunctions.GetField(rpInp, "FirstName");
                        objUser.LastName                = GenXmlFunctions.GetField(rpInp, "LastName");
                        objUser.Username                = GenXmlFunctions.GetField(rpInp, "Username");
                        objUser.Profile.PreferredLocale = Utils.GetCurrentCulture();

                        if (objUser.Username == "")
                        {
                            objUser.Username = GenXmlFunctions.GetField(rpInp, "Email");
                        }
                        objUser.Membership.CreatedDate = System.DateTime.Now;
                        var passwd = GenXmlFunctions.GetField(rpInp, "Password");
                        if (passwd == "")
                        {
                            objUser.Membership.UpdatePassword = true;
                            passwd = UserController.GeneratePassword(9);
                        }
                        objUser.Membership.Password = passwd;
                        objUser.Membership.Approved = PortalSettings.UserRegistration == (int)Globals.PortalRegistrationType.PublicRegistration;

                        // Create the user
                        var createStatus = UserController.CreateUser(ref objUser);

                        DataCache.ClearPortalCache(PortalId, true);

                        switch (createStatus)
                        {
                        case UserCreateStatus.Success:
                            //boNotify = true;
                            if (objUser.Membership.Approved)
                            {
                                UserController.UserLogin(this.PortalId, objUser, PortalSettings.PortalName, AuthenticationLoginBase.GetIPAddress(), false);
                            }
                            notifyCode = NotifyCode.ok;
                            break;

                        case UserCreateStatus.DuplicateEmail:
                            failreason = "exists";
                            break;

                        case UserCreateStatus.DuplicateUserName:
                            failreason = "exists";
                            break;

                        case UserCreateStatus.UsernameAlreadyExists:
                            failreason = "exists";
                            break;

                        case UserCreateStatus.UserAlreadyRegistered:
                            failreason = "exists";
                            break;

                        default:
                            // registration error
                            break;
                        }

                        if (notifyCode == NotifyCode.ok)
                        {
                            _profileData  = new ProfileData(objUser.UserID, rpInp, DebugMode);    //create and update a profile for this new logged in user.
                            emailtemplate = ModSettings.Get("emailregisteredtemplate");
                            if (emailtemplate != "")
                            {
                                NBrightBuyUtils.SendEmailToManager(emailtemplate, _profileData.GetProfile(), "profileregistered_emailsubject.Text");
                            }
                            emailtemplate = ModSettings.Get("emailregisteredclienttemplate");
                            if (emailtemplate != "")
                            {
                                NBrightBuyUtils.SendEmail(objUser.Email, emailtemplate, _profileData.GetProfile(), "profileregistered_emailsubject.Text", "", objUser.Profile.PreferredLocale);
                            }
                        }
                    }
                }
                else
                {
                    NBrightBuyUtils.SetFormTempData(ModuleId, GenXmlFunctions.GetGenXml(rpInp));
                    failreason = "captcha";
                }

                param[0] = "msg=" + NotifyRef + "_" + notifyCode;
                if (!UserInfo.IsInRole(StoreSettings.ClientEditorRole) && ModSettings.Get("clientrole") == "True" && notifyCode == NotifyCode.ok)
                {
                    NBrightBuyUtils.SetNotfiyMessage(ModuleId, NotifyRef + "clientrole", notifyCode);
                }
                else
                {
                    NBrightBuyUtils.SetNotfiyMessage(ModuleId, NotifyRef + failreason, notifyCode);
                }

                if (notifyCode == NotifyCode.ok)
                {
                    redirecttabid = ModSettings.Get("ddlredirecttabid");
                }
                if (!Utils.IsNumeric(redirecttabid))
                {
                    redirecttabid = TabId.ToString("");
                }
                Response.Redirect(Globals.NavigateURL(Convert.ToInt32(redirecttabid), "", param), true);
                break;
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="groupName"></param>
        /// <param name="fieldInfo"></param>
        /// <param name="target"></param>
        /// <param name="instance"></param>
        /// <param name="prefix"></param>
        public static void CreateExtendedComponent(
            string groupName, FieldInfo fieldInfo, object target, RoadEditorPanel instance, string prefix = "")
        {
            //Assert(string.IsNullOrEmpty(groupName), "groupName is empty");
            UIComponent container = instance.m_Container;  //instance.component.GetComponentInChildren<UIScrollablePanel>();

            if (!string.IsNullOrEmpty(groupName))
            {
                container = instance.GetGroupPanel(groupName).Container;
            }

            AssertNotNull(container, "container");
            Log.Debug("CreateExtendedComponent():container=" + container);

            Assert(fieldInfo.HasAttribute <CustomizablePropertyAttribute>(), "HasAttribute:CustomizablePropertyAttribute");
            AssertNotNull(target, "target");
            AssertNotNull(target, "fieldInfo");
            AssertNotNull(target, "RoadEditorPanel instance");
            Log.Debug(
                $"CreateExtendedComponent(groupName={groupName}, fieldInfo={fieldInfo}, target={target}, instance={instance.name}) called",
                false);

            var att        = fieldInfo.GetAttribute <CustomizablePropertyAttribute>();
            var optionals  = fieldInfo.GetAttributes <OptionalAttribute>();
            var optionals2 = target.GetType().GetAttributes <OptionalAttribute>();

            foreach (var optional in optionals.Concat(optionals2))
            {
                if (optional != null && !ModSettings.GetOption(optional.Option))
                {
                    Log.Debug($"Hiding {target.GetType().Name}::`{att.name}` because {optional.Option} is disabled");
                    return;
                }
            }

            var hints = fieldInfo.GetHints();

            hints.AddRange(fieldInfo.FieldType.GetHints());
            string hint = hints.JoinLines();

            Log.Debug("hint is " + hint);

            if (fieldInfo.FieldType.HasAttribute <FlagPairAttribute>())
            {
                int GetRequired()
                {
                    object subTarget = fieldInfo.GetValue(target);

                    return((int)GetFieldValue(subTarget, "Required"));
                }

                void SetRequired(int flags)
                {
                    var subTarget = fieldInfo.GetValue(target);

                    SetFieldValue(target: subTarget, fieldName: "Required", value: flags);
                    fieldInfo.SetValue(target, subTarget);
                }

                int GetForbidden()
                {
                    object subTarget = fieldInfo.GetValue(target);

                    return((int)GetFieldValue(subTarget, "Forbidden"));
                }

                void SetForbidden(int flags)
                {
                    var subTarget = fieldInfo.GetValue(target);

                    SetFieldValue(target: subTarget, fieldName: "Forbidden", value: flags);
                    fieldInfo.SetValue(target, subTarget);
                }

                Type enumType = fieldInfo.FieldType.GetField("Required").FieldType;
                enumType = HintExtension.GetMappedEnumWithHints(enumType);

                var panel0 = BitMaskPanel.Add(
                    roadEditorPanel: instance,
                    container: container,
                    label: prefix + att.name + " Flags Required",
                    enumType: enumType,
                    setHandler: SetRequired,
                    getHandler: GetRequired,
                    hint: hint);
                panel0.EventPropertyChanged += instance.OnObjectModified;
                var panel1 = BitMaskPanel.Add(
                    roadEditorPanel: instance,
                    container: container,
                    label: prefix + att.name + " Flags Forbidden",
                    enumType: enumType,
                    setHandler: SetForbidden,
                    getHandler: GetForbidden,
                    hint: hint);
                panel1.EventPropertyChanged += instance.OnObjectModified;
            }
            else if (fieldInfo.FieldType == typeof(NetInfoExtionsion.Range) &&
                     fieldInfo.Name.ToLower().Contains("speed"))
            {
                var panel = SpeedRangePanel.Add(
                    roadEditorPanel: instance,
                    container: container,
                    label: prefix + att.name,
                    target: target,
                    fieldInfo: fieldInfo);
                panel.EventPropertyChanged += instance.OnObjectModified;
            }
            else
            {
                Log.Error($"CreateExtendedComponent: Unhandled field: {fieldInfo} att:{att.name} ");
            }
        }
        private void RazorDisplayDataEntry(String entryId)
        {
            var productData = new ProductData();

            if (Utils.IsNumeric(entryId))
            {
                productData = ProductUtils.GetProductData(Convert.ToInt32(entryId), Utils.GetCurrentCulture(), true, EntityTypeCode);
            }

            if (productData.Exists)
            {
                if (PortalSettings.HomeTabId == TabId)
                {
                    PageIncludes.IncludeCanonicalLink(Page, Globals.AddHTTP(PortalSettings.PortalAlias.HTTPAlias)); //home page always default of site.
                }
                else
                {
                    PageIncludes.IncludeCanonicalLink(Page, NBrightBuyUtils.GetEntryUrl(PortalId, _eid, "", productData.SEOName, TabId.ToString("")));
                }

                // overwrite SEO data
                if (productData.SEOName != "")
                {
                    BasePage.Title = productData.SEOTitle;
                }
                else
                {
                    BasePage.Title = productData.ProductName;
                }

                if (productData.SEODescription != "")
                {
                    BasePage.Description = productData.SEODescription;
                }

                // if debug , output the xml used.
                if (DebugMode)
                {
                    productData.Info.XMLDoc.Save(PortalSettings.HomeDirectoryMapPath + "debug_entry.xml");
                }

                #region "do razor template"

                var strOut = NBrightBuyUtils.RazorTemplRender(RazorTemplate, ModuleId, "productdetailrazor" + ModuleId.ToString() + "*" + entryId, productData, _controlPath, ModSettings.ThemeFolder, Utils.GetCurrentCulture(), ModSettings.Settings());
                var lit    = new Literal();
                lit.Text = strOut;
                phData.Controls.Add(lit);

                #endregion
            }
            else
            {
                DisplayProductError(productData, "");
            }
        }
        override protected void OnInit(EventArgs e)
        {
            _eid           = Utils.RequestQueryStringParam(Context, "eid");
            _print         = Utils.RequestParam(Context, "print");
            _printtemplate = Utils.RequestParam(Context, "template");
            _controlPath   = ControlPath;

            //SK this tells basepage not to inject the pager
            EnablePaging = false;

            base.OnInit(e);

            // check if we're using a typcode for the data.
            if (ModSettings != null)
            {
                // check if we're using a typcode for the data.
                var modentitytypecode = ModSettings.Get("entitytypecode");
                if (modentitytypecode != "")
                {
                    EntityTypeCode     = modentitytypecode;
                    EntityTypeCodeLang = modentitytypecode + "LANG";
                }
                // check if we're using a provider _controlPath for the templates.
                var provider_controlPath = ModSettings.Get("provider_controlPath");
                if (provider_controlPath != "")
                {
                    _controlPath = "/DesktopModules/NBright/" + provider_controlPath + "/";
                }
            }

            // if guidkey entered instead of eid, find it using the guid and assign to _eid
            _guidkey = Utils.RequestQueryStringParam(Context, "guidkey");
            if (_guidkey == "")
            {
                _guidkey = Utils.RequestQueryStringParam(Context, "ref");
            }
            if (_eid == "" && _guidkey != "")
            {
                var guidData = ModCtrl.GetByGuidKey(PortalId, -1, EntityTypeCode, _guidkey);
                if (guidData != null)
                {
                    _eid = guidData.ItemID.ToString("D");
                }
                else
                {
                    _eid = "0";
                }
            }

            // if we want to print we need to open the browser with a startup script, this points to a Printview.aspx. (Must go after the ModSettings has been init.)
            if (_print != "")
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "printproduct", "window.open('" + StoreSettings.NBrightBuyPath() + "/PrintView.aspx?itemid=" + _eid + "&printcode=" + _print + "&template=" + _printtemplate + "&theme=" + ModSettings.Get("themefolder") + "','_blank');", true);
            }

            if (ModuleKey == "")  // if we don't have module setting jump out
            {
                var lit = new Literal();
                lit.Text = "NO MODULE SETTINGS";
                phData.Controls.Add(lit);
                return;
            }

            _navigationdata = new NavigationData(PortalId, ModuleKey);

            // Pass in a template specifying the token to create a friendly url for paging.
            // (NOTE: we need this in NBS becuase the edit product from list return url will copy the page number and hence paging will not work after editing if we don;t do this)
            //CtrlPaging.HrefLinkTemplate = "[<tag type='valueof' databind='PreText' />][<tag type='if' databind='Text' testvalue='' display='{OFF}' />][<tag type='hrefpagelink' moduleid='" + ModuleId.ToString("") + "' />][<tag type='endif' />][<tag type='valueof' databind='PostText' />]";
            //CtrlPaging.UseListDisplay = true;
            try
            {
                _catid = Utils.RequestQueryStringParam(Context, "catid");

                #region "set templates based on entry id (eid) from url"

                _ename  = Utils.RequestQueryStringParam(Context, "entry");
                _modkey = Utils.RequestQueryStringParam(Context, "modkey");

                // see if we need to display the entry page.
                if ((_modkey == ModuleKey | _modkey == "") && (_eid != "" | _ename != ""))
                {
                    _displayentrypage = true;
                }

                // if we have entry detail display, but no catd, get the default one.
                if (_displayentrypage && _catid == "" && Utils.IsNumeric(_eid))
                {
                    var prdData = ProductUtils.GetProductData(Convert.ToInt32(_eid), Utils.GetCurrentCulture(), true, EntityTypeCode);
                    var defcat  = prdData.GetDefaultCategory();
                    if (defcat != null)
                    {
                        _catid = defcat.categoryid.ToString("");
                    }
                }

                if (ModSettings.Get("listonly").ToLower() == "true")
                {
                    _displayentrypage = false;
                }

                // get template codes
                if (_displayentrypage)
                {
                    RazorTemplate = ModSettings.Get("razordetailtemplate");
                }
                else
                {
                    RazorTemplate = ModSettings.Get("razortemplate");
                }

                #endregion
            }
            catch (Exception exc)
            {
                // remove any cookie which might store SQL in error.
                _navigationdata.Delete();
                DisplayProductError(null, exc.ToString());
            }
        }
示例#5
0
        override protected void OnInit(EventArgs e)
        {
            EnablePaging = true;

            base.OnInit(e);

            if (ModSettings.Get("themefolder") == "")  // if we don't have module setting jump out
            {
                rpDataH.ItemTemplate = new GenXmlTemplate("NO MODULE SETTINGS");
                return;
            }

            CtrlPaging.Visible = false; // don't bother with paging on this module.
            try
            {
                #region "set templates based on entry id (eid) from url"

                _entryid = Utils.RequestQueryStringParam(Context, "eid");

                if (_entryid != "")
                {
                    _displayentrypage = true;
                }

                // get template codes
                if (_displayentrypage)
                {
                    _templH = ModSettings.Get("txtdetailheader");
                    _templD = ModSettings.Get("txtdetailbody");
                    _templF = ModSettings.Get("txtdetailfooter");
                }
                else
                {
                    _templH = ModSettings.Get("txtdisplayheader");
                    _templD = ModSettings.Get("txtdisplaybody");
                    _templF = ModSettings.Get("txtdisplayfooter");
                }

                _templIH = ModSettings.Get("txtitemdetailheader");
                _templID = ModSettings.Get("txtitemdetailbody");
                _templIF = ModSettings.Get("txtitemdetailfooter");

                #endregion

                // Get Search
                var rpSearchTempl = ModCtrl.GetTemplateData(ModSettings, "orderadminsearch.html", Utils.GetCurrentCulture(), DebugMode);
                _templSearch          = NBrightBuyUtils.GetGenXmlTemplate(rpSearchTempl, ModSettings.Settings(), PortalSettings.HomeDirectory);
                rpSearch.ItemTemplate = _templSearch;

                // Get Display Header
                var rpDataHTempl   = ModCtrl.GetTemplateData(ModSettings, _templH, Utils.GetCurrentCulture(), DebugMode);
                var templateHeader = NBrightBuyUtils.GetGenXmlTemplate(rpDataHTempl, ModSettings.Settings(), PortalSettings.HomeDirectory);
                rpDataH.ItemTemplate = templateHeader;

                // insert page header text
                NBrightBuyUtils.IncludePageHeaders(ModCtrl, ModuleId, Page, templateHeader, ModSettings.Settings(), null, DebugMode);


                // Get Display Body
                var rpDataTempl = ModCtrl.GetTemplateData(ModSettings, _templD, Utils.GetCurrentCulture(), DebugMode);
                rpData.ItemTemplate = NBrightBuyUtils.GetGenXmlTemplate(rpDataTempl, ModSettings.Settings(), PortalSettings.HomeDirectory);
                // Get Display Footer
                var rpDataFTempl = ModCtrl.GetTemplateData(ModSettings, _templF, Utils.GetCurrentCulture(), DebugMode);
                rpDataF.ItemTemplate = NBrightBuyUtils.GetGenXmlTemplate(rpDataFTempl, ModSettings.Settings(), PortalSettings.HomeDirectory);

                if (Utils.IsNumeric(_entryid))
                {
                    var rpItemHTempl = ModCtrl.GetTemplateData(ModSettings, _templIH, Utils.GetCurrentCulture(), DebugMode);
                    rpItemH.ItemTemplate = NBrightBuyUtils.GetGenXmlTemplate(rpItemHTempl, ModSettings.Settings(), PortalSettings.HomeDirectory);
                    // Get Display Body
                    var rpItemTempl = ModCtrl.GetTemplateData(ModSettings, _templID, Utils.GetCurrentCulture(), DebugMode);
                    rpItem.ItemTemplate = NBrightBuyUtils.GetGenXmlTemplate(rpItemTempl, ModSettings.Settings(), PortalSettings.HomeDirectory);
                    // Get Display Footer
                    var rpItemFTempl = ModCtrl.GetTemplateData(ModSettings, _templIF, Utils.GetCurrentCulture(), DebugMode);
                    rpItemF.ItemTemplate = NBrightBuyUtils.GetGenXmlTemplate(rpItemFTempl, ModSettings.Settings(), PortalSettings.HomeDirectory);
                }
                else
                {
                    rpItemH.Visible = false;
                    rpItem.Visible  = false;
                    rpItemF.Visible = false;
                }
            }
            catch (Exception exc)
            {
                //display the error on the template (don;t want to log it here, prefer to deal with errors directly.)
                var l = new Literal();
                l.Text = exc.ToString();
                phData.Controls.Add(l);
            }
        }
示例#6
0
        public static void InitMod(bool bedSleeping, bool archery, bool riding, bool encumbrance, bool bandaging, bool shipPorts, bool expulsion, bool climbing, bool weaponSpeed, bool weaponMaterials, bool equipDamage, bool enemyAppearance,
                                   bool purifyPot, bool autoExtinguishLight, bool classicStrDmgBonus, bool variantNpcs)
        {
            Debug.Log("Begin mod init: RoleplayRealism");

            Mod         rrItemsMod      = ModManager.Instance.GetMod("RoleplayRealismItems");
            ModSettings rrItemsSettings = rrItemsMod != null?rrItemsMod.GetSettings() : null;

            if (bedSleeping)
            {
                PlayerActivate.RegisterCustomActivation(mod, 41000, BedActivation);
                PlayerActivate.RegisterCustomActivation(mod, 41001, BedActivation);
                PlayerActivate.RegisterCustomActivation(mod, 41002, BedActivation);
            }

            if (archery)
            {
                // Override adjust to hit and damage formulas
                FormulaHelper.RegisterOverride(mod, "AdjustWeaponHitChanceMod", (Func <DaggerfallEntity, DaggerfallEntity, int, int, DaggerfallUnityItem, int>)AdjustWeaponHitChanceMod);
                FormulaHelper.RegisterOverride(mod, "AdjustWeaponAttackDamage", (Func <DaggerfallEntity, DaggerfallEntity, int, int, DaggerfallUnityItem, int>)AdjustWeaponAttackDamage);
            }

            if (riding)
            {
                GameObject playerAdvGO = GameObject.Find("PlayerAdvanced");
                if (playerAdvGO)
                {
                    EnhancedRiding enhancedRiding = playerAdvGO.AddComponent <EnhancedRiding>();
                    if (enhancedRiding != null)
                    {
                        enhancedRiding.RealisticMovement = mod.GetSettings().GetBool("EnhancedRiding", "RealisticMovement");
                        enhancedRiding.TerrainFollowing  = mod.GetSettings().GetBool("EnhancedRiding", "followTerrainEnabled");
                        enhancedRiding.SetFollowTerrainSoftenFactor(mod.GetSettings().GetInt("EnhancedRiding", "followTerrainSoftenFactor"));
                    }
                }
            }

            if (encumbrance)
            {
                EntityEffectBroker.OnNewMagicRound += EncumbranceEffects_OnNewMagicRound;
            }

            if (rrItemsMod == null && bandaging)
            {
                DaggerfallUnity.Instance.ItemHelper.RegisterItemUseHandler((int)UselessItems2.Bandage, UseBandage);
            }

            if (shipPorts)
            {
                GameManager.Instance.TransportManager.ShipAvailiable = IsShipAvailiable;
            }

            if (expulsion)
            {
                // Register the TG/DB Guild classes
                if (!GuildManager.RegisterCustomGuild(FactionFile.GuildGroups.GeneralPopulace, typeof(ThievesGuildRR)))
                {
                    throw new Exception("GuildGroup GeneralPopulace is already overridden, unable to register ThievesGuildRR guild class.");
                }

                if (!GuildManager.RegisterCustomGuild(FactionFile.GuildGroups.DarkBrotherHood, typeof(DarkBrotherhoodRR)))
                {
                    throw new Exception("GuildGroup DarkBrotherHood is already overridden, unable to register DarkBrotherhoodRR guild class.");
                }
            }

            if (climbing)
            {
                FormulaHelper.RegisterOverride(mod, "CalculateClimbingChance", (Func <PlayerEntity, int, int>)CalculateClimbingChance);
            }

            if (weaponSpeed && (rrItemsSettings == null || !rrItemsSettings.GetBool("Modules", "weaponBalance")))
            {
                FormulaHelper.RegisterOverride(mod, "GetMeleeWeaponAnimTime", (Func <PlayerEntity, WeaponTypes, ItemHands, float>)GetMeleeWeaponAnimTime);
            }

            if (weaponMaterials)
            {
                FormulaHelper.RegisterOverride(mod, "CalculateWeaponToHit", (Func <DaggerfallUnityItem, int>)CalculateWeaponToHit);
            }

            if (equipDamage)
            {
                FormulaHelper.RegisterOverride(mod, "ApplyConditionDamageThroughPhysicalHit", (Func <DaggerfallUnityItem, DaggerfallEntity, int, bool>)ApplyConditionDamageThroughPhysicalHit);
            }

            if (enemyAppearance)
            {
                UpdateEnemyClassAppearances();
            }

            if (purifyPot)
            {
                GameManager.Instance.EntityEffectBroker.RegisterEffectTemplate(new CureDiseaseRR(), true);
            }

            if (autoExtinguishLight)
            {
                PlayerEnterExit.OnTransitionDungeonExterior += OnTransitionToDungeonExterior_ExtinguishLight;
            }

            if (classicStrDmgBonus)
            {
                FormulaHelper.RegisterOverride(mod, "DamageModifier", (Func <int, int>)DamageModifier_classicDisplay);
            }

            if (variantNpcs)
            {
                PlayerEnterExit.OnTransitionInterior += OnTransitionToInterior_VariantNPCsprites;
            }

            // Initialise the FG master quest.
            if (!QuestListsManager.RegisterQuestList("RoleplayRealism"))
            {
                throw new Exception("Quest list name is already in use, unable to register RoleplayRealism quest list.");
            }

            RegisterFactionIds();

            // Add additional data into the quest machine for the quests
            QuestMachine questMachine = GameManager.Instance.QuestMachine;

            questMachine.PlacesTable.AddIntoTable(placesTable);
            questMachine.FactionsTable.AddIntoTable(factionsTable);

            // Register the custom armor service
            Services.RegisterMerchantService(1022, CustomArmorService, "Custom Armor");

            Debug.Log("Finished mod init: RoleplayRealism");
        }
示例#7
0
 public override void Initialize(ModSettings modSettings)
 {
     Debug.Log((object)"Character List DLL initialising");
     base.Initialize(modSettings);
     modSettings.Factory = new CharacterListGameFactory();
 }
 public override string GetFilter(string currentFilter, NavigationData navigationData, ModSettings setting, NBrightInfo ajaxInfo)
 {
     throw new NotImplementedException();
 }
示例#9
0
        override protected void OnInit(EventArgs e)
        {
            base.OnInit(e);

            _catGrpCtrl = new GrpCatController(Utils.GetCurrentCulture());

            if (ModSettings.Get("themefolder") == "")  // if we don't have module setting jump out
            {
                rpDataH.ItemTemplate = new GenXmlTemplate("NO MODULE SETTINGS");
                return;
            }

            try
            {
                _targetModuleKey = "";
                _targetModuleKey = ModSettings.Get("targetmodulekey");

                _entryid = Utils.RequestQueryStringParam(Context, "eid");
                _catid   = Utils.RequestQueryStringParam(Context, "catid");
                _catname = Utils.RequestQueryStringParam(Context, "catref");
                if (_catid == "" && _catname != "")
                {
                    _catid = CategoryUtils.GetCatIdFromName(_catname);
                }

                var navigationdata = new NavigationData(PortalId, _targetModuleKey);
                if (Utils.IsNumeric(_catid))
                {
                    navigationdata.Delete();                          // if a category button has been clicked (in url) then clear search;
                }
                if (Utils.IsNumeric(navigationdata.CategoryId) && navigationdata.FilterMode)
                {
                    _catid = navigationdata.CategoryId.ToString("D");
                }
                if (Utils.IsNumeric(_entryid))
                {
                    // Get catid from product
                    var prodData = ProductUtils.GetProductData(Convert.ToInt32(_entryid), Utils.GetCurrentCulture());
                    var catDef   = prodData.GetDefaultCategory();
                    if (catDef != null)
                    {
                        _catid = catDef.categoryid.ToString("");
                    }
                }
                if (_catid == "")
                {
                    _catid = ModSettings.Get("defaultcatid");
                }

                _templH     = ModSettings.Get("txtdisplayheader");
                _templD     = ModSettings.Get("txtdisplaybody");
                _templDfoot = ModSettings.Get("txtdisplaybodyfoot");
                _templF     = ModSettings.Get("txtdisplayfooter");

                _tabid = ModSettings.Get("ddllisttabid");
                if (!Utils.IsNumeric(_tabid))
                {
                    _tabid = TabId.ToString("");
                }

                // Get Display Header
                var rpDataHTempl = ModCtrl.GetTemplateData(ModSettings, _templH, Utils.GetCurrentCulture(), DebugMode);


                rpDataH.ItemTemplate = NBrightBuyUtils.GetGenXmlTemplate(rpDataHTempl, ModSettings.Settings(), PortalSettings.HomeDirectory);
                _templateHeader      = (GenXmlTemplate)rpDataH.ItemTemplate;

                // insert page header text
                NBrightBuyUtils.IncludePageHeaders(ModCtrl, ModuleId, Page, _templateHeader, ModSettings.Settings(), null, DebugMode);

                // Get Display Body
                var rpDataTempl = ModCtrl.GetTemplateData(ModSettings, _templD, Utils.GetCurrentCulture(), DebugMode);
                rpData.ItemTemplate = NBrightBuyUtils.GetGenXmlTemplate(rpDataTempl, ModSettings.Settings(), PortalSettings.HomeDirectory);

                // Get Display Footer
                var rpDataFTempl = ModCtrl.GetTemplateData(ModSettings, _templF, Utils.GetCurrentCulture(), DebugMode);
                rpDataF.ItemTemplate = NBrightBuyUtils.GetGenXmlTemplate(rpDataFTempl, ModSettings.Settings(), PortalSettings.HomeDirectory);
            }
            catch (Exception exc)
            {
                if (UserInfo.IsSuperUser)
                {
                    rpDataF.ItemTemplate = new GenXmlTemplate(exc.Message, ModSettings.Settings());
                }
                // catch any error and allow processing to continue, output error as footer template.
            }
        }
示例#10
0
        public UiManager(
            Game.Settings.GameSettings clientGameSettings,
            ModSettings modSettings,
            NetClient netClient
            )
        {
            _modSettings = modSettings;

            // First we create a gameObject that will hold all other objects of the UI
            UiGameObject = new GameObject();

            // Create event system object
            var eventSystemObj = new GameObject("EventSystem");

            var eventSystem = eventSystemObj.AddComponent <EventSystem>();

            eventSystem.sendNavigationEvents = true;
            eventSystem.pixelDragThreshold   = 10;

            eventSystemObj.AddComponent <StandaloneInputModule>();

            Object.DontDestroyOnLoad(eventSystemObj);

            // Make sure that our UI is an overlay on the screen
            UiGameObject.AddComponent <Canvas>().renderMode = RenderMode.ScreenSpaceOverlay;

            // Also scale the UI with the screen size
            var canvasScaler = UiGameObject.AddComponent <CanvasScaler>();

            canvasScaler.uiScaleMode         = CanvasScaler.ScaleMode.ScaleWithScreenSize;
            canvasScaler.referenceResolution = new Vector2(1920f, 1080f);

            UiGameObject.AddComponent <GraphicRaycaster>();

            Object.DontDestroyOnLoad(UiGameObject);

            PrecacheText();

            var uiGroup = new ComponentGroup();

            var pauseMenuGroup = new ComponentGroup(false, uiGroup);

            var connectGroup = new ComponentGroup(parent: pauseMenuGroup);

            var settingsGroup = new ComponentGroup(parent: pauseMenuGroup);

            ConnectInterface = new ConnectInterface(
                modSettings,
                connectGroup,
                settingsGroup
                );

            var inGameGroup = new ComponentGroup(parent: uiGroup);

            var infoBoxGroup = new ComponentGroup(parent: inGameGroup);

            InternalChatBox = new ChatBox(infoBoxGroup, modSettings);

            var pingGroup = new ComponentGroup(parent: inGameGroup);

            _pingInterface = new PingInterface(
                pingGroup,
                modSettings,
                netClient
                );

            SettingsInterface = new ClientSettingsInterface(
                modSettings,
                clientGameSettings,
                settingsGroup,
                connectGroup,
                _pingInterface
                );

            // Register callbacks to make sure the UI is hidden and shown at correct times
            On.UIManager.SetState += (orig, self, state) => {
                orig(self, state);

                if (state == UIState.PAUSED)
                {
                    // Only show UI in gameplay scenes
                    if (!SceneUtil.IsNonGameplayScene(SceneUtil.GetCurrentSceneName()))
                    {
                        _canShowPauseUi = true;

                        pauseMenuGroup.SetActive(!_isUiHiddenByKeyBind);
                    }

                    inGameGroup.SetActive(false);
                }
                else
                {
                    pauseMenuGroup.SetActive(false);

                    _canShowPauseUi = false;

                    // Only show chat box UI in gameplay scenes
                    if (!SceneUtil.IsNonGameplayScene(SceneUtil.GetCurrentSceneName()))
                    {
                        inGameGroup.SetActive(true);
                    }
                }
            };
            UnityEngine.SceneManagement.SceneManager.activeSceneChanged += (oldScene, newScene) => {
                if (SceneUtil.IsNonGameplayScene(newScene.name))
                {
                    eventSystem.enabled = false;

                    _canShowPauseUi = false;

                    pauseMenuGroup.SetActive(false);
                    inGameGroup.SetActive(false);
                }
                else
                {
                    eventSystem.enabled = true;

                    inGameGroup.SetActive(true);
                }
            };

            // The game is automatically unpaused when the knight dies, so we need
            // to disable the UI menu manually
            // TODO: this still gives issues, since it displays the cursor while we are supposed to be unpaused
            ModHooks.AfterPlayerDeadHook += () => { pauseMenuGroup.SetActive(false); };

            MonoBehaviourUtil.Instance.OnUpdateEvent += () => { CheckKeyBinds(uiGroup); };
        }
示例#11
0
        private void PageLoad()
        {
            var catid = 0;

            if (Utils.IsNumeric(_catid))
            {
                catid = Convert.ToInt32(_catid);
            }

            #region "Get default category into list for displaying header and footer templates on product (breadcrumb)"

            // if we have a product displaying, get the deault category for the category
            var obj = new GroupCategoryData();
            if (Utils.IsNumeric(_entryid))
            {
                if (catid == 0)
                {
                    catid = _catGrpCtrl.GetDefaultCatId(Convert.ToInt32(_entryid));
                }
            }
            else
            {
                if (catid != 0)
                {
                    obj = _catGrpCtrl.GetCategory(catid);
                }
            }
            var catl = new List <object> {
                obj
            };

            if (Utils.IsNumeric(catid) && ModSettings.Get("injectseo") == "True")
            {
                var eid       = Utils.RequestQueryStringParam(Context, "eid");
                var objSEOCat = ModCtrl.GetData(Convert.ToInt32(catid), "CATEGORYLANG", Utils.GetCurrentCulture());
                if (objSEOCat != null && eid == "")  // we may have a detail page and listonly module, in which can we need the product detail as page title
                {
                    //Page Title
                    var seoname = objSEOCat.GetXmlProperty("genxml/lang/genxml/textbox/txtseoname");
                    if (seoname == "")
                    {
                        seoname = objSEOCat.GetXmlProperty("genxml/lang/genxml/textbox/txtcategoryname");
                    }

                    var newBaseTitle = objSEOCat.GetXmlProperty("genxml/lang/genxml/textbox/txtseopagetitle");
                    if (newBaseTitle == "")
                    {
                        newBaseTitle = objSEOCat.GetXmlProperty("genxml/lang/genxml/textbox/txtseoname");
                    }
                    if (newBaseTitle == "")
                    {
                        newBaseTitle = objSEOCat.GetXmlProperty("genxml/lang/genxml/textbox/txtcategoryname");
                    }
                    if (newBaseTitle != "")
                    {
                        BasePage.Title = BasePage.Title + " > " + newBaseTitle;
                    }
                    //Page KeyWords
                    var newBaseKeyWords = objSEOCat.GetXmlProperty("genxml/lang/genxml/textbox/txtmetakeywords");
                    if (newBaseKeyWords != "")
                    {
                        BasePage.KeyWords = newBaseKeyWords;
                    }
                    //Page Description
                    var newBaseDescription = objSEOCat.GetXmlProperty("genxml/lang/genxml/textbox/txtmetadescription");
                    if (newBaseDescription == "")
                    {
                        newBaseDescription = objSEOCat.GetXmlProperty("genxml/lang/genxml/textbox/txtcategorydesc");
                    }
                    if (newBaseDescription != "")
                    {
                        BasePage.Description = newBaseDescription;
                    }
                }
            }


            #endregion

            #region "Data Repeater"


            if (_templD.Trim() != "")     // if we don;t have a template, don't do anything
            {
                var menutype = ModSettings.Get("ddlmenutype").ToLower();

                #region "Drill Down"

                if (menutype == "drilldown")
                {
                    var l = _catGrpCtrl.GetVisibleCategoriesWithUrl(catid, TabId);
                    if (l.Count == 0 && (ModSettings.Get("alwaysshow") == "True"))
                    {
                        // if we have no categories, it could be the end of branch or product view, so load the root menu
                        var catid2 = 0;
                        _catid = ModSettings.Get("defaultcatid");
                        if (Utils.IsNumeric(_catid))
                        {
                            catid2 = Convert.ToInt32(_catid);
                        }
                        l = _catGrpCtrl.GetVisibleCategoriesWithUrl(catid2, TabId);
                    }
                    rpData.DataSource = l;
                    rpData.DataBind();
                }

                #endregion

                #region "treeview"

                if (menutype == "treeview")
                {
                    var catidtree = 0;
                    if (Utils.IsNumeric(ModSettings.Get("defaultcatid")))
                    {
                        catidtree = Convert.ToInt32(ModSettings.Get("defaultcatid"));
                    }

                    var cachekey = "CatMenu*" + ModuleId.ToString("") + "*" + catid + "*" + catidtree.ToString() + "*" + Utils.GetCurrentCulture();
                    var strOut   = (String)NBrightBuyUtils.GetModCache(cachekey);
                    if (strOut == null)
                    {
                        rpData.Visible = false;
                        var catBuiler = new CatMenuBuilder(_templD, ModSettings, catid, DebugMode);
                        strOut = catBuiler.GetTreeCatList(50, catidtree, Convert.ToInt32(_tabid), ModSettings.Get("treeidentclass"), ModSettings.Get("treerootclass"));

                        // if debug , output the html used.
                        if (StoreSettings.Current.DebugModeFileOut)
                        {
                            Utils.SaveFile(PortalSettings.HomeDirectoryMapPath + "debug_treemenu.html", strOut);
                        }
                        NBrightBuyUtils.SetModCache(ModuleId, cachekey, strOut);
                    }
                    var l = new Literal {
                        Text = strOut
                    };
                    phData.Controls.Add(l);
                }

                #endregion

                #region "Accordian"

                if (menutype == "accordian")
                {
                }

                #endregion

                #region "megamenu"

                if (menutype == "megamenu")
                {
                }

                #endregion
            }

            // display header
            rpDataH.DataSource = catl;
            rpDataH.DataBind();

            // display footer
            rpDataF.DataSource = catl;
            rpDataF.DataBind();

            #endregion
        }
示例#12
0
 public void AddInstalledModInfo(ModSettings modSettings)
 {
     Settings.installedMods.Add(modSettings);
     WriteSettingsToFile(Settings);
 }
 public Settings(string[] args)
 {
     Input  = new InputSettings(args);
     Mod    = new ModSettings(args);
     Output = new OutputSettings(args);
 }
    bool GetModSettings(ref ModSettings ms)
    {
        if (modList.SelectedIndex < 0 || modList.SelectedIndex > modSettings.Count())
            return false;

         ms = modSettings[modList.SelectedIndex];
         return ms.modInfo != null;
    }
示例#15
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            try
            {
                // check for new plugins
                PluginUtils.UpdateSystemPlugins();

                #region "load templates"

                var t1 = "backoffice.html";

                // Get Display Body
                var dataTempl = ModCtrl.GetTemplateData(ModSettings, t1, Utils.GetCurrentCulture(), DebugMode);
                // insert page header text
                var headerTempl = NBrightBuyUtils.GetGenXmlTemplate(dataTempl, ModSettings.Settings(), PortalSettings.HomeDirectory);
                NBrightBuyUtils.IncludePageHeaders(ModCtrl, ModuleId, Page, headerTempl, ModSettings.Settings(), null, DebugMode);

                // remove any DNN modules from the BO page
                var tabInfo  = PortalSettings.Current.ActiveTab;
                var modCount = tabInfo.Modules.Count;
                for (int i = 0; i < modCount; i++)
                {
                    tabInfo.Modules.RemoveAt(0);
                }


                var aryTempl = Utils.ParseTemplateText(dataTempl);

                foreach (var s in aryTempl)
                {
                    var htmlDecode = System.Web.HttpUtility.HtmlDecode(s);
                    if (htmlDecode != null)
                    {
                        switch (htmlDecode.ToLower())
                        {
                        case "<tag:menu>":
                            var c1 = LoadControl(ControlPath + "/Menu.ascx");
                            phData.Controls.Add(c1);
                            break;

                        case "<tag:container>":
                            var c2 = LoadControl(ControlPath + "/Container.ascx");
                            phData.Controls.Add(c2);
                            break;

                        default:
                            var lc = new Literal {
                                Text = s
                            };
                            phData.Controls.Add(lc);
                            break;
                        }
                    }
                }


                #endregion
            }
            catch (Exception exc)
            {
                //display the error on the template (don;t want to log it here, prefer to deal with errors directly.)
                var l = new Literal();
                l.Text = exc.ToString();
                phData.Controls.Add(l);
            }
        }
示例#16
0
 public static void readSettings()
 {
     settings = modHelper.Data.ReadJsonFile <ModSettings>("settings.json") ?? new ModSettings();
 }
示例#17
0
        private void PageLoad()
        {
            #region " Cart List Data Repeater"


            if (_templD.Trim() != "") // if we don;t have a template, don't do anything
            {
                var groupresults = ModSettings.Get("chkgroupresults") == "True";
                var l            = _cartInfo.GetCartItemList(groupresults);
                rpData.DataSource = l;
                rpData.DataBind();
            }

            var cartL = new List <NBrightInfo>();
            cartL.Add(_cartInfo.GetInfo());

            // display header
            rpDataH.DataSource = cartL;
            rpDataH.DataBind();

            // display footer
            rpDataF.DataSource = cartL;
            rpDataF.DataBind();

            #endregion

            if (carttype == "3") // full cart list
            {
                // display footer
                cartL[0].SetXmlProperty("genxml/hidden/currentcartstage", cartL[0].GetXmlProperty("genxml/currentcartstage")); // set the cart stage so we appear on correct stage.
                checkoutlayout.DataSource = cartL;
                checkoutlayout.DataBind();
            }
            if (carttype == "2") // full checkout
            {
                // display footer
                cartL[0].SetXmlProperty("genxml/hidden/currentcartstage", cartL[0].GetXmlProperty("genxml/currentcartstage")); // set the cart stage so we appear on correct stage.
                checkoutlayout.DataSource = cartL;
                checkoutlayout.DataBind();

                var objl     = new List <NBrightInfo>();
                var billaddr = _cartInfo.GetBillingAddress();
                if (billaddr.XMLData == null)
                {
                    var defAddr = _addressData.GetDefaultAddress();
                    if (defAddr == null)
                    {
                        var cookieaddr = Cookie.GetCookieValue(PortalId, "cartaddress", "billingaddress", "cartaddress");
                        billaddr.XMLData = cookieaddr;
                    }
                    else
                    {
                        billaddr.XMLData = defAddr.XMLData;
                    }
                }
                objl.Add(billaddr);
                rpAddrB.DataSource = objl;
                rpAddrB.DataBind();

                objl = new List <NBrightInfo>();
                objl.Add(_cartInfo.GetShippingAddress());
                rpAddrS.DataSource = objl;
                rpAddrS.DataBind();

                // display shipping input form
                objl = new List <NBrightInfo>();
                objl.Add(_cartInfo.GetShipData());
                rpShip.DataSource = objl;
                rpShip.DataBind();

                // display extra input form
                objl = new List <NBrightInfo>();
                objl.Add(_cartInfo.GetExtraInfo());
                rpExtra.DataSource = objl;
                rpExtra.DataBind();
            }
        }
 public abstract String GetFilter(String currentFilter, NavigationData navigationData, ModSettings setting, NBrightInfo ajaxInfo);
示例#19
0
        protected void CtrlItemCommand(object source, RepeaterCommandEventArgs e)
        {
            var cArg  = e.CommandArgument.ToString();
            var param = new string[3];

            if (Utils.RequestParam(Context, "eid") != "")
            {
                param[0] = "eid=" + Utils.RequestParam(Context, "eid");
            }

            switch (e.CommandName.ToLower())
            {
            case "additems":
                // save before add
                UpdateCartAddresses();
                UpdateCartInfo();
                SaveCart();
                // add item
                _cartInfo.AddItem(rpData, StoreSettings.Current.SettingsInfo, e.Item.ItemIndex, DebugMode);
                _cartInfo.Save();
                Response.Redirect(Globals.NavigateURL(TabId, "", param), true);
                break;

            case "addqty":
                if (!Utils.IsNumeric(cArg))
                {
                    cArg = "1";
                }
                if (Utils.IsNumeric(cArg))
                {
                    _cartInfo.UpdateItemQty(e.Item.ItemIndex, Convert.ToInt32(cArg));
                    _cartInfo.Save();
                }
                Response.Redirect(Globals.NavigateURL(TabId, "", param), true);
                break;

            case "removeqty":
                if (!Utils.IsNumeric(cArg))
                {
                    cArg = "-1";
                }
                if (Utils.IsNumeric(cArg))
                {
                    _cartInfo.UpdateItemQty(e.Item.ItemIndex, Convert.ToInt32(cArg));
                    _cartInfo.Save();
                }
                Response.Redirect(Globals.NavigateURL(TabId, "", param), true);
                break;

            case "deletecartitem":
                UpdateCartAddresses();
                UpdateCartInfo();
                SaveCart();
                if (cArg == "")
                {
                    _cartInfo.RemoveItem(e.Item.ItemIndex);
                }
                else
                {
                    _cartInfo.RemoveItem(cArg);
                }
                _cartInfo.Save();
                Response.Redirect(Globals.NavigateURL(TabId, "", param), true);
                break;

            case "deletecart":
                _cartInfo.DeleteCart();
                Response.Redirect(Globals.NavigateURL(TabId, "", param), true);
                break;

            case "updatecart":
                UpdateCartAddresses();
                UpdateCartInfo();
                SaveCart();
                Response.Redirect(Globals.NavigateURL(TabId, "", param), true);
                break;

            case "confirm":
                UpdateCartAddresses();
                UpdateCartInfo();
                SaveCart();
                Response.Redirect(Globals.NavigateURL(TabId, "", param), true);
                break;

            case "gotocart":
                if (_cartInfo.GetCartItemList().Count > 0)
                {
                    UpdateCartInfo();
                    SaveCart();
                    var paytabid = ModSettings.Get("paymenttab");
                    if (!Utils.IsNumeric(paytabid))
                    {
                        paytabid = TabId.ToString("");
                    }
                    Response.Redirect(Globals.NavigateURL(Convert.ToInt32(paytabid), "", param), true);
                }
                Response.Redirect(Globals.NavigateURL(TabId, "", param), true);
                break;

            case "order":
                if (_cartInfo.GetCartItemList().Count > 0)
                {
                    _cartInfo.SetValidated(true);
                    _cartInfo.Lang = Utils.GetCurrentCulture();      // set lang so we can send emails in same language the order was made in.
                    UpdateCartAddresses();
                    UpdateCartInfo();
                    SaveCart(true);     // remove zero qty items on order, so they don;t appear in BO or on order.
                    _addressData.AddAddress(rpAddrS);
                    _addressData.AddAddress(rpAddrB);
                    var paytabid = ModSettings.Get("paymenttab");
                    if (!Utils.IsNumeric(paytabid))
                    {
                        paytabid = TabId.ToString("");
                    }
                    Response.Redirect(Globals.NavigateURL(Convert.ToInt32(paytabid), "", param), true);
                }
                Response.Redirect(Globals.NavigateURL(TabId, "", param), true);
                break;

            case "saveshipaddress":
                UpdateCartAddresses();
                _cartInfo.Save();
                _addressData.AddAddress(rpAddrS);
                Response.Redirect(Globals.NavigateURL(TabId, "", param), true);
                break;

            case "savebilladdress":
                UpdateCartAddresses();
                _cartInfo.Save();
                _addressData.AddAddress(rpAddrB);
                Response.Redirect(Globals.NavigateURL(TabId, "", param), true);
                break;
            }
        }
示例#20
0
 public ModSettings(ModSettings clone)
 {
     sprintByDefault = clone.sprintByDefault;
     crouchIsToggle  = clone.crouchIsToggle;
 }
示例#21
0
        override protected void OnInit(EventArgs e)
        {
            base.OnInit(e);

            // get setting via control params
            if (DisplayHeader != null && DisplayHeader == "")
            {
                DisplayHeader = "minicartheader.html";
            }
            if (DisplayBody != null && DisplayHeader == "")
            {
                DisplayBody = "minicartbody.html";
            }
            if (DisplayFooter != null && DisplayHeader == "")
            {
                DisplayFooter = "minicartfooter.html";
            }
            if (!String.IsNullOrEmpty(DisplayHeader) && !ModSettings.Settings().ContainsKey("txtdisplayheader"))
            {
                ModSettings.Settings().Add("txtdisplayheader", DisplayHeader);
            }
            if (!String.IsNullOrEmpty(DisplayBody) && !ModSettings.Settings().ContainsKey("txtdisplaybody"))
            {
                ModSettings.Settings().Add("txtdisplaybody", DisplayBody);
            }
            if (!String.IsNullOrEmpty(DisplayFooter) && !ModSettings.Settings().ContainsKey("txtdisplayfooter"))
            {
                ModSettings.Settings().Add("txtdisplayfooter", DisplayFooter);
            }
            if (!String.IsNullOrEmpty(PaymentTab) && !ModSettings.Settings().ContainsKey("PaymentTab"))
            {
                ModSettings.Settings().Add("PaymentTab", PaymentTab);
            }
            if (!String.IsNullOrEmpty(Themefolder) && !ModSettings.Settings().ContainsKey("themefolder"))
            {
                ModSettings.Settings().Add("themefolder", Themefolder);
            }

            _cartInfo = new CartData(PortalId);

            _addressData = new AddressData(_cartInfo.UserId.ToString(""));

            if (ModSettings.Get("themefolder") == "")  // if we don't have module setting jump out
            {
                rpDataH.ItemTemplate = new GenXmlTemplate("NO MODULE SETTINGS");
                return;
            }

            try
            {
                _templH     = ModSettings.Get("txtdisplayheader");
                _templD     = ModSettings.Get("txtdisplaybody");
                _templDfoot = ModSettings.Get("txtdisplaybodyfoot");
                _templF     = ModSettings.Get("txtdisplayfooter");

                const string templAB = "cartbillingaddress.html";
                const string templAS = "cartshippingaddress.html";
                const string templS  = "cartshipment.html";
                const string templE  = "cartextra.html";
                const string templD  = "cartdetails.html";

                carttype = ModSettings.Get("ddlcarttype");  // This is left for backward compatiblity with NBS_Cart module (now removed from install).

                if (carttype == "")
                {
                    // cart type is not a setting, so use the controlanme
                    if (ModuleConfiguration.DesktopModule.ModuleName == "NBS_MiniCart")
                    {
                        carttype = "1";
                    }
                    if (ModuleConfiguration.DesktopModule.ModuleName == "NBS_FullCart")
                    {
                        carttype = "3";
                    }
                    if (ModuleConfiguration.DesktopModule.ModuleName == "NBS_Checkout")
                    {
                        carttype = "2";
                    }
                }

                if (carttype == "3" || carttype == "2") // check if we need to add cookie items
                {
                    _cartInfo.AddCookieToCart();
                    _cartInfo.Save();
                }
                if (!_cartInfo.GetCartItemList().Any() && (carttype == "3" || carttype == "2"))
                {
                    _templH = "cartempty.html"; // check for empty cart
                }
                else
                {
                    // Get Display Body
                    var rpDataTempl = ModCtrl.GetTemplateData(ModSettings, _templD, Utils.GetCurrentCulture(), DebugMode);
                    rpData.ItemTemplate = NBrightBuyUtils.GetGenXmlTemplate(rpDataTempl, ModSettings.Settings(), PortalSettings.HomeDirectory);

                    // Get Display Footer
                    var rpDataFTempl = ModCtrl.GetTemplateData(ModSettings, _templF, Utils.GetCurrentCulture(), DebugMode);
                    rpDataF.ItemTemplate = NBrightBuyUtils.GetGenXmlTemplate(rpDataFTempl, ModSettings.Settings(), PortalSettings.HomeDirectory);

                    // Get CartLayout
                    var layouttemplate = "checkoutlayout.html";
                    if (carttype == "3")
                    {
                        layouttemplate = "fullcartlayout.html";
                    }
                    var checkoutlayoutTempl = ModCtrl.GetTemplateData(ModSettings, layouttemplate, Utils.GetCurrentCulture(), DebugMode);
                    checkoutlayout.ItemTemplate = NBrightBuyUtils.GetGenXmlTemplate(checkoutlayoutTempl, ModSettings.Settings(), PortalSettings.HomeDirectory);
                    _templateHeader             = (GenXmlTemplate)checkoutlayout.ItemTemplate;
                }
                // Get Display Header
                var rpDataHTempl = ModCtrl.GetTemplateData(ModSettings, _templH, Utils.GetCurrentCulture(), DebugMode);

                rpDataH.ItemTemplate = NBrightBuyUtils.GetGenXmlTemplate(rpDataHTempl, ModSettings.Settings(), PortalSettings.HomeDirectory);

                // insert page header text
                NBrightBuyUtils.IncludePageHeaders(ModCtrl, ModuleId, Page, _templateHeader, ModSettings.Settings(), null, DebugMode);


                if (carttype == "2")
                {
                    // add any shiiping provider templates to the cart layout, so we can process any data required by them
                    rpShip.ItemTemplate  = NBrightBuyUtils.GetGenXmlTemplate(ModCtrl.GetTemplateData(ModSettings, templS, Utils.GetCurrentCulture(), DebugMode), ModSettings.Settings(), PortalSettings.HomeDirectory);
                    rpAddrB.ItemTemplate = NBrightBuyUtils.GetGenXmlTemplate(ModCtrl.GetTemplateData(ModSettings, templAB, Utils.GetCurrentCulture(), DebugMode), ModSettings.Settings(), PortalSettings.HomeDirectory);
                    rpAddrS.ItemTemplate = NBrightBuyUtils.GetGenXmlTemplate(ModCtrl.GetTemplateData(ModSettings, templAS, Utils.GetCurrentCulture(), DebugMode), ModSettings.Settings(), PortalSettings.HomeDirectory);

                    var checkoutextraTempl = ModCtrl.GetTemplateData(ModSettings, templE, Utils.GetCurrentCulture(), DebugMode);
                    checkoutextraTempl  += GetShippingProviderTemplates();
                    rpExtra.ItemTemplate = NBrightBuyUtils.GetGenXmlTemplate(checkoutextraTempl, ModSettings.Settings(), PortalSettings.HomeDirectory);
                }
            }
            catch (Exception exc)
            {
                rpDataF.ItemTemplate = new GenXmlTemplate(exc.Message, ModSettings.Settings());
                // catch any error and allow processing to continue, output error as footer template.
            }
        }
        private void RazorPageLoad()
        {
            NBrightInfo objCat = null;

            if (RazorTemplate.Trim() != "")  // if we don;t have a template, don't do anything
            {
                if (_displayentrypage)
                {
                    // get correct itemid, based on eid given
                    _eid = GetEntryIdFromName(_eid);
                    RazorDisplayDataEntry(_eid);
                }
                else
                {
                    // load base template which should call ajax and load the list.
                    var strOut = NBrightBuyUtils.RazorTemplRender(RazorTemplate, ModuleId, "productdetailrazor" + ModuleId, new NBrightInfo(true), _controlPath, ModSettings.ThemeFolder, Utils.GetCurrentCulture(), ModSettings.Settings());
                    var lit    = new Literal();
                    lit.Text = strOut;
                    phData.Controls.Add(lit);
                }
            }
        }
示例#23
0
        override protected void OnInit(EventArgs e)
        {
            base.OnInit(e);

            if (ModSettings.Get("themefolder") == "")  // if we don't have module setting jump out
            {
                rpPaymentGateways.ItemTemplate = new GenXmlTemplate("NO MODULE SETTINGS");
                return;
            }

            try
            {
                var pluginData = new PluginData(PortalSettings.Current.PortalId);
                _provList = pluginData.GetPaymentProviders();
                _cartInfo = new CartData(PortalId);

                var orderid     = Utils.RequestQueryStringParam(Context, "orderid");
                var templOk     = ModSettings.Get("paymentoktemplate");
                var templFail   = ModSettings.Get("paymentfailtemplate");
                var templHeader = "";
                var templFooter = "";
                var templText   = "";

                if (_provList.Count == 0 && ModSettings.Get("orderingsystem") == "True")
                {
                    #region "No Payment providers, so process as a ordering system"

                    var displayTempl = templOk;
                    if (!_cartInfo.IsValidated())
                    {
                        displayTempl = templFail;
                    }

                    rpDetailDisplay.ItemTemplate = NBrightBuyUtils.GetGenXmlTemplate(ModCtrl.GetTemplateData(ModSettings, displayTempl, Utils.GetCurrentCulture(), DebugMode), ModSettings.Settings(), PortalSettings.HomeDirectory);
                    _templateHeader = (GenXmlTemplate)rpDetailDisplay.ItemTemplate;

                    // we may have voucher discounts that give a zero appliedtotal, so process.
                    var discountprov = DiscountCodeInterface.Instance();
                    if (discountprov != null)
                    {
                        discountprov.UpdatePercentUsage(PortalId, UserId, _cartInfo.PurchaseInfo);
                        discountprov.UpdateVoucherAmount(PortalId, UserId, _cartInfo.PurchaseInfo);
                    }

                    #endregion
                }
                else
                {
                    #region "Payment Details"

                    // display the payment method by default
                    templHeader = ModSettings.Get("paymentordersummary");
                    templFooter = ModSettings.Get("paymentfooter");
                    var templPaymentText = "";
                    var msg = "";
                    if (Utils.IsNumeric(orderid))
                    {
                        // orderid exists, so must be return from bank; Process it!!
                        _orderData = new OrderData(PortalId, Convert.ToInt32(orderid));
                        _prov      = PaymentsInterface.Instance(_orderData.PaymentProviderKey);

                        msg = _prov.ProcessPaymentReturn(Context);
                        if (msg == "")                                                      // no message so successful
                        {
                            _orderData = new OrderData(PortalId, Convert.ToInt32(orderid)); // get the updated order.
                            _orderData.PaymentOk("050");
                            templText = templOk;
                        }
                        else
                        {
                            _orderData = new OrderData(PortalId, Convert.ToInt32(orderid)); // reload the order, becuase the status and typecode may have changed by the payment provider.
                            _orderData.AddAuditMessage(msg, "paymsg", "payment.ascx", "False");
                            _orderData.Save();
                            templText = templFail;
                        }
                        templFooter = ""; // return from bank, hide footer
                    }
                    else
                    {
                        // not returning from bank, so display list of payment providers.
                        rpPaymentGateways.ItemTemplate = NBrightBuyUtils.GetGenXmlTemplate(GetPaymentProviderTemplates(), ModSettings.Settings(), PortalSettings.HomeDirectory);
                    }

                    if (templText == "")
                    {
                        templText = templHeader;                  // if we are NOT returning from bank, then display normal header summary template
                    }
                    templPaymentText = ModCtrl.GetTemplateData(ModSettings, templText, Utils.GetCurrentCulture(), DebugMode);

                    rpDetailDisplay.ItemTemplate = NBrightBuyUtils.GetGenXmlTemplate(templPaymentText, ModSettings.Settings(), PortalSettings.HomeDirectory);
                    _templateHeader = (GenXmlTemplate)rpDetailDisplay.ItemTemplate;

                    if (templFooter != "")
                    {
                        var templPaymentFooterText = ModCtrl.GetTemplateData(ModSettings, templFooter, Utils.GetCurrentCulture(), DebugMode);
                        rpDetailFooter.ItemTemplate = NBrightBuyUtils.GetGenXmlTemplate(templPaymentFooterText, ModSettings.Settings(), PortalSettings.HomeDirectory);
                    }

                    #endregion
                }


                // insert page header text
                NBrightBuyUtils.IncludePageHeaders(ModCtrl, ModuleId, Page, _templateHeader, ModSettings.Settings(), null, DebugMode);
            }
            catch (Exception exc)
            {
                //display the error on the template (don;t want to log it here, prefer to deal with errors directly.)
                var l = new Literal();
                l.Text = exc.ToString();
                phData.Controls.Add(l);
            }
        }
        private void DisplayProductError(ProductData productData, String msg)
        {
            var strOut = msg;

            if (productData != null)
            {
                strOut = NBrightBuyUtils.RazorTemplRender("ProductNotFound.cshtml", ModuleId, "", productData, _controlPath, ModSettings.ThemeFolder, Utils.GetCurrentCulture(), ModSettings.Settings());
            }
            var lit = new Literal();

            lit.Text = strOut;
            phData.Controls.Add(lit);
            if (StoreSettings.Current.SettingsInfo.GetXmlPropertyBool("genxml/checkbox/activate404"))
            {
                Response.StatusCode = 404;
            }
        }
示例#25
0
    public static void BackupAll(DirectoryInfo source, DirectoryInfo target, DirectoryInfo backup, ModSettings modSettings = null)
    {
        if (!Directory.Exists(backup.FullName))
        {
            Directory.CreateDirectory(backup.FullName);
        }

        // Backup each file into it's backup directory.
        foreach (FileInfo fi in source.GetFiles())
        {
            string destFile   = Path.Combine(target.ToString(), fi.Name);
            string backupFile = Path.Combine(backup.ToString(), fi.Name);

            //don't backup readme files
            if (destFile.ToLower().Contains("readme"))
            {
                continue;
            }

            if (File.Exists(destFile))
            {
                try
                {
                    //don't backup a file that's already been backed up
                    if (modSettings == null || modSettings.backupFiles == null || !modSettings.backupFiles.Contains(destFile))
                    {
                        //Don't double-backup a file, we might destroy an original
                        if (!File.Exists(backupFile))
                        {
                            Debug.Log(" Backing up " + destFile + " to " + backupFile);
                            File.Copy(destFile, backupFile);
                        }

                        //record the install location of this file so we can uninstall it later
                        if (modSettings != null)
                        {
                            modSettings.backupFiles.Add(backupFile);
                        }
                    }
                }
                catch (Exception e)
                {
                    System.Windows.Forms.MessageBox.Show("Error backup up mod file from " + destFile + " to " + backupFile + ". Error Message: " + e.Message);
                }
            }
        }

        // Backup each subdirectory using recursion.
        foreach (DirectoryInfo diSourceSubDir in source.GetDirectories())
        {
            DirectoryInfo nextTargetSubDir = target.CreateSubdirectory(diSourceSubDir.Name);
            DirectoryInfo nextBackupSubDir = backup.CreateSubdirectory(diSourceSubDir.Name);
            BackupAll(diSourceSubDir, nextTargetSubDir, nextBackupSubDir, modSettings);
        }
    }
示例#26
0
 private static void DebugAction_WriteModSettings()
 {
     ModSettings.WriteModSettings();
 }
示例#27
0
    //original method taken from: https://stackoverflow.com/questions/9053564/c-sharp-merge-one-directory-with-another
    public void CopyAll(DirectoryInfo source, DirectoryInfo target, ModSettings modSettings = null)
    {
        if (source.FullName.ToLower() == target.FullName.ToLower())
        {
            return;
        }

        try
        {
            // Check if the target directory exists, if not, create it.
            if (Directory.Exists(target.FullName) == false)
            {
                Directory.CreateDirectory(target.FullName);
            }
        }
        catch (Exception e)
        {
            System.Windows.Forms.MessageBox.Show("Copy aborted. Error creating target directory at " + target.FullName + "; Error Message: " + e.Message);
            return;
        }

        // Copy each file into it's new directory.
        foreach (FileInfo fi in source.GetFiles())
        {
            string destFile = Path.Combine(target.ToString(), fi.Name);

            if (File.Exists(destFile))
            {
                File.SetAttributes(destFile, FileAttributes.Normal);
            }

            //Attempting to handle UnauthorizedAccessException and anything else that might happen when copying

            //don't copy the readme files to the normal location
            if (modSettings != null && destFile.ToLower().Contains("readme"))
            {
                string modReadmePath = GetModReadmePath(modSettings.modName);
                string modReadme     = Path.Combine(modReadmePath, fi.Name);

                try
                {
                    if (!Directory.Exists(modReadmePath))
                    {
                        Directory.CreateDirectory(modReadmePath);
                    }

                    Debug.Log(" Copying readme from " + fi.FullName + " to " + modReadme);
                    fi.CopyTo(modReadme, true);

                    //skip the normal copy for the readme
                    continue;
                }
                catch (Exception e)
                {
                    System.Windows.Forms.MessageBox.Show("Error copying readme file from " + fi.FullName + " to " + modReadme + ". Error Message: " + e.Message);
                }
            }

            try
            {
                //don't copy a file that's already been copied
                if (modSettings == null || modSettings.modFiles == null || !modSettings.modFiles.Contains(destFile))
                {
                    //if( modSettings != null && modSettings.modFiles != null )
                    //{
                    //    Debug.Log( "List of files already copied" );
                    //    foreach( var v in modSettings.modFiles )
                    //        Debug.Log( v );
                    //}

                    Debug.Log(" Copying from " + fi.FullName + " to " + destFile);
                    fi.CopyTo(destFile, true);

                    //record the install location of this file so we can uninstall it later
                    if (modSettings != null)
                    {
                        if (modSettings.modFiles == null)
                        {
                            modSettings.modFiles = new List <string>();
                        }

                        modSettings.modFiles.Add(destFile);
                    }
                }
            }
            catch (Exception e)
            {
                System.Windows.Forms.MessageBox.Show("Error copying mod file from " + fi.FullName + " to " + destFile + ". Error Message: " + e.Message);
            }
        }//end foreach( FileInfo fi in source.GetFiles() )

        // Copy each subdirectory using recursion.
        foreach (DirectoryInfo diSourceSubDir in source.GetDirectories())
        {
            DirectoryInfo nextTargetSubDir = target.CreateSubdirectory(diSourceSubDir.Name);
            CopyAll(diSourceSubDir, nextTargetSubDir, modSettings);
        }
    }
示例#28
0
        public void Load()
        {
            // find the collection json
            var collectionPath = Path.Combine(_basePath.FullName, "collection.json");

            if (File.Exists(collectionPath))
            {
                try
                {
                    ModSettings = JsonConvert.DeserializeObject <List <ModInfo> >(File.ReadAllText(collectionPath));
                    ModSettings = ModSettings.OrderBy(x => x.Priority).ToList();
                }
                catch (Exception e)
                {
                    PluginLog.Error($"failed to read log collection information, failed path: {collectionPath}, err: {e.Message}");
                }
            }

#if DEBUG
            if (ModSettings != null)
            {
                foreach (var ms in ModSettings)
                {
                    PluginLog.Information(
                        "mod: {ModName} Enabled: {Enabled} Priority: {Priority}",
                        ms.FolderName, ms.Enabled, ms.Priority
                        );
                }
            }
#endif

            ModSettings ??= new();
            var foundMods = new List <string>();

            foreach (var modDir in _basePath.EnumerateDirectories())
            {
                var metaFile = modDir.EnumerateFiles().FirstOrDefault(f => f.Name == "meta.json");

                if (metaFile == null)
                {
                    PluginLog.LogError("mod meta is missing for resource mod: {ResourceModLocation}", modDir);
                    continue;
                }

                var meta = JsonConvert.DeserializeObject <ModMeta>(File.ReadAllText(metaFile.FullName));

                var mod = new ResourceMod
                {
                    Meta        = meta,
                    ModBasePath = modDir
                };

                var modEntry = FindOrCreateModSettings(mod);
                foundMods.Add(modDir.Name);
                mod.RefreshModFiles();
            }

            // remove any mods from the collection we didn't find
            ModSettings = ModSettings.Where(
                x =>
                foundMods.Any(
                    fm => string.Equals(x.FolderName, fm, StringComparison.InvariantCultureIgnoreCase)
                    )
                ).ToList();

            // if anything gets removed above, the priority ordering gets f****d, so we need to resort and reindex them otherwise BAD THINGS HAPPEN
            ModSettings = ModSettings.OrderBy(x => x.Priority).ToList();
            var p = 0;
            foreach (var modSetting in ModSettings)
            {
                modSetting.Priority = p++;
            }

            // reorder the resourcemods list so we can just directly iterate
            EnabledMods = GetOrderedAndEnabledModList().ToArray();

            // write the collection metadata back to disk
            Save();
        }
 private void RazorPageLoad()
 {
     // insert page header text
     NBrightBuyUtils.RazorIncludePageHeaderNoCache(ModuleId, Page, Path.GetFileNameWithoutExtension(RazorTemplate) + "_head" + Path.GetExtension(RazorTemplate), ControlPath, ModSettings.ThemeFolder, ModSettings.Settings());
 }
    void GetLoadedMods()
    {
        var mods = ModManager.Instance.GetAllMods(true);

        modList.ClearItems();

        if(modSettings == null || modSettings.Length != mods.Length)
        {
            modSettings = new ModSettings[mods.Length];
        }

        for (int i = 0; i < mods.Length; i++)
        {
            ModSettings modsett = new ModSettings();
            modsett.modInfo = mods[i].ModInfo;
            modsett.enabled = mods[i].Enabled;
            modSettings[i] = modsett;
            modList.AddItem(modsett.modInfo.ModFileName);
        }

        mods = null;
    }
示例#31
0
        public PlayerManager(NetworkManager networkManager, Game.Settings.GameSettings gameSettings, ModSettings settings)
        {
            _gameSettings = gameSettings;

            _playerData = new Dictionary <ushort, ClientPlayerData>();

            // Create the player prefab, used to instantiate player objects
            _playerPrefab = new GameObject(
                "PlayerPrefab",
                typeof(BoxCollider2D),
                typeof(DamageHero),
                typeof(EnemyHitEffectsUninfected),
                typeof(MeshFilter),
                typeof(MeshRenderer),
                typeof(NonBouncer),
                typeof(SpriteFlash),
                typeof(tk2dSprite),
                typeof(tk2dSpriteAnimator),
                typeof(CoroutineCancelComponent)
                )
            {
                layer = 9
            };

            // Add some extra gameObject related to animation effects
            new GameObject("Attacks")
            {
                layer = 9
            }.transform.SetParent(_playerPrefab.transform);
            new GameObject("Effects")
            {
                layer = 9
            }.transform.SetParent(_playerPrefab.transform);
            new GameObject("Spells")
            {
                layer = 9
            }.transform.SetParent(_playerPrefab.transform);

            _playerPrefab.SetActive(false);
            Object.DontDestroyOnLoad(_playerPrefab);
        }
示例#32
0
 public abstract String GetFilter(String currentFilter, NavigationData navigationData, ModSettings setting, HttpContext context);
        private void RazorPageLoad()
        {
            NBrightInfo objCat = null;

            if (_templD.Trim() != "")  // if we don;t have a template, don't do anything
            {
                if (_displayentrypage)
                {
                    // get correct itemid, based on eid given
                    _eid = GetEntryIdFromName(_eid);
                    RazorDisplayDataEntry(_eid);
                }
                else
                {
                    // Get meta data from template

                    var metaTokens = NBrightBuyUtils.RazorPreProcessTempl(_templD, _controlPath, ModSettings.ThemeFolder, Utils.GetCurrentCulture(), ModSettings.Settings(), ModuleId.ToString());

                    #region "Order BY"

                    ////////////////////////////////////////////
                    // get ORDERBY SORT
                    ////////////////////////////////////////////
                    if (_orderbyindex != "") // if we have orderby set in url, find the meta tags
                    {
                        if (metaTokens.ContainsKey("orderby" + _orderbyindex))
                        {
                            if (metaTokens["orderby" + _orderbyindex].Contains("{") || metaTokens["orderby" + _orderbyindex].ToLower().Contains("order by"))
                            {
                                _navigationdata.OrderBy    = metaTokens["orderby" + _orderbyindex];
                                _navigationdata.OrderByIdx = _orderbyindex;
                            }
                            else
                            {
                                _navigationdata.OrderBy    = " Order by " + metaTokens["orderby" + _orderbyindex];
                                _navigationdata.OrderByIdx = _orderbyindex;
                            }
                            _navigationdata.Save();
                        }
                    }
                    else
                    {
                        if (String.IsNullOrEmpty(_navigationdata.OrderBy) && metaTokens.ContainsKey("orderby"))
                        {
                            if (metaTokens["orderby"].Contains("{") || metaTokens["orderby"].ToLower().Contains("order by"))
                            {
                                _navigationdata.OrderBy = metaTokens["orderby"];
                            }
                            else
                            {
                                _navigationdata.OrderBy = " Order by " + metaTokens["orderby"];
                            }
                            _navigationdata.OrderByIdx = "";
                            _navigationdata.Save();
                        }
                    }


                    #endregion

                    #region "Get Paging setup"

                    //See if we have a pagesize, uses the "searchpagesize" tag token.
                    // : This can be overwritten by the cookie value if we need user selection of pagesize.
                    CtrlPaging.Visible = false;

                    #region "Get pagesize, from best place"

                    var pageSize = 0;
                    if (Utils.IsNumeric(ModSettings.Get("pagesize")))
                    {
                        pageSize = Convert.ToInt32(ModSettings.Get("pagesize"));
                    }
                    // overwrite default module pagesize , if we have a pagesize control in the template
                    if (metaTokens.ContainsKey("selectpagesize") && Utils.IsNumeric(_navigationdata.PageSize))
                    {
                        pageSize = Convert.ToInt32(_navigationdata.PageSize);
                    }
                    //check for url param page size
                    if (Utils.IsNumeric(_pagesize) && (_pagemid == "" | _pagemid == ModuleId.ToString(CultureInfo.InvariantCulture)))
                    {
                        pageSize = Convert.ToInt32(_pagesize);
                    }
                    if (pageSize == 0)
                    {
                        var strPgSize = "";
                        if (metaTokens.ContainsKey("searchpagesize"))
                        {
                            strPgSize = metaTokens["searchpagesize"];
                        }
                        if (metaTokens.ContainsKey("pagesize") && strPgSize == "")
                        {
                            strPgSize = metaTokens["pagesize"];
                        }
                        if (Utils.IsNumeric(strPgSize))
                        {
                            pageSize = Convert.ToInt32(strPgSize);
                        }
                    }
                    if (pageSize > 0)
                    {
                        CtrlPaging.Visible = true;
                    }
                    _navigationdata.PageSize = pageSize.ToString("");

                    #endregion

                    var pageNumber = 1;
                    //check for url param paging
                    if (Utils.IsNumeric(_pagenum) && (_pagemid == "" | _pagemid == ModuleId.ToString(CultureInfo.InvariantCulture)))
                    {
                        pageNumber = Convert.ToInt32(_pagenum);
                    }

                    //Get returnlimt from module settings
                    var returnlimit    = 0;
                    var strreturnlimit = ModSettings.Get("returnlimit");
                    if (Utils.IsNumeric(strreturnlimit))
                    {
                        returnlimit = Convert.ToInt32(strreturnlimit);
                    }

                    #endregion

                    #region "Get filter setup"

                    // check the display header to see if we have a sqlfilter defined.
                    var strFilter         = "";
                    var sqlTemplateFilter = "";
                    if (metaTokens.ContainsKey("sqlfilter"))
                    {
                        sqlTemplateFilter = GenXmlFunctions.StripSqlCommands(metaTokens["sqlfilter"]);
                    }

                    if (_navigationdata.HasCriteria)
                    {
                        var paramcatid = Utils.RequestQueryStringParam(Context, "catid");
                        if (Utils.IsNumeric(paramcatid))
                        {
                            if (_navigationdata.CategoryId != Convert.ToInt32(paramcatid)) // filter mode DOES NOT persist catid (stop confusion when user selects a category)
                            {
                                _navigationdata.ResetSearch();
                            }
                        }

                        // if navdata is not deleted then get filter from navdata, created by productsearch module.
                        strFilter = _navigationdata.Criteria;
                        if (!strFilter.Contains(sqlTemplateFilter))
                        {
                            strFilter += " " + sqlTemplateFilter;
                        }

                        if (_navigationdata.Mode.ToLower() == "s")
                        {
                            _navigationdata.ResetSearch();                                        // single search so clear after
                        }
                    }
                    else
                    {
                        // reset search if category selected
                        // NOTE: keeping search across categories is VERY confusing for cleint, although it works logically.
                        _navigationdata.ResetSearch();
                        strFilter = sqlTemplateFilter;
                    }

                    #endregion

                    #region "Get Category select setup"

                    var objQual = DotNetNuke.Data.DataProvider.Instance().ObjectQualifier;
                    var dbOwner = DataProvider.Instance().DatabaseOwner;

                    //get default catid.
                    var catseo   = _catid;
                    var defcatid = ModSettings.Get("defaultcatid");
                    if (defcatid == "")
                    {
                        defcatid = "0";
                    }
                    if (Utils.IsNumeric(defcatid) && Convert.ToInt32(defcatid) > 0)
                    {
                        // if we have no filter use the default category
                        if (_catid == "" && strFilter.Trim() == "")
                        {
                            _catid = defcatid;
                        }
                    }
                    else
                    {
                        defcatid = ModSettings.Get("defaultpropertyid");
                        if (defcatid == "")
                        {
                            defcatid = "0";
                        }
                        if (Utils.IsNumeric(defcatid))
                        {
                            // if we have no filter use the default category
                            if (_catid == "" && strFilter.Trim() == "")
                            {
                                _catid = defcatid;
                            }
                        }
                    }

                    // If we have a static list,then always display the default category
                    if (ModSettings.Get("staticlist") == "True")
                    {
                        if (catseo == "")
                        {
                            catseo = _catid;
                        }
                        _catid = defcatid;
                        if (ModSettings.Get("chkcascaderesults").ToLower() == "true")
                        {
                            strFilter = strFilter + " and NB1.[ItemId] in (select parentitemid from " + dbOwner + "[" + objQual + "NBrightBuy] where (typecode = 'CATCASCADE' or typecode = 'CATXREF') and XrefItemId = " + _catid + ") ";
                        }
                        else
                        {
                            strFilter = strFilter + " and NB1.[ItemId] in (select parentitemid from " + dbOwner + "[" + objQual + "NBrightBuy] where typecode = 'CATXREF' and XrefItemId = " + _catid + ") ";
                        }

                        if (ModSettings.Get("caturlfilter") == "True" && catseo != "" && catseo != _catid)
                        {
                            // add aditional filter for catid filter on url (catseo holds catid from url)
                            if (ModSettings.Get("chkcascaderesults").ToLower() == "true")
                            {
                                strFilter = strFilter + " and NB1.[ItemId] in (select parentitemid from " + dbOwner + "[" + objQual + "NBrightBuy] where (typecode = 'CATCASCADE' or typecode = 'CATXREF') and XrefItemId = " + catseo + ") ";
                            }
                            else
                            {
                                strFilter = strFilter + " and NB1.[ItemId] in (select parentitemid from " + dbOwner + "[" + objQual + "NBrightBuy] where typecode = 'CATXREF' and XrefItemId = " + catseo + ") ";
                            }
                        }
                        // do special custom sort in each cateogry, this passes the catid to the SQL SPROC, whcih process the '{bycategoryproduct}' and orders by product/category seq.
                        if (_navigationdata.OrderBy.Contains("{bycategoryproduct}"))
                        {
                            _navigationdata.OrderBy = "{bycategoryproduct}" + _catid;
                        }
                    }
                    else
                    {
                        #region "use url to get category to display"

                        //check if we are display categories
                        // get category list data
                        if (_catname != "") // if catname passed in url, calculate what the catid is
                        {
                            objCat = ModCtrl.GetByGuidKey(PortalId, ModuleId, "CATEGORYLANG", _catname);
                            if (objCat == null)
                            {
                                // check it's not just a single language
                                objCat = ModCtrl.GetByGuidKey(PortalId, ModuleId, "CATEGORY", _catname);
                                if (objCat != null)
                                {
                                    _catid = objCat.ItemID.ToString("");
                                }
                            }
                            else
                            {
                                _catid = objCat.ParentItemId.ToString("");
                                if (!String.IsNullOrEmpty(objCat.GUIDKey) && Utils.IsNumeric(_catid) && objCat.Lang != Utils.GetCurrentCulture())
                                {
                                    // do a 301 redirect to correct url for the langauge (If the langauge is changed on the product list, we need to make sure we have the correct catref for the langauge)
                                    var catGrpCtrl = new GrpCatController(Utils.GetCurrentCulture());
                                    var activeCat  = catGrpCtrl.GetCategory(Convert.ToInt32(_catid));
                                    if (activeCat != null)
                                    {
                                        var redirecturl = "";
                                        if (Utils.IsNumeric(_eid))
                                        {
                                            var prdData = ProductUtils.GetProductData(Convert.ToInt32(_eid), Utils.GetCurrentCulture(), true, EntityTypeCode);
                                            redirecturl = NBrightBuyUtils.GetEntryUrl(PortalId, _eid, _modkey, prdData.SEOName, TabId.ToString(), "", activeCat.categoryrefGUIDKey);
                                        }
                                        else
                                        {
                                            redirecturl = catGrpCtrl.GetCategoryUrl(activeCat, TabId, Utils.GetCurrentCulture());
                                        }

                                        try
                                        {
                                            if (redirecturl != "")
                                            {
                                                Response.Redirect(redirecturl, false);
                                                Response.StatusCode = (int)System.Net.HttpStatusCode.MovedPermanently;
                                                Response.End();
                                            }
                                        }
                                        catch (Exception)
                                        {
                                            // catch err
                                        }
                                    }
                                }
                            }
                            // We have a category selected (in url), so overwrite categoryid navigationdata.
                            // This allows the return to the same category after a returning from a entry view.
                            if (Utils.IsNumeric(_catid))
                            {
                                _navigationdata.CategoryId = Convert.ToInt32(_catid);
                            }
                            catseo = _catid;
                            _navigationdata.ResetSearch();
                            strFilter = "";
                        }

                        if (Utils.IsNumeric(_catid))
                        {
                            if (ModSettings.Get("chkcascaderesults").ToLower() == "true")
                            {
                                strFilter = strFilter + " and NB1.[ItemId] in (select parentitemid from " + dbOwner + "[" + objQual + "NBrightBuy] where (typecode = 'CATCASCADE' or typecode = 'CATXREF') and XrefItemId = " + _catid + ") ";
                            }
                            else
                            {
                                strFilter = strFilter + " and NB1.[ItemId] in (select parentitemid from " + dbOwner + "[" + objQual + "NBrightBuy] where typecode = 'CATXREF' and XrefItemId = " + _catid + ") ";
                            }

                            if (Utils.IsNumeric(catseo))
                            {
                                var objSEOCat = ModCtrl.GetData(Convert.ToInt32(catseo), "CATEGORYLANG", Utils.GetCurrentCulture());
                                if (objSEOCat != null && _eid == "") // we may have a detail page and listonly module, in which can we need the product detail as page title
                                {
                                    //Page Title
                                    var seoname = objSEOCat.GetXmlProperty("genxml/lang/genxml/textbox/txtseoname");
                                    if (seoname == "")
                                    {
                                        seoname = objSEOCat.GetXmlProperty("genxml/lang/genxml/textbox/txtcategoryname");
                                    }

                                    var newBaseTitle = objSEOCat.GetXmlProperty("genxml/lang/genxml/textbox/txtseopagetitle");
                                    if (newBaseTitle == "")
                                    {
                                        newBaseTitle = objSEOCat.GetXmlProperty("genxml/lang/genxml/textbox/txtseoname");
                                    }
                                    if (newBaseTitle == "")
                                    {
                                        newBaseTitle = objSEOCat.GetXmlProperty("genxml/lang/genxml/textbox/txtcategoryname");
                                    }
                                    if (newBaseTitle != "")
                                    {
                                        BasePage.Title = newBaseTitle;
                                    }
                                    //Page KeyWords
                                    var newBaseKeyWords = objSEOCat.GetXmlProperty("genxml/lang/genxml/textbox/txtmetakeywords");
                                    if (newBaseKeyWords != "")
                                    {
                                        BasePage.KeyWords = newBaseKeyWords;
                                    }
                                    //Page Description
                                    var newBaseDescription = objSEOCat.GetXmlProperty("genxml/lang/genxml/textbox/txtmetadescription");
                                    if (newBaseDescription == "")
                                    {
                                        newBaseDescription = objSEOCat.GetXmlProperty("genxml/lang/genxml/textbox/txtcategorydesc");
                                    }
                                    if (newBaseDescription != "")
                                    {
                                        BasePage.Description = newBaseDescription;
                                    }


                                    // Remove canonical link for list.  The Open URL Rewriter (OUR) will create a url that is different to the default SEO url in NBS.
                                    // So to stop clashes it's been disable by default.  The requirment for a canonical link on a category list is more ticking the box than of being any SEO help (might even be causing confusion to Search Engines).
                                    // ** If your a SEO nutcases (or SEO companies pushing for it) then you can uncomment the code below, and you can implement the Open URL Rewriter and canonical link.

                                    //if (PortalSettings.HomeTabId == TabId)
                                    //    PageIncludes.IncludeCanonicalLink(Page, Globals.AddHTTP(PortalSettings.PortalAlias.HTTPAlias)); //home page always default of site.
                                    //else
                                    //{
                                    //    PageIncludes.IncludeCanonicalLink(Page, NBrightBuyUtils.GetListUrl(PortalId, TabId, objSEOCat.ItemID, seoname, Utils.GetCurrentCulture()));
                                    //    // Code required for OUR (if used, test to ensure it works correctly!!)
                                    //    //PageIncludes.IncludeCanonicalLink(Page, NBrightBuyUtils.GetListUrl(PortalId, TabId, objSEOCat.ItemID, "", Utils.GetCurrentCulture()));
                                    //}
                                }
                            }

                            // do special custom sort in each cateogry, this passes the catid to the SQL SPROC, whcih process the '{bycategoryproduct}' and orders by product/category seq.
                            if (_navigationdata.OrderBy.Contains("{bycategoryproduct}"))
                            {
                                _navigationdata.OrderBy = "{bycategoryproduct}" + _catid;
                            }
                        }
                        else
                        {
                            if (!_navigationdata.FilterMode)
                            {
                                _navigationdata.CategoryId = 0;                              // filter mode persist catid
                            }
                            if (_navigationdata.OrderBy.Contains("{bycategoryproduct}"))
                            {
                                _navigationdata.OrderBy = " Order by ModifiedDate DESC  ";
                            }
                        }

                        #endregion
                    }

                    // This allows the return to the same category after a returning from a entry view. + Gives support for current category in razor tokens
                    if (Utils.IsNumeric(_catid))
                    {
                        _navigationdata.CategoryId = Convert.ToInt32(_catid);
                    }

                    #endregion

                    #region "Apply provider product filter"

                    // Special filtering can be done, by using the ProductFilter interface.
                    var productfilterkey = "";
                    if (metaTokens.ContainsKey("providerfilterkey"))
                    {
                        productfilterkey = metaTokens["providerfilterkey"];
                    }
                    if (productfilterkey != "")
                    {
                        var provfilter = FilterInterface.Instance(productfilterkey);
                        if (provfilter != null)
                        {
                            strFilter = provfilter.GetFilter(strFilter, _navigationdata, ModSettings, Context);
                        }
                    }

                    #endregion

                    #region "itemlists (wishlist)"

                    // if we have a itemListName field then get the itemlist cookie.
                    if (ModSettings.Get("displaytype") == "2") // displaytype 2 = "selected list"
                    {
                        var cw = new ItemListData(PortalId, UserController.Instance.GetCurrentUserInfo().UserID);
                        if (cw.Exists && cw.ItemCount > 0)
                        {
                            strFilter = " and (";
                            foreach (var i in cw.GetItemList())
                            {
                                strFilter += " NB1.itemid = '" + i + "' or";
                            }
                            strFilter = strFilter.Substring(0, (strFilter.Length - 3)) + ") ";
                            // remove the last "or"
                        }
                        else
                        {
                            //no data in list so select false itemid to stop anything displaying
                            strFilter += " and (NB1.itemid = '-1') ";
                        }
                    }

                    #endregion

                    // insert page header text
                    NBrightBuyUtils.RazorIncludePageHeader(ModuleId, Page, Path.GetFileNameWithoutExtension(_templD) + "_head" + Path.GetExtension(_templD), _controlPath, ModSettings.ThemeFolder, ModSettings.Settings());

                    // save navigation data
                    _navigationdata.PageModuleId = Utils.RequestParam(Context, "pagemid");
                    _navigationdata.PageNumber   = Utils.RequestParam(Context, "page");
                    if (Utils.IsNumeric(_catid))
                    {
                        _navigationdata.PageName = NBrightBuyUtils.GetCurrentPageName(Convert.ToInt32(_catid));
                    }

                    // save the last active modulekey to a cookie, so it can be used by the "NBrightBuyUtils.GetReturnUrl" function
                    NBrightCore.common.Cookie.SetCookieValue(PortalId, "NBrigthBuyLastActive", "ModuleKey", ModuleKey, 1);


                    if (strFilter.Trim() == "")
                    {
                        // if at this point we have no filter, then assume we're using urlrewriter and a 404 url has been entered.
                        // rather than display all visible products in a list with no default.
                        // redirect to the product display function, so we can display a 404 and product not found.
                        RazorDisplayDataEntry(_eid);
                    }
                    else
                    {
                        strFilter += " and (NB3.Visible = 1) "; // get only visible products

                        var recordCount = ModCtrl.GetDataListCount(PortalId, ModuleId, EntityTypeCode, strFilter, EntityTypeCodeLang, Utils.GetCurrentCulture(), DebugMode);

                        _navigationdata.RecordCount = recordCount.ToString("");
                        _navigationdata.Save();

                        if (returnlimit > 0 && returnlimit < recordCount)
                        {
                            recordCount = returnlimit;
                        }

                        // **** check if we already have the template cached, if so no need for DB call or razor call ****
                        // get same cachekey used for DB return, and use for razor.
                        var razorcachekey = ModCtrl.GetDataListCacheKey(PortalId, ModuleId, EntityTypeCode, EntityTypeCodeLang, Utils.GetCurrentCulture(), strFilter, _navigationdata.OrderBy, DebugMode, "", returnlimit, pageNumber, pageSize, recordCount);
                        var cachekey      = "NBrightBuyRazorOutput" + _templD + "*" + razorcachekey + PortalId.ToString();
                        var strOut        = (String)NBrightBuyUtils.GetModCache(cachekey);
                        if (strOut == null || StoreSettings.Current.DebugMode)
                        {
                            var l = ModCtrl.GetDataList(PortalId, ModuleId, EntityTypeCode, EntityTypeCodeLang, Utils.GetCurrentCulture(), strFilter, _navigationdata.OrderBy, DebugMode, "", returnlimit, pageNumber, pageSize, recordCount);
                            strOut = NBrightBuyUtils.RazorTemplRenderList(_templD, ModuleId, razorcachekey, l, _controlPath, ModSettings.ThemeFolder, Utils.GetCurrentCulture(), ModSettings.Settings());
                        }

                        var lit = new Literal();
                        lit.Text = strOut;
                        phData.Controls.Add(lit);

                        if (_navigationdata.SingleSearchMode)
                        {
                            _navigationdata.ResetSearch();
                        }

                        if (pageSize > 0)
                        {
                            CtrlPaging.PageSize     = pageSize;
                            CtrlPaging.CurrentPage  = pageNumber;
                            CtrlPaging.TotalRecords = recordCount;
                            CtrlPaging.BindPageLinks();
                        }
                    }
                }
            }
        }