//Citeste fisierul de zodii public static SignRange[] ReadSignFile() { var fileContent = System.IO.File.ReadAllText(ZodiacFile); //array cu toate liniile din fisierul de zodii var lines = fileContent.Split("\n"); //array cu obiecte care reprezinta intervalul fiecarei zodii var signRanges = new SignRange[12]; for (var i = 0; i < lines.Length; i++) { //campurile prin care intervalul zodiei este reprezentat var fields = lines[i].Split(";"); var start = fields[0]; var end = fields[1]; //indexul zodiei din fiseriul .proto var signIndex = Int32.Parse(fields[2]); var startDay = Int32.Parse(start.Split("/")[0]); var startMonth = Int32.Parse(start.Split("/")[1]); var endDay = Int32.Parse(end.Split("/")[0]); var endMonth = Int32.Parse(end.Split("/")[1]); //creem obiect cu toate proprietetiile unui interval de zodie var signRange = new SignRange { StartDay = startDay, StartMonth = startMonth, EndDay = endDay, EndMonth = endMonth, SignIndex = signIndex }; signRanges[i] = signRange; } return(signRanges); }
public static SignRange[] ReadFile() { var fileContent = System.IO.File.ReadAllText(ZodieFile); var lines = fileContent.Split("\n"); var signRanges = new SignRange[12]; for (var i = 0; i < lines.Length; i++) { var fields = lines[i].Split(";"); var start = fields[0]; var end = fields[1]; var signIndex = Int32.Parse(fields[2]); var startDay = Int32.Parse(start.Split("/")[0]); var startMonth = Int32.Parse(start.Split("/")[1]); var endDay = Int32.Parse(end.Split("/")[0]); var endMonth = Int32.Parse(end.Split("/")[1]); var signRange = new SignRange { StartDay = startDay, StartMonth = startMonth, EndDay = endDay, EndMonth = endMonth, SignIndex = signIndex }; signRanges[i] = signRange; } return(signRanges); }