I have an III file that I want to read a line from below the [DEVICE]
tab I specify the following line DEVICENAME = PHJ01444-MC35
and the value for a string.
[BEGIN-DO not change / this line transferred] [ExecList] Exec4 = PilotMobileBackup v1; On = "1.0"; NoUninst = 1 Exec3 = MC35 108 U 02; On = "1.0.8"; NoUninst = 1 Exec2 = FixMGa; On = "1.0"; BCK = 1 Exec1 = Clear Log MC35; On = "1.0"; Back = 1 [Kiosk] Menu 8 = \ Program Files \ PilotMobile \ Pilot Mobile Backup. XE MenuCount = 8 AdministratorPod = D 85F72A 85AAI 65A71BF 3178CC378b 260E Menonam = Pilot Mobile Backup Menu7 = Windows SimNaregire.exeNenNet 7 = SIM ManagerUserPid = AF2163B24AF45971Policy = C34B3DE916AA052DCB2A63D7DCE83F17 DisableBeam = 0 DisableBT = 0 DisableSDCard = 0 EnableAS = 1 ActionCount = 0 URL = file: // \ Application \ MCPortal.htz AutoLaunch = 0 Menu6 = \ Windows \ solitare.exe MenuName6 = Solitare Menu5 = \ Windows \ bubblebreaker. Exe MenuName5 = Bubble Breaker menu 4 = \ Windows \ wrlsmgr.exe MenuName4 = communication Menu3 = \ Windows \ Calendar.exe MenuName3 = calendar Menu2 = \ Windows \ tmail.exe MenuName2 = text message menu1 = \ Program Files \ PilotMobile \ Pilot. Mobile.exe MenuName1 = Pilot Mobile ShowStartMenu = 1 CustomTaskBar = 0 IdleTimeout = 0 NoTaskbar = 0 PPCKeys = 1111111111111111 = On 1 [Position] MCLastConn = 2006/10/01 00:50:56 [Connection] DeploySvr1 = ***** *** [location] backup = backup install = \ application [com] RetryDelay = 60000 Nhininboundknekt = 0 TLS = 0 Broadcast = 1 [Info] lid = 090128-117 Peedbludiaidi = 081212-10 Taimsinseed = {24 9 CEE 72-5918-4D 18-BEA 8-11 E8 D 8 D 9 72 BF} Taimsinniarrintrvl = 5 Taimsinnkintrvl = 120 Ototaimsinks = 1 secondary Santeepisr = NTP 1. uk.uu.net DefaultSNTPServer = ntp0.uk.uu.net DepServerTimeSyncType = 4 TimeSyncServerType = 1 DFID = 080717-8 platform = PPC method = 39 SiteName = ***** [device] SyncTimer = 4 var = 1 DeviceID = { 040171BD-3603-6106-A800-FFFFFFFFFFFF} ShowTrayIcon = 1 DeviceIDType = 2 DeviceClass = AADE7ECE-DF8C-4AFC-89D2-DE7C73B579D0 Diwaisnam = PHJ01444-MC35 name type = 2 [END- Do not change this line]
If you do not want very simple but very clear answers:
< Using the code> System.IO; Streamer reader = new streamer (file name); While (reader.ReadLine ()! = "[DEVICE]") {continue; } Const String DeviceNameString = "DeviceName ="; While (true) {string line = reader.ReadLine (); If (line.line and lt; DeviceNameString.Length) {continue; } And if (line shuttle (0, DeviceNameString.Length)! = DeviceNameString) {continue; } Return line Shuttle (DeviceNameString.Length); }
If you intend to read only one value from the file, then this is an alternate option, maybe I'll combine loops and add to some closing of the file, You are serious about using code
Comments
Post a Comment