Git Product home page Git Product logo

inifile's People

Contributors

njcrawford avatar

Watchers

 avatar  avatar

inifile's Issues

Crash when saving from multiple copies of an application

This was originally opened as njcrawford/EmbroideryReader#18, but it's actually a bug in IniFile.

When several copies of an application are opened, and they all try to save settings on close, and the user does "Close this group" from the taskbar, all copies try to write to the settings file at the same time and crash.

Example crash log, taken from Embroidery Reader issue 18:
Time: 2016-11-14 12:09:03
Program: embroideryReader, Version=2.2.3.0, Culture=neutral,
PublicKeyToken=null
Program location: C:\Program Files (x86)\NJCrawford
Software\Embroidery Reader\embroideryReader.exe
OS: Windows 10 Home release 1607 (6.3 build 14393) (x64)
OS Culture: en-US
Framework: 4.0.30319.42000 (x64)

Error:
System.IO.IOException (The process cannot access the file
'C:\Users[username]\AppData\Local\NJCrawford Software\Embroidery
Reader\embroideryreader.ini' because it is being used by another
process.)
at System.IO.__Error.WinIOError(Int32 errorCode, String
maybeFullPath)
at System.IO.File.InternalCopy(String sourceFileName, String
destFileName, Boolean overwrite, Boolean checkHost)
at NJCrawford.IniFile.save()
at embroideryReader.frmMain.Form1_FormClosing(Object sender,
FormClosingEventArgs e)
at System.Windows.Forms.Form.OnFormClosing(FormClosingEventArgs e)
at System.Windows.Forms.Form.WmClose(Message& m)
at embroideryReader.frmMain.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)

Unexpected results when saving and loading values containing newlines

When setting a value containing newlines, they can be retrieved just as they were set until being saved to a file. When the newlines are saved to file and read back, they are interpreted as separate lines and no longer parts of the value.

IniFile iniFile = new IniFile();
string value = "one
two
three";
iniFile.setValue('test', value);
iniFile.save();
// Reload file from disk
iniFile = new IniFile();
string after = iniFile.getValue('test');

At this point, after contains "one" instead of "one\ntwo\nthree".

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.