Line 6 is read, I need that after the word AUTHENTIC_DOMAIN = the address AUTHENTIC_DOMAIN = 127.0.0.1 is read
Here is the line itself in the File.ReadLines code (@ "service.ini"). ElementAt (6);
Line 6 is read, I need that after the word AUTHENTIC_DOMAIN = the address AUTHENTIC_DOMAIN = 127.0.0.1 is read
Here is the line itself in the File.ReadLines code (@ "service.ini"). ElementAt (6);
Try to write more detailed questions. To get an answer, explain what exactly you see the problem, how to reproduce it, what you want to get as a result, etc. Give an example that clearly demonstrates the problem. If the question can be reformulated according to the rules set out in the certificate , edit it .
I will answer, not to this question, but to another. Which, in fact, the author is interested more than this - "how to read / process data in INI files?"
using System.Runtime.InteropServices; using System.Text; namespace BotAgent.DataExporter { public class Ini { public string Path; [DllImport("kernel32")] private static extern long WritePrivateProfileString(string section, string key, string val, string filePath); [DllImport("kernel32")] private static extern int GetPrivateProfileString(string section, string key, string def, StringBuilder retVal, int size, string filePath); public Ini(string iniPath) { Path = iniPath; } /// <summary> /// Works with "Default" section /// </summary> public void Write(string key, string value) { WritePrivateProfileString("Default", key, value, Path); } /// <summary> /// Write Data to the INI File /// </summary> /// <PARAM name="section"></PARAM> /// section name /// <PARAM name="key"></PARAM> /// key Name /// <PARAM name="value"></PARAM> /// value Name public void Write(string section, string key, string value) { WritePrivateProfileString(section, key, value, Path); } /// <summary> /// Works with "Default" section /// </summary> public string Read(string key) { StringBuilder temp = new StringBuilder(255); int i = GetPrivateProfileString("Default", key, "", temp, 255, Path); return temp.ToString(); } /// <summary> /// Read Data value From the Ini File /// </summary> /// <PARAM name="section"></PARAM> /// <PARAM name="key"></PARAM> /// <PARAM name="Path"></PARAM> /// <returns></returns> public string Read(string section, string key) { StringBuilder temp = new StringBuilder(255); int i = GetPrivateProfileString(section, key, "", temp, 255, Path); return temp.ToString(); } } } The code is taken from here: https://github.com/ukushu/DataExporter/
Well, if you really answer this:
var a = someString.SubString(17, someString.Length - 17);
Source: https://ru.stackoverflow.com/questions/907312/
All Articles