private async void LoadModelsFile() { // Checking if file exists if (!File.Exists(ModelsFileName)) { return; } // Reading model file content StreamReader r = new StreamReader(ModelsFileName); string models = await r.ReadToEndAsync(); r.Close(); // Parsing lines, we filter out comments and empty lines foreach (string modelName in Regex.Split(models, "\r\n") .Where(modelName => modelName.Length != 0 && !modelName.StartsWith("#"))) { _manager.AddModel(modelName); } }
private async void LoadModelsFile() { // Checking if file exists if (!File.Exists(ModelsFileName)) { return; } // Reading model file content var r = new StreamReader(ModelsFileName); var modelNames = await r.ReadToEndAsync(); r.Close(); // Parsing lines, we filter out comments and empty lines foreach (var modelName in Regex.Split(modelNames, Environment.NewLine) .Select(line => line.Trim()) .Where(modelName => modelName.Length != 0 && !modelName.StartsWith("#"))) { _manager.AddModel(modelName); } }
private async void LoadModelsFile() { // Checking if file exists if (!File.Exists(ModelsFileName)) { return; } // Reading model file content var r = new StreamReader(ModelsFileName); var modelNames = await r.ReadToEndAsync(); r.Close(); string[] xxx = Regex.Split(modelNames, Environment.NewLine); toolStripProgressBar1.Maximum = xxx.Count(); // MessageBox.Show( xxx.Count().ToString(),"Info", MessageBoxButtons.OK,MessageBoxIcon.Exclamation); Int32 countModelProgress = 0; // Parsing lines, we filter out comments and empty lines foreach (var modelName in xxx .Select(line => line.Trim()) .Where(modelName => modelName.Length != 0 && !modelName.StartsWith("#"))) { _manager.AddModel(modelName); countModelProgress += 1; toolStripProgressBar1.Value = countModelProgress; this.Update(); toolStripStatusLabel1.Text = "Loading model: " + modelName; } toolStripProgressBar1.Value = xxx.Count(); toolStripStatusLabel1.Text = "Finished loading models."; }