Using Ymodem file transfer in c# - c#

I am currently searching for an idea to use a ymodem communication on one of my software using c# Framework .NET 2.0.
Does somebody have a solution to do ymodem file transfer in C# ? Because I haven't found anything for now...
Thank you by advance.
Joe

There is a project on google code (http://code.google.com/p/ymodemdotnet/). I can not speak to it's quality. It would be a start at least.

Here is an Ymodem implementation I wrote.
It's still far from perfect, but it works, commented and simple.
https://sites.google.com/site/adamficsor1024/home/programming/xymodem

I don't know about YModem, but original XModem (not the non-standard 1k version) is pretty easy to code up on your own with a SOH byte, block#, block, and small checksum.

Related

How do I get bulletphysics/bulletsharps' multithreading working?

That is to say, what is the minimum set of code I need to set up the BulletSharp physics engine wrappers' "DynamicsWorld" to use "BulletSharp.MultiThreaded.ParallelConstraintSolver"? Alternately, I could probably work it out from the same set of code for the BulletPhysics engine itself.
If I have not phrased the right question, I would appreciate clarification; I only started using it today. (Yes, I have written a quick program using the standard classes).
BulletPhysics is a C++ library; the wrapper is written in C#.
http://bulletphysics.org/wordpress/
http://code.google.com/p/bulletsharp/
Thanks.
I haven't personally attempted to get multithreading working yet, but I'd recommend looking at page 42 in the user manual, as it points out where to look for examples. They're in C++, but it should help get you started, at the very least.

C# Lua Parser / Analyser

first things first;
I am writing a little LUA-Ide in C#. The code execution is done by an Assembly named LuaInterface. The code-editing is done by a Scintilla-Port & the RAD / UI Interface is via the extensible IDesignSurfaceExt Visual Studio (one way code generation). File handling is provided by a little sql-lite-db used as a project-package-file.
So all in all i've got everything i need together...
The only problem unsolved is the parser / lexer for lua. I do not want to load & execute the code! I just want to parse the String containing the Lua code and get some information about it like function and global vars. I really don't want to write the parser completly myself... (I hate regex - I get the wrong all the time ^^)
Anybody got a link to a .net lua parser lying around?
Just to clarify - I only want to analyse the code at this point - I dont wnat to run it!
Thanks in advance!
Corelgott
Just for the record:
I went with a comibination of:
http://irony.codeplex.com/ - A Language implementation Kit that can be adapted to parse several languages. (Btw. this one got virtually no ducumentation what so ever... So code-comments no docs... but lots of fun...)
and a customized version of
http://luairony.codeplex.com/ - the Lua Syntax for irony (added some degree error tolerance)
But I gotta admin, both are pretty heavy stuff... and you kind of open up a box of new problems as well as lots of possibilities...
Cheers, Corelgott
This SO question's responses may be helpful.
Easiest way to parse a Lua datastructure in C# / .Net
Incomplete but:
http://luairony.codeplex.com/
This isn't quite what you're after, but maybe half of it can provide half the answer.
It converts Lua to C, by parsing the Lua to an AST. You could then extract the info you need from the AST. It's written in Lua, but you already know how to call that :)
Have look here: Lua recipes for LPeg
Maybe you can use one - otherwise I would look at using the extended BNF from the documentation.

How to programmatically clear the Kerberos ticket cache

Does anyone know how to clear out the Kerberos ticket cache on the local computer - using managed \ unmanaegd code?
Thanks in advance!
I believe you need to do a call to LsaCallAuthenticationPackage using KERB_PURGE_TKT_CACHE_REQUEST after using either LsaConnectUntrusted or LsaRegisterLogonProcess. Sorry no specifics, but I don't have my code for this around...
The most simple way is to take the source code of Microsoft's KList (Included in the platform SDK\ Samples), and to do like them...
There is a "managed C#" example of purging kerberos tickets using pInvoke at https://github.com/ErtiEelmaa/StackOverflow/blob/master/GroupPolicyUtilities.cs
Way too long to copy/paste here. It took some time since structures in pInvoke were invalid(eg someone though C++ LONG is equal to C# LONG and yada-yada), however, I've tested this one, and it worked for me.
Also, I noticed that the Windows server 2003 klist.c has few bugs in PurgeTicket:
it does not clean up the response
it double-checks the same "RESULT", instead of checking "RESULT" and then "SUB-RESULT"
The simple, stupid way:
system("kdestroy");
Or if you want to be more legit, just check out the source of a kdestroy implementation. krb5_cc_destroy() seems to be the relevant function call.

C# Get the difference between two files and use it for incremental backup

I want to create my own incremental backup solution using C#. How can I obtain the difference between two files (version 1 and version 2 of ABC.TXT) and then update ABC.TXT version 1 with the difference? Would appreciate some hints! Thank you!
here are some articles to some diff algorithms explained in C#
Codeproject 1
Codeproject 2
Its not easy to get this algorithm right. I would suggest executing kdiff3 or some other good diffing tool in a background process rather than writing it yourself.
Here's something I just Googled, might be helpful as a starting point:
An O(ND) Difference Algorithm for C#
Do you really need incremental backup? Is there any reason why you can't just replace version 1 with version 2?
And as Jon pointed, probably you'd better use an already existing and tested backup solution.
I'm not sure as to how exactly you would replace the 'difference' text as that could get quite complex. But for the initial checking, you could compare the file sizes.
The link below might help you out:
http://dotnetperls.com/file-size

NOVAS for .NET

Any astronomers out there? I'm wondering if anyone has produced or stumbled upon a .NET (preferably C#) implementation of the US Naval Observatoru Vector Astrometry Subroutines (NOVAS).
I know nothing (of consequence) about astronomy, and absolutely nothing about NOVAS, so please take this with a grain of salt.
But, I did look at the website, and it looks like they have a C implementation. You could always take the C implementation, access it via pinvoke, and write a C# wrapper around it.
Are you only interested in a port of that library or anything usable from C# for astronomy?
I don't have anything for the first part, but for the second I would take a look at AGI's Components. Their libraries provide ways to compute all kind of astronomical data. The Dynamic Geometry Library lets you model everything including planets and such rather easily.
This download contains a very useful astronomical library in C#.
Sorry that I don't remember where I got it but perhaps it is documented in there somewhere.
http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=8399&lngWId=10
Sidenote: The NOVAS library is not very complete. You would be better off to pursue the SOFA lib from the International Astronomy Union. Here's the link:
http://www.iausofa.org/
Urania is an astronomy library in C#:
http://www.smokycogs.com/blog/tutorials/astronomical-calculations-in-c-sharp/
The download is the non-obvious "here" link on the page that combines all of the sample code into a single app called Urania.
Once downloaded, you will also need to modify the Urania.sln file to fix the paths of the different libraries that he uses (MathLib, UraniaLib, etc.) and then it will compile correctly. (Open Urania.sld in notepad and delete: "..\Libs\" out of the 3 project paths)

Categories