|
Does the while code needed?
|
|
|
|
|
No, the while loop is my signature
Sorry for that ambiguity.
while (!(success = Try()));
|
|
|
|
|
I think you forgot to add Console.ReadLine();
|
|
|
|
|
phil.o has given you the documentation, but if you look at your line text, the section you want starts at index 25 (starting form zero, remember) and is 9 characters long. So those are the numbers you feed into substring to specific exactly which chunk of text you want to extract.
A Regex will do fine, but they can be complicated and difficult to understand (and worse to modify), so it you can use a "fixed position" extraction for now, that's the best place to start.
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Thanks for the explanation. I have a better understanding of substring
|
|
|
|
|
You're welcome!
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
string line3a = File.ReadAllLines( "xxx" )
.Skip( 2 )
.FirstOrDefault();
string line3b = File.ReadAllLines( "xxx" )
.SkipWhile( s => s.Contains( "S.1.1.004" ) == false )
.FirstOrDefault();
if ( line3a != null ) {
}
The Master said, 'Am I indeed possessed of knowledge? I am not knowing. But if a mean person, who appears quite empty-like, ask anything of me, I set it forth from one end to the other, and exhaust it.'
― Confucian Analects
|
|
|
|
|
ReadAllLines reads the whole file into memory. In this case, it would be better to use ReadLines instead.
File.ReadAllLines Method (System.IO) | Microsoft Docs[^]
File.ReadLines Method (System.IO) | Microsoft Docs[^]
Quote: The ReadLines and ReadAllLines methods differ as follows: When you use ReadLines , you can start enumerating the collection of strings before the whole collection is returned; when you use ReadAllLines , you must wait for the whole array of strings be returned before you can access the array. Therefore, when you are working with very large files, ReadLines can be more efficient.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi All,
I was looking more for a snip in c#/WPF of making connection to AD Azure server for authentication.
The rest of the code i can do by my self.
The info that i find with google is not clear how to do it
Regards
Jan meeling
Thanks
Regards
Jan Meeling
modified 27-Aug-19 8:11am.
|
|
|
|
|
Here you can find some examples:
Azure Active Directory code samples (v1.0 endpoint)[^]
And your favorite search engine will give you plenty of other links.
enum HumanBool { Yes, No, Maybe, Perhaps, Probably, ProbablyNot, MostLikely, MostUnlikely, HellYes, HellNo, Wtf }
|
|
|
|
|
Maybe he/she/them/they doesn't have a favorite search enchine.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
Or maybe his/her/their favorite is just us.
enum HumanBool { Yes, No, Maybe, Perhaps, Probably, ProbablyNot, MostLikely, MostUnlikely, HellYes, HellNo, Wtf }
|
|
|
|
|
Hi Phil,
Thanks for pointing to the right way.
On the search engine is lost of grape .
Regards
Jan Meeling
|
|
|
|
|
I need to win the lottery, but that isn't working for me either.
Perhaps if I bought a ticket, I'd stand a better chance or winning?
Likewise, if you put some effort into working out what to do, rather than just going "!give me the code" you could have a chance of completing your project as well.
We aren't a "code to order" service.
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Hi OriginalGriff,
If you can't said any thing useful the shut your moth
|
|
|
|
|
Do not be abusive, or you will find your account removed from the site.
|
|
|
|
|
Hi Richard,
My excuses for my reaction I'm not want to be abusive but his reaction was very abusive.
Regards,
Jan Meeling
|
|
|
|
|
|
That was not the intesion.
I was looking more for a snipchat of making connection to AD server for authentication.
The rest of the code i can do by my self.
The info that i find with google is not clear how to do it
Regards
Jan meeling
|
|
|
|
|
Then you need to go back to the original message and edit it with proper details of what you are looking for. No one guess from "I need code" exactly what problem you are trying to solve. Keep in mind that we cannot see your screen, or know anything about your project, so the only details we can work on is what you tell us.
|
|
|
|
|
I am writing a tiny app which will be triggered in GPO by a user logoff. The app simply checks that the user has done some required housework. Can anyone show me how to interrupt the logoff (and remain logged on) depending on the answer?
|
|
|
|
|
Best you can do is handle the SystemEvents.SessionEnding Event (Microsoft.Win32) | Microsoft Docs[^] - it catches both shutdown and logoff. It's cancelable, so your app can request that the system remains up - but it's only a request, it mayu not be honoured depending on what the system is doing. As the documentation says Quote: It provides no guarantee that the session will not end.
And it won't detect and cancel a user pulling the plug out of the wall ...
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
|
There is no way to absolutely prevent a user from logging off or shutting down the system.
Even the solution you found is a "suggestion" that the system not shutdown. There is nothing you can do to prevent it as everything you come up with can be defeated just by ending the process that is your application.
|
|
|
|
|
Yes, I understand that. The intention is to remind people to do their housekeeping before logging off, perhaps even to annoy them into it.
|
|
|
|