void DataRead(GLib.Object obj, GLib.AsyncResult res) { File file = FileAdapter.GetObject(obj); Regex keyValueRegex = new Regex( @"(^(\s)*(?<Key>([^\=^\n]+))[\s^\n]*\=(\s)*(?<Value>([^\n]+(\n){0,1})))", RegexOptions.IgnorePatternWhitespace | RegexOptions.Compiled | RegexOptions.CultureInvariant ); using (DataInputStream stream = new DataInputStream(file.ReadFinish(res))) { ulong len; string line; while ((line = stream.ReadLine(out len, null)) != null) { line = line.Trim(); Match match = keyValueRegex.Match(line); if (match.Success) { string key = match.Groups["Key"].Value; string val = match.Groups["Value"].Value; if (key.Equals(NameTag)) { Name = val; } else if (key.Equals(DescTag)) { Description = val; } else if (key.Equals(AppUriTag)) { AppUri = val; } else if (key.Equals(IconTag)) { if (val.StartsWith("./") && val.Length > 2) { IconFile = file.Parent.GetChild(val.Substring(2)); if (IconFile.Exists) { Icon = DockServices.Drawing.LoadIcon(IconFile.Path + ";;extension"); } } else { Icon = DockServices.Drawing.LoadIcon(val + ";;extension", 128); } } } } } OnDataReady(); }