Problem with accents

Oct 15, 2009 at 10:08 AM

Firstly, congratulations for your program, i use it every days.

But I had a little problem with accents like 'é' or 'à' (I'm French)

So I download your source code and made a little modification for me.

Your code is really clear, so i have no problem to find what i was looking for.

In the Initialize Method fo the FileReceiver Object I have modified the ctor of your _fileReader by adding the default encoding method

_fileReader = new StreamReader(new FileStream(_fileToWatch, FileMode.Open, FileAccess.Read, FileShare.ReadWrite), System.Text.Encoding.Default);

I don't know if you want to report this modification in your next versions. I give it to you in order to help you to upgrade your software which is very usefull.

The only missing feature in your software if think, is to be able to load a file which has generated before and with your method i think it's not very difficult to develop.

Best regards and thanks again for your software,

lgm42

Oct 15, 2009 at 12:03 PM

Hi, it's me again.

I have work on the idea i had to open existing log file and i have developped a solution for me.

If you want to use it i give you the source code of my new functions.

There is a little quantity of code. I have only add some code and made no modification of yours.

Firstly, I had a button on your toolbar linking the OnClick Event to this method :

/// <summary>

/// Load function of a Log4J file generated using FileReceiver

/// </summary>

private void loadBtn_Click(object sender, EventArgs e)

{

    OpenFileDialog dlg = new OpenFileDialog();

    if (dlg.ShowDialog(this) == DialogResult.Cancel)

        return;

 

    bool oldPauseLog = _pauseLog;

    _pauseLog = false;

 

    LogManager.Instance.ClearLogMessages();

 

    //we need a FileReceiver

    FileReceiver fr = new FileReceiver();

 

    //it need to manage the specified file

    fr.FileToWatch = dlg.FileName;

 

    //normal use of a FileReceiver

    fr.Initialize();

    fr.Attach(this);

    fr.ReloadAllFile();

    fr.Terminate();

 

    //release ressources

    fr = null;

    _pauseLog = oldPauseLog;

}


And I need another method : ReloadAllFile on the FileReceiver object :

/// <summary>

/// Permit to reload a complete file

/// </summary>

public void ReloadAllFile()

{

    //we put the last position to 0 in order to read all the file

    _lastFileLength = 0;

    //we simulate a fileChanged event

    OnFileChanged(null, new FileSystemEventArgs(WatcherChangeTypes.Changed, string.Empty, string.Empty));

}

That's all !


If you are interested in this functionnality, i can send you directly the source code if you want to test it without modifing your code.

Hoping it's interest you.

Best regards,

Lgm42

Nov 5, 2009 at 1:06 PM

Are you interest in managing accents for the others cultures ?

The modification I have submit is usefull for you or not ?

And what do you think about reopen log files method ?