|
Dear Friends,
Thank you a lot.
Best Regards,
M. J. Jaya Chitra
|
|
|
|
|
I changed binary2Hex and Hex2Binary parts to make a bit more efficient
I am using the code above at the moment, it is trusted to be worked.
private string HexToBinary(string hexString)
{
string binaryval = String.Empty;
for (int i = 0; i < hexString.Length; i = i + 2)
{
binaryval += Convert.ToString(Convert.ToInt32(hexString.Substring(i, 2), 16), 2).PadLeft(8, '0');
}
return binaryval;
}
private string BinaryToHex(string binString)
{
string hexval = String.Empty;
for (int i = 0; i < binString.Length; i = i + 8)
{
hexval += Convert.ToString(Convert.ToInt32(binString.Substring(i, 8), 2), 16).PadLeft(2, '0');
}
return hexval;
}
private string XORStrings(string s1, string s2)
{
string bin1 = HexToBinary(s1);
string bin2 = HexToBinary(s2);
string result = String.Empty;
for (int i = 0; i < bin1.Length; i++)
{
if (bin1[i] == bin2[i])
result += "0";
else
result += "1";
}
return BinaryToHex(result);
}
|
|
|
|
|
You could convert them to bytes (or ints, or longs, will be faster but you'd have to pad)
Then xor and convert back. Converting hex string into/from ints is pretty fast.
I wouldn't expect "manually" xorring (on characters) to be faster.
|
|
|
|
|
I am attempting to write some code that will execute one of my EXE's from another project.
This other EXE file uses an INI file which is located in the same folder as the exe itself.
But when I run the exe file using C# code, the exe creates a new default INI file here: C:\Documents and Settings\UserName\Local Settings\Application Data\Temporary Projects\KeepAlive\bin\Debug (this is the projects directory)
How do I execute an exe in code asif it was simply a shorcut being double-clicked on the desktop?
I have tried the following:
Process.Start(@ApplicationFullPath);
string str = (@ApplicationFullPath;
Process process = new Process();
process.StartInfo.FileName = str;
process.Start
Both of these solution had the same problem.
|
|
|
|
|
and what is the path of the .exe you want to execute?
|
|
|
|
|
"C:\Program Files\Company\ApplicationPath"
|
|
|
|
|
so just to clarify.
you have an apllication in C:\..\Application that you want to launch an applciation in C:\..\keepAlive\Bin\Debug. The application in debug is supposed to create an INI file in its location but instead it creates it in the location of the application that is loading it? (LOL maybe not so clear)
|
|
|
|
|
Application A -> Located in Program Files, uses a INI file in it's "home directory" (Creates a default INI if none exists)
Application B -> VisualStudio Project has code to startup application A, however, when B starts A, A looks for this INI file in Documents & Setting in the path where Application B's debug binaries etc are located. It doesn't find it and creates a default INI, but not in Program Files.
|
|
|
|
|
Thats because when B starts A, A's startup path is set to B's home directory. Use the following algorithm in B to start A:
1. Change the directory where A resides.
2. Start A
This should solve your problem.
Excuse me for buttin' in, but I'm interrupt driven.
|
|
|
|
|
How do I change the Directory where A resides? A is perfect where it is, I'm not sure what you mean...
|
|
|
|
|
i assume app A uses applicationStartupPath to find where to put the INI, which when started from App B becomes the startup path of App B instead of where it was executed from.
You could try passing a parameter to application A that tells it its startup path, but you would need to Modify App A to handle the parameter.
Something like a global variable with the startupPath, then if paramter is present set it to the passed paramter otherwise use the Application.StartupPath when no paramter is passed
|
|
|
|
|
|
How secure is this code, I have a web app that checks someone security level?
is it possible from a user to change int LocalStatus = 5 to int LocalStatus = 6?? (for example)
protected void btnUpdateStatus_Click(object sender, EventArgs e)
{
try
{
int LocalStatus = 5;
if (LocalStatus >= Profile.UserPermissionLevel)
{
object values = gvRasiedECN.GetRowValues(gvRasiedECN.FocusedRowIndex, new string[] { "OID" });
ENG_UpdateECN UpdateECN = new ENG_UpdateECN(Profile.UserID, Convert.ToInt32(values),"meh");
}
}
catch(Exception ea)
{
ErrorLog = new ErrorLog (ea.ToString(), "PageName");
}
}
|
|
|
|
|
As the '5' is hardcoded and i assume stored on server i wouldnt think a user would be able to access without the source code or source data
|
|
|
|
|
Hello,
Can you recommend any PDF creation library in C sharp. There are several at codeproject but most of them have bug reports in messages and aren't supported.Does anyone have any experience with any PDF libraries in .NET?
|
|
|
|
|
|
PDFNet is very use full for pdfcreation ,editing ,drawing ,etc
Sanjoy Bagchi
S/W Engineer
|
|
|
|
|
|
|
|
I once encountered similar problem. I deleted the solution's user option file. It's usually located it the same directory as your solution file. It's hidden by default and has the same name as your solution file, but with ".suo" extension. I'm using VS2005.
Excuse me for buttin' in, but I'm interrupt driven.
|
|
|
|
|
helo.. i have a windows service running is there any code to capture the keystrokes from the user ... thans...
|
|
|
|
|
max.4u wrote: helo.. i have a windows service running is there any code to capture the keystrokes from the user ... thans...
First, tell us why do you need to do that?
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
i am writing a serivce for the child safe internet access... when the service gets through any prohibited words or sentences then it should end a mail to the users.... so i need to capture the keystrokes.....
|
|
|
|
|
Write a webbrowser with that built-in.
|
|
|
|