コード例 #1
0
ファイル: ItemRow.cs プロジェクト: klanderso/YAGE
        public ItemRow(ItemID id)
        {
            ItemId = id;
            var str = id.ToString();

            switch (str)
            {
                case "RawStart":
                    Name = "RawSoil";
                    break;
                case "RawEnd":
                    Name = "RawHide";
                    break;
                case "FoodStart":
                    Name = "Fruit";
                    break;
                case "FoodEnd":
                    Name = "Sandwich";
                    break;
                case "DrinkStart":
                    Name = "Milk";
                    break;
                case "DrinkEnd":
                    Name = "Beer";
                    break;
                case "StorageStart":
                    Name = "Crate";
                    break;
                case "StorageEnd":
                    Name = "Bag";
                    break;
                case "FurnitureStart":
                    Name = "WoodDoor";
                    break;
                case "FurnitureEnd":
                    Name = "Statue";
                    break;
                case "WeaponStart":
                    Name = "Sword";
                    break;
                case "WeaponEnd":
                    Name = "Torch";
                    break;
                case "EquipmentStart":
                    Name = "Helmet";
                    break;
                case "EquipmentEnd":
                    Name = "LeatherBoot";
                    break;
                case "ToolStart":
                    Name = "Pickaxe";
                    break;
                case "ToolEnd":
                    Name = "FellingAxe";
                    break;
                default:
                    Name = str;
                    break;
            }
        }
コード例 #2
0
ファイル: ScriptInstance.cs プロジェクト: BogusCurry/akisim
        /// <summary>
        /// Load the script from an assembly into an AppDomain.
        /// </summary>
        /// <param name='dom'></param>
        /// <param name='assembly'></param>
        /// <param name='stateSource'></param>
        /// <returns>false if load failed, true if suceeded</returns>
        public bool Load(AppDomain dom, string assembly, StateSource stateSource)
        {
            m_Assembly    = assembly;
            m_stateSource = stateSource;

            ApiManager am = new ApiManager();

            foreach (string api in am.GetApis())
            {
                m_Apis[api] = am.CreateApi(api);
                m_Apis[api].Initialize(Engine, Part, ScriptTask, m_coopSleepHandle);
            }

            try
            {
                object[] constructorParams;

                Assembly scriptAssembly = dom.Load(Path.GetFileNameWithoutExtension(assembly));
                Type     scriptType     = scriptAssembly.GetType("SecondLife.XEngineScript");

                if (scriptType != null)
                {
                    constructorParams = new object[] { m_coopSleepHandle };
                }
                else if (!m_coopTermination)
                {
                    scriptType        = scriptAssembly.GetType("SecondLife.Script");
                    constructorParams = null;
                }
                else
                {
                    m_log.ErrorFormat(
                        "[SCRIPT INSTANCE]: Not starting script {0} (id {1}) in part {2} (id {3}) in object {4} in {5}.  You must remove all existing {6}* script DLL files before using enabling co-op termination"
                        + ", either by setting DeleteScriptsOnStartup = true in [XEngine] for one run"
                        + " or by deleting these files manually.",
                        ScriptTask.Name, ScriptTask.ItemID, Part.Name, Part.UUID, Part.ParentGroup.Name, Engine.World.Name, assembly);

                    return(false);
                }

//                m_log.DebugFormat(
//                    "[SCRIPT INSTANCE]: Looking to load {0} from assembly {1} in {2}",
//                    scriptType.FullName, Path.GetFileNameWithoutExtension(assembly), Engine.World.Name);

                if (dom != System.AppDomain.CurrentDomain)
                {
                    m_Script
                        = (IScript)dom.CreateInstanceAndUnwrap(
                              Path.GetFileNameWithoutExtension(assembly),
                              scriptType.FullName,
                              false,
                              BindingFlags.Default,
                              null,
                              constructorParams,
                              null,
                              null,
                              null);
                }
                else
                {
                    m_Script
                        = (IScript)scriptAssembly.CreateInstance(
                              scriptType.FullName,
                              false,
                              BindingFlags.Default,
                              null,
                              constructorParams,
                              null,
                              null);
                }

                //ILease lease = (ILease)RemotingServices.GetLifetimeService(m_Script as ScriptBaseClass);
                //RemotingServices.GetLifetimeService(m_Script as ScriptBaseClass);
//                lease.Register(this);
            }
            catch (Exception e)
            {
                m_log.ErrorFormat(
                    "[SCRIPT INSTANCE]: Not starting script {0} (id {1}) in part {2} (id {3}) in object {4} in {5}.  Error loading assembly {6}.  Exception {7}{8}",
                    ScriptTask.Name, ScriptTask.ItemID, Part.Name, Part.UUID, Part.ParentGroup.Name, Engine.World.Name, assembly, e.Message, e.StackTrace);

                return(false);
            }

            try
            {
                foreach (KeyValuePair <string, IScriptApi> kv in m_Apis)
                {
                    m_Script.InitApi(kv.Key, kv.Value);
                }

//                // m_log.Debug("[Script] Script instance created");

                Part.SetScriptEvents(ItemID,
                                     (int)m_Script.GetStateEventFlags(State));
            }
            catch (Exception e)
            {
                m_log.ErrorFormat(
                    "[SCRIPT INSTANCE]: Not starting script {0} (id {1}) in part {2} (id {3}) in object {4} in {5}.  Error initializing script instance.  Exception {6}{7}",
                    ScriptTask.Name, ScriptTask.ItemID, Part.Name, Part.UUID, Part.ParentGroup.Name, Engine.World.Name, e.Message, e.StackTrace);

                return(false);
            }

            m_SaveState = true;

            string savedState = Path.Combine(Path.GetDirectoryName(assembly),
                                             ItemID.ToString() + ".state");

            if (File.Exists(savedState))
            {
                string xml = String.Empty;

                try
                {
                    FileInfo fi   = new FileInfo(savedState);
                    int      size = (int)fi.Length;
                    if (size < 512000)
                    {
                        using (FileStream fs = File.Open(savedState,
                                                         FileMode.Open, FileAccess.Read, FileShare.None))
                        {
                            Byte[] data = new Byte[size];
                            fs.Read(data, 0, size);

                            xml = Encoding.UTF8.GetString(data);

                            ScriptSerializer.Deserialize(xml, this);

                            AsyncCommandManager.CreateFromData(Engine,
                                                               LocalID, ItemID, ObjectID,
                                                               PluginData);

//                            m_log.DebugFormat("[Script] Successfully retrieved state for script {0}.{1}", PrimName, m_ScriptName);

                            Part.SetScriptEvents(ItemID,
                                                 (int)m_Script.GetStateEventFlags(State));

                            if (!Running)
                            {
                                m_startOnInit = false;
                            }

                            Running = false;

                            // we get new rez events on sim restart, too
                            // but if there is state, then we fire the change
                            // event

                            // We loaded state, don't force a re-save
                            m_SaveState             = false;
                            m_startedFromSavedState = true;
                        }
                    }
                    else
                    {
                        m_log.WarnFormat(
                            "[SCRIPT INSTANCE]: Not starting script {0} (id {1}) in part {2} (id {3}) in object {4} in {5}.  Unable to load script state file {6}.  Memory limit exceeded.",
                            ScriptTask.Name, ScriptTask.ItemID, Part.Name, Part.UUID, Part.ParentGroup.Name, Engine.World.Name, savedState);
                    }
                }
                catch (Exception e)
                {
                    m_log.ErrorFormat(
                        "[SCRIPT INSTANCE]: Not starting script {0} (id {1}) in part {2} (id {3}) in object {4} in {5}.  Unable to load script state file {6}.  XML is {7}.  Exception {8}{9}",
                        ScriptTask.Name, ScriptTask.ItemID, Part.Name, Part.UUID, Part.ParentGroup.Name, Engine.World.Name, savedState, xml, e.Message, e.StackTrace);
                }
            }
//            else
//            {
//                ScenePresence presence = Engine.World.GetScenePresence(part.OwnerID);

//                if (presence != null && (!postOnRez))
//                    presence.ControllingClient.SendAgentAlertMessage("Compile successful", false);

//            }

            return(true);
        }
コード例 #3
0
ファイル: ItemCreator.cs プロジェクト: klanderso/YAGE
 private Item NewItem(Vector3 position, ItemID itemId, Material material, List<Item> components)
 {
     return components.Any()
         ? new Item(position, itemId.ToString(), components)
         : new Item(position, itemId.ToString(), material.ToString());
 }
コード例 #4
0
ファイル: ItemCreator.cs プロジェクト: klanderso/YAGE
        private Item CreateSimpleItem(ItemID itemId, Material material, Vector3 position)
        {
            var componentSource = GetComponentSource(material, position);
            Item newItem;

            if (material==Material.BlueGem || material == Material.GreenGem) /* special case - fix 23/03/2016 chatmetaleux */
            {
                newItem = new Item(position, itemId.ToString(), (material == Material.BlueGem) ? "Sapphire":"Emerald");
            }
            else
                newItem = new Item(position, itemId.ToString(), material.ToString());

            if (componentSource != null)
            {
                newItem.CrafterHistory = componentSource.Character.History;
                if (componentSource.ShouldDestroy)
                {
                    componentSource.Character.LeftRegion();
                }
            }

            GnomanEmpire.Instance.EntityManager.SpawnEntityImmediate(newItem);
            return newItem;
        }
コード例 #5
0
ファイル: ItemCreator.cs プロジェクト: klanderso/YAGE
        private Item CreateComplexItem(ItemID itemId, Material material, Vector3 position)
        {
            Item newItem;
            List<Item> components;
            if (itemId == ItemID.Bag || itemId == ItemID.Barrel ||
                itemId == ItemID.Crate || itemId == ItemID.Wheelbarrow)
            {
                components = CreateComponents(itemId, material, position);
                newItem = new StorageContainer(position, itemId.ToString(), components) {CrafterHistory = creator.History};
            }
            else
            {
                components = CreateComponents(itemId, material, position);
                if (components.Any())
                {
                    newItem = new Item(position, itemId.ToString(), components) { CrafterHistory = creator.History };
                }
                else
                {
                    newItem = new Item(position, itemId.ToString(), material.ToString());
                }
            }

            GnomanEmpire.Instance.EntityManager.SpawnEntityImmediate(newItem);
            GnomanEmpire.Instance.Fortress.AddItem(newItem);

            RemoveComponents(components);

            return newItem;
        }
コード例 #6
0
        public void Execute(IRocketPlayer caller, params string[] command)
        {
            if (!UTools.Instance.Configuration.Instance.AllowAuction)
            {
                UnturnedChat.Say(caller, UTools.Instance.Translate("auction_disabled"));
                return;
            }

            UnturnedPlayer player = (UnturnedPlayer)caller;

            if (command.Length == 0)
            {
                UnturnedChat.Say(player, UTools.Instance.Translate("auction_command_usage"));
                return;
            }
            if (command.Length == 1)
            {
                switch (command[0])
                {
                case ("add"):
                    UnturnedChat.Say(player, UTools.Instance.Translate("auction_addcommand_usage"));
                    return;

                case ("list"):
                    string   Message            = "";
                    string[] ItemNameAndQuality = UTools.Instance.DatabaseAuction.GetAllItemNameWithQuality();
                    string[] AuctionID          = UTools.Instance.DatabaseAuction.GetAllAuctionID();
                    string[] ItemPrice          = UTools.Instance.DatabaseAuction.GetAllItemPrice();
                    int      count = 0;
                    for (int x = 0; x < ItemNameAndQuality.Length; x++)
                    {
                        if (x < ItemNameAndQuality.Length - 1)
                        {
                            Message += "[" + AuctionID[x] + "]: " + ItemNameAndQuality[x] + " for " + ItemPrice[x] + Uconomy.Instance.Configuration.Instance.MoneyName + ", ";
                        }
                        else
                        {
                            Message += "[" + AuctionID[x] + "]: " + ItemNameAndQuality[x] + " for " + ItemPrice[x] + Uconomy.Instance.Configuration.Instance.MoneyName;
                        }
                        count++;
                        if (count == 2)
                        {
                            UnturnedChat.Say(player, Message);
                            Message = "";
                            count   = 0;
                        }
                    }
                    if (Message != "")
                    {
                        UnturnedChat.Say(player, Message);
                    }
                    break;

                case ("buy"):
                    UnturnedChat.Say(player, UTools.Instance.Translate("auction_buycommand_usage"));
                    return;

                case ("cancel"):
                    UnturnedChat.Say(player, UTools.Instance.Translate("auction_cancelcommand_usage"));
                    return;

                case ("find"):
                    UnturnedChat.Say(player, UTools.Instance.Translate("auction_findcommand_usage"));
                    return;
                }
            }
            if (command.Length == 2)
            {
                int auctionid = 0;
                switch (command[0])
                {
                case ("add"):
                    UnturnedChat.Say(player, UTools.Instance.Translate("auction_addcommand_usage2"));
                    return;

                case ("buy"):
                    if (int.TryParse(command[1], out auctionid))
                    {
                        try
                        {
                            string[] itemInfo = UTools.Instance.DatabaseAuction.AuctionBuy(auctionid);
                            decimal  balance  = Uconomy.Instance.Database.GetBalance(player.Id);
                            decimal  cost     = 1.00m;
                            decimal.TryParse(itemInfo[2], out cost);
                            if (balance < cost)
                            {
                                UnturnedChat.Say(player, UTools.Instance.DefaultTranslations.Translate("not_enough_currency_msg", Uconomy.Instance.Configuration.Instance.MoneyName, itemInfo[1]));
                                return;
                            }
                            SDG.Unturned.Item item = new SDG.Unturned.Item(ushort.Parse(itemInfo[0]), 1, byte.Parse(itemInfo[3]), Convert.FromBase64String(itemInfo[6]));
                            player.Inventory.forceAddItem(item, true);
                            UTools.Instance.DatabaseAuction.DeleteAuction(command[1]);
                            decimal newbal = Uconomy.Instance.Database.IncreaseBalance(player.CSteamID.ToString(), (cost * -1));
                            UnturnedChat.Say(player, UTools.Instance.Translate("auction_buy_msg", itemInfo[1], cost, Uconomy.Instance.Configuration.Instance.MoneyName, newbal, Uconomy.Instance.Configuration.Instance.MoneyName));
                            decimal sellernewbalance = Uconomy.Instance.Database.IncreaseBalance(itemInfo[4], (cost * 1));
                        }
                        catch
                        {
                            UnturnedChat.Say(player, UTools.Instance.Translate("auction_addcommand_idnotexist"));
                            return;
                        }
                    }
                    else
                    {
                        UnturnedChat.Say(player, UTools.Instance.Translate("auction_addcommand_usage2"));
                        return;
                    }
                    break;

                case ("cancel"):
                    if (int.TryParse(command[1], out auctionid))
                    {
                        if (UTools.Instance.DatabaseAuction.checkAuctionExist(auctionid))
                        {
                            string OwnerID = UTools.Instance.DatabaseAuction.GetOwner(auctionid);
                            if (OwnerID.Trim() == player.Id.Trim())
                            {
                                string[]          itemInfo = UTools.Instance.DatabaseAuction.AuctionCancel(auctionid);
                                SDG.Unturned.Item item     = new SDG.Unturned.Item(ushort.Parse(itemInfo[0]), 1, byte.Parse(itemInfo[1]), Convert.FromBase64String(itemInfo[2]));
                                player.Inventory.forceAddItem(item, true);
                                UTools.Instance.DatabaseAuction.DeleteAuction(auctionid.ToString());
                                UnturnedChat.Say(player, UTools.Instance.Translate("auction_cancelled", auctionid));
                            }
                            else
                            {
                                UnturnedChat.Say(player, UTools.Instance.Translate("auction_notown"));
                                return;
                            }
                        }
                        else
                        {
                            UnturnedChat.Say(player, UTools.Instance.Translate("auction_notexist"));
                            return;
                        }
                    }
                    else
                    {
                        UnturnedChat.Say(player, UTools.Instance.Translate("auction_notexist"));
                        return;
                    }
                    break;

                case ("find"):
                    uint ItemID;
                    if (uint.TryParse(command[1], out ItemID))
                    {
                        string[] AuctionID          = UTools.Instance.DatabaseAuction.FindItemByID(ItemID.ToString());
                        string   Message            = "";
                        string[] ItemNameAndQuality = UTools.Instance.DatabaseAuction.FindAllItemNameWithQualityByID(ItemID.ToString());
                        string[] ItemPrice          = UTools.Instance.DatabaseAuction.FindAllItemPriceByID(ItemID.ToString());
                        int      count = 0;
                        for (int x = 0; x < ItemNameAndQuality.Length; x++)
                        {
                            if (x < ItemNameAndQuality.Length - 1)
                            {
                                Message += "[" + AuctionID[x] + "]: " + ItemNameAndQuality[x] + " for " + ItemPrice[x] + " " + Uconomy.Instance.Configuration.Instance.MoneyName + ", ";
                            }
                            else
                            {
                                Message += "[" + AuctionID[x] + "]: " + ItemNameAndQuality[x] + " for " + ItemPrice[x] + " " + Uconomy.Instance.Configuration.Instance.MoneyName;
                            }
                            count++;
                            if (count == 2)
                            {
                                UnturnedChat.Say(player, Message);
                                Message = " ";
                                count   = 0;
                            }
                        }
                        if (Message != null)
                        {
                            UnturnedChat.Say(player, Message);
                        }
                        else
                        {
                            UnturnedChat.Say(player, UTools.Instance.Translate("auction_find_failed"));
                            return;
                        }
                    }
                    else
                    {
                        Asset[] array  = Assets.find(EAssetType.ITEM);
                        Asset[] array2 = array;
                        ushort  id;
                        string  ItemName = "";
                        for (int i = 0; i < array2.Length; i++)
                        {
                            ItemAsset vAsset = (ItemAsset)array2[i];
                            if (vAsset != null && vAsset.itemName != null && vAsset.itemName.ToLower().Contains(command[1].ToLower()))
                            {
                                id       = vAsset.id;
                                ItemName = vAsset.itemName;
                                break;
                            }
                        }
                        if (ItemName != "")
                        {
                            string[] AuctionID          = UTools.Instance.DatabaseAuction.FindItemByName(ItemName);
                            string   Message            = "";
                            string[] ItemNameAndQuality = UTools.Instance.DatabaseAuction.FindAllItemNameWithQualityByItemName(ItemName);
                            string[] ItemPrice          = UTools.Instance.DatabaseAuction.FindAllItemPriceByItemName(ItemName);
                            int      count = 0;
                            for (int x = 0; x < ItemNameAndQuality.Length; x++)
                            {
                                if (x < ItemNameAndQuality.Length - 1)
                                {
                                    Message += "[" + AuctionID[x] + "]: " + ItemNameAndQuality[x] + " for " + ItemPrice[x] + Uconomy.Instance.Configuration.Instance.MoneyName + ", ";
                                }
                                else
                                {
                                    Message += "[" + AuctionID[x] + "]: " + ItemNameAndQuality[x] + " for " + ItemPrice[x] + Uconomy.Instance.Configuration.Instance.MoneyName;
                                }
                                count++;
                                if (count == 2)
                                {
                                    UnturnedChat.Say(player, Message);
                                    Message = "";
                                    count   = 0;
                                }
                            }
                            if (Message != "")
                            {
                                UnturnedChat.Say(player, Message);
                            }
                            else
                            {
                                UnturnedChat.Say(player, UTools.Instance.Translate("auction_find_failed"));
                                return;
                            }
                        }
                        else
                        {
                            UnturnedChat.Say(player, UTools.Instance.Translate("auction_find_failed"));
                            return;
                        }
                    }
                    break;
                }
            }
            if (command.Length > 2 && player.HasPermission("auction.add"))
            {
                switch (command[0])
                {
                case ("add"):
                    byte      amt = 1;
                    ushort    id;
                    string    name     = null;
                    ItemAsset vAsset   = null;
                    string    itemname = "";
                    for (int x = 1; x < command.Length - 1; x++)
                    {
                        itemname += command[x] + " ";
                    }
                    itemname = itemname.Trim();
                    if (!ushort.TryParse(itemname, out id))
                    {
                        Asset[] array  = Assets.find(EAssetType.ITEM);
                        Asset[] array2 = array;
                        for (int i = 0; i < array2.Length; i++)
                        {
                            vAsset = (ItemAsset)array2[i];
                            if (vAsset != null && vAsset.itemName != null && vAsset.itemName.ToLower().Contains(itemname.ToLower()))
                            {
                                id   = vAsset.id;
                                name = vAsset.itemName;
                                if (name == "Hell's Fury")
                                {
                                    name = "Hells Fury";
                                }
                                break;
                            }
                        }
                    }
                    if (name == null && id == 0)
                    {
                        UnturnedChat.Say(player, UTools.Instance.Translate("could_not_find", itemname));
                        return;
                    }
                    else if (name == null && id != 0)
                    {
                        try
                        {
                            vAsset = (ItemAsset)Assets.find(EAssetType.ITEM, id);
                            name   = vAsset.itemName;
                            if (name == "Hell's Fury")
                            {
                                name = "Hells Fury";
                            }
                        }
                        catch
                        {
                            UnturnedChat.Say(player, UTools.Instance.Translate("item_invalid"));
                            return;
                        }
                    }
                    if (player.Inventory.has(id) == null)
                    {
                        UnturnedChat.Say(player, UTools.Instance.Translate("not_have_item_auction", name));
                        return;
                    }
                    List <InventorySearch> list = player.Inventory.search(id, true, true);
                    if (vAsset.amount > 1)
                    {
                        UnturnedChat.Say(player, UTools.Instance.Translate("auction_item_mag_ammo", name));
                        return;
                    }
                    decimal price = 0.00m;
                    if (UTools.Instance.Configuration.Instance.EnableShopPriceCheck)
                    {
                        price = ZaupShop.ZaupShop.Instance.ShopDB.GetItemCost(id);
                        if (price <= 0.00m)
                        {
                            UnturnedChat.Say(player, UTools.Instance.Translate("auction_item_notinshop", name));
                            price = 0.00m;
                        }
                    }


                    if (ZaupShop.ZaupShop.Instance.ShopDB.GetItemCost(id) == 0 || (ZaupShop.ZaupShop.Instance.ShopDB.GetItemCost(id) != 0 && Convert.ToDecimal(command[command.Length - 1]) >= (ZaupShop.ZaupShop.Instance.ShopDB.GetItemCost(id) * 0.3m) && Convert.ToDecimal(command[command.Length - 1]) <= (ZaupShop.ZaupShop.Instance.ShopDB.GetItemCost(id) * 1.5m)))
                    {
                        int    quality  = 100;
                        string metadata = null;
                        switch (vAsset.amount)
                        {
                        case 1:
                            while (amt > 0)
                            {
                                try
                                {
                                    if (player.Player.equipment.checkSelection(list[0].page, list[0].jar.x, list[0].jar.y))
                                    {
                                        player.Player.equipment.dequip();
                                    }
                                }
                                catch
                                {
                                    UnturnedChat.Say(player, UTools.Instance.Translate("auction_unequip_item", name));
                                    return;
                                }
                                quality  = list[0].jar.item.durability;
                                metadata = (list[0].jar.item.metadata != null ? Convert.ToBase64String(list[0].jar.item.metadata) : string.Empty);
                                player.Inventory.removeItem(list[0].page, player.Inventory.getIndex(list[0].page, list[0].jar.x, list[0].jar.y));
                                list.RemoveAt(0);
                                amt--;
                            }
                            break;

                        default:
                            UnturnedChat.Say(player, UTools.Instance.Translate("auction_item_mag_ammo", name));
                            return;
                        }
                        decimal SetPrice;
                        if (!decimal.TryParse(command[command.Length - 1], out SetPrice))
                        {
                            SetPrice = price;
                        }
                        if (UTools.Instance.DatabaseAuction.AddAuctionItem(UTools.Instance.DatabaseAuction.GetLastAuctionNo(), id.ToString(), name, SetPrice, price, quality, metadata, player.Id, player.DisplayName.ToString()))
                        {
                            UnturnedChat.Say(player, UTools.Instance.Translate("auction_item_succes", name, SetPrice, Uconomy.Instance.Configuration.Instance.MoneyName));
                        }
                        else
                        {
                            UnturnedChat.Say(player, UTools.Instance.Translate("auction_item_failed"));
                        }
                    }
                    else
                    {
                        UnturnedChat.Say(player, UTools.Instance.Translate("auction_price_low_high", Math.Floor((ZaupShop.ZaupShop.Instance.ShopDB.GetItemCost(id) * 0.3m)), Math.Floor((ZaupShop.ZaupShop.Instance.ShopDB.GetItemCost(id) * 1.5m))));
                    }
                    break;
                }
            }
            if (command.Length > 2 && !player.HasPermission("auction.add"))
            {
                UnturnedChat.Say(player, UTools.Instance.Translate("auction_add_no_perm"));
            }
        }
コード例 #7
0
        public void StoreContent()
        {
            if (ItemID < 1)
            {
                ErrToClient("[产生错误的可能原因:您访问的商品信息不存在!");
            }
            M_Product ItemInfo = proBll.GetproductByid(ItemID);

            if (ItemInfo == null)
            {
                ErrToClient("[产生错误的可能原因:您访问的商品信息不存在!]"); return;
            }
            M_Node nodeinfo = nodeBll.GetNodeXML(ItemInfo.Nodeid);

            if (nodeinfo.PurviewType)
            {
                if (!buser.CheckLogin())
                {
                    function.WriteErrMsg("该信息所属栏目需登录验证,请先登录再进行此操作!", "/User/login"); return;
                }
                else
                {
                    //此处以后可以加上用户组权限检测
                }
            }
            string TemplateDir = "";

            //ItemID 商品ID
            if (proBll.SelectProByCmdID(ItemID).Rows.Count < 1)
            {
                function.WriteErrMsg("该商品不存在!"); return;
            }
            int       UserID    = DataConverter.CLng(proBll.SelectProByCmdID(ItemID).Rows[0]["UserID"]);
            string    username  = buser.GetUserByUserID(UserID).UserName;
            DataTable mosinfo   = mfbll.SelectTableName("ZL_CommonModel", "TableName like 'ZL_Store_%' and Inputer='" + username + "'");
            int       GeneralID = DataConverter.CLng(mosinfo.Rows[0]["GeneralID"]);

            DataTable         infos        = conBll.GetContent(GeneralID);
            int               StoreStyleID = DataConverter.CLng(infos.Rows[0]["StoreStyleID"]);
            M_StoreStyleTable stinfo       = sstbll.GetStyleByID(DataConverter.CLng(StoreStyleID));
            string            ContentStyle = stinfo.ContentStyle;
            M_ModelInfo       modelinfo    = modBll.GetModelById(ItemInfo.ModelID);
            string            TempNode     = nodeBll.GetModelTemplate(ItemInfo.Nodeid, ItemInfo.ModelID);

            if (!string.IsNullOrEmpty(TempNode))
            {
                TemplateDir = TempNode;
            }

            if (!string.IsNullOrEmpty(ContentStyle))
            {
                TemplateDir = ContentStyle;
            }

            if (string.IsNullOrEmpty(TemplateDir))
            {
                Response.Write("[产生错误的可能原因:该商品所属模型未指定模板!]");
            }
            else
            {
                TemplateDir = base.Request.PhysicalApplicationPath + SiteConfig.SiteOption.TemplateDir + "/" + TemplateDir;
                TemplateDir = TemplateDir.Replace("/", @"\");
                string ContentHtml = FileSystemObject.ReadFile(TemplateDir);
                ContentHtml = this.createBll.CreateHtml(ContentHtml, 0, ItemID, "0");
                if (!string.IsNullOrEmpty(ContentHtml))
                {
                    /* --------------------判断是否分页 并做处理------------------------------------------------*/
                    string infoContent = ""; //进行处理的商品字段
                    string pagelabel   = "";
                    string infotmp     = "";
                    string pattern     = @"{\#Content}([\s\S])*?{\/\#Content}"; //查找要分页的商品
                    if (Regex.IsMatch(ContentHtml, pattern, RegexOptions.IgnoreCase))
                    {
                        infoContent = Regex.Match(ContentHtml, pattern, RegexOptions.IgnoreCase).Value;
                        infotmp     = infoContent;
                        infoContent = infoContent.Replace("{#Content}", "").Replace("{/#Content}", "");
                    }
                    //查找分页标签
                    bool   isPage   = false;
                    string pattern1 = @"{ZL\.Page([\s\S])*?\/}";
                    if (Regex.IsMatch(ContentHtml, pattern1, RegexOptions.IgnoreCase))
                    {
                        pagelabel = Regex.Match(ContentHtml, pattern1, RegexOptions.IgnoreCase).Value;
                        isPage    = true;
                    }
                    if (isPage)
                    {
                        if (string.IsNullOrEmpty(infoContent)) //没有设定要分页的字段商品
                        {
                            ContentHtml = ContentHtml.Replace(pagelabel, "");
                        }
                        else   //进行商品分页处理
                        {
                            //文件名
                            string file1 = "StoreContent.aspx?ItemID=" + ItemID.ToString();
                            //取分页标签处理结果 返回字符串数组 根据数组元素个数生成几页
                            string         ilbl       = pagelabel.Replace("{ZL.Page ", "").Replace("/}", "").Replace(" ", ",");
                            string         lblContent = "";
                            int            NumPerPage = 500;
                            IList <string> ContentArr = new List <string>();
                            if (string.IsNullOrEmpty(ilbl))
                            {
                                lblContent = "{loop}<a href=\"{$pageurl/}\">{$pageid/}</a>$$$<b>[{$pageid/}]</b>{/loop}"; //默认格式的分页导航
                                ContentArr = this.createBll.GetContentPage(infoContent, NumPerPage);
                            }
                            else
                            {
                                string[] paArr = ilbl.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                                if (paArr.Length == 0)
                                {
                                    lblContent = "{loop}<a href=\"{$pageurl/}\">{$pageid/}</a>$$$<b>[{$pageid/}]</b>{/loop}"; //默认格式的分页导航
                                    ContentArr = this.createBll.GetContentPage(infoContent, NumPerPage);
                                }
                                else
                                {
                                    string lblname = paArr[0].Split(new char[] { '=' })[1].Replace("\"", "");
                                    if (paArr.Length > 1)
                                    {
                                        NumPerPage = DataConverter.CLng(paArr[1].Split(new char[] { '=' })[1].Replace("\"", ""));
                                    }
                                    B_Label blbl = new B_Label();
                                    lblContent = blbl.GetLabelXML(lblname).Content;
                                    if (string.IsNullOrEmpty(lblContent))
                                    {
                                        lblContent = "{loop}<a href=\"{$pageurl/}\">{$pageid/}</a>$$$<b>[{$pageid/}]</b>{/loop}"; //默认格式的分页导航
                                    }
                                    ContentArr = this.createBll.GetContentPage(infoContent, NumPerPage);
                                }
                            }
                            //Response.Write(NumPerPage.ToString());
                            //Response.End();
                            if (ContentArr.Count > 0) //存在分页数据
                            {
                                ContentHtml = ContentHtml.Replace(infotmp, ContentArr[Cpage - 1]);
                                ContentHtml = ContentHtml.Replace(pagelabel, this.createBll.GetPage(lblContent, ItemID, Cpage, ContentArr.Count, NumPerPage));
                            }
                            else
                            {
                                ContentHtml = ContentHtml.Replace(infotmp, infoContent);
                                ContentHtml = ContentHtml.Replace(pagelabel, "");
                            }
                        }
                    }
                    else  //没有分页标签
                    {
                        //如果设定了分页商品字段 将该字段商品的分页标志清除
                        if (!string.IsNullOrEmpty(infoContent))
                        {
                            ContentHtml = ContentHtml.Replace(infotmp, infoContent);
                        }
                    }
                }
                /*--------------------- 分页商品处理结束-------------------------------------------------------------------------*/
                Response.Write(ContentHtml);
            }
        }
コード例 #8
0
        public void SaveState(string assembly)
        {
            // If we're currently in an event, just tell it to save upon return
            //
            if (m_InEvent)
            {
                m_SaveState = true;
                return;
            }

            PluginData = AsyncCommandManager.GetSerializationData(Engine, ItemID);

            string xml = ScriptSerializer.Serialize(this);

            // Compare hash of the state we just just created with the state last written to disk
            // If the state is different, update the disk file.
            UUID hash = UUID.Parse(Utils.MD5String(xml));

            if (hash != m_CurrentStateHash)
            {
                try
                {
                    FileStream fs  = File.Create(Path.Combine(Path.GetDirectoryName(assembly), ItemID.ToString() + ".state"));
                    Byte[]     buf = Util.UTF8NoBomEncoding.GetBytes(xml);
                    fs.Write(buf, 0, buf.Length);
                    fs.Close();
                }
                catch (Exception)
                {
                    // m_log.Error("Unable to save xml\n"+e.ToString());
                }
                //if (!File.Exists(Path.Combine(Path.GetDirectoryName(assembly), ItemID.ToString() + ".state")))
                //{
                //    throw new Exception("Completed persistence save, but no file was created");
                //}
                m_CurrentStateHash = hash;
            }
        }
コード例 #9
0
ファイル: CommandAuction.cs プロジェクト: Uneska/LPX
        public void Execute(IRocketPlayer caller, params string[] command)
        {
            if (!LIGHT.Instance.Configuration.Instance.AllowAuction)
            {
                UnturnedChat.Say(caller, LIGHT.Instance.Translate("auction_disabled"));
                return;
            }
            UnturnedPlayer player = (UnturnedPlayer)caller;

            if (command.Length == 0)
            {
                UnturnedChat.Say(player, LIGHT.Instance.Translate("auction_command_usage"));
                return;
            }
            if (command.Length == 1)
            {
                switch (command[0])
                {
                case ("add"):
                    UnturnedChat.Say(player, LIGHT.Instance.Translate("auction_addcommand_usage"));
                    return;

                case ("list"):
                    string   Message            = "";
                    string[] ItemNameAndQuality = LIGHT.Instance.DatabaseAuction.GetAllItemNameWithQuality();
                    string[] AuctionID          = LIGHT.Instance.DatabaseAuction.GetAllAuctionID();
                    string[] ItemPrice          = LIGHT.Instance.DatabaseAuction.GetAllItemPrice();
                    int      count = 0;
                    for (int x = 0; x < ItemNameAndQuality.Length; x++)
                    {
                        if (x < ItemNameAndQuality.Length - 1)
                        {
                            Message += "[" + AuctionID[x] + "]: " + ItemNameAndQuality[x] + " for " + ItemPrice[x] + Uconomy.Instance.Configuration.Instance.MoneyName + ", ";
                        }
                        else
                        {
                            Message += "[" + AuctionID[x] + "]: " + ItemNameAndQuality[x] + " for " + ItemPrice[x] + Uconomy.Instance.Configuration.Instance.MoneyName;
                        }
                        count++;
                        if (count == 2)
                        {
                            UnturnedChat.Say(player, Message);
                            Message = "";
                            count   = 0;
                        }
                    }
                    if (Message != "")
                    {
                        UnturnedChat.Say(player, Message);
                    }
                    break;

                case ("buy"):
                    UnturnedChat.Say(player, LIGHT.Instance.Translate("auction_buycommand_usage"));
                    return;

                case ("cancel"):
                    UnturnedChat.Say(player, LIGHT.Instance.Translate("auction_cancelcommand_usage"));
                    return;

                case ("find"):
                    UnturnedChat.Say(player, LIGHT.Instance.Translate("auction_findcommand_usage"));
                    return;
                }
            }
            if (command.Length == 2)
            {
                int auctionid = 0;
                switch (command[0])
                {
                case ("add"):
                    UnturnedChat.Say(player, LIGHT.Instance.Translate("auction_addcommand_usage2"));
                    return;

                case ("buy"):
                    if (int.TryParse(command[1], out auctionid))
                    {
                        try
                        {
                            string[] itemInfo = LIGHT.Instance.DatabaseAuction.AuctionBuy(auctionid);
                            decimal  balance  = Uconomy.Instance.Database.GetBalance(player.Id);
                            decimal  cost     = 1.00m;
                            decimal.TryParse(itemInfo[2], out cost);
                            if (balance < cost)
                            {
                                UnturnedChat.Say(player, LIGHT.Instance.DefaultTranslations.Translate("not_enough_currency_msg", Uconomy.Instance.Configuration.Instance.MoneyName, itemInfo[1]));
                                return;
                            }
                            player.GiveItem(ushort.Parse(itemInfo[0]), 1);
                            InventorySearch inventory = player.Inventory.has(ushort.Parse(itemInfo[0]));
                            byte            index     = player.Inventory.getIndex(inventory.page, inventory.jar.x, inventory.jar.y);
                            player.Inventory.updateQuality(inventory.page, index, byte.Parse(itemInfo[3]));
                            LIGHT.Instance.DatabaseAuction.DeleteAuction(command[1]);
                            decimal newbal = Uconomy.Instance.Database.IncreaseBalance(player.CSteamID.ToString(), (cost * -1));
                            UnturnedChat.Say(player, LIGHT.Instance.Translate("auction_buy_msg", itemInfo[1], cost, Uconomy.Instance.Configuration.Instance.MoneyName, newbal, Uconomy.Instance.Configuration.Instance.MoneyName));
                            decimal sellernewbalance = Uconomy.Instance.Database.IncreaseBalance(itemInfo[4], (cost * 1));
                        }
                        catch
                        {
                            UnturnedChat.Say(player, LIGHT.Instance.Translate("auction_addcommand_idnotexist"));
                            return;
                        }
                    }
                    else
                    {
                        UnturnedChat.Say(player, LIGHT.Instance.Translate("auction_addcommand_usage2"));
                        return;
                    }
                    break;

                case ("cancel"):
                    if (int.TryParse(command[1], out auctionid))
                    {
                        if (LIGHT.Instance.DatabaseAuction.checkAuctionExist(auctionid))
                        {
                            string OwnerID = LIGHT.Instance.DatabaseAuction.GetOwner(auctionid);
                            if (OwnerID.Trim() == player.Id.Trim())
                            {
                                string[] itemInfo = LIGHT.Instance.DatabaseAuction.AuctionCancel(auctionid);
                                player.GiveItem(ushort.Parse(itemInfo[0]), 1);
                                InventorySearch inventory = player.Inventory.has(ushort.Parse(itemInfo[0]));
                                byte            index     = player.Inventory.getIndex(inventory.page, inventory.jar.x, inventory.jar.y);
                                player.Inventory.updateQuality(inventory.page, index, byte.Parse(itemInfo[1]));
                                LIGHT.Instance.DatabaseAuction.DeleteAuction(auctionid.ToString());
                                UnturnedChat.Say(player, LIGHT.Instance.Translate("auction_cancelled", auctionid));
                            }
                            else
                            {
                                UnturnedChat.Say(player, LIGHT.Instance.Translate("auction_notown"));
                                return;
                            }
                        }
                        else
                        {
                            UnturnedChat.Say(player, LIGHT.Instance.Translate("auction_notexist"));
                            return;
                        }
                    }
                    else
                    {
                        UnturnedChat.Say(player, LIGHT.Instance.Translate("auction_notexist"));
                        return;
                    }
                    break;

                case ("find"):
                    uint ItemID;
                    if (uint.TryParse(command[1], out ItemID))
                    {
                        string[] AuctionID          = LIGHT.Instance.DatabaseAuction.FindItemByID(ItemID.ToString());
                        string   Message            = "";
                        string[] ItemNameAndQuality = LIGHT.Instance.DatabaseAuction.FindAllItemNameWithQualityByID(ItemID.ToString());
                        string[] ItemPrice          = LIGHT.Instance.DatabaseAuction.FindAllItemPriceByID(ItemID.ToString());
                        int      count = 0;
                        for (int x = 0; x < ItemNameAndQuality.Length; x++)
                        {
                            if (x < ItemNameAndQuality.Length - 1)
                            {
                                Message += "[" + AuctionID[x] + "]: " + ItemNameAndQuality[x] + " for " + ItemPrice[x] + Uconomy.Instance.Configuration.Instance.MoneyName + ", ";
                            }
                            else
                            {
                                Message += "[" + AuctionID[x] + "]: " + ItemNameAndQuality[x] + " for " + ItemPrice[x] + Uconomy.Instance.Configuration.Instance.MoneyName;
                            }
                            count++;
                            if (count == 2)
                            {
                                UnturnedChat.Say(player, Message);
                                Message = "";
                                count   = 0;
                            }
                        }
                        if (Message != "")
                        {
                            UnturnedChat.Say(player, Message);
                        }
                        else
                        {
                            UnturnedChat.Say(player, LIGHT.Instance.Translate("auction_find_failed"));
                            return;
                        }
                    }
                    else
                    {
                        Asset[] array  = Assets.find(EAssetType.ITEM);
                        Asset[] array2 = array;
                        ushort  id;
                        string  ItemName = "";
                        for (int i = 0; i < array2.Length; i++)
                        {
                            ItemAsset vAsset = (ItemAsset)array2[i];
                            if (vAsset != null && vAsset.itemName != null && vAsset.itemName.ToLower().Contains(command[1].ToLower()))
                            {
                                id       = vAsset.id;
                                ItemName = vAsset.itemName;
                                break;
                            }
                        }
                        if (ItemName != "")
                        {
                            string[] AuctionID          = LIGHT.Instance.DatabaseAuction.FindItemByName(ItemName);
                            string   Message            = "";
                            string[] ItemNameAndQuality = LIGHT.Instance.DatabaseAuction.FindAllItemNameWithQualityByItemName(ItemName);
                            string[] ItemPrice          = LIGHT.Instance.DatabaseAuction.FindAllItemPriceByItemName(ItemName);
                            int      count = 0;
                            for (int x = 0; x < ItemNameAndQuality.Length; x++)
                            {
                                if (x < ItemNameAndQuality.Length - 1)
                                {
                                    Message += "[" + AuctionID[x] + "]: " + ItemNameAndQuality[x] + " for " + ItemPrice[x] + Uconomy.Instance.Configuration.Instance.MoneyName + ", ";
                                }
                                else
                                {
                                    Message += "[" + AuctionID[x] + "]: " + ItemNameAndQuality[x] + " for " + ItemPrice[x] + Uconomy.Instance.Configuration.Instance.MoneyName;
                                }
                                count++;
                                if (count == 2)
                                {
                                    UnturnedChat.Say(player, Message);
                                    Message = "";
                                    count   = 0;
                                }
                            }
                            if (Message != "")
                            {
                                UnturnedChat.Say(player, Message);
                            }
                            else
                            {
                                UnturnedChat.Say(player, LIGHT.Instance.Translate("auction_find_failed"));
                                return;
                            }
                        }
                        else
                        {
                            UnturnedChat.Say(player, LIGHT.Instance.Translate("auction_find_failed"));
                            return;
                        }
                    }
                    break;
                }
            }
            if (command.Length > 2)
            {
                switch (command[0])
                {
                case ("add"):
                    byte      amt = 1;
                    ushort    id;
                    string    name     = null;
                    ItemAsset vAsset   = null;
                    string    itemname = "";
                    for (int x = 1; x < command.Length - 1; x++)
                    {
                        itemname += command[x] + " ";
                    }
                    itemname = itemname.Trim();
                    if (!ushort.TryParse(itemname, out id))
                    {
                        Asset[] array  = Assets.find(EAssetType.ITEM);
                        Asset[] array2 = array;
                        for (int i = 0; i < array2.Length; i++)
                        {
                            vAsset = (ItemAsset)array2[i];
                            if (vAsset != null && vAsset.itemName != null && vAsset.itemName.ToLower().Contains(itemname.ToLower()))
                            {
                                id   = vAsset.id;
                                name = vAsset.itemName;
                                break;
                            }
                        }
                    }
                    if (name == null && id == 0)
                    {
                        UnturnedChat.Say(player, LIGHT.Instance.Translate("could_not_find", itemname));
                        return;
                    }
                    else if (name == null && id != 0)
                    {
                        try
                        {
                            vAsset = (ItemAsset)Assets.find(EAssetType.ITEM, id);
                            name   = vAsset.itemName;
                        }
                        catch
                        {
                            UnturnedChat.Say(player, LIGHT.Instance.Translate("item_invalid"));
                            return;
                        }
                    }
                    if (player.Inventory.has(id) == null)
                    {
                        UnturnedChat.Say(player, LIGHT.Instance.Translate("not_have_item_auction", name));
                        return;
                    }
                    List <InventorySearch> list = player.Inventory.search(id, true, true);
                    if (vAsset.amount > 1)
                    {
                        UnturnedChat.Say(player, LIGHT.Instance.Translate("auction_item_mag_ammo", name));
                        return;
                    }
                    decimal price = 0.00m;
                    if (LIGHT.Instance.Configuration.Instance.EnableShop)
                    {
                        price = LIGHT.Instance.ShopDB.GetItemCost(id);
                        if (price <= 0.00m)
                        {
                            UnturnedChat.Say(player, LIGHT.Instance.Translate("auction_item_notinshop", name));
                            price = 0.00m;
                        }
                    }
                    byte quality = 100;
                    switch (vAsset.amount)
                    {
                    case 1:
                        // These are single items, not ammo or magazines
                        while (amt > 0)
                        {
                            try
                            {
                                if (player.Player.equipment.checkSelection(list[0].page, list[0].jar.x, list[0].jar.y))
                                {
                                    player.Player.equipment.dequip();
                                }
                            }
                            catch
                            {
                                UnturnedChat.Say(player, LIGHT.Instance.Translate("auction_unequip_item", name));
                                return;
                            }
                            quality = list[0].jar.item.durability;
                            player.Inventory.removeItem(list[0].page, player.Inventory.getIndex(list[0].page, list[0].jar.x, list[0].jar.y));
                            list.RemoveAt(0);
                            amt--;
                        }
                        break;

                    default:
                        UnturnedChat.Say(player, LIGHT.Instance.Translate("auction_item_mag_ammo", name));
                        return;
                    }
                    decimal SetPrice;
                    if (!decimal.TryParse(command[command.Length - 1], out SetPrice))
                    {
                        SetPrice = price;
                    }
                    if (LIGHT.Instance.DatabaseAuction.AddAuctionItem(LIGHT.Instance.DatabaseAuction.GetLastAuctionNo(), id.ToString(), name, SetPrice, price, (int)quality, player.Id))
                    {
                        UnturnedChat.Say(player, LIGHT.Instance.Translate("auction_item_succes", name, SetPrice, Uconomy.Instance.Configuration.Instance.MoneyName));
                    }
                    else
                    {
                        UnturnedChat.Say(player, LIGHT.Instance.Translate("auction_item_failed"));
                    }
                    break;
                }
            }
        }
コード例 #10
0
        private bool ValidateData()
        {
            if (this.dtblItems.Select("BranchStoreID is null", "", DataViewRowState.CurrentRows).Length > 0)
            {
                MessageBox.Show("库位不能为空");
                return(false);
            }
            if (this.dtblItems.Select("Quantity>InventoryQty", "", DataViewRowState.CurrentRows).Length > 0)
            {
                MessageBox.Show("存在送货数大于库存数的记录");
                return(false);
            }
            long    ItemID;
            object  objBoxQty;
            decimal Qty;

            foreach (DataRow drowItem in this.dtblItems.Rows)
            {
                ItemID    = (long)drowItem["ItemID"];
                Qty       = (decimal)drowItem["Quantity"];
                objBoxQty = this.dtblBoxes.Compute("SUM(Quantity)", "SaleDeliverItemID=" + ItemID.ToString());
                if (objBoxQty == null)
                {
                    continue;
                }
                if ((decimal)objBoxQty > Qty)
                {
                    MessageBox.Show("存在同产品装箱产品数大于出货数");
                    return(false);
                }
            }
            return(true);
        }
コード例 #11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!string.IsNullOrEmpty(base.Request.QueryString["ItemID"]))
        {
            B_Model      bmode = new B_Model();
            B_Node       bnode = new B_Node();
            B_ModelField mfll  = new B_ModelField();

            int CPage = string.IsNullOrEmpty(base.Request.QueryString["p"]) ? 1 : DataConverter.CLng(base.Request.QueryString["p"]);
            if (CPage <= 0)
            {
                CPage = 1;
            }
            M_CommonData ItemInfo = bcontent.GetCommonData(ItemID);
            if (ItemInfo.IsNull)
            {
                Response.Write("[产生错误的可能原因:内容信息不存在或未开放!]");
            }
            M_ModelInfo modelinfo = bmode.GetModelById(ItemInfo.ModelID);

            M_Templata Nodeinfo    = tll.Getbyid(ItemInfo.NodeID);
            string     TemplateDir = GetTempPath(ItemInfo, Nodeinfo, pageID);
            if (string.IsNullOrEmpty(TemplateDir))
            {
                Response.Write("[产生错误的可能原因:该内容所属模型未指定模板!]");
            }
            else
            {
                int Cpage = 1;
                if (string.IsNullOrEmpty(base.Request.QueryString["p"]))
                {
                    Cpage = 1;
                }
                else
                {
                    Cpage = DataConverter.CLng(base.Request.QueryString["p"]);
                }
                string ContentHtml = "";
                try
                {
                    ContentHtml = FileSystemObject.ReadFile(TemplateDir);
                }
                catch
                {
                    Response.Write("[产生错误的可能原因:该内容所属模型未指定模板!]");
                }

                ContentHtml = this.bll.CreateHtml(ContentHtml, Cpage, ItemID, 0);

                /* --------------------判断是否分页 并做处理------------------------------------------------*/
                if (!string.IsNullOrEmpty(ContentHtml))
                {
                    string infoContent = ""; //进行处理的内容字段
                    string pagelabel   = "";
                    string infotmp     = "";
                    #region 分页符分页
                    string pattern = @"{\#PageCode}([\s\S])*?{\/\#PageCode}";  //查找要分页的内容
                    if (Regex.IsMatch(ContentHtml, pattern, RegexOptions.IgnoreCase))
                    {
                        infoContent = Regex.Match(ContentHtml, pattern, RegexOptions.IgnoreCase).Value;
                        infotmp     = infoContent;
                        infoContent = infoContent.Replace("{#PageCode}", "").Replace("{/#PageCode}", "");
                        //查找分页标签
                        //bool flag = false;
                        bool   isPage   = false;
                        string pattern1 = @"{ZL\.Page([\s\S])*?\/}";
                        if (Regex.IsMatch(ContentHtml, pattern1, RegexOptions.IgnoreCase))
                        {
                            pagelabel = Regex.Match(ContentHtml, pattern1, RegexOptions.IgnoreCase).Value;
                            isPage    = true;
                        }
                        if (isPage)
                        {
                            if (string.IsNullOrEmpty(infoContent)) //没有设定要分页的字段内容
                            {
                                ContentHtml = ContentHtml.Replace(pagelabel, "");
                            }
                            else   //进行内容分页处理
                            {
                                //文件名
                                string file1 = "Content.aspx?ID=" + ItemID.ToString();
                                //取分页标签处理结果 返回字符串数组 根据数组元素个数生成几页
                                string         ilbl       = pagelabel.Replace("{ZL.Page ", "").Replace("/}", "").Replace(" ", ",");
                                string         lblContent = "";
                                IList <string> ContentArr = new List <string>();
                                if (string.IsNullOrEmpty(ilbl))
                                {
                                    lblContent = "{loop}<a href=\"{$pageurl/}\">{$pageid/}</a>$$$<b>[{$pageid/}]</b>{/loop}"; //默认格式的分页导航
                                    ContentArr = this.bll.GetContentPage(infoContent);
                                }
                                else
                                {
                                    string[] paArr = ilbl.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                                    if (paArr.Length == 0)
                                    {
                                        lblContent = "{loop}<a href=\"{$pageurl/}\">{$pageid/}</a>$$$<b>[{$pageid/}]</b>{/loop}"; //默认格式的分页导航
                                        ContentArr = this.bll.GetContentPage(infoContent);
                                    }
                                    else
                                    {
                                        string  lblname = paArr[0].Split(new char[] { '=' })[1].Replace("\"", "");
                                        B_Label blbl    = new B_Label();
                                        lblContent = blbl.GetLabelXML(lblname).Content;
                                        if (string.IsNullOrEmpty(lblContent))
                                        {
                                            lblContent = "{loop}<a href=\"{$pageurl/}\">{$pageid/}</a>$$$<b>[{$pageid/}]</b>{/loop}"; //默认格式的分页导航
                                        }
                                        ContentArr = this.bll.GetContentPage(infoContent);
                                    }
                                }

                                if (ContentArr.Count > 0) //存在分页数据
                                {
                                    ContentHtml = ContentHtml.Replace(infotmp, ContentArr[CPage - 1]);
                                    ContentHtml = ContentHtml.Replace(pagelabel, this.bll.GetPage(lblContent, ItemID, CPage, ContentArr.Count, ContentArr.Count));
                                }
                                else
                                {
                                    ContentHtml = ContentHtml.Replace(infotmp, infoContent);
                                    ContentHtml = ContentHtml.Replace(pagelabel, "");
                                }
                            }
                        }
                        else  //没有分页标签
                        {
                            //如果设定了分页内容字段 将该字段内容的分页标志清除
                            if (!string.IsNullOrEmpty(infoContent))
                            {
                                ContentHtml = ContentHtml.Replace(infotmp, infoContent);
                            }
                        }
                    }
                    #endregion

                    pattern = @"{\#Content}([\s\S])*?{\/\#Content}";  //查找要分页的内容
                    if (Regex.IsMatch(ContentHtml, pattern, RegexOptions.IgnoreCase))
                    {
                        infoContent = Regex.Match(ContentHtml, pattern, RegexOptions.IgnoreCase).Value;
                        infotmp     = infoContent;
                        infoContent = infoContent.Replace("{#Content}", "").Replace("{/#Content}", "");

                        //查找分页标签
                        //bool flag = false;
                        bool   isPage   = false;
                        string pattern1 = @"{ZL\.Page([\s\S])*?\/}";
                        if (Regex.IsMatch(ContentHtml, pattern1, RegexOptions.IgnoreCase))
                        {
                            pagelabel = Regex.Match(ContentHtml, pattern1, RegexOptions.IgnoreCase).Value;
                            isPage    = true;
                        }
                        if (isPage)
                        {
                            if (string.IsNullOrEmpty(infoContent)) //没有设定要分页的字段内容
                            {
                                ContentHtml = ContentHtml.Replace(pagelabel, "");
                            }
                            else   //进行内容分页处理
                            {
                                //文件名
                                string file1 = "Content.aspx?ID=" + ItemID.ToString();
                                //取分页标签处理结果 返回字符串数组 根据数组元素个数生成几页
                                string         ilbl       = pagelabel.Replace("{ZL.Page ", "").Replace("/}", "").Replace(" ", ",");
                                string         lblContent = "";
                                int            NumPerPage = 500;
                                IList <string> ContentArr = new List <string>();

                                if (string.IsNullOrEmpty(ilbl))
                                {
                                    lblContent = "{loop}<a href=\"{$pageurl/}\">{$pageid/}</a>$$$<b>[{$pageid/}]</b>{/loop}"; //默认格式的分页导航
                                    ContentArr = this.bll.GetContentPage(infoContent, NumPerPage);
                                }
                                else
                                {
                                    string[] paArr = ilbl.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                                    if (paArr.Length == 0)
                                    {
                                        lblContent = "{loop}<a href=\"{$pageurl/}\">{$pageid/}</a>$$$<b>[{$pageid/}]</b>{/loop}"; //默认格式的分页导航
                                        ContentArr = this.bll.GetContentPage(infoContent, NumPerPage);
                                    }
                                    else
                                    {
                                        string lblname = paArr[0].Split(new char[] { '=' })[1].Replace("\"", "");
                                        if (paArr.Length > 1)
                                        {
                                            NumPerPage = DataConverter.CLng(paArr[1].Split(new char[] { '=' })[1].Replace("\"", ""));
                                        }
                                        B_Label blbl = new B_Label();
                                        lblContent = blbl.GetLabelXML(lblname).Content;
                                        if (string.IsNullOrEmpty(lblContent))
                                        {
                                            lblContent = "{loop}<a href=\"{$pageurl/}\">{$pageid/}</a>$$$<b>[{$pageid/}]</b>{/loop}"; //默认格式的分页导航
                                        }
                                        ContentArr = this.bll.GetContentPage(infoContent, NumPerPage);
                                    }
                                }
                                if (ContentArr.Count > 0) //存在分页数据
                                {
                                    ContentHtml = ContentHtml.Replace(infotmp, ContentArr[CPage - 1]);
                                    ContentHtml = ContentHtml.Replace(pagelabel, this.bll.GetPage(lblContent, ItemID, CPage, ContentArr.Count, NumPerPage));
                                }
                                else
                                {
                                    ContentHtml = ContentHtml.Replace(infotmp, infoContent);
                                    ContentHtml = ContentHtml.Replace(pagelabel, "");
                                }
                            }
                        }
                        else  //没有分页标签
                        {
                            //如果设定了分页内容字段 将该字段内容的分页标志清除
                            if (!string.IsNullOrEmpty(infoContent))
                            {
                                ContentHtml = ContentHtml.Replace(infotmp, infoContent);
                            }
                        }
                    }
                }
                string patterns   = @"{ZL\.Page([\s\S])*?\/}";
                string pagelabels = Regex.Match(ContentHtml, patterns, RegexOptions.IgnoreCase).Value;
                if (pagelabels != "")
                {
                    ContentHtml = ContentHtml.Replace(pagelabels, "");
                }
                /*--------------------- 分页内容处理结束-------------------------------------------------------------------------*/
                Response.Write(ContentHtml);
            }
        }
        else
        {
            Response.Write("[产生错误的可能原因:您访问的内容信息不存在!访问规则:PageContent.aspx?ItemID=信息ID]");
        }
    }
コード例 #12
0
ファイル: Projects.aspx.cs プロジェクト: kenstammjr/SPA
        protected override void PageIndexChange(int Index)
        {
            string searchString = string.Empty;

            if (txtSearch.Text.Length > 0 && txtSearch.Text != "Search...")
            {
                searchString = txtSearch.Text;
            }
            PageIndex = Index;
            string url = QueryStringParameter(CurrentURL, Request.QueryString, new string[] { "ID", "PageIndex", "Filter" }, new string[] { ItemID.ToString(), PageIndex.ToString(), searchString });

            Response.Redirect(url, false);
        }
コード例 #13
0
    private void Start()
    {
        Image image = GetComponent <Image>();

        image.sprite = Resources.Load <Sprite>(ItemID.ToString());
    }
コード例 #14
0
        public string GetProperty(string strPropertyName, string strFormat, CultureInfo formatProvider, UserInfo AccessingUser, Scope AccessLevel, ref bool PropertyNotFound)
        {
            PortalSettings portalSettings = PortalController.Instance.GetCurrentPortalSettings();
            string         outputFormat   = strFormat == string.Empty ? "D" : strFormat;

            switch (strPropertyName.ToLowerInvariant())
            {
            case "edit":
                if (IsEditable)
                {
                    string editUrl = Globals.NavigateURL(portalSettings.ActiveTab.TabID, false, portalSettings,
                                                         "Edit",
                                                         CultureInfo.CurrentCulture.Name,
                                                         "mid=" + ModuleID.ToString(CultureInfo.InvariantCulture),
                                                         "itemid=" + ItemID.ToString(CultureInfo.InvariantCulture));
                    if (portalSettings.EnablePopUps)
                    {
                        editUrl = UrlUtils.PopUpUrl(editUrl, null, portalSettings, false, false);
                    }
                    return("<a href=\"" + editUrl + "\"><img border=\"0\" src=\"" + Globals.ApplicationPath + "/icons/sigma/Edit_16X16_Standard_2.png\" alt=\"" + Localization.GetString("EditAnnouncement.Text", _localResourceFile) + "\" /></a>");
                }
                return(string.Empty);

            case "itemid":
                return(ItemID.ToString(outputFormat, formatProvider));

            case "moduleid":
                return(ModuleID.ToString(outputFormat, formatProvider));

            case "title":
                return(PropertyAccess.FormatString(Title, strFormat));

            case "url":
                return(PropertyAccess.FormatString(string.IsNullOrEmpty(URL) ? URL : Utilities.FormatUrl(URL, portalSettings.ActiveTab.TabID, ModuleID, TrackClicks), strFormat));

            case "description":
                return(HttpUtility.HtmlDecode(Description));

            case "imagesource":
            case "rawimage":
                string strValue = ImageSource;
                if (strPropertyName.ToLowerInvariant() == "imagesource" && string.IsNullOrEmpty(strFormat))
                {
                    strFormat = "<img src=\"{0}\" alt=\"" + Title + "\" />";
                }

                //Retrieve the path to the imagefile
                if (strValue != "")
                {
                    //Get path from filesystem only when the image comes from within DNN.
                    // this is now legacy, from version 7.0.0, a real filename is saved in the DB
                    if (ImageSource.StartsWith("FileID="))
                    {
                        var objFile = FileManager.Instance.GetFile(Convert.ToInt32(strValue.Substring(7)));
                        if (objFile != null)
                        {
                            strValue = portalSettings.HomeDirectory + objFile.Folder + objFile.FileName;
                        }
                        else
                        {
                            strValue = "";
                        }
                    }
                    else
                    {
                        if (!ImageSource.ToLowerInvariant().StartsWith("http"))
                        {
                            strValue = portalSettings.HomeDirectory + ImageSource;
                        }
                    }
                    strValue = PropertyAccess.FormatString(strValue, strFormat);
                }
                return(strValue);

            case "vieworder":
                return(ViewOrder.ToString(outputFormat, formatProvider));

            case "createdbyuserid":
                return(CreatedByUserID.ToString(outputFormat, formatProvider));

            case "createdbyuser":
                UserInfo tmpUser = CreatedByUser(portalSettings.PortalId);
                return(tmpUser != null ? tmpUser.DisplayName : Localization.GetString("userUnknown.Text", _localResourceFile));

            case "lastmodifiedbyuserid":
                return(LastModifiedByUserID.ToString(outputFormat, formatProvider));

            case "lastmodifiedbyuser":
                UserInfo tmpUser2 = LastModifiedByUser(portalSettings.PortalId);
                return(tmpUser2 != null ? tmpUser2.DisplayName : Localization.GetString("userUnknown.Text", _localResourceFile));

            case "trackclicks":
                return(PropertyAccess.Boolean2LocalizedYesNo(TrackClicks, formatProvider));

            case "newwindow":
                return(NewWindow ? "_blank" : "_self");

            case "createddate":
            case "createdondate":
                return(CreatedOnDate.ToString(outputFormat, formatProvider));

            case "lastmodifiedondate":
                return(LastModifiedOnDate.ToString(outputFormat, formatProvider));

            case "publishdate":
                return(PublishDate.HasValue ? (PublishDate.Value.ToString(outputFormat, formatProvider)) : "");

            case "expiredate":
                return(ExpireDate.HasValue ? (ExpireDate.Value.ToString(outputFormat, formatProvider)) : "");

            case "more":
                return(Localization.GetString("More.Text", _localResourceFile));

            case "readmore":
                string strTarget = NewWindow ? "_new" : "_self";

                return(!(string.IsNullOrEmpty(URL))
                               ? "<a href=\"" + Utilities.FormatUrl(URL, portalSettings.ActiveTab.TabID, ModuleID, TrackClicks) +
                       "\" target=\"" + strTarget + "\">" + Localization.GetString("More.Text", _localResourceFile) +
                       "</a>"
                               : "");

            case "permalink":
                return(Permalink());

            case "subscribe":

            default:
                PropertyNotFound = true;
                break;
            }

            return(Null.NullString);
        }
コード例 #15
0
ファイル: ItemRow.cs プロジェクト: jimmble/YAGE
        public ItemRow(ItemID id)
        {
            ItemId = id;
            var str = id.ToString();

            switch (str)
            {
            case "RawStart":
                Name = "RawSoil";
                break;

            case "RawEnd":
                Name = "RawHide";
                break;

            case "FoodStart":
                Name = "Fruit";
                break;

            case "FoodEnd":
                Name = "Sandwich";
                break;

            case "DrinkStart":
                Name = "Milk";
                break;

            case "DrinkEnd":
                Name = "Beer";
                break;

            case "StorageStart":
                Name = "Crate";
                break;

            case "StorageEnd":
                Name = "Bag";
                break;

            case "FurnitureStart":
                Name = "WoodDoor";
                break;

            case "FurnitureEnd":
                Name = "Statue";
                break;

            case "WeaponStart":
                Name = "Sword";
                break;

            case "WeaponEnd":
                Name = "Torch";
                break;

            case "EquipmentStart":
                Name = "Helmet";
                break;

            case "EquipmentEnd":
                Name = "LeatherBoot";
                break;

            case "ToolStart":
                Name = "Pickaxe";
                break;

            case "ToolEnd":
                Name = "FellingAxe";
                break;

            default:
                Name = str;
                break;
            }
        }
コード例 #16
0
 /// <
 /// mary>
 ///     Initializes a new instance of the Branch class to the value indicated
 ///     by the given parameters.
 /// </summary>
 ///
 /// <param name="orderID">The OrderID of the ordered order.</param>
 /// <param name="dishID"> The DishID of the ordered dish.</param>
 /// <param name="amount"> Amount of dishes orderd.</param>
 ///public Ordered_Dish(int orderID=0, int dishID=0, int amount=0)
 //{
 //    ItemID = 0;
 //    OrderID = orderID;
 //    DishID = dishID;
 //    Amount = amount;
 //}
 /// <summary>
 ///     Converts the value of this instance to its equivalent string representation.
 /// </summary>
 ///
 /// <returns>
 ///     The string representation of the ordered-dish's properties.
 /// </returns>
 public override string ToString()
 {
     return(ItemID.ToString() + " " + OrderID.ToString() + " " + DishID.ToString() + " " + Amount.ToString());
 }
コード例 #17
0
ファイル: itmFreqNode.cs プロジェクト: PeterHatch/brawltools
        public void UpdateName()
        {
            var item = BrawlLib.SSBB.Item.Items.Where(s => s.ID == ItemID).FirstOrDefault();

            Name = "0x" + ItemID.ToString("X2") + (item == null ? "" : (" - " + item.Name));
        }
コード例 #18
0
        // One byte (0x06)
        // Always 00? Unless quantity goes over 255, lol

        public override string ToString()
        {
            return(string.Format("{0} x{1}", ItemID.ToString(), Quantity.ToString()));
        }
コード例 #19
0
        private void SaveREQRequisitionItemEntity()
        {
            try
            {
                IList <ListViewDataItem> list = lvREQRequisitionItem.Items;

                if (list != null && list.Count > 0)
                {
                    foreach (ListViewDataItem lvdi in list)
                    {
                        Decimal PresentRequiredQty;
                        Int64   ItemID;

                        Label   lblItemID             = (Label)lvdi.FindControl("lblItemLV");
                        Label   lblQtyLV              = (Label)lvdi.FindControl("lblQtyLV");
                        Label   lblPurchasedQty       = (Label)lvdi.FindControl("lblPurchasedQty");
                        TextBox txtPresentRequiredQty = (TextBox)lvdi.FindControl("txtPresentRequiredQty");
                        TextBox txtRequiredDate       = (TextBox)lvdi.FindControl("txtRequiredDate");
                        TextBox txtRemarksLV          = (TextBox)lvdi.FindControl("txtRemarksLV");


                        if (txtPresentRequiredQty.Enabled != false)
                        {
                            Decimal.TryParse(txtPresentRequiredQty.Text.Trim(), out PresentRequiredQty);
                            Int64.TryParse(lblItemID.Text, out ItemID);

                            String fe1 = SqlExpressionBuilder.PrepareFilterExpression(REQRequisitionItemEntity.FLD_NAME_RequisitionID, REQRequisitionID.ToString(), SQLMatchType.Equal);
                            String fe2 = SqlExpressionBuilder.PrepareFilterExpression(REQRequisitionItemEntity.FLD_NAME_ItemID, ItemID.ToString(), SQLMatchType.Equal);
                            String fe  = SqlExpressionBuilder.PrepareFilterExpression(fe1, SQLJoinType.AND, fe2);

                            IList <REQRequisitionItemEntity> RequisitionItemList = FCCREQRequisitionItem.GetFacadeCreate().GetIL(null, null, String.Empty, fe, DatabaseOperationType.LoadWithFilterExpression);

                            if (RequisitionItemList != null && RequisitionItemList.Count > 0)
                            {
                                REQRequisitionItemEntity rEQRequisitionItem = RequisitionItemList[0];
                                rEQRequisitionItem.RequisitionID      = REQRequisitionID;
                                rEQRequisitionItem.PresentRequiredQty = PresentRequiredQty;
                                rEQRequisitionItem.ItemID             = ItemID;
                                //Another Entity Item may be added Here.
                                FCCREQRequisitionItem.GetFacadeCreate().Update(rEQRequisitionItem, fe, DatabaseOperationType.Update, TransactionRequired.No);
                            }
                        }
                    }
                }
                BindREQRequisitionItemList();
                MiscUtil.ShowMessage(lblMessage, "Requisition Item Information has been saved successfully.", false);
            }
            catch (Exception ex)
            {
                MiscUtil.ShowMessage(lblMessage, "Failed to save Requisition Item Information.", true);
            }
        }
コード例 #20
0
ファイル: Content.aspx.cs プロジェクト: zoomlacms/web022
        protected void Page_Load(object sender, EventArgs e)
        {
            if (ItemID < 1)
            {
                function.WriteErrMsg("[产生错误的可能原因:内容信息不存在或未开放!调用方法:Content.aspx?ID=内容ID]");
            }
            M_CommonData ItemInfo = bcontent.GetCommonData(ItemID);
            M_Node       nodeinfo = bnode.GetNode(ItemInfo.NodeID);

            if (ItemInfo.IsNull)
            {
                function.WriteErrMsg("[产生错误的可能原因:内容信息不存在或未开放!]");
            }
            else if (ItemInfo.Status == -2)
            {
                function.WriteErrMsg("[对不起,当前信息已删除,您无法浏览!]");
            }
            else if (ItemInfo.Status == 0 && ItemInfo.NodeID != 37)
            {
                function.WriteErrMsg("[对不起,当前信息待审核状态,您无法浏览!]");
            }
            else if (ItemInfo.Status < 0)
            {
                function.WriteErrMsg("[对不起,当前信息未通过审核,您无法浏览!]");
            }
            if (nodeinfo.PurviewType)
            {
                if (!buser.CheckLogin())
                {
                    function.WriteErrMsg("该信息所属栏目需登录验证,请先<a href='/User/login.aspx' target='_top'>登录</a>再进行此操作!", "/User/login.aspx");
                }
                else
                {
                    //此处以后可以加上用户组权限检测
                }
            }
            if (nodeinfo.ConsumePoint > 0)
            {
                M_UserInfo userinfo = buser.GetUserByUserID(buser.GetLogin().UserID);
                int        groupID  = 0; //会员级别id
                int        groupNum = 0; //浏览文章的次数

                if (nodeinfo.Viewinglimit != "" || nodeinfo.Viewinglimit != null)
                {
                    #region 查找当前登录会员浏览该文章规定的次数
                    string   Viewinglimits     = nodeinfo.Viewinglimit;
                    string[] ViewinglimitArray = Viewinglimits.Split(new char[] { '|' });
                    if (ViewinglimitArray.Length > 1)
                    {
                        for (int i = 0; i < ViewinglimitArray.Length; i++)
                        {
                            if (userinfo.GroupID == int.Parse(ViewinglimitArray[i].Substring(0, ViewinglimitArray[i].IndexOf("="))))
                            {
                                groupID  = int.Parse(ViewinglimitArray[i].Substring(0, ViewinglimitArray[i].IndexOf("=")));
                                groupNum = int.Parse(ViewinglimitArray[i].Substring(ViewinglimitArray[i].IndexOf("=") + 1, ViewinglimitArray[i].Length - ViewinglimitArray[i].Substring(0, ViewinglimitArray[i].IndexOf("=") + 1).Length));
                                break;
                            }
                        }
                    }
                    #endregion
                }
                if (buser.CheckLogin() && (userinfo.UserPoint - nodeinfo.ConsumePoint) > 0)
                {
                    B_CompleteHistory bcomhistory = new B_CompleteHistory();
                    switch (nodeinfo.ConsumeType)
                    {
                    case 0:        //0-不重复收费
                        ReadArticleStandardCharges(userinfo, nodeinfo, buser, bcomhistory, ItemInfo.GeneralID, nodeinfo.ConsumeType, groupID, groupNum);
                        break;

                    case 1:        //1-距离上次收费时间多少小时后重新收费
                        ReadArticleStandardCharges(userinfo, nodeinfo, buser, bcomhistory, ItemInfo.GeneralID, nodeinfo.ConsumeType, groupID, groupNum);
                        break;

                    case 2:        //2-重复阅读内容多少次重新收费
                        ReadArticleStandardCharges(userinfo, nodeinfo, buser, bcomhistory, ItemInfo.GeneralID, nodeinfo.ConsumeType, groupID, groupNum);
                        break;

                    case 3:        //3-上述两者都满足时重新收费
                        ReadArticleStandardCharges(userinfo, nodeinfo, buser, bcomhistory, ItemInfo.GeneralID, nodeinfo.ConsumeType, groupID, groupNum);
                        break;

                    case 4:        //4- 1、2两者任一个满足时就重新收费
                        ReadArticleStandardCharges(userinfo, nodeinfo, buser, bcomhistory, ItemInfo.GeneralID, nodeinfo.ConsumeType, groupID, groupNum);
                        break;

                    case 5:         //5-每阅读一次就重复收费一次
                        ReadArticleStandardCharges(userinfo, nodeinfo, buser, bcomhistory, ItemInfo.GeneralID, nodeinfo.ConsumeType, groupID, groupNum);
                        break;

                    default:
                        ReadArticleStandardCharges(userinfo, nodeinfo, buser, bcomhistory, ItemInfo.GeneralID, nodeinfo.ConsumeType, groupID, groupNum);        //不重复收费
                        break;
                    }
                }
                else
                {
                    function.WriteErrMsg("您的点券不足,请充值!");
                }
            }
            M_ModelInfo modelinfo   = bmode.GetModelById(ItemInfo.ModelID);
            string      TempNode    = bnode.GetModelTemplate(ItemInfo.NodeID, ItemInfo.ModelID);
            string      TempContent = ItemInfo.Template;
            string      TemplateDir = modelinfo.ContentModule;
            if (!string.IsNullOrEmpty(TempContent))
            {
                TemplateDir = TempContent;
            }
            else
            {
                if (!string.IsNullOrEmpty(TempNode))
                {
                    TemplateDir = TempNode;
                }
            }
            if (string.IsNullOrEmpty(TemplateDir))
            {
                function.WriteErrMsg("该内容所属模型未指定模板");
            }
            else
            {
                GetNodePreate(nodeinfo.NodeID);
                if (!(TemplateDir.ToLower().IndexOf("site") > 0 && TemplateDir.ToLower().IndexOf("site") <= 2))
                {
                    TemplateDir = base.Request.PhysicalApplicationPath + SiteConfig.SiteOption.TemplateDir + "/" + TemplateDir;
                }
                else
                {
                    TemplateDir = base.Request.PhysicalApplicationPath + "/" + TemplateDir;
                }
                int    pid = bnode.GetContrarily(DataConverter.CLng(ItemInfo.NodeID), 5); //子站判断
                M_Node mn  = bnode.GetNodeXML(DataConverter.CLng(pid));
                mn = bnode.dal_GetNode(DataConverter.CLng(pid));
                if (mn.NodeBySite == 5)
                {
                    string NodeDir = mn.NodeDir;
                    mn          = bnode.GetNodeXML(DataConverter.CLng(ItemInfo.NodeID));
                    TemplateDir = modelinfo.ContentModule;
                    if (!string.IsNullOrEmpty(TempNode))
                    {
                        TemplateDir = TempNode;
                    }
                    if (TemplateDir.IndexOf("SiteTemplate") < 0)
                    {
                        TemplateDir = "\\Site\\" + NodeDir + "\\Template" + TemplateDir;
                    }
                    TemplateDir = base.Request.PhysicalApplicationPath + TemplateDir;    // "\\Site\\" + NodeDir + "\\Template" +
                }
                TemplateDir = TemplateDir.Replace("/", @"\").Replace(@"\\", @"\");
                string Templatestrstr = FileSystemObject.ReadFile(TemplateDir);
                string ContentHtml    = this.bll.CreateHtml(Templatestrstr, Cpage, ItemID, "0"); //Templatestrstr:模板页面字符串,页码,该文章ID
                /* --------------------判断是否分页 并做处理------------------------------------------------*/
                if (!string.IsNullOrEmpty(ContentHtml))
                {
                    string infoContent = "";     //进行处理的内容字段
                    string pagelabel   = "";
                    string infotmp     = "";

                    #region 分页符分页

                    string pattern = @"{\#PageCode}([\s\S])*?{\/\#PageCode}";      //查找要分页的内容
                    if (Regex.IsMatch(ContentHtml, pattern, RegexOptions.IgnoreCase))
                    {
                        infoContent = Regex.Match(ContentHtml, pattern, RegexOptions.IgnoreCase).Value;
                        infotmp     = infoContent;
                        infoContent = infoContent.Replace("{#PageCode}", "").Replace("{/#PageCode}", "");
                        //查找分页标签
                        bool   isPage   = false;
                        string pattern1 = @"{ZL\.Page([\s\S])*?\/}";

                        if (Regex.IsMatch(ContentHtml, pattern1, RegexOptions.IgnoreCase))
                        {
                            pagelabel = Regex.Match(ContentHtml, pattern1, RegexOptions.IgnoreCase).Value;
                            isPage    = true;
                        }
                        if (isPage)
                        {
                            if (string.IsNullOrEmpty(infoContent))     //没有设定要分页的字段内容
                            {
                                ContentHtml = ContentHtml.Replace(pagelabel, "");
                            }
                            else       //进行内容分页处理
                            {
                                //文件名
                                string file1 = "Content.aspx?ID=" + ItemID.ToString();
                                //取分页标签处理结果 返回字符串数组 根据数组元素个数生成几页
                                string         ilbl       = pagelabel.Replace("{ZL.Page ", "").Replace("/}", "").Replace(" ", ",");
                                string         lblContent = "";
                                IList <string> ContentArr = new List <string>();

                                if (string.IsNullOrEmpty(ilbl))
                                {
                                    lblContent = "{loop}<a href=\"{$pageurl/}\">{$pageid/}</a>$$$<b>[{$pageid/}]</b>{/loop}";     //默认格式的分页导航
                                    ContentArr = this.bll.GetContentPage(infoContent);
                                }
                                else
                                {
                                    string[] paArr = ilbl.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                                    if (paArr.Length == 0)
                                    {
                                        lblContent = "{loop}<a href=\"{$pageurl/}\">{$pageid/}</a>$$$<b>[{$pageid/}]</b>{/loop}";     //默认格式的分页导航
                                        ContentArr = this.bll.GetContentPage(infoContent);
                                    }
                                    else
                                    {
                                        string  lblname = paArr[0].Split(new char[] { '=' })[1].Replace("\"", "");
                                        B_Label blbl    = new B_Label();
                                        lblContent = blbl.GetLabelXML(lblname).Content;
                                        if (string.IsNullOrEmpty(lblContent))
                                        {
                                            lblContent = "{loop}<a href=\"{$pageurl/}\">{$pageid/}</a>$$$<b>[{$pageid/}]</b>{/loop}";     //默认格式的分页导航
                                        }
                                        ContentArr = this.bll.GetContentPage(infoContent);
                                    }
                                }

                                if (ContentArr.Count > 0) //存在分页数据
                                {
                                    if (Cpage == 0)       //显示全部
                                    {
                                        ContentHtml = ContentHtml.Replace(infotmp, infoContent);
                                        ContentHtml = ContentHtml.Replace("[PageCode/]", "");
                                    }
                                    else
                                    {
                                        ContentHtml = ContentHtml.Replace(infotmp, ContentArr[Cpage - 1]);
                                    }
                                    ContentHtml = ContentHtml.Replace(pagelabel, this.bll.GetPage(lblContent, ItemID, Cpage, ContentArr.Count, ContentArr.Count));    //输出分页
                                }
                                else
                                {
                                    ContentHtml = ContentHtml.Replace(infotmp, infoContent);
                                    ContentHtml = ContentHtml.Replace(pagelabel, "");
                                }
                            }
                        }
                        else      //没有分页标签
                        {
                            //如果设定了分页内容字段 将该字段内容的分页标志清除
                            if (!string.IsNullOrEmpty(infoContent))
                            {
                                ContentHtml = ContentHtml.Replace(infotmp, infoContent);
                            }
                        }
                    }
                    #endregion

                    pattern = @"{\#Content}([\s\S])*?{\/\#Content}";      //查找要分页的内容
                    if (Regex.IsMatch(ContentHtml, pattern, RegexOptions.IgnoreCase))
                    {
                        infoContent = Regex.Match(ContentHtml, pattern, RegexOptions.IgnoreCase).Value;
                        infotmp     = infoContent;
                        infoContent = infoContent.Replace("{#Content}", "").Replace("{/#Content}", "");
                        //查找分页标签
                        bool   isPage   = false;
                        string pattern1 = @"{ZL\.Page([\s\S])*?\/}";
                        if (Regex.IsMatch(ContentHtml, pattern1, RegexOptions.IgnoreCase))
                        {
                            pagelabel = Regex.Match(ContentHtml, pattern1, RegexOptions.IgnoreCase).Value;
                            isPage    = true;
                        }
                        if (isPage)
                        {
                            if (string.IsNullOrEmpty(infoContent))     //没有设定要分页的字段内容
                            {
                                ContentHtml = ContentHtml.Replace(pagelabel, "");
                            }
                            else       //进行内容分页处理
                            {
                                //文件名
                                string file1 = "Content.aspx?ID=" + ItemID.ToString();
                                //取分页标签处理结果 返回字符串数组 根据数组元素个数生成几页
                                string         ilbl       = pagelabel.Replace("{ZL.Page ", "").Replace("/}", "").Replace(" ", ",");
                                string         lblContent = "";
                                int            NumPerPage = 500;
                                IList <string> ContentArr = new List <string>();

                                if (string.IsNullOrEmpty(ilbl))
                                {
                                    lblContent = "{loop}<a href=\"{$pageurl/}\">{$pageid/}</a>$$$<b>[{$pageid/}]</b>{/loop}";     //默认格式的分页导航
                                    ContentArr = this.bll.GetContentPage(infoContent, NumPerPage);
                                }
                                else
                                {
                                    string[] paArr = ilbl.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                                    if (paArr.Length == 0)
                                    {
                                        lblContent = "{loop}<a href=\"{$pageurl/}\">{$pageid/}</a>$$$<b>[{$pageid/}]</b>{/loop}";     //默认格式的分页导航
                                        ContentArr = this.bll.GetContentPage(infoContent, NumPerPage);
                                    }
                                    else
                                    {
                                        string lblname = paArr[0].Split(new char[] { '=' })[1].Replace("\"", "");
                                        if (paArr.Length > 1)
                                        {
                                            NumPerPage = DataConverter.CLng(paArr[1].Split(new char[] { '=' })[1].Replace("\"", ""));
                                        }
                                        B_Label blbl = new B_Label();
                                        lblContent = blbl.GetLabelXML(lblname).Content;
                                        if (string.IsNullOrEmpty(lblContent))
                                        {
                                            lblContent = "{loop}<a href=\"{$pageurl/}\">{$pageid/}</a>$$$<b>[{$pageid/}]</b>{/loop}";     //默认格式的分页导航
                                        }
                                        ContentArr = this.bll.GetContentPage(infoContent, NumPerPage);
                                    }
                                }
                                if (ContentArr.Count > 0)     //存在分页数据
                                {
                                    ContentHtml = ContentHtml.Replace(infotmp, ContentArr[Cpage - 1]);
                                    ContentHtml = ContentHtml.Replace(pagelabel, this.bll.GetPage(lblContent, ItemID, Cpage, ContentArr.Count, NumPerPage));
                                }
                                else
                                {
                                    ContentHtml = ContentHtml.Replace(infotmp, infoContent);
                                    ContentHtml = ContentHtml.Replace(pagelabel, "");
                                }
                            }
                        }
                        else    //没有分页标签
                        {
                            //如果设定了分页内容字段 将该字段内容的分页标志清除
                            if (!string.IsNullOrEmpty(infoContent))
                            {
                                ContentHtml = ContentHtml.Replace(infotmp, infoContent);
                            }
                        }
                    }
                }

                string patterns   = @"{ZL\.Page([\s\S])*?\/}";
                string pagelabels = Regex.Match(ContentHtml, patterns, RegexOptions.IgnoreCase).Value;
                if (pagelabels != "")
                {
                    ContentHtml = ContentHtml.Replace(pagelabels, "");
                }
                if (nodeinfo.SafeGuard == 1 && File.Exists(Server.MapPath("/JS/Guard.js")))
                {
                    ContentHtml = ContentHtml + SafeSC.ReadFileStr("/JS/Guard.js");
                }
                if (SiteConfig.SiteOption.IsSensitivity == 1)
                {
                    ContentHtml = sell.ProcessSen(ContentHtml);
                }
                Response.Write(ContentHtml);
            }
        }