Click here to Skip to main content
15,913,709 members
Home / Discussions / C#
   

C#

 
AnswerRe: What is the correct way to do an ini file these days..... Pin
PIEBALDconsult12-Mar-12 7:28
mvePIEBALDconsult12-Mar-12 7:28 
AnswerRe: What is the correct way to do an ini file these days..... Pin
OriginalGriff12-Mar-12 7:31
mveOriginalGriff12-Mar-12 7:31 
GeneralRe: What is the correct way to do an ini file these days..... Pin
jschell12-Mar-12 8:53
jschell12-Mar-12 8:53 
GeneralRe: What is the correct way to do an ini file these days..... Pin
OriginalGriff12-Mar-12 9:02
mveOriginalGriff12-Mar-12 9:02 
GeneralRe: What is the correct way to do an ini file these days..... Pin
jschell13-Mar-12 10:19
jschell13-Mar-12 10:19 
GeneralRe: What is the correct way to do an ini file these days..... Pin
PIEBALDconsult12-Mar-12 11:54
mvePIEBALDconsult12-Mar-12 11:54 
GeneralRe: What is the correct way to do an ini file these days..... Pin
OriginalGriff12-Mar-12 21:55
mveOriginalGriff12-Mar-12 21:55 
GeneralRe: What is the correct way to do an ini file these days..... Pin
glennPattonWork312-Mar-12 22:53
professionalglennPattonWork312-Mar-12 22:53 
Sooo...,
For maximum flexibly still the old ground hugging ini file is best it appears to the best, users can open see and scr*w up!
C#
if (File.Exists(INIPath + "\\MeteringData.ini"))
          {
              StreamReader sr = new StreamReader(INIPath + "\\MeteringData.ini");

              Defaults = sr.ReadToEnd();
              sr.Close();
              string[] Values = Defaults.Split(delimetersChars);
              foreach (string v in Values)
              {
                  a++;
                  char[] separator = { '=' };
                  string[] Key = v.Split(separator);
                  if (Key.Length != 2) continue;

                  Key[0] = Key[0].Trim();
                  Key[1] = Key[1].Trim();
                  if(Key[0] == "Location")
                  {
                      LocationData = Key[1];
                  }

The really nice thing is when you get a panic stricken email/phone call "we have broken something help" send them a fresh version of the ini file modded to their specs and 'Hussar!' it works.

Glenn
GeneralRe: What is the correct way to do an ini file these days..... Pin
PIEBALDconsult13-Mar-12 3:30
mvePIEBALDconsult13-Mar-12 3:30 
GeneralRe: What is the correct way to do an ini file these days..... Pin
glennPattonWork313-Mar-12 3:40
professionalglennPattonWork313-Mar-12 3:40 
GeneralRe: What is the correct way to do an ini file these days..... Pin
PIEBALDconsult13-Mar-12 7:24
mvePIEBALDconsult13-Mar-12 7:24 
GeneralRe: What is the correct way to do an ini file these days..... Pin
jschell13-Mar-12 10:26
jschell13-Mar-12 10:26 
GeneralRe: What is the correct way to do an ini file these days..... Pin
PIEBALDconsult13-Mar-12 3:32
mvePIEBALDconsult13-Mar-12 3:32 
QuestionRegEx help Pin
Sunil P V12-Mar-12 5:15
Sunil P V12-Mar-12 5:15 
AnswerRe: RegEx help Pin
Dave Kreskowiak12-Mar-12 5:25
mveDave Kreskowiak12-Mar-12 5:25 
GeneralRe: RegEx help Pin
Sunil P V12-Mar-12 5:32
Sunil P V12-Mar-12 5:32 
GeneralRe: RegEx help Pin
djdanlib12-Mar-12 6:41
djdanlib12-Mar-12 6:41 
GeneralRe: RegEx help Pin
Dave Kreskowiak12-Mar-12 7:18
mveDave Kreskowiak12-Mar-12 7:18 
AnswerRe: RegEx help Pin
Richard MacCutchan12-Mar-12 6:21
mveRichard MacCutchan12-Mar-12 6:21 
AnswerRe: RegEx help Pin
PIEBALDconsult12-Mar-12 7:01
mvePIEBALDconsult12-Mar-12 7:01 
Questionlimit memory c# Pin
william ormundo12-Mar-12 4:29
william ormundo12-Mar-12 4:29 
AnswerRe: limit memory c# Pin
Dave Kreskowiak12-Mar-12 4:55
mveDave Kreskowiak12-Mar-12 4:55 
GeneralRe: limit memory c# Pin
william ormundo12-Mar-12 9:44
william ormundo12-Mar-12 9:44 
AnswerRe: limit memory c# Pin
Luc Pattyn12-Mar-12 10:06
sitebuilderLuc Pattyn12-Mar-12 10:06 
GeneralRe: limit memory c# Pin
william ormundo12-Mar-12 10:31
william ormundo12-Mar-12 10:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.