如果会发布ClickOnce版本,Dotfuscator如何对其进行模糊处理?
我有以下内容:
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button3_Click(object sender, EventArgs e)
{
try
{
var strExpression = @"
import sys
sys.stdout=my.write
print 'ABC'
";
var engine = Python.CreateEngine();
var scope = engine.CreateScope();
var sourceCode = engine.CreateScriptSourceFromString(strExpression);
scope.SetVariable("my", this);
var actual = sourceCode.Execute<string>(scope);
textBox1.Text += actual;
}
catch (System.Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
public void write(string s)
{
textBox1.Text += s;
}
}
Run Code Online (Sandbox Code Playgroud)
但我得到一个Exception说没有write.
我做错了什么?
我可以在IE中手动下载.
但是,使用以下代码
WebClient client = new WebClient();
client.DownloadFile(address, filename);
Run Code Online (Sandbox Code Playgroud)
显示例外:403禁止
怎么了?我怎样才能做到这一点?
其他
.net4.0
mytest.py
def Add (a, b):
return a+b
Run Code Online (Sandbox Code Playgroud)
我可以在C#4中使用它,像这样:
ScriptRuntime runtime = Python.CreateRuntime();
dynamic script = runtime.UseFile("mytest.py");
Console.WriteLine(script.Add(1, 3));
Run Code Online (Sandbox Code Playgroud)
但是,我如何在F#中使用动态?
open System
open Microsoft.Scripting.Hosting
open IronPython.Hosting
let call a b=
let runtime = Python.CreateRuntime()
let script = runtime.UseFile("mytest.py")
script.Add(a,b)
Run Code Online (Sandbox Code Playgroud) 我想用Button.Content绑定字符串属性。
但是为什么它不起作用?
数据类:
namespace test4
{
public class Test : INotifyPropertyChanged
{
string _Text = "Begin";
public string Text
{
get{return _Text;}
protected set { _Text = value; }
}
public void Start()
{
Text = "Begin";
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs(Text));
}
public void End()
{
Text = "End";
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs(Text));
}
public event PropertyChangedEventHandler PropertyChanged;
}
}
Run Code Online (Sandbox Code Playgroud)
逻辑代码:
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
test4.Test …Run Code Online (Sandbox Code Playgroud) 在Cpython中,我可以使用win32com.
但是,在ironpython中,我不知道如何导入它.
因为,在.net中,总是使用Visual Studio来交互COM并使用它.
Visual Studio 2010 + Ironpython for .net4
我想在ironpython中使用numpy,他们说我必须使用帧支持.所以,我应该在命令行上使用-X:Frames或-X:FullFrames运行ipy.
但是,我有两个问题:1.我可以在Ironpython Interactive控制台中使用-X:Frames或-X:FullFrames吗?
2.如果我使用C#4加载包含numpy的py,我该如何使用-X:Frames或-X:FullFrames等extern参数?
非常感谢.
我希望在ironpython中加载.net dll.
但是.net dll中的一个静态函数有一些Named和Optional Arguments.
比如,画(重量:w,高度:h,面积= 1)
我只能使用完整的参数吗?
let sub (m:double[],n:double[]) : double[]=
[| for i = 0 to Array.length m -1 do m.[i]-n.[i] |]
Run Code Online (Sandbox Code Playgroud)
错误1此值不是函数且无法应用E:\ MyDocuments\Visual Studio 2010\Projects\curve intersection \newton\Module1.fs 27 21 newton
但是,这没关系:
let a = [| "a"; "b"; "c"; "d"; "e"; "f" |]
for i = 0 to Array.length a - 1 do
System.Console.WriteLine(a.[i])
Run Code Online (Sandbox Code Playgroud) module FSharp=
let Point2d (x,y)= Point2d(x,y)
let Point3d (x,y,z)= Point3d(x,y,z)
type NXOpen.Point3d with
static member ( * ) (p:Point3d,t:float)= Point3d(p.X*t,p.Y*t,p.Z*t)
static member ( * ) (t:float,p:Point3d)= Point3d(p.X*t,p.Y*t,p.Z*t)
static member (+) (p:Point3d,t:float)= Point3d(p.X+t,p.Y+t,p.Z+t)
static member (+) (t:float,p:Point3d)= Point3d(p.X+t,p.Y+t,p.Z+t)
static member (+) (p:Point3d,t:Point3d)= Point3d(p.X+t.X,p.Y+t.Y,p.Z+t.Z)
let a=Point3d (1.,2.,3.)
let b=1.0
let c=a * b//error
Run Code Online (Sandbox Code Playgroud)
错误15:类型'float'与
'Point3d' 类型不匹配E:\ Work\extension-RW\VS\extension\NXOpen.Extension.FSharp\Module1.fs 18 13 NXOpen.Extension.FSharp
我想扩展Point3d方法,一些新的运算符.但它并没有过去.
我这样做了:
let (-) (m:float[]) (n:float[])= [| for i = 0 to Array.length m - 1 do yield m.[i]-n.[i] |]
Run Code Online (Sandbox Code Playgroud)
但是,为什么这是错的?!
let y=1.0-0.0
Run Code Online (Sandbox Code Playgroud)
那之前还可以!
Error 1 This expression was expected to have type float [] but here has type float E:\MyDocuments\Visual Studio 2010\Projects\curve intersection\newton\Module1.fs 28 7 newton
Error 2 This expression was expected to have type float [] but here has type float E:\MyDocuments\Visual Studio 2010\Projects\curve intersection\newton\Module1.fs 28 11 newton
Run Code Online (Sandbox Code Playgroud)
我认为(m:float [])(n:float [])设置参数类型,为什么1.0-0.0,浮点浮点数,不去使用( - )浮点浮点数 - >浮点数???
ironpython ×5
f# ×4
.net ×3
c# ×3
c#-4.0 ×1
clickonce ×1
com ×1
command-line ×1
data-binding ×1
dotfuscator ×1
dynamic ×1
frames ×1
interactive ×1
obfuscation ×1
operators ×1
redirect ×1
stdout ×1
webclient ×1
wpf ×1