|
Hi,
That is a lot of code already, without much being achieved.
You do not really have to test for identical files, same length, etc; if the data comparison is present and correct, that would generate the right result anyway; checking for identical files and same length, are optimisations that initially will make your testing more difficult. I suggest you concentrate on the heart of the matter first.
You probably don't need FileStreams at all.
Assuming both files are text files, you could use File.ReadAllLines() twice, then sort both arrays, and compare the two arrays.
Assuming the lines are in a fixed order (maybe the filenames are ordered alphabetically) you could even just use File.ReadAllText().
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
how to create a set up file for a project
|
|
|
|
|
You can create a new setup project in VS 2005.
Include the project you would like to create a setup file for. Add the dlls to dependency and then Build it.
|
|
|
|
|
- right click on your newly created setup project
- go to View -> File System
- you'll see a new opened window
- right click on Application Folder -> Add -> Project Output
- select the project and Primary Output
Calin
|
|
|
|
|
You can also use Inno Setup here[^]. It's a free installer for Windows programs with nice feature set and good stability.
|
|
|
|
|
Dear All,
I have an application which is reading a datagram from the client.
If the bytes to be read is greater that are equal to the byte sent, then it is working fine.
But my requirement is to read the data by 10 bytes at a time or specific bytes configured by the user.
I don't know how to achieve this.
The code used is:
private void OnReceive(IAsyncResult ar)
{
try
{
IPEndPoint ipeSender = new IPEndPoint(IPAddress.Any, 0);
EndPoint epSender = (EndPoint)ipeSender;
int aCount = serverSocket.EndReceive(ar);
Data msgReceived = new Data(byteData);
string aReadData = System.Text.ASCIIEncoding.ASCII.GetString(byteData, 0, aCount);
int aPacketEnd = aReadData.LastIndexOf("|");
if (aPacketEnd == -1)
{
aPacketEnd = aReadData.LastIndexOf('\0');
}
if (aPacketEnd != -1)
{
string aValidData = System.String.Empty;
string aPacketData = System.String.Empty;
if (myBuffer.Length > 0)
{
aValidData = System.Text.ASCIIEncoding.ASCII.GetString(myBuffer);
}
if (aPacketEnd < aCount - 1)
{
myBuffer = new byte[aCount - (aPacketEnd + 1)];
System.Buffer.BlockCopy(byteData, aPacketEnd + 1, myBuffer, 0, aCount - (aPacketEnd + 1));
}
else
{
myBuffer = new byte[0];
}
System.Threading.Thread.Sleep(100);
byte[] message = new byte[10];
serverSocket.BeginSendTo(message, 0, message.Length, SocketFlags.None, epSender,
new AsyncCallback(OnSend), epSender);
byte []byteData = new byte[10];
serverSocket.BeginReceiveFrom(byteData , 0, byteData.Length, SocketFlags.None, ref epSender,
new AsyncCallback(OnReceive), epSender);
}
else
{
byte[] aTempArray = new byte[myBuffer.Length];
System.Buffer.BlockCopy(myBuffer, 0, aTempArray, 0, myBuffer.Length);
myBuffer = new byte[aTempArray.Length + (aCount)];
System.Buffer.BlockCopy(aTempArray, 0, myBuffer, 0, aTempArray.Length);
System.Buffer.BlockCopy(byteData, 0, myBuffer, aTempArray.Length, aCount);
byteData = new byte[0];
byteData = new byte[10];
serverSocket.BeginReceiveFrom(byteData, 0, byteData.Length, SocketFlags.None, ref epSender,
new AsyncCallback(OnReceive), epSender);
}
}
catch (Exception ex)
{
IPEndPoint ipeSender = new IPEndPoint(IPAddress.Any, 0);
EndPoint epSender = (IPEndPoint)ipeSender;
byteData = new byte[10];
serverSocket.BeginReceiveFrom(byteData, 0, byteData.Length, SocketFlags.None, ref epSender,
new AsyncCallback(OnReceive), epSender);
}
}
As the datagram sent may be very larger too, so that time I have to limit my reading.
Another important point is to send an ACK when the data transfer is completed. The start and end of the transmission is identified by the character "|".
Can any one help me to get rid of this?
Thanks a lot in advance.
Best Regards,
M. J. Jaya Chitra
modified on Thursday, February 19, 2009 6:58 AM
|
|
|
|
|
Hello,
How can I read a line in PDF, a specific emplacement (ex a square) is in this square you read the line of characters line by line, thank you very much.
|
|
|
|
|
|
I don't find how we read from file pdf, thank you verry mutch
|
|
|
|
|
Have you actually followed the links, read the articles and tried any of it? The second link seems to present a way.
|
|
|
|
|
Hi folks,
Is there any weatherforecating service come with webservice at free of cast? if you know please help me. Mainly that webservice should not change its resultset format frequently.
friendly,
ranandbe
|
|
|
|
|
|
Hello,
I used to use 3rd party installer (wizard based) for my applications and today I was interested to study the Visual Studio Setup Project so that I can use my C# skill to build install time Dialogs, Forms , etc and so on. But when I started learning the Setup Project, I found it is just another kind of advanced Wizard but nothing else. I cannot add Windows Forms, run C# codes. Although I found how to add dialogs and those dialogs are prebuilt, I can just change some values. So, my question is, Why it is like this ? Am I missing something ? Is it not possible for a C# developer to build the installer by his own way using his own Windows Forms, etc ? May be it is possible, but then I will have to create another stand along Windows Application which will be the installer but not using Setup Projects, right ?
Please advice.
Regards
Emran
|
|
|
|
|
It is possible to customize the installer. You may edit the dialogs, add registry keys, deployment files, and most important, custom actions. You need to extend the Installer and override some methods like: Install, OnCommitting, Rollback...so, you may add your C# code here.
Also, in these custom actions you may use the input values from the dialogs fields.
For more customizations related to UI dialogs, use Orca application, which let's you edit the resulted MSI.
Calin
|
|
|
|
|
Also have look at this articles part1[^] and part2[^]. Especially part2 shows some cool customization methods.
|
|
|
|
|
hello all.
m working on windows application uses web services to insert and retreave data
what m trying to do when the application call web service a thread splash screen appear , i did it fine but sometime i get unhandeled exception : "Thread was being aborted" how can i overcome this problime ?
thanks in advance
My Code:
Users user = new Users();//web service
LoadingIndicator.ShowLoading();
int employeeId = user.Login(userName, passWord);
LoadingIndicator.HideLoading();
class LoadingIndicator
{
static Thread LoadingThread;
public static void ShowLoading()
{
LoadingThread = new Thread(new ThreadStart(DoShowSplash));
LoadingThread.Start();
}
public static void HideLoading()
{
try
{
if (LoadingThread.IsAlive)
LoadingThread.Abort();
}
catch (ThreadAbortException ex)
{
Thread.ResetAbort();
}
}
private static void DoShowSplash()
{
frmLoading frm = new frmLoading();
frm.ShowDialog();
}
}
|
|
|
|
|
I am working a desktop application ,in which i using web control and fill auto user id and password and it is filled .so i want to auto Login. please give me a idea how i click event fire .eg www.mail.yahoo.com
Usewrid=abc
password=***
Sign In (button)
adilkhan
|
|
|
|
|
but yahoo already has a feature to keep the user signed in, so you dont need to logon each time...
If only MySelf.Visible was more than just a getter...
A person can produce over 5 times there own body weight in excrement each year... please re-read your questions before posting
|
|
|
|
|
actually there is a web control .i also got this in this site.
http://www.codeproject.com/KB/recipes/Automatic_Login.aspx
adilkhan
|
|
|
|
|
Hi,
Currently i am developing a client server application in c#. I am using socket for communication. With compare to remoting and WCF, is it socket is better?.. or which is good. How can i convert socket to WCF or Remoting?
Thankyou,
Yesuprakash
|
|
|
|
|
It really depends on the situation. I have never used WCF, but sockets is semi-hard to use, but is the fastest and lowest bandwidth, but you do all the work codewise. Remoting packages it up and opens it back up for you, but has lots of overhead with the XML stuff and conversions...
Remoting can be perfectly acceptable is MANY applications, but time-critical packets like those for a video game need faster than remoting provides.
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
I have two data grids on a windows form.........
On double-clicking a row on first datagrid i want that row grid should get copied onto the second data grid under new auto incremented row number........
can any one help please
regards
|
|
|
|
|
Identify the row
Create a new row in the target table
copy each field into the new row
save the target table to get the ID
OR
clone the selected row
add cloned row to target table.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
You select the row using itemindex and pick that row using this itemindex to select the row of the datasource(should be a dataset) and then add that row to the datasource of the second dataset and the bind it again.
|
|
|
|
|
I have an XML file which contains "
"
While using the Load or LoadXML function of XMLDocument class, "
"
is converted to "\r\n".I just want to retain as "
" while loading the document.Is there a way to do that?
|
|
|
|
|