Monday, 15 April 2013

c# - How can I work around a bad API function that leaves a locked file on failure? -



c# - How can I work around a bad API function that leaves a locked file on failure? -

basically, i'm running problem "working around" api have no command on locking file when shouldn't be.

the method api looks this:

public static bool upload(string filename) { ... } // have no ability within

it behaves it's reading file straight off disk, , not placing file memory before hand.

this problem because it's written poorly whenever fails @ uploading, fails release file lock. means have start application on 1 time again in order release file - huge pain in production!

the work-around think of making individual re-create of file (~ few mb @ most) each firmware upload instance. working, leaves me problem of deleting each file manually afterwards (since file lock open long app is, couldn't in code)

is there workaround can wouldn't create ton of issues? thought creating separate c# class hold static upload function, find way dispose class , resources after runs. ideas?

edit: it's 3rd party api uses proprietary code talk microcontroller - unless want bit-spy , re-create , forth packets, looks rewriting original function no-go.

c# .net file-permissions

No comments:

Post a Comment