本文整理汇总了C#中System.Security.Permissions.FileIOPermission.Deny方法的典型用法代码示例。如果您正苦于以下问题:C# FileIOPermission.Deny方法的具体用法?C# FileIOPermission.Deny怎么用?C# FileIOPermission.Deny使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Security.Permissions.FileIOPermission
的用法示例。
在下文中一共展示了FileIOPermission.Deny方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Setup
public virtual void Setup()
{
var sp = new FileIOPermission(PermissionState.Unrestricted);
sp.Assert();
string prefix;
if (Environment.CurrentDirectory.EndsWith("target"))
{
prefix = "../../";
}
else
{
prefix = "../../../";
}
sp.Deny();
Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");
BridgeSetup setup=new BridgeSetup (false){Verbose = true, Debug = true};
setup.IgnoreJavaHome = true;
setup.AddJVMOption("-Xmx512m");
setup.AddClassPath(prefix + "jni4net.j/target/classes");
setup.AddClassPath(prefix + "jni4net.tested.j/target/classes");
setup.AddClassPath(prefix + "jni4net.test.j/target/test-classes");
//setup.JavaHome = @"c:\Program Files (x86)\Java\ibm_sdk60";
env = Bridge.CreateJVM(setup);
Bridge.RegisterAssembly(typeof(TestBase).Assembly);
Bridge.RegisterAssembly(typeof(JavaInstanceFields).Assembly);
}
示例2: Main
static void Main(string[] args)
{
CodeAccessPermission permission = new FileIOPermission(FileIOPermissionAccess.AllAccess,@"c:\");
permission.Deny();
UntrustworthyClass.Method();
CodeAccessPermission.RevertDeny();
}
示例3: RunInternal
private object RunInternal(MethodOverloads methodOverloads, object[] rawParams)
{
// TODO: Security
FileIOPermission phoenixLauncherFile = new FileIOPermission(FileIOPermissionAccess.AllAccess, System.IO.Path.Combine(Core.Directory, "PhoenixLauncher.xml"));
phoenixLauncherFile.Deny();
// First create ParameterData array
ParameterData[] parameters = new ParameterData[rawParams.Length];
for (int i = 0; i < rawParams.Length; i++) {
parameters[i] = new ParameterData(rawParams[i]);
}
// Get valid overloads (array is never empty)
Method[] methods = methodOverloads.FindOverloads(parameters);
Exception exception = null;
foreach (Method m in methods) {
ExecutionInfo info = new ExecutionInfo(m);
ExecutionAttribute[] execAttributes = (ExecutionAttribute[])m.MethodInfo.GetCustomAttributes(typeof(ExecutionAttribute), false);
try {
// Call all Execution attributes
for (int i = 0; i < execAttributes.Length; i++) {
execAttributes[i].Starting(m);
}
// Add execution to running list
lock (syncRoot) {
if (runningExecutions.Count >= Executions.MaxExecutions) {
throw new RuntimeException("Executions limit exceeded.");
}
RuntimeCore.AddAssemblyObject(info, this);
runningExecutions.Add(info);
try {
// Raise Started event
executionStarted.Invoke(this, new ExecutionsChangedEventArgs(info));
}
catch (Exception e) {
Core.ShowMessageBoxAsync("Unhandled exception in Executions.ExecutionStarted event handler.\r\nMessage: " + e.Message, "Warning");
}
}
// Init thread-dependent classes
if (!threadInitialized) {
ScriptErrorException.ThreadInit();
WorldData.World.ThreadInit();
Journal.ThreadInit();
threadInitialized = true;
}
// Invoke
try {
return m.Invoke(parameters);
}
catch (System.Reflection.TargetInvocationException e) {
// Im interested only in exception thrown by code
throw e.InnerException;
}
}
catch (ParameterException e) {
exception = e;
}
catch (ExecutionBlockedException e) {
exception = e;
}
finally {
// Remove execution from running list
lock (syncRoot) {
runningExecutions.Remove(info);
RuntimeCore.RemoveAssemblyObject(info);
try {
// Raise Finished event
executionFinished.Invoke(this, new ExecutionsChangedEventArgs(info));
}
catch (Exception e) {
Core.ShowMessageBoxAsync("Unhandled exception in Executions.ExecutionFinished event handler.\r\nMessage: " + e.Message, "Warning");
}
}
// Call all Execution attributes
for (int i = 0; i < execAttributes.Length; i++) {
execAttributes[i].Finished(m);
}
}
}
if (exception != null) {
throw exception;
}
else {
throw new InternalErrorException();
}
}
示例4: FileIOPermission
public void FileIOPermission()
{
FileIOPermission f = new FileIOPermission(PermissionState.Unrestricted);
f.Deny();
try
{
IStateName2 proxy = (IStateName2)XmlRpcProxyGen.Create(typeof(IStateName2));
}
finally
{
CodeAccessPermission.RevertDeny();
}
}
示例5: Log3
public static void Log3(string text)
{
CodeAccessPermission p = new FileIOPermission(PermissionState.Unrestricted);
p.Deny();
}