/// <summary> /// Loads catalog from .po file. /// </summary> public bool Load(IProgressMonitor monitor, string poFile) { Clear(); isOk = false; fileName = poFile; // Load the .po file: try { CharsetInfoFinder charsetFinder = new CharsetInfoFinder(parentProj, poFile); charsetFinder.Parse(); Charset = charsetFinder.Charset; originalNewLine = charsetFinder.NewLine; } catch (Exception e) { string msg = "Error during getting charset of file '" + poFile + "'."; LoggingService.LogFatalError(msg, e); if (monitor != null) { monitor.ReportError(msg, e); } return(false); } LoadParser parser = new LoadParser(this, poFile, Catalog.GetEncoding(this.Charset)); if (!parser.Parse()) { string msg = string.Format("Error during parsing '{0}' file, file is probably corrupted.", poFile); LoggingService.LogError(msg); if (monitor != null) { monitor.ReportError(msg, null); } return(false); } isOk = true; IsDirty = false; return(true); }
/// <summary> /// Loads catalog from .po file. /// </summary> public bool Load(IProgressMonitor monitor, string poFile) { Clear(); isOk = false; fileName = poFile; // Load the .po file: bool finished = false; try { CharsetInfoFinder charsetFinder = new CharsetInfoFinder(parentProj, poFile); charsetFinder.Parse(); Charset = charsetFinder.Charset; originalNewLine = charsetFinder.NewLine; finished = true; } catch (Exception e) { if (monitor != null) { monitor.ReportError("Error during getting charset of file '" + poFile + "'.", e); } } if (!finished) { return(false); } LoadParser parser = new LoadParser(this, poFile, Catalog.GetEncoding(this.Charset)); if (!parser.Parse()) { // TODO: use loging - GUI! Console.WriteLine("Error during parsing '{0}' file, file is probably corrupted.", poFile); return(false); } isOk = true; IsDirty = false; return(true); }