|
Uhhh.. you're either asking how to write an 8086 emulator or your looking to write an app in Intel Assembly Language. I really can't tell which.
In either case, the required discussion would fill entire books. WAY too much information for a couple of forum posts.
|
|
|
|
|
Here[^] is an article that seems to explain things rather well, I didn't test it however I do expect it to work properly, even with Visual Studio C++ Express. What it doesn't say is you will be getting some build errors, unless you move some switches away from their default values. Trial and error will be involved.
[ADDED]
ML.exe may already be present in C:\Program Files\Microsoft Visual Studio 9.0\VC\bin
Now how is this a C# question?
[/ADDED]
modified 22-Oct-11 19:41pm.
|
|
|
|
|
Luc Pattyn wrote: Now how is this a C# question?
From what it sounds like, and I'm still wondering about it, he might be wanting to have some 8086 (why an old 8086, maybe meant 80x86) Assembly code get called from C#. Like Dave's post, who knows for sure.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
Nah. Calling an assembly function is too easy: just call it like you would call a regular C/C++ function, i.e. using P/Invoke, and make sure to have the calling conventions declared correctly.
We'll know what he really wants tomorrow. Or later. Or not at all. Who knows?
|
|
|
|
|
Luc Pattyn wrote: just call it like you would call a regular C/C++ function, i.e. using P/Invoke, and make sure to have the calling conventions declared correctly
It's pretty easy, too. But again, who knows what his real requirements are.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
Hi there, i'm really in need of a convertor to convert unicode character map to iran system charachter map
Please Help!
|
|
|
|
|
I don't know what the Iranian character set is but assuming it is a 256 character set a bit like the western one you can have a static map which specifies what Unicode code point each Iranian byte index represents. Then you can look up Unicode code points in that map, converting anything that isn't found to a ?.
|
|
|
|
|
I just had a look and this is a really interesting question.
There are a few encoding in .NET that might be derived from the 'Iran System encoding standard'
But they don't appear to be as described in the Wikipedia page[^].
708: Arabic (ASMO 708) - different
720: Arabic (DOS) - different
864: Arabic (864) - different
1256: Arabic (Windows) - different
10004: Arabic (Mac) - not found
20420: IBM EBCDIC (Arabic) - not found
28596: Arabic (ISO) - different
I thought it would be fun to try to write it then:
class IranianSystemEncoding
{
static char[] ByteToChar;
static Byte[][] CharToByte;
static IranianSystemEncoding()
{
InitializeData();
}
static void InitializeData()
{
var iranSystem = new int[] { 0x06F0, 0x06F1, 0x06F2, 0x06F3, 0x06F4, 0x06F5, 0x06F6, 0x06F7, 0x06F8, 0x06F9, 0x060C, 0x0640, 0x061F, 0xFE81, 0xFE8B, 0x0621, 0xFE8D, 0xFE8E, 0xFE8F, 0xFE91, 0xFB56, 0xFB58, 0xFE95, 0xFE97, 0xFE99, 0xFE9B, 0xFE9D, 0xFE9F, 0xFB7C, 0xFB7C, 0xFEA1, 0xFEA3, 0xFEA5, 0xFEA7, 0x062F, 0x0630, 0x0631, 0x0632, 0x0698, 0xFEB1, 0xFEB3, 0xFEB5, 0xFEB7, 0xFEB9, 0xFEBB, 0xFEBD, 0xFEBF, 0x0637, 0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510, 0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567, 0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580, 0x0638, 0xFEC9, 0xFECA, 0xFECC, 0xFECB, 0xFECD, 0xFECE, 0xFED0, 0xFECF, 0xFED1, 0xFED3, 0xFED5, 0xFED7, 0xFB8E, 0xFB90, 0xFB92, 0xFB94, 0xFEDD, 0xFEFB, 0xFEDF, 0xFEE1, 0xFEE3, 0xFEE5, 0xFEE7, 0x0648, 0xFEE9, 0xFEEC, 0xFEEB, 0xFBFD, 0xFBFC, 0xFBFE, 0x00A0 };
ByteToChar = new char[256];
for (int i = 0; i < 128; i++) ByteToChar[i] = (char)i;
for (int i = 128; i < 256; i++) ByteToChar[i] = (char)iranSystem[i - 128];
CharToByte = new Byte[256][];
for (int i = 0; i < 256; i++)
{
char ch = (char)ByteToChar[i];
var low = ch & 0xff;
var high = ch >> 8 & 0xff;
var lowCharToByte = CharToByte[high];
if (lowCharToByte == null)
{
lowCharToByte = new Byte[256];
CharToByte[high] = lowCharToByte;
}
lowCharToByte[low] = (byte)(i);
}
}
public static String GetString(byte[] bytes)
{
var sb = new System.Text.StringBuilder();
foreach (var b in bytes)
{
sb.Append(ByteToChar[b]);
}
return sb.ToString();
}
public static Byte[] GetBytes(string str)
{
var mem = new System.IO.MemoryStream();
foreach (var ch in str)
{
var high = ch >> 8 & 0xff;
var lowCharToByte = CharToByte[high];
Byte res = 0;
if (lowCharToByte != null)
{
var low = ch & 0xff;
res = lowCharToByte[low];
}
if (res == 0) res = 0xff;
mem.WriteByte(res);
}
return mem.ToArray();
}
}
I have not clue if it works or not. My visual studio get confused with left and right when I try to put some of those characters in the source.
This was good fun though.
I posted this into [Tips] for reference.
|
|
|
|
|
I don't think there is a direct way to do this, from the brief research I did it looks like the Iran System is obsolete, though that doesn't help your problem.
My advices is to create a Map which maps the numeric value of the Iranian System to the numeric equivalent in Unicode and vice versa. This isn't a huge problem but:
- There isn't a map type in .net, which is a pity. You can fudge it a few ways, I've done it via dictionary (it is close with key/value instead of "key"/"key"), there is a discussion here[^]
- Entering the numberic values by hand in code or config or somesuchis error prone.
This[^] should help as there is a [almost] copy and paste value mapping
Internationized text is a real pain (as I'm learning to my cost), it is even worse for right-to-left languages such as Farsi.
|
|
|
|
|
Hello everyone!
What i want to do is to make an animation of a female character that appears on SCREEN and does everything it was supposed to do during animation.
The MAIN problem that i have no idea how to do this on the screen, without any borders of audio/video player. Closest EXAMPLE is VHGD aka VirtuaGirl player - girls walk on your screen without any border of the player (my version is NOT porn, it is rather gift).
Animation will be done by myself, all i ask is how to make it look like a VHGD.
How can i perform this using C# or any 3rd party libraries/ect?
modified 23-Oct-11 3:51am.
|
|
|
|
|
...That pretty much says it all:
private void SetValue(object instance, PropertyInfo property, object data)
{
if(property.PropertyType.IsAssignableFrom(data.GetType()))
property.SetValue(instance, data, null);
else
{
if(data is int)
{
int? unboxed = (int?)data;
property.SetValue(instance, unboxed, null);
}
else
property.SetValue(instance, Convert.ChangeType(data.ToString(), property.PropertyType), null);
}
I have an object that has a property of type long? and the value "1" cannot be pushed into it.
The failure is inside the "if(data is int)" branch.
"Object of type 'System.Int32' cannot be converted to type 'System.Nullable '1[System.Int64]'
How do I go about getting a System.Int32 into a System.Nullable [System.Int64] ??
"I need build Skynet. Plz send code"
|
|
|
|
|
omg...the int? is still boxed, isn't it
"I need build Skynet. Plz send code"
|
|
|
|
|
if((property.PropertyType ==(typeof(long))) || ((property.PropertyType == (typeof(long?)))))
{
long converted;
if(Int64.TryParse(data.ToString(), out converted))
property.SetValue(instance, converted, null);
}
Money
"I need build Skynet. Plz send code"
|
|
|
|
|
I have a static class that requires a delegate. A delegate should not be static and cant be fine. However a static class requires the variable and methods be static; There for how do I declare a delegate within the class?
e.g.
public delegate void currentBalance(int value);
public static DoSomething()
{
do something...
balance = 10;
currentBalance(balance);
}
Any Help more than welcome.
Thanks
dotman1
|
|
|
|
|
ok worked it out forgot to pass the delegate to the method.
dotman1
|
|
|
|
|
My application experiences the problem where occasionally, two packets appear to arrive out of order. Since I'm using TCP, this must be impossible at the protocol level, so I think the problem must lie with my implementation of the async model.
The pseudo code of my implementation is below. Are there any general pointers someone can mention that might be wrong with my model?
Is there anything wrong with issuing subsequent reads directly from the read-completion handler?
Begin Read
Issue asynchronous read
if Read completes synchronously, directly call Read Completion function
Read Complete Function
call EndRead to determine number of bytes read
write receive buffer to my stream
process stream
call Begin Read to issue another read
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Post a simplification of the actual implementation; pseudo-code is almost always correct and useless in debugging-attempts.
Bastard Programmer from Hell
|
|
|
|
|
I don't see anything wrong with your basic implementation.
Richard Andrew x64 wrote: Is there anything wrong with issuing subsequent reads directly from the read-completion handler? Hmmm... I don't think so, but you might consider signaling an event or posting an async operation: http://msdn.microsoft.com/en-us/library/system.componentmodel.asyncoperation.post.aspx[^]
If your actions inspire others to dream more, learn more, do more and become more, you are a leader." - John Quincy Adams You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering” - Wernher von Braun
|
|
|
|
|
How exactly are you determining that they are "out of order"?
|
|
|
|
|
To be more precise, instead of saying the packets are out of order, I'll say that the receives are completing out of order.
I'm using a log file to record each packet as it is processed by the completion routine.
I have a receive buffer of 1024 bytes, and the full message is about 7200 bytes. When one of the receives is processed out of order, the message becomes corrupted and the deserialization fails.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Some possibilities.
You are ignoring the read count.
You are not reading the entire set of data.
What is arriving is 'incorrect' (thus the sender is the problem.)
You don't have an actual size so you are hoping that 'about 7200' can be figured out via deserialization and that isn't a good idea.
|
|
|
|
|
Thanks for your thoughts. I was able to solve the issue for now by using a variable-length receive buffer.
I calculate how many bytes are left in the message, and adjust the buffer to be big enough to handle it in one go. That way, there is no chance for anything to get out of order.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Hello all,
While working on a project that emails files with international filenames, I've come across an unusual issue. if I attach with a US-ASCII filename only, I can get better than 200 characters long without errors.
If I include an extended character, it encodes in UTF-8 and the length before it gets funky is very small (< 40 characters). To define funky.. here's an example filename after it goes bad:
=utf-8BSU5GT1JNw4FUSUNBX0ltcGFjdF9Bc3Nl
it looks like UTF8 encoded string with a UTF-8 decoding instruction or a mime boundary... not sure which.
Has anyone seen this before -- and what are the rules / limitations of filenames -- I tried emailing the file by hand through outlook and it handles it, so I don't think it is a MIME specific limitation.
Sample code:
class Program
{
private const string DOMAIN = "foobar.com";
private const string SMTPHOST = "mail." + DOMAIN;
private const string FROM = "chadwick.posey@" + DOMAIN;
private const string TO = FROM;
static void Main(string[] args)
{
MailMessage msg = new MailMessage(FROM, TO, "Subject", "Body");
string path = Path.GetTempPath();
string name = "AAAAAA_AAAAAAAAAAAA_AAAAAAA_AAAA - IIIIIII CCCCCCCCCC DD IIIIIIÁIIII_20111018_091327.pptx";
File.WriteAllText(path + "\\" + name, "blah");
Attachment att = new Attachment(path + "\\" + name, new ContentType("application/vnd.openxmlformats-officedocument.presentationml.presentation"));
msg.Attachments.Add(att);
SmtpClient client = new SmtpClient(SMTPHOST, 25);
client.Send(msg);
}
}
I've tried (so far) -- setting the encoding for the attachment.NameEncoding to UTF8 and UTF32, neither worked. Setting the ContentDisposition.FileName on the attachment fails because it is not using US-ASCII characters only.
Any suggestions on how to get it to include the full filename with the accent / extended characters in tact?
Thanks
Chadwick
=============================
I'm a developer, he's a developer, she's a developer, Wouldn't ya like to be a developer too?
|
|
|
|
|
Chadwick Posey wrote: and what are the rules / limitations of filenames
Long filenames under Windows can be upto 255 UTF16 characters. (Source[^])
Lots of older apps (and drivers) will still be using the MAX_PATH value and coding everything in ASCII, cutting back your effective storage-space.
Chadwick Posey wrote: Any suggestions on how to get it to include the full filename with the accent / extended characters in tact?
Is it an option to archive the files in a ZIP-file and to attach that? I'm not sure whether it would work, but it'd be the first alternative that I'd go for.
Bastard Programmer from Hell
|
|
|
|
|
I will definitely look into that... optimally I'd like to send the bare file with the name intact, but this will be my last resort option I think.
I figured even if the filename length was 255 with single byte characters, that it would support 128 or so with double byte characters, but it is significantly less... I think at 36 characters (72 bytes) it starts exhibiting the strange behavior... I'm wondering if the whole MIME-wrapping thing (I think the mime source is limited to 75 characters wide or something) is throwing something off if it is in UTF-8.
Thanks
Chadwick
=============================
I'm a developer, he's a developer, she's a developer, Wouldn't ya like to be a developer too?
|
|
|
|
|