|
well i assumed it was 16 bit values
My opinion is... If someone has already posted an answer, dont post the SAME answer
|
|
|
|
|
Finding and writing the string to and .EXE file is only one problem. The other problem is that you can't modify an .EXE file if it's currently running. You'll need a second app that takes the parameters and waits for the main .EXE to end, then it can modify the .EXE.
Though, this really isn't a good idea since it's not "version agnostic". If you make a small change to the code and recompile into a new .EXE, the string can very easily change position in the file.
Oh! And if the resulting .EXE is signed with a digital signature, you'll break the security envelope around the .EXE and the code won't run since it will no longer be trusted by the .NET CLR.
|
|
|
|
|
So, instead of my writing into EXE idea. What can I do to change a variable within the application and keep that variable same after I restarted it?
By the way. As an extra idea, how can I make an application which creates another exe from itself with modifying a variable or value of itself?
I have looked for it in Google. But I haven't find satisfactoring answers to my questions.
|
|
|
|
|
SimpleData wrote: So, instead of my writing into EXE idea. What can I do to change a variable within the application and keep that variable same after I restarted it?
There is no alternative, other than saving in the Registry or files external to the .EXE.
SimpleData wrote: As an extra idea, how can I make an application which creates another exe from itself with modifying a variable or value of itself?
The same way you read/write any binary file. Read the .EXE file until you get to the point where the string is, write all that data to a new file, then write the string data, skip reading the string in the source .EXE file, and continue to read the old file to the end, writing it's data to the new file.
But, you have a problem. You STILL need an external application to delete the old .EXE and rename the new .EXE to the old filename. Not, a good solution...
|
|
|
|
|
Ya You Can by creating a variable in the settings of an application.
. on Form load you can call that for ex.
where VariableName is a variable which u need to create in settings of the application
and txtbox1 is a textbox.
public form1()
{
InitializeComponent();
txtbox1.Text = Properties.Settings.Default.VariableName;
}
and on form close you need to save that
private void form1_FormClosed(object sender, FormClosedEventArgs e)
{
Properties.Settings.Default.Save();
}
Thanks.
Sandy
|
|
|
|
|
You may want to go back and re-read the thread, plus read the documentation on Properties.Settings.
You missed the entire point of the conversation. The OP wanted to save "settings" back to the .EXE instead of a seperate *.settings file. You cannot do that in a "nice" manner. He did NOT want to use an external file, which is what you're proposing doing.
|
|
|
|
|
But then it wouldn't work properly if the system has multiple users.
And what if the user types the name wrong or something?
I suggest saving to a file (I'd use XML), perhaps in the user's "Application Data" directory.
You could also use a database, especially if the user may use several different systems.
|
|
|
|
|
Hello,
I have the need for spell checking in my windows forms application.
I initially attempted my own using a Forms.RichTextBox which didnt turn out too badly, i got spelling mistakes to highlight with red font.
Then i found out the the WPF RichTextBox has spell check functionality, including red squigly line and correct spelling suggestions.
So i looked for a way to have the WPF RichTextBox in my appliation. The solution i found was to use an elementHost in my app and then have the WPF RichTextBox as a child of that.
This solution works, i have all the functionality i require.
The problem is, its causing performance issues when loaded any form containing the control. or rather the customControl i have made which contains the WPF RichTextBox. This custom control also contains a toolStrip with a number of buttons for formatting the WPF RichTextBox content.
Can anyone offer an explaination to the delay in initialisation? Or any alternatives for how i can use the WPF RichTextBox in my WinForms Application?
Any help is greatly appriciated, as always
My opinion is... If someone has already posted an answer, dont post the SAME answer
|
|
|
|
|
WPF is slow to load, especially the first time it is used in an app.
If your users have Word, you can use Word for spell check.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Thanks for your reply, I will take a long into using word.
Thou i do use for some mail merging and that can be slow to init the word application so will have to see how well it works for spell checking.
Thanks again
My opinion is... If someone has already posted an answer, dont post the SAME answer
|
|
|
|
|
I need to parse Log files with different operations that will require different grammars as each operation is organized differently. I have been using
char[] delimiterChars = { ',' 'WHATEVER' }; to detemine what gets parsed. the problem with that is, it does not seem to discriminate which parameter it chooses and when. Is there anyway to make it a little more automated instead of just creating a whole bunch of delimiter chars and then calling them in order at which they wouldd appear?
|
|
|
|
|
I have no idea as to what you mean... please examplify
My opinion is... If someone has already posted an answer, dont post the SAME answer
|
|
|
|
|
Can you provide a small sample of the various types of data?
|
|
|
|
|
directly from the log file:
E 12:28:45 Line 1 : Dispense
tip 1 : dispense 0.00nl 1, 1 Deep Well, landscape [1,1]
10.00µl ">> Water << 23" Fixed <3 - 50µl> Single
E 12:28:47 Line 2 : Aspirate
tip 1 : aspirate 60.00µl 1, 1 Deep Well, landscape [1,2]
10.00µl "Water" Fixed <3 - 50µl> Multi
E 12:28:45 Line 1 : Dispense
tip 1 : dispense 0.00nl 1, 1 Deep Well, landscape [1,1]
10.00µl ">> Water << 23" Fixed <3 - 50µl> Single
E 12:28:47 Line 2 : Aspirate
tip 1 : aspirate 60.00µl 1, 1 Deep Well, landscape [1,2]
10.00µl "Water" Fixed <3 - 50µl> Multi
|
|
|
|
|
scratch the last reply...
these three commands are the bread and butter of the operations. most are just combination of these 3...
E 12:28:45 Line 1 : Dispense
tip 1 : dispense 0.00nl 1, 1 Deep Well, landscape [1,1]
10.00µl ">> Water << 23" Fixed <3 - 50µl> Single
E 12:28:47 Line 2 : Aspirate
tip 1 : aspirate 60.00µl 1, 1 Deep Well, landscape [1,2]
10.00µl "Water" Fixed <3 - 50µl> Multi
E 12:28:57 Line 3 : Wash Tips
wash (2ml + 1ml), grid 26 and grid 26
now they look similar but each hasa different set of information needed to cut out or set as variables. I do plan on calling a "dispense", "asperate" and "Wash Tips" grammar structure when needed. if i tell it to parse at the comma's, i will get data that i dont want. I could remember each value of the word, and set that to a variable like word[1]=volume and word[5]=fluid type but i dont really want to do that. is there any way to make it a little more automated so that it knows the sequence to skip over bits not biased on charactor length as that will change as well.
|
|
|
|
|
Hi,
I've reviewed your posts on the topic of parsing these instrument log files. What I haven't got from any of your questions is what information you want to extract.
So, for example, in the log just posted what output do you want?
Alan.
|
|
|
|
|
Oh, this is the same thing I've seen posted before.
I'd use a Regular Expression. Not having much else to do today, I think I'll experiment a little... I'll be back.
|
|
|
|
|
So far I've created this Regex:
System.Text.RegularExpressions.Regex reg = new System.Text.RegularExpressions.Regex
(
@"(?'Type'\S)\s(?'Time'\d\d:\d\d:\d\d)\sLine\s*(?'Line'[^:]*)\s:\s(?'Operation'[^\r]*)\r\n(?'Data'([^\r]*\r){1,3})"
,
System.Text.RegularExpressions.RegexOptions.Compiled |
System.Text.RegularExpressions.RegexOptions.Singleline |
System.Text.RegularExpressions.RegexOptions.CultureInvariant
) ;
It matches the three log entries you provided and provides the named groups:
E 12:28:45 Line 1 : Dispense
- -------- - --------
| | | |
| | | Operation
| | Line
| Time
Type
and then the following two or three lines go into Data
You can then use the Operation to determine further processing of the Data, perhaps each operation would have its own Regex to parse its data.
|
|
|
|
|
Sorry for the late reply I thank you for the help. So far you have pretty much hit the pin on the head. The problem here is... I dont know what you mean by regular expressions and how I would build them for each operation. Ill show you the desired data and maybe give some pointers on how to create one for this operation and then Ill be able to use that to create more. This is the dispense operation.
tip 1 : dispense 0.00nl 1, 1 Deep Well, landscape [1,1]
----- | | | |
| | | | |
a b c d e
10.00µl ">> Water << 23" Fixed <3 - 50µl> Single
----- ----
| |
| |
f g
Also, my plan right now is to take each word that is parsed in the array, assign the desired arrays with the proper variables (time=word[8]) and work it that way. Im not sure if that is the most effective way to do it, im sure it will work but maybe not the best.
|
|
|
|
|
Ignore the last post forgot the change HTML setting
Sorry for the late reply I thank you for the help. So far you have pretty much hit the pin on the head. The problem here is... I dont know what you mean by regular expressions and how I would build them for each operation. Ill show you the desired data and maybe give some pointers on how to create one for this operation and then Ill be able to use that to create more. This is the dispense operation.
tip 1 : dispense 0.00nl 1, 1 Deep Well, landscape [1,1]
----- | | | |
| | | | |
a b c d e
10.00µl ">> Water << 23" Fixed <3 - 50µl> Single
----- ----
| |
| |
f g
Also, my plan right now is to take each word that is parsed in the array, assign the desired arrays with the proper variables (time=word[8]) and work it that way. Im not sure if that is the most effective way to do it, im sure it will work but maybe not the best.
|
|
|
|
|
You could put the stuff in a "code block" to have it appear properly in the message.
|
|
|
|
|
Could you explain what each section of this line means?
@"(?'Type'\S)\s(?'Time'\d\d:\d\d:\d\d)\sLine\s*(?'Line'[^:]*)\s:\s(?'Operation'[^\r]*)\r\n(?'Data'([^\r]*\r){1,3})"
Im trying to find a legend for all the possibilities but i dont even know where to start...
|
|
|
|
|
(?'Type'\S) There must be a non-whitespace character, capture it in group Type
\s Then there must be one whitespace character
(?'Time'\d\d:\d\d:\d\d) Then there must be a sequence of six decimal digits separated by colons, capture it in group Time
\sLine\s* Then there must be a whitespace character, the characters L i n e, and zero or more whitespace characters.
(?'Line'[^:]*) Then capture everything up to (but not including) the next colon in group Line
\s:\s Then there must be a whitespace character, a colon, and another whitespace character.
(?'Operation'[^\r]*) Then capture everything up to (but not including) the next carriage return in group Operation
\r\n There must then be a carriage return and a linefeed.
(?'Data'([^\r]*\r){1,3}) And finally capture everything from there through the next few carriage returns, there must be at least one and at most three carriage returns. Capture this into the Data group.
|
|
|
|
|
thanks this is working perfectly except for one thing. under operation, serveral of the operations have spaces between them. I cant seem to find an expression that says "include everything here, and if it has a space include that too" into the operations group. is that even possible?
|
|
|
|
|
The Operation group should contain everything up to the next carriage return. Doesn't it? Culd you post an example of a problematic string?
|
|
|
|