小编ohl*_*mar的帖子

使用API​​更新现有防火墙规则

我能够以编程方式将单个规则添加到Windows防火墙(Server 2008 R2),但是我试图避免每个IP地址有多个规则,并且只想更新现有规则RemoteAddresses.下面是我用来添加规则的代码,我正在尽力研究如何更新现有规则远程地址,但没有运气.

任何帮助表示赞赏!

string ip = "x.x.x.x";

INetFwRule2 firewallRule = (INetFwRule2)Activator.CreateInstance(Type.GetTypeFromProgID("HNetCfg.FWRule"));

firewallRule.Name = "Block Bad IP Addresses";
firewallRule.Description = "Block Nasty Incoming Connections from IP Address.";
firewallRule.Action = NET_FW_ACTION_.NET_FW_ACTION_BLOCK;
firewallRule.Direction = NET_FW_RULE_DIRECTION_.NET_FW_RULE_DIR_IN;
firewallRule.Enabled = true;
firewallRule.InterfaceTypes = "All";
firewallRule.RemoteAddresses = ip;

INetFwPolicy2 firewallPolicy = (INetFwPolicy2)Activator.CreateInstance(Type.GetTypeFromProgID("HNetCfg.FwPolicy2"));
firewallPolicy.Rules.Add(firewallRule);
Run Code Online (Sandbox Code Playgroud)

c# api windows-firewall

9
推荐指数
3
解决办法
1万
查看次数

TypeError:window.tinyMCE.execInstanceCommand不是函数

我无法在wordpress编辑器中添加任何短代码.它显示 - Uncaught TypeError:Object [object Object]没有方法'execInstanceCommand'.plesase帮助我解决这个问题.

代码(tinymce.js)

    function init() {
    tinyMCEPopup.resizeToInnerSize();
}

function getCheckedValue(radioObj) {
    if(!radioObj)
        return "";
    var radioLength = radioObj.length;
    if(radioLength == undefined)
        if(radioObj.checked)
            return radioObj.value;
        else
            return "";
    for(var i = 0; i < radioLength; i++) {
        if(radioObj[i].checked) {
            return radioObj[i].value;
        }
    }
    return "";
}

function tjshortcodesubmit() {

    var tagtext;

    var tj_shortcode = document.getElementById('tjshortcode_panel');

    // who is active ?
    if (tj_shortcode.className.indexOf('current') != -1) {
        var tj_shortcodeid = document.getElementById('tjshortcode_tag').value;
        switch(tj_shortcodeid)
{
case 0:
    tinyMCEPopup.close();
  break;

case "button": …
Run Code Online (Sandbox Code Playgroud)

tinymce-3

7
推荐指数
1
解决办法
4059
查看次数

quartz.net中JobBuilder的Create方法中的类实例

JobBuilder的默认创建方法是

IJobDetail paymentJob = JobBuilder.Create<Hello>().WithIdentity(jobName, groupName).Build();
Run Code Online (Sandbox Code Playgroud)

我检查了重载,但没有重载可以让我们在其中拥有类的实例。创建方法。像这样的东西

IJobDetail paymentJob = JobBuilder.Create<new Hello()>().WithIdentity(jobName, groupName).Build();
Run Code Online (Sandbox Code Playgroud)

但这给出了一个错误

运算符 < 不能应用于“方法组”或“Hello”

我需要这个的原因是:

public abstract class Hello:IJob
{
    public abstract void Execute(IJobExecutionContext context);
}

public Hello1: Hello
{
    public void Execute(IJobExecutionContext context)
    {
        //implementation
    }
}

public Hello2: Hello
{
    public void Execute(IJobExecutionContext context)
    {
        //implementation
    }
}
public static HelloFactory
{

    public Hello GetHelloType(HelloEnum enum)
    {
        Hello job = new Hello();
        switch(enum)
        {
            case HelloEnum.Type1: job = new Hello1();
            case HelloEnum.Type2: job = new …
Run Code Online (Sandbox Code Playgroud)

c# quartz.net

5
推荐指数
1
解决办法
3718
查看次数

在代码后面绑定静态属性

我试图按照这篇文章,唯一的区别是我在后面的代码中创建和绑定控件.不幸的是它不起作用.这是我的示例代码:

 public partial class ShellWindow
 {
      private static Visibility progressbarVisibility = Visibility.Collapsed;
      public static Visibility ProgressbarVisibility
      {
           get { return progressbarVisibility; }
           set
           {
               if (progressbarVisibility == value) return;
               progressbarVisibility = value;
               RaiseStaticPropertyChanged("ProgressbarVisibility");
           }
      }
      public static event EventHandler<PropertyChangedEventArgs> StaticPropertyChanged;
      public static void RaiseStaticPropertyChanged(string propName)
      {
           EventHandler<PropertyChangedEventArgs> handler = StaticPropertyChanged;
           if (handler != null)
               handler(null, new PropertyChangedEventArgs(propName));
     }
}
Run Code Online (Sandbox Code Playgroud)

我这样绑定

var binding = new Binding("ShellWindow.ProgressbarVisibility") { Mode = BindingMode.TwoWay };
       progressbar = new CircularProgressBar ();
  progressbar.SetBinding(VisibilityProperty,
                             binding);
Run Code Online (Sandbox Code Playgroud)

我想我错过了什么,但我不确定我错在哪里.任何帮助都会很棒.

c# wpf xaml binding

0
推荐指数
1
解决办法
1402
查看次数

为什么数组没有在javacode下面排序?

当我运行代码时,数组p没有排序.我弄清楚了

为什么会这样?

import java.util.Arrays;

public class Main {

    public static void main (String[] args){

        //creating array p
        int[] p= new int[] {2,7,8,3,9,1,4,5,6,0 };

        //sort p[5] to p[9]
        Arrays.sort(p, 5, 9);
        for(int l=0;l<p.length;l++)
        {
            System.out.print(p[l]);
        }

    }
}
Run Code Online (Sandbox Code Playgroud)

输出为:2783914560

java

-6
推荐指数
1
解决办法
72
查看次数

标签 统计

c# ×3

api ×1

binding ×1

java ×1

quartz.net ×1

tinymce-3 ×1

windows-firewall ×1

wpf ×1

xaml ×1