Report post

Are you sure you want to report the post shown below? This will send an email to the ATVO administrators. Please include a short reason for reporting.

Users reporting for no reason may be locked out.


Post

Posted by Merlin C
on
Not sure what I'm doing wrong - but during editing a script in ATVO I do get sometimes an exception. Looks to me that the code is already executed in the background although I did not save/compile the code before.

Here is the script-code at the point of time were ATVO crashed. Script should do nothing except writing a trace-file to better understand when function execute is called and (as a next step) what data is provided via the parameters.

By the way I do use for the path 2x "\" but somehow copy/pasting the into the forum editor it changes it 1x"\".

using System;
using System.Media;
using ATVO.ThemesSDK;
using ATVO.ThemeEditor.ThemeModels;
using ATVO.ThemeEditor.Scripting.DotNET;
using ATVO.ThemesSDK.Data.Entity;
using System.IO;

namespace Scripts
{
public class SimpleTracer : IScript
{

        //private filestream logfile = new filestream("c:\temp\aorlogfile.txt", filemode.append, fileaccess.write);; 
        //private streamwriter writer = new streamwriter(logfile);
        //private datetime now;
        static private string logFile = "c:\temp\aorlogfile.txt";
        static private FileStream logFileStream = new FileStream(logFile, FileMode.Append, FileAccess.ReadWrite);
        static private StreamWriter logFileWriter = new StreamWriter(logFileStream);


        public SimpleTracer()
        {
            logEvent("Class constructor called");
        }

        public void logEvent(string text)
        {
       
            logFileWriter.WriteLine( DateTime.Now.ToString("hh:mm:ss.fffffffff") + ": " + text);
            logFileWriter.Flush();
        }

        public object Execute(ThemeContentItem item, object value, string parameter, ISimulation sim)
{
// do nothing except writing a time-stamp and some basic information
logEvent( "Scripts.AORClasses.Methode Execute called");
logEvent( "Content of object is: " + value.ToString());
return value;
}

}
}