Exemple #1
0
 /// <summary>
 /// Fix icon reference
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void OnIconSizeChanged(object sender, PropertyChangedEventArgs e)
 {
     if (e.PropertyName == "IconSize")
     {
         try {
             string exePath = PluginUtils.GetExePath("cmd.exe");
             if (exePath != null && File.Exists(exePath))
             {
                 itemPlugInRoot.Image = PluginUtils.GetCachedExeIcon(exePath, 0);
             }
         } catch (Exception ex) {
             LOG.Warn("Couldn't get the cmd.exe image", ex);
         }
     }
 }
Exemple #2
0
 /// <summary>
 /// Properly closes and disposes and resources and connections associated with this object.
 /// </summary>
 public void Dispose()
 {
     if (!_closed)
     {
         _closed = true;
         _proxy.FireClientDisconnected(this);
         _clientStream?.Close();
         _serverStream?.Close();
         _clientConnection?.Close();
         _serverConnection?.Close();
         _clientBuffer.Dispose();
         _serverBuffer.Dispose();
         PluginUtils.Log("Client", "Disconnected.");
     }
 }
Exemple #3
0
        /// <summary>
        /// Attempts to load the user's preferences file from disk if it exists,
        /// otherwise returns the default set of preferences.
        /// </summary>
        /// <returns></returns>
        private TmdbPreferences LoadPreferences()
        {
            var prefs = PluginUtils.GetPreferences(AssemblyInfo, () => new TmdbPreferences());

            // Use our default API key if the user has not specified their own
            if (string.IsNullOrWhiteSpace(prefs.ApiKey))
            {
                prefs.ApiKey = new TmdbPreferences().ApiKey;
            }

            _searchISO_639_1 = prefs.DefaultLanguage;
            _apiKey          = prefs.ApiKey;

            return(prefs);
        }
    private void OnServerStateChanged(object sender, StateChangedEventArgs <RealtimeVideoServer.ServerState> e)
    {
        PluginUtils.ExecuteOnUnityThread(() =>
        {
            if (e.CurrentState == RealtimeVideoServer.ServerState.Ready)
            {
                UnityEngine.Debug.Log("Server State changed to Ready - Starting Unity VideoPlayer");

                videoPlayer.Play();
                videoPlayer.Prepare();

                stopwatch.Start();
            }
        });
    }
Exemple #5
0
 private void OnCommand(Client client, string command, string[] args)
 {
     if (args.Length == 0 || args[0] == "settings" || args[0] == "config")
     {
         PluginUtils.ShowGenericSettingsGUI(AntiLagConfig.Default, "AntiLag Settings");
     }
     else
     {
         if (args[0] == "effects" && args[1] == "all")
         {
             allEffects[client] = !allEffects[client];
             client.SendToClient(PluginUtils.CreateNotification(client.ObjectId, "AntiLag ALL Particles " + allEffects[client]));
         }
     }
 }
Exemple #6
0
        public ActionResult Config()
        {
            ConfigModel model = new ConfigModel();

            PluginSetInfo pluginSetInfo = PluginUtils.GetPluginSet();

            model.Partner    = pluginSetInfo.Partner;
            model.Key        = pluginSetInfo.Key;
            model.PrivateKey = pluginSetInfo.PrivateKey;
            model.Seller     = pluginSetInfo.Seller;
            model.PayFee     = pluginSetInfo.PayFee;
            model.FreeMoney  = pluginSetInfo.FreeMoney;

            return(View("~/plugins/BrnMall.PayPlugin.Alipay/views/adminalipay/config.cshtml", model));
        }
Exemple #7
0
        /// <summary>
        /// Persists the user's preferences by serializing <paramref name="prefs"/> as JSON
        /// and saving it to disk.
        /// </summary>
        /// <param name="prefs"></param>
        private void SavePreferences(TmdbPreferences prefs)
        {
            var apiKey = prefs.ApiKey;

            // Don't save the default API key to the user's preferences file
            if (apiKey == new TmdbPreferences().ApiKey)
            {
                prefs.ApiKey = null;
            }

            PluginUtils.SavePreferences(AssemblyInfo, prefs);

            // Restore the API key if it was nulled out above
            prefs.ApiKey = apiKey;
        }
Exemple #8
0
        private bool CheckValidity()
        {
            var pluginInfo = PluginUtils.GetPluginInfo(this);

            if (this.WorkshopId > 0 && pluginInfo.PublishedFileID != PublishedFileId.invalid && pluginInfo.PublishedFileID.AsUInt64 != this.WorkshopId)
            {
                // The mod is not published officially
                this.Log.Error("YOU ARE CURRENTLY USING AN UNAUTHORIZED PUBLICATION OF THE MOD '{0}' WITH WORKSHOP ID {1}.\r\n" +
                               "Please use the original version that can be found at http://steamcommunity.com/sharedfiles/filedetails/?id={2}.\r\n\r\n" +
                               "This version will not be loaded. Don't forget to report this version on the original workshop item page as it's most likely stolen (it has happened before).",
                               this.Name.ToUpper(), pluginInfo.PublishedFileID.AsUInt64, this.WorkshopId);
                return(false);
            }
            return(true);
        }
Exemple #9
0
        /// <summary>
        /// Called when the mod is enabled.
        /// </summary>
        public void OnEnabled()
        {
            this.Log                  = new Logger(this.GetType().Assembly);
            this.PluginInfo           = PluginUtils.GetPluginInfo(this);
            UserModBase <T> .Instance = (T)(object)this; // Make the compiler shut up about non-existing conversions

            this.isValid = this.CheckValidity();
            if (!this.isValid)
            {
                return;
            }

            this.CheckIncompatibility();
            this.OnModInitializing();
        }
Exemple #10
0
        private void OnUpdate(Client client, Packet packet)
        {
            UpdatePacket update = (UpdatePacket)packet;

            // New Objects
            foreach (Entity entity in update.NewObjs)
            {
                bool   inc  = false;
                string name = "";

                foreach (StatData statData in entity.Status.Data)
                {
                    if (!statData.IsStringData() && (statData.Id >= 8 && statData.Id <= 19) || (statData.Id >= 71 && statData.Id <= 78))
                    {
                        if (statData.IntValue == INC_ID)
                        {
                            inc = true;
                        }
                    }

                    if (statData.Id == StatsType.Name)
                    {
                        name = statData.StringValue;
                    }
                }

                if (inc && entity.Status.ObjectId != client.ObjectId)
                {
                    if (!_incHolders.ContainsKey(entity.Status.ObjectId))
                    {
                        _incHolders.Add(entity.Status.ObjectId, name);
                    }

                    client.SendToClient(PluginUtils.CreateOryxNotification("Inc Finder", name + " has an Incantation!"));
                }
            }

            // Removed Objects
            foreach (int drop in update.Drops)
            {
                if (_incHolders.ContainsKey(drop))
                {
                    client.SendToClient(PluginUtils.CreateOryxNotification(
                                            "Inc Finder", _incHolders[drop] + " has left!"));
                    _incHolders.Remove(drop);
                }
            }
        }
Exemple #11
0
        public void Initialize(Proxy proxy)
        {
            GameData.Objects.Map
            .ForEach(enemy =>
            {
                if (enemy.Value.Projectiles.Any(p => p.ArmorPiercing))
                {
                    Bullet.piercing[enemy.Value.ID] = new List <int>();
                    enemy.Value.Projectiles.ForEach(proj =>
                    {
                        if (proj.ArmorPiercing)
                        {
                            Bullet.piercing[enemy.Value.ID].Add(proj.ID);
                        }
                    });
                }

                if (enemy.Value.Projectiles.Any(p => p.StatusEffects.ContainsKey("Armor Broken")))
                {
                    Bullet.breaking[enemy.Value.ID] = new List <int>();
                    enemy.Value.Projectiles.ForEach(proj =>
                    {
                        if (proj.StatusEffects.ContainsKey("Armor Broken"))
                        {
                            Bullet.breaking[enemy.Value.ID].Add(proj.ID);
                        }
                    });
                }
            });
            PluginUtils.Log("Auto Nexus", "Found {0} armor-piercing projectiles from {1} enemies.", Bullet.piercing.Sum(e => e.Value.Count), Bullet.piercing.Count);
            PluginUtils.Log("Auto Nexus", "Found {0} armor-breaking projectiles from {1} enemies.", Bullet.breaking.Sum(e => e.Value.Count), Bullet.breaking.Count);

            clients = new Dictionary <Client, ClientState>();

            proxy.HookCommand("autonexus", OnCommand);

            proxy.ClientConnected    += OnConnect;
            proxy.ClientDisconnected += OnDisconnect;

            proxy.HookPacket(PacketType.UPDATE, OnPacket);
            proxy.HookPacket(PacketType.NEWTICK, OnPacket);
            proxy.HookPacket(PacketType.ENEMYSHOOT, OnPacket);
            proxy.HookPacket(PacketType.PLAYERHIT, OnPacket);
            proxy.HookPacket(PacketType.AOE, OnPacket);
            proxy.HookPacket(PacketType.GROUNDDAMAGE, OnPacket);

            MapCacher.MapCacher.ForceLoad();
        }
 public OutlookDestination()
 {
     if (EmailConfigHelper.HasOutlook())
     {
         _isActiveFlag = true;
     }
     _exePath = PluginUtils.GetExePath("OUTLOOK.EXE");
     if (_exePath != null && !File.Exists(_exePath))
     {
         _exePath = null;
     }
     if (_exePath == null)
     {
         _isActiveFlag = false;
     }
 }
        public ActionResult Config(ConfigModel model)
        {
            if (ModelState.IsValid)
            {
                PluginSetInfo pluginSetInfo = new PluginSetInfo();
                pluginSetInfo.Partner    = model.Partner.Trim();
                pluginSetInfo.Key        = model.Key.Trim();
                pluginSetInfo.PrivateKey = model.PrivateKey.Trim();
                pluginSetInfo.Seller     = model.Seller.Trim();
                PluginUtils.SavePluginSet(pluginSetInfo);

                AddAdminOperateLog("修改支付宝插件配置信息");
                return(PromptView(Url.Action("config", "plugin", new { configController = "AdminAlipay", configAction = "Config" }), "插件配置修改成功"));
            }
            return(PromptView(Url.Action("config", "plugin", new { configController = "AdminAlipay", configAction = "Config" }), "信息有误,请重新填写"));
        }
Exemple #14
0
        public ActionResult Config(ConfigModel model)
        {
            if (ModelState.IsValid)
            {
                PluginSetInfo pluginSetInfo = new PluginSetInfo();
                pluginSetInfo.Mid       = model.Mid.Trim();
                pluginSetInfo.Key       = model.Key.Trim();
                pluginSetInfo.PayFee    = model.PayFee;
                pluginSetInfo.FreeMoney = model.FreeMoney;
                PluginUtils.SavePluginSet(pluginSetInfo);

                AddMallAdminLog("修改网银在线插件配置信息");
                return(PromptView(Url.Action("config", "plugin", new { configController = "AdminChinaBank", configAction = "Config" }), "插件配置修改成功"));
            }
            return(PromptView(Url.Action("config", "plugin", new { configController = "AdminChinaBank", configAction = "Config" }), "信息有误,请重新填写"));
        }
Exemple #15
0
        private void SendUseItem(Client client)
        {
            _cooldown = AutoAbilityConfig.Default.RetryDelay;

            UseItemPacket useItem = _useItemMap[client];

            useItem.Time       = client.Time;
            useItem.ItemUsePos = client.PlayerData.Pos;
            client.SendToServer(useItem);

            if (AutoAbilityConfig.Default.ShowBuffNotifications)
            {
                client.SendToClient(PluginUtils.CreateNotification(
                                        client.ObjectId, "Auto-Buff Triggered!"));
            }
        }
Exemple #16
0
        public ActionResult Config(ConfigModel model)
        {
            if (ModelState.IsValid)
            {
                PluginSetInfo pluginSetInfo = new PluginSetInfo();
                pluginSetInfo.BargainorId = model.BargainorId.Trim();
                pluginSetInfo.TenpayKey   = model.TenpayKey.Trim();
                pluginSetInfo.PayFee      = model.PayFee;
                pluginSetInfo.FreeMoney   = model.FreeMoney;
                PluginUtils.SavePluginSet(pluginSetInfo);

                AddAdminOperateLog("修改财付通插件配置信息");
                return(PromptView(Url.Action("config", "plugin", new { configController = "AdminTenpay", configAction = "Config" }), "插件配置修改成功"));
            }
            return(PromptView(Url.Action("config", "plugin", new { configController = "AdminTenpay", configAction = "Config" }), "信息有误,请重新填写"));
        }
Exemple #17
0
 private void onCommand(Client client, string command, string[] args)
 {
     if (args[0] == "on")
     {
         _hidePlayers = true;
     }
     else if (args[0] == "off")
     {
         _hidePlayers = false;
     }
     else
     {
         return;
     }
     client.SendToClient(PluginUtils.CreateNotification(client.ObjectId, "HidePlayers: Size = " + args[0]));
 }
        public override void Scene_Load(MsgObject message)
        {
            PluginUtils.InvokePluginMethod("LockOnPlugin.LockOnBase", "ResetModState");
            Studio.Studio.Instance.LoadScene(message.path);
            StartCoroutine(StudioNEOExtendSaveMgrLoad());

            IEnumerator StudioNEOExtendSaveMgrLoad()
            {
                for (int i = 0; i < 3; i++)
                {
                    yield return(null);
                }
                PluginUtils.InvokePluginMethod("HSStudioNEOExtSave.StudioNEOExtendSaveMgr", "LoadExtData", message.path);
                PluginUtils.InvokePluginMethod("HSStudioNEOExtSave.StudioNEOExtendSaveMgr", "LoadExtDataRaw", message.path);
            }
        }
Exemple #19
0
        /// <summary>
        /// Stops the client listener if it's running.
        /// Fires the ProxyListenStopped event.
        /// </summary>
        public void Stop()
        {
            if (_localListener == null)
            {
                return;
            }

            PluginUtils.Log("Listener", "Stopping local listener...");
            _localListener.Stop();
            _localListener = null;

            PluginUtils.ProtectedInvoke(() =>
            {
                ProxyListenStopped?.Invoke(this);
            }, "ProxyListenStopped");
        }
Exemple #20
0
        /// <summary>
        /// 支付
        /// </summary>
        public ActionResult Pay()
        {
            //订单id
            int oid = WebHelper.GetQueryInt("oid");

            //订单信息
            OrderInfo orderInfo = Orders.GetOrderByOid(oid);

            if (orderInfo == null || orderInfo.Uid != WorkContext.Uid || orderInfo.OrderState != (int)OrderState.WaitPaying || orderInfo.PayMode != 1)
            {
                return(Redirect("/"));
            }

            PluginSetInfo pluginSetInfo = PluginUtils.GetPluginSet();
            string        v_mid         = pluginSetInfo.Mid; //商户号
            string        key           = pluginSetInfo.Key;

            string v_url   = string.Format("http://{0}/ChinaBank/Notify", BSPConfig.ShopConfig.SiteUrl);        //返回接收支付结果的页面
            string remark2 = string.Format("[url:=http://{0}/ChinaBank/Notify]", BSPConfig.ShopConfig.SiteUrl); //服务器异步通知的接收地址

            string v_oid    = oid.ToString();
            string v_amount = orderInfo.SurplusMoney.ToString();

            string v_moneytype = "CNY";

            string text = v_amount + v_moneytype + v_oid + v_mid + v_url + key; // 拼凑加密串

            string v_md5info = FormsAuthentication.HashPasswordForStoringInConfigFile(text, "md5").ToUpper();

            StringBuilder sbHtml = new StringBuilder();

            sbHtml.Append("<form action=\"https://pay3.chinabank.com.cn/PayGate?encoding=UTF-8\"  method=\"post\" name=\"E_FORM\">");
            sbHtml.AppendFormat("<input type=\"hidden\" name=\"v_md5info\" value=\"{0}\" size=\"100\" />", v_md5info);
            sbHtml.AppendFormat("<input type=\"hidden\" name=\"v_mid\" value=\"{0}\" />", v_mid);
            sbHtml.AppendFormat("<input type=\"hidden\" name=\"v_oid\" value=\"{0}\" />", v_oid);
            sbHtml.AppendFormat("<input type=\"hidden\" name=\"v_amount\" value=\"{0}\" />", v_amount);
            sbHtml.AppendFormat("<input type=\"hidden\" name=\"v_moneytype\" value=\"{0}\" />", v_moneytype);
            sbHtml.AppendFormat("<input type=\"hidden\" name=\"v_url\" value=\"{0}\" />", v_url);

            //<!--以下几项项为网上支付完成后,随支付反馈信息一同传给信息接收页-->
            sbHtml.Append("<input type=\"hidden\"  name=\"remark1\" value=\"\" />");
            sbHtml.AppendFormat("<input type=\"hidden\"  name=\"remark2\" value=\"{0}\" />", remark2);
            sbHtml.Append("<input type=\"submit\" value=\"网银在线支付\"/>");
            sbHtml.Append("</form>");
            sbHtml.Append("<script>document.forms['E_FORM'].submit();</script>");
            return(Content(sbHtml.ToString()));
        }
Exemple #21
0
        /// <summary>
        /// Setup the Bitmap scaling (for icons)
        /// </summary>
        private void SetupBitmapScaleHandler()
        {
            ContextMenuDpiHandler = contextMenu.AttachDpiHandler();

            var dpiChangeSubscription = FormDpiHandler.OnDpiChanged.Subscribe(info =>
            {
                // Change the ImageScalingSize before setting the bitmaps
                var width  = DpiHandler.ScaleWithDpi(_coreConfiguration.IconSize.Width, info.NewDpi);
                var height = DpiHandler.ScaleWithDpi(_coreConfiguration.IconSize.Height, info.NewDpi);
                var size   = new Size(width, height);
                contextMenu.SuspendLayout();
                contextMenu.ImageScalingSize   = size;
                contextmenu_quicksettings.Size = new Size(170, width + 8);
                contextMenu.ResumeLayout(true);
                contextMenu.Refresh();
                notifyIcon.Icon = GreenshotResources.GetGreenshotIcon();
            });

            var contextMenuResourceScaleHandler = BitmapScaleHandler.WithComponentResourceManager(ContextMenuDpiHandler, GetType(), (bitmap, dpi) => bitmap.ScaleIconForDisplaying(dpi));

            contextMenuResourceScaleHandler.AddTarget(contextmenu_capturewindow, "contextmenu_capturewindow.Image");
            contextMenuResourceScaleHandler.AddTarget(contextmenu_capturearea, "contextmenu_capturearea.Image");
            contextMenuResourceScaleHandler.AddTarget(contextmenu_capturelastregion, "contextmenu_capturelastregion.Image");
            contextMenuResourceScaleHandler.AddTarget(contextmenu_capturefullscreen, "contextmenu_capturefullscreen.Image");
            contextMenuResourceScaleHandler.AddTarget(contextmenu_captureclipboard, "contextmenu_captureclipboard.Image");
            contextMenuResourceScaleHandler.AddTarget(contextmenu_openfile, "contextmenu_openfile.Image");
            contextMenuResourceScaleHandler.AddTarget(contextmenu_settings, "contextmenu_settings.Image");
            contextMenuResourceScaleHandler.AddTarget(contextmenu_help, "contextmenu_help.Image");
            contextMenuResourceScaleHandler.AddTarget(contextmenu_donate, "contextmenu_donate.Image");
            contextMenuResourceScaleHandler.AddTarget(contextmenu_exit, "contextmenu_exit.Image");

            // this is special handling, for the icons which come from the executables
            var exeBitmapScaleHandler = BitmapScaleHandler.Create <string>(ContextMenuDpiHandler,
                                                                           (path, dpi) => PluginUtils.GetCachedExeIcon(path, 0, dpi >= 120),
                                                                           (bitmap, dpi) => bitmap.ScaleIconForDisplaying(dpi));

            exeBitmapScaleHandler.AddTarget(contextmenu_captureie, PluginUtils.GetExePath("iexplore.exe"));

            // Add cleanup
            Application.ApplicationExit += (sender, args) =>
            {
                dpiChangeSubscription.Dispose();
                ContextMenuDpiHandler.Dispose();
                contextMenuResourceScaleHandler.Dispose();
                exeBitmapScaleHandler.Dispose();
            };
        }
        public IReadOnlyDictionary <string, FoundPluginDto> FindPluginsInAssemblies(string path)
        {
            var assemblyPluginInfos = new Dictionary <string, FoundPluginDto>();

            (PluginLoadContext pluginLoadContext, IEnumerable <Assembly> assemblies) = GetAssembliesAndLoadContext(path);

            foreach (var assembly in assemblies)
            {
                foreach (var plugin in PluginUtils.GetValidPluginTypes(assembly))
                {
                    var pluginDto = new FoundPluginDto(plugin.Name, assembly.Location);
                    assemblyPluginInfos.Add(plugin.Name, pluginDto);
                }
            }
            pluginLoadContext.Unload();
            return(assemblyPluginInfos);
        }
Exemple #23
0
        public ActionResult Config()
        {
            ConfigModel model = new ConfigModel();

            PluginSetInfo pluginSetInfo = PluginUtils.GetPluginSet();

            model.WPMchId       = pluginSetInfo.WPMchId;
            model.WPAppId       = pluginSetInfo.WPAppId;
            model.WPAppSecret   = pluginSetInfo.WPAppSecret;
            model.WPAppKey      = pluginSetInfo.WPAppKey;
            model.OpenMchId     = pluginSetInfo.OpenMchId;
            model.OpenAppId     = pluginSetInfo.OpenAppId;
            model.OpenAppSecret = pluginSetInfo.OpenAppSecret;
            model.OpenAppKey    = pluginSetInfo.OpenAppKey;

            return(View("~/plugins/BrnShop.PayPlugin.WeChat/views/adminwechat/config.cshtml", model));
        }
Exemple #24
0
        public void OnSwitch(Client client, string command, string[] args)
        {
            if (client.PlayerData.HasBackpack == false)
            {
                client.SendToClient(PluginUtils.CreateOryxNotification("Item Switcher", "YOU DONT HAVE A BACKPACK!"));
                return;
            }

            if (args.Length == 0)
            {
                Swap(client,
                     new SlotObject
                {
                    ObjectId   = client.ObjectId,
                    SlotId     = 4,
                    ObjectType = client.PlayerData.Slot[4]
                },
                     new SlotObject
                {
                    ObjectId   = client.ObjectId,
                    SlotId     = 12,
                    ObjectType = client.PlayerData.BackPack[0]
                }, true);
            }
            else if (args.Length == 1)
            {
                int slot;
                if (Int32.TryParse(args[0], out slot))
                {
                    slot = slot + 3;
                    Swap(client,
                         new SlotObject
                    {
                        ObjectId   = client.ObjectId,
                        SlotId     = (byte)slot,
                        ObjectType = client.PlayerData.Slot[slot]
                    },
                         new SlotObject
                    {
                        ObjectId   = client.ObjectId,
                        SlotId     = (byte)(slot + 8),
                        ObjectType = client.PlayerData.BackPack[slot - 4]
                    });
                }
            }
        }
Exemple #25
0
        /// <summary>
        /// Implementation of the IGreenshotPlugin.Initialize
        /// </summary>
        /// <param name="pluginHost">Use the IGreenshotPluginHost interface to register events</param>
        /// <param name="myAttributes">My own attributes</param>
        /// <returns>true if plugin is initialized, false if not (doesn't show)</returns>
        public virtual bool Initialize(IGreenshotHost pluginHost, PluginAttribute myAttributes)
        {
            _host      = pluginHost;
            Attributes = myAttributes;

            // Get configuration
            _config    = IniConfig.GetIniSection <ImgurConfiguration>();
            _resources = new ComponentResourceManager(typeof(ImgurPlugin));

            ToolStripMenuItem itemPlugInRoot = new ToolStripMenuItem("Imgur")
            {
                Image = (Image)_resources.GetObject("Imgur")
            };

            _historyMenuItem = new ToolStripMenuItem(Language.GetString("imgur", LangKey.history))
            {
                Tag = _host
            };
            _historyMenuItem.Click += delegate {
                ImgurHistory.ShowHistory();
            };
            itemPlugInRoot.DropDownItems.Add(_historyMenuItem);

            _itemPlugInConfig = new ToolStripMenuItem(Language.GetString("imgur", LangKey.configure))
            {
                Tag = _host
            };
            _itemPlugInConfig.Click += delegate {
                _config.ShowConfigDialog();
            };
            itemPlugInRoot.DropDownItems.Add(_itemPlugInConfig);

            PluginUtils.AddToContextMenu(_host, itemPlugInRoot);
            Language.LanguageChanged += OnLanguageChanged;

            // retrieve history in the background
            Thread backgroundTask = new Thread(CheckHistory)
            {
                Name         = "Imgur History",
                IsBackground = true
            };

            backgroundTask.SetApartmentState(ApartmentState.STA);
            backgroundTask.Start();
            return(true);
        }
        /// <summary>
        /// 删除配送规则
        /// </summary>
        public ActionResult DelShipRule(string shipRuleName = "")
        {
            List <ShipRuleInfo> shipRuleList = PluginUtils.GetShipRuleList();

            foreach (ShipRuleInfo shipRuleInfo in shipRuleList)
            {
                if (shipRuleInfo.Name == shipRuleName)
                {
                    shipRuleList.Remove(shipRuleInfo);
                    break;
                }
            }

            PluginUtils.SaveShipRuleList(shipRuleList);
            AddAdminOperateLog("删除申通快递配送规则");
            return(PromptView(Url.Action("config", "plugin", new { configController = "AdminSTO", configAction = "ShipRuleList" }), "配送规则删除成功"));
        }
Exemple #27
0
        public static Image IconForCommand(string commandName)
        {
            Image icon = null;

            if (commandName != null)
            {
                if (config.Commandline.ContainsKey(commandName) && File.Exists(config.Commandline[commandName]))
                {
                    try {
                        icon = PluginUtils.GetCachedExeIcon(config.Commandline[commandName], 0);
                    } catch (Exception ex) {
                        LOG.Warn("Problem loading icon for " + config.Commandline[commandName], ex);
                    }
                }
            }
            return(icon);
        }
 public static string PluginAdminList(HttpContext context)
 {
     try
     {
         if (NBrightBuyUtils.CheckRights())
         {
             var ajaxInfo = NBrightBuyUtils.GetAjaxInfo(context);
             var list     = PluginUtils.GetPluginList();
             return(RenderPluginAdminList(list, ajaxInfo, 0));
         }
     }
     catch (Exception ex)
     {
         Logging.LogException(ex);
         return(ex.ToString());
     }
     return("");
 }
        public static void PluginDelete(HttpContext context)
        {
            if (NBrightBuyUtils.CheckRights())
            {
                var ajaxInfo = NBrightBuyUtils.GetAjaxFields(context);
                var itemid   = ajaxInfo.GetXmlProperty("genxml/hidden/itemid");
                if (Utils.IsNumeric(itemid))
                {
                    var objCtrl = new NBrightBuyController();
                    objCtrl.Delete(Convert.ToInt32(itemid));

                    PluginUtils.CopySystemPluginsToPortal();

                    // remove save GetData cache
                    DataCache.ClearCache();
                }
            }
        }
Exemple #30
0
        public void OnMove(Client client, Packet packet)
        {
            if (!_dQuest.ContainsKey(client))
            {
                return;
            }

            foreach (int bagId in _dQuest[client].bagLocations.Keys)
            {
                float distance = _dQuest[client].bagLocations[bagId].DistanceTo(client.PlayerData.Pos);

                if (DailyQuestConfig.Default.BagNotifications && Environment.TickCount - _dQuest[client].lastNotif > 2000 && distance < 15)
                {
                    _dQuest[client].lastNotif = Environment.TickCount;
                    client.SendToClient(PluginUtils.CreateNotification(bagId, "Current Daily Quest: " + GameData.Objects.ByID((ushort)_dQuest[client].goal).Name));
                }
            }
        }