Unauthorized ExceptionNot An Issue

Hi, so i'm new to "Rust Oxide Plugin Creation" and i want to use the "System.IO" and the "System.Net" but i'm not allowed to do so how can i use "System.Net" and "System.IO" without problem ? because it's my server and i want to communicate with tcpsocket.

Oxide has a sandbox that is enabled by default. To disable it, you can do so at your own risk by creating an oxide.disable-sandbox file under RustDedicated_Data/Managed or similar directory based on which game you are using and restart the server.

oh yeah thx this is useful i have check : https://umod.org/guides/oxide/disabling-plugin-sandboxing and it work so thx. Now i want to know an other thing where can i know all "References" needed to create a plugin with visual studios ? because i have check a "plugin template" and the plugin has "Configuration" but i don't find this class.

You'd generally need all of the Oxide DLLs that you download from our site for a server.

oh ok but why this is not detect by visual studio ? 

 

it's a source of a mod named "No Decay" made by "0x89A"

class NoDecay : CovalencePlugin
    {
        private Configuration config;

        void Init() => permission.RegisterPermission(config.General.permission, this);​

Did you reference Oxide.Core and Oxide.CSharp properly?

this is my references

 

using System;
using System.Collections.Generic;
using System.Reflection;
using System.Data;
using Oxide.Core;
using Oxide.Core.Configuration;
using Oxide.Core.Plugins;
using UnityEngine;
using Rust;
using Newtonsoft.Json;
using System.IO;
using System.Text;
using ConVar;


Merged post

and i have tried "File.WriteAllText()" but it seems doesn't work in Oxide so why ? i have disable the security so why ?

so yeah the references are already added and do you have an idea about the "File.WriteAllText" ?

Below it's the error when i use the "File.WriteAllText"

Failed to call hook 'OnPlayerChat' on plugin 'ItemsRequests v1.0.0' (IOException: Win32 IO returned 1314. Path: C:\Merde.txt)
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x0019e] in <eae584ce26bc40229c1b1aa476bfa589>:0 
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.IO.FileOptions options, System.String msgPath, System.Boolean bFromProxy, System.Boolean useLongPath, System.Boolean checkHost) [0x00000] in <eae584ce26bc40229c1b1aa476bfa589>:0 
  at (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,int,System.IO.FileOptions,string,bool,bool,bool)
  at System.IO.StreamWriter.CreateFile (System.String path, System.Boolean append, System.Boolean checkHost) [0x0001c] in <eae584ce26bc40229c1b1aa476bfa589>:0 
  at System.IO.StreamWriter..ctor (System.String path, System.Boolean append, System.Text.Encoding encoding, System.Int32 bufferSize, System.Boolean checkHost) [0x00055] in <eae584ce26bc40229c1b1aa476bfa589>:0 
  at System.IO.StreamWriter..ctor (System.String path, System.Boolean append, System.Text.Encoding encoding, System.Int32 bufferSize) [0x00000] in <eae584ce26bc40229c1b1aa476bfa589>:0 
  at System.IO.StreamWriter..ctor (System.String path, System.Boolean append, System.Text.Encoding encoding) [0x00000] in <eae584ce26bc40229c1b1aa476bfa589>:0 
  at (wrapper remoting-invoke-with-check) System.IO.StreamWriter..ctor(string,bool,System.Text.Encoding)
  at System.IO.File.WriteAllText (System.String path, System.String contents, System.Text.Encoding encoding) [0x00000] in <eae584ce26bc40229c1b1aa476bfa589>:0 
  at System.IO.File.WriteAllText (System.String path, System.String contents) [0x00007] in <eae584ce26bc40229c1b1aa476bfa589>:0 
  at Oxide.Plugins.ItemsRequests.OnPlayerChat (BasePlayer player, System.String message, ConVar.Chat+ChatChannel channel) [0x00011] in <fb6e205bc22b49c18103a194fc5fc283>:0 
  at Oxide.Plugins.ItemsRequests.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00032] in <fb6e205bc22b49c18103a194fc5fc283>:0 
  at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <31122a27a2414cd799150f8677cf39d4>:0 
  at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <c2afd8354b8b4f3ca451cf5a1aa111c3>:0 
  at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <c2afd8354b8b4f3ca451cf5a1aa111c3>:0  ​
Ramirezdu06

oh ok but why this is not detect by visual studio ? 

 

it's a source of a mod named "No Decay" made by "0x89A"

class NoDecay : CovalencePlugin
    {
        private Configuration config;

        void Init() => permission.RegisterPermission(config.General.permission, this);​

"Configuration" is a nested class defined in the plugin for serialising the config file. You won't find it in any of the reference dlls instead you will need to include it in the plugin.

Oh thx for you answer 0x89A so now i know why. Anyway do you know how to "WriteAllText" or use a similar system to create a .txt or a file in a specific directory in the plugin ?

Ramirezdu06

Oh thx for you answer 0x89A so now i know why. Anyway do you know how to "WriteAllText" or use a similar system to create a .txt or a file in a specific directory in the plugin ?

You could either do that or you could use Oxides data file system.

gcIoymlEq0ugY4f.png 0x89A

You could either do that or you could use Oxides data file system.

That would be only under where the oxide folder is though and only for JSON.

ok so i have tried "Webclient" | "Thread" and it worked. I have tried again the "File.WriteAllText" and it worked and i have understand my error i have used the "C:\\" path and we can't write to this path.

 

Edit : We can write to the "C:\\" Disk but not here "C:\\MyFile" you need to write it in a folder under "C:\\" example "C:\\MyFolder\\MyFile" but seems to be a C# problem because i haven't tried with "Elevated Privileges"

Locked automatically