1

Closed

Plugin?

description

So I was playing around with plugins and I noticed that you can't save/create files with it. Is there a fix to this?
 
I think this is a kinda issue when I want to work with Plugins to a program. I want to be abble to handle files. Maybe just my preference but yeah...
Closed Jul 18, 2012 at 9:31 PM by colinvella
Not a tIDE/xTile issue

comments

colinvella wrote Mar 23, 2012 at 7:20 PM

You can write .net code within your plugin to open/save files using the system.io framework classes. You should also be able to access the xtile engine api. Can you please explain what you're trying to accomplish in more detail?

ChFlashER wrote Mar 23, 2012 at 10:19 PM

What I am saying is that I cant use the system.io in the plugin. I just get access denied. Whereever I save it. I will try agien soon :P

ChFlashER wrote Mar 23, 2012 at 10:56 PM

System.UnauthorizedAccessException: Access to the path 'D:\Users\Public\Desktop' is denied.

using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"D:\Users\Public\Desktop"))
        {
            file.WriteLine("test");
        } 

colinvella wrote Mar 25, 2012 at 5:08 PM

You seem to be writing to a folder name directly. Try changing your path to @"D:\Users\Public\Desktop\test.txt"

ChFlashER wrote Mar 25, 2012 at 6:13 PM

I did that but I get the same error,

ChFlashER wrote Mar 30, 2012 at 8:01 PM

So after my last discussion I when't way with trying using FileStream. And it works fine.

using (FileStream stream = new FileStream(@"F:\TE\Test\File.xml", FileMode.Create, FileAccess.Write, FileShare.None))
        {

            StreamWriter m_streamWriter = new StreamWriter(stream);
            m_streamWriter.WriteLine("Test");
            m_streamWriter.Flush(); 
        }