|
Hello XSockets.NET,
I am newbie, I am installing XSocket by command: Install-Package XSockets (http://xsockets.net/docs/video-tutorials), It complete. But, I can not see CodeTemplate folder in project
(I am using Package Manager Console Host Version 2.8.50126.400, VS 2010 SP1).
Please help me, how to show CodeTemplate folder???
|
|
|
|
|
If it has successfully installed the package, left click on the project that you have installed it into. Select the Project menu and then Show all files... If the folder is shown in the project now, open it up and right click on the files in there - choose Include in project
|
|
|
|
|
I have developed a c# application and when I tried to install it I figured out that some users don't have framework installed on their computers and for some business constraints they can't install it.
Is there a tool to convert my c# application to native one to be able to work on clean machines with out installing framework ?
|
|
|
|
|
Native code? Why?? There's no point to it.
If you want to avoid the .NET Framework, you have to spend some big'ish money. The only compiler I know of is not free, called Salamander[^]. It costs about $1300 per developer using it and it hasn't been updated since 2007.
Warning: Linking in the .NET Framework is NOT supported will result is HUGE executables!
|
|
|
|
|
What? You don't like 500Mb .EXE files? Luddite!
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
|
|
|
|
|
After a couple of herniated disks, I was told by my doctor that I can't do any heavy lifting. So I can't generate a 500MB executable anymore.
|
|
|
|
|
My doctor said the same thing so now I have to sit to urinate.
|
|
|
|
|
|
The basic .NET framework comes with Windows, and there is no business reason not to install the latest updates. Trying to convert a .NET application to native, would mean a complete rewrite in C++ possibly with MFC.
Veni, vidi, abiit domum
|
|
|
|
|
To add to Dave's answer, there is also this: http://spoon.net/studio?gclid=CJOjsY-mxrwCFYjLtAodoCIA8A[^] - but at $4800 per application, it's a tad expensive as well...
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
|
|
|
|
|
If they have Windows the chances are that they will have a version of the .NET framework installed.
Lots of software uses the .NET framework nowadays, so it's really just a case of how long you can put off installing it if you have a WIndows machine rather than not installing it.
Generally the 'I don't want to install the .NET framework " crowd don't understand what the .NET framework is.
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
|
http://msdn.microsoft.com/en-us/library/aa326741%28v=vs.71%29.aspx[^]
//I WAS READING FROM THE ABOVE MICROSOFT LINK ABOUT CONVERTING //FROM BYTE TO TO DECIMAL IN C#, BUT I AM JUST NOT GETTING MY ////CODE TO WORK. I AM TRYING TO CONVERT AN ARRAY OF BYTES TO AN //ARRAY OF DECIMALS. THIS IS WHAT I AM DOING..PLEASE KINDLY SEE //BELOW.
<pre>using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Applica
{
class Program
{
static void Main(string[] args)
{
long Totbyte = 0;
string filePath = null;
DirectoryInfo da = new DirectoryInfo("C:\\Folder");
FileInfo[] Arr = da.GetFiles();
foreach (FileInfo ap in Arr)
{
Totbyte = ap.Length;
filePath = ap.FullName;
}
string temPath = Path.GetTempFileName();
byte[] data = new byte[Totbyte];
if (File.Exists(temPath))
{
data = File.ReadAllBytes(filePath);
File.WriteAllBytes(temPath, data);
}
decimal decVal;
int[] arry = new int[Totbyte];
for (int count = 0; count < data.Length; count++)
{
arry[count] = decimal.GetBits((data[count])decVal);
Console.WriteLine("Byte to Decimal = {0},,,,,, count = {1}", arry[count], count);
}
}
}
}
|
|
|
|
|
You don't have an array of decimals. You have an array of ints. Also, I'm pretty sure this was answered in the thread below, and the answer is much simpler than anything you've been trying to do.
|
|
|
|
|
I tried using an array of decimal and it still does not work. Also the question i ask this morning was about Bitconverter. There is no Bitconverter in this question. You keep saying you don't know what I am trying to do. I think it is pretty obvious that i am having trouble converting from byte to decimal. This is what I am trying to do.
|
|
|
|
|
computerpublic wrote: i am having trouble converting from byte to decimal. Ok, good. That's a pretty clear description. Here you go:
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Applica
{
class Program
{
static void Main(string[] args)
{
long Totbyte = 0;
string filePath = null;
DirectoryInfo da = new DirectoryInfo("C:\\Folder");
FileInfo[] Arr = da.GetFiles();
foreach (FileInfo ap in Arr)
{
Totbyte = ap.Length;
filePath = ap.FullName;
}
string temPath = Path.GetTempFileName();
byte[] data = new byte[Totbyte];
if (File.Exists(temPath))
{
data = File.ReadAllBytes(filePath);
File.WriteAllBytes(temPath, data);
}
decimal[] arry = new decimal[Totbyte];
for (int count = 0; count < data.Length; count++)
{
arry[count] = data[count];
Console.WriteLine("Byte to Decimal = {0},,,,,, count = {1}", arry[count], count);
}
}
}
}
That's what you meant, right?
|
|
|
|
|
Your answer worked very well. I think I was over complicating the problem. Anyway thank you very much for your help.
|
|
|
|
|
You are correct. I did ask the question improperly. I do have one final question:
In a file transfer OUT: Does LSB of the FIRST byte transfer out before MSB? Followed by the LSB of the SECOND byte, then the MSB? Followed by the LSB of the LAST byte , then the MSB?
In a file transfer work the same way when I file comes IN?
|
|
|
|
|
The bytes in a file are exactly what they are, the bits of those bytes are not mixed in weird ways.
|
|
|
|
|
 //I AM TRYING TO REVERSE THE PROCESS OF BYTE TO DECIMAL CONVERSION WHICH WAS SUCCESSFUL. I THOUGHT THAT REVERSING THE CODE WOULD REVERSE THE PROCESS AND DECIMAL TO BYTE CONVERSION, BUT IT IS NOT WORKING.
<pre>using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Applica
{
class Program
{
static void Main(string[] args)
{
long Totbyte = 0;
string filePath = null;
DirectoryInfo da = new DirectoryInfo("C:\\Folder");
FileInfo[] Arr = da.GetFiles();
foreach (FileInfo ap in Arr)
{
Totbyte = ap.Length;
filePath = ap.FullName;
}
Console.WriteLine("Total Bytes = {0} bytes", Totbyte);
string temPath = Path.GetTempFileName();
byte[] data = new byte[Totbyte];
if (File.Exists(temPath))
{
data = File.ReadAllBytes(filePath);
File.WriteAllBytes(temPath, data);
}
decimal[] arry = new decimal[Totbyte];
for (int count = 0; count < data.Length; count++)
{
arry[count] = data[count];
}
byte[] data2 = new byte[Totbyte];
for (int count = 0; count < arry.Length; count++)
{
data2[count] = arry[count];
}
FileStream file = new FileStream(filePath, FileMode.Create);
BinaryWriter binarystream = new BinaryWriter(file);
binarystream.Write(data2);
binarystream.Close();
}
}
}
|
|
|
|
|
 Follow the error message. It tells you what to do. But I'm a nice guy (well, sometimes), so here you go:
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Applica
{
class Program
{
static void Main(string[] args)
{
long Totbyte = 0;
string filePath = null;
DirectoryInfo da = new DirectoryInfo("C:\\Folder");
FileInfo[] Arr = da.GetFiles();
foreach (FileInfo ap in Arr)
{
Totbyte = ap.Length;
filePath = ap.FullName;
}
Console.WriteLine("Total Bytes = {0} bytes", Totbyte);
string temPath = Path.GetTempFileName();
byte[] data = new byte[Totbyte];
if (File.Exists(temPath))
{
data = File.ReadAllBytes(filePath);
File.WriteAllBytes(temPath, data);
}
decimal[] arry = new decimal[Totbyte];
for (int count = 0; count < data.Length; count++)
{
arry[count] = data[count];
}
byte[] data2 = new byte[Totbyte];
for (int count = 0; count < arry.Length; count++)
{
data2[count] = (byte)arry[count];
}
FileStream file = new FileStream(filePath, FileMode.Create);
BinaryWriter binarystream = new BinaryWriter(file);
binarystream.Write(data2);
binarystream.Close();
}
}
}
By the way, may I ask what this is for? Converting all the bytes of a file to decimals is a pretty weird thing to do. I have a gut feeling there might be a nicer solution.
|
|
|
|
|
I did figure out the casting (byte) from one of my books.
Also filePath (FileStream file = new FileStream(filePath, FileMode.Create)) did not work. I had to replace filePath with an actual path. When I open the file, it was looked like garbage. It was not the same file that I started with. It got corrupted at some point.
What is it for: Well it is a very long story and really don't mind sharing my thoughts after I prove my theory. I would be more than happy to explore a nicer, shorter, more stream line and robust solution. Please assist.
|
|
|
|
|
You might be interested in File.WriteAllBytes(path, bytes) to making writing them back a little simpler.
computerpublic wrote: When I open the file, it was looked like garbage. It was not the same file that I started with. It got corrupted at some point. Is that with the code I posted? Or else, with what code?
|
|
|
|
|
My first idea was to use WriteAllBytes, but books did not talk about it. And the online resources did not show me properly how to code it. I found the other solution which i used, but I am getting garbage. Can you please show me how to make it work?
|
|
|
|
|
It should work without special effort. Did you verify that the bytes you give it are OK?
|
|
|
|
|
computerpublic wrote: You keep saying you don't know what I am trying to do. I think it is pretty obvious that ...
Of course it's obvious to you - you're the one who's having the problems. The trick is to clearly explain the problem to someone else, remembering that we can't see your screen, access your hard-drive, or read your mind.
None of the questions you've posted in the last couple of days have had a clear explanation of what you're trying to do. They've mostly been code-dumps with a few cryptic comments along the lines of "this line doesn't work". The code you've posted doesn't seem to make any logical sense, because you haven't explained what you're trying to do.
The code you posted in this question is almost identical to the code you posted in the question below[^]. It seems you either didn't read Pete's answer, or you didn't understand it, because now you're just calling a random method and trying to assign the result to an incompatible type. Reposting a virtually identical question whilst ignoring the previous answers is not a good way to get people to help you!
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|