private void getOpen(string text) { // Parse the string and pick out the relevant information var match = rgxOpenCommand.Match(text); var groups = match.Groups; string dict = groups["dict"].Value.Trim(); string filename = groups["filename"].Value.Trim(); string isArray = groups["isarray"].Value.Trim(); string to = groups["to"].Value.Trim(); _log.Debug("Found OPEN|OPENSEQ statement for filename {0}, dict: {1}, handle: {2}", filename, dict, to); // Check to see if somethign matched otherwise there is an error if (match.Success) { // Ignore the filename if it is an array if (!isArray.Equals("")) { // Skip this statement as it is using an array for the file handle _log.Info("Found array as handle so skipping statement. The statement found is {0}", text); return; } // Add the file handle and the file name to the dictionary of open files found if (to.Equals("")) { // This is a reference to a default file which we need to update so that any read or writes not using a handle will use this if (!handleToFilenameLookup.TryAdd(DEFAULT_FILEHANDLE, filename)) { handleToFilenameLookup[DEFAULT_FILEHANDLE] = filename; } } // Add to the list of handles or update if already exists if (!handleToFilenameLookup.TryAdd(to, filename)) { handleToFilenameLookup[to] = filename; } // Add the name of the file to the list of files found, ignore if it already exists var universeFile = new UniVerseFile(dict, filename); files.TryAdd(filename, universeFile); } else { _log.Error("Expecting to match an OPEN statement but none found. Something is wrong with the match pattern for the OPEN statement. Text being matched is '{0}", text); } }
private void getCallOpenFileSub(string text) { // Parse the string and pick out the relevant information var match = rgxCallOpenFileSub.Match(text); var groups = match.Groups; string filename = groups["filename"].Value; string to = groups["to"].Value; _log.Debug("Found CALL OPEN.FILE.SUB statement for filename {0}, handle: {1}", filename, to); // Check to see if somethign matched otherwise there is an error if (match.Success) { // Add the file handle and the file name to the dictionary of open files found if (to.Equals("")) { // This is a reference to a default file which we need to update so that any read or writes not using a handle will use this if (!handleToFilenameLookup.TryAdd(DEFAULT_FILEHANDLE, filename)) { handleToFilenameLookup[DEFAULT_FILEHANDLE] = filename; } } // Add to the list of handles or update if already exists if (!handleToFilenameLookup.TryAdd(to, filename)) { handleToFilenameLookup[to] = filename; } // Add the name of the file to the list of files found, ignore if it already exists var universeFile = new UniVerseFile("", filename); files.TryAdd(filename, universeFile); } else { _log.Error("Expecting to match an OPEN statement but none found. Something is wrong with the match pattern for the OPEN statement. Text being matched is '{0}", text); } }