public static void GetFromDisk() { List <Teacher> Desearlize(string RawString) { string[] inputs = RawString.Split(new char[] { '\t' }, StringSplitOptions.RemoveEmptyEntries); if (inputs.Length != 1 + (int.Parse(inputs[0]) * Teacher.NoOfParametres)) { throw new Exception(); } List <Teacher> _output = new List <Teacher>(); for (int CurrentIndex = 1; CurrentIndex < inputs.Length; CurrentIndex += Teacher.NoOfParametres) { _output.Add(new Teacher(RawString, CurrentIndex)); } return(_output); } string output = Task.Run(async() => { return(await FileIO.ReadTextAsync( await ApplicationData.Current.LocalFolder.GetFileAsync( @"Database\Teachers"))); }).Result; string[] lists = output.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < 7; ++i) { TeachersList[i] = Desearlize(lists[i]); } }
private void BindData() { string[] info = RawString.Split(",".ToCharArray()); string[] OutputColumninfo = info[0].Split("|".ToCharArray()); string[] InputColumninfo = info[1].Split("|".ToCharArray()); InputColumn = InputColumninfo[0]; OutputDataType = (AttributeTypes)int.Parse(OutputColumninfo[1]); OutputColumn = OutputColumninfo[0]; }
private void Parse() { var tasks = new List <Task>(); List <SubtitleItem> Action(object obj) { return(new SrtParser().Parse(DownloadString((string)obj))); } var urls = RawString.Split(new[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries) .Where(e => e.StartsWith("http://www.dr.dk/mu-online/") || e.StartsWith("https://www.dr.dk/mu-online/")); foreach (var line in urls) { tasks.Add(Task.Factory.StartNew(Action, line) .ContinueWith(elements => Items.AddRange(elements.Result.ToList()))); } Task.WaitAll(tasks.ToArray()); }
private void Init() { if (string.IsNullOrEmpty(RawString)) { return; } ExtensionMethods.TraceInformation("GEC:Initializing:" + RawString); if (RawString.Contains("°")) { string[] strEvents = RawString.Split("°".ToCharArray()); foreach (string strEvent in strEvents) { CreateOneEvent(strEvent); } } else { CreateOneEvent(RawString); } }