Exemplo n.º 1
0
		public void PopulateDefinitions(ProgressState state)
		{
			state.StatusLabel = "Updating Lift File...";
			try
			{
				string pathToLift = _liftFilePath;
				string temp1 = Utilities.ProcessLiftForLaterMerging(pathToLift);
				//    int liftProducerVersion = GetLiftProducerVersion(pathToLift);

				string outputPath = Path.Combine(Path.GetTempPath(), Path.GetTempFileName());
				XmlWriterSettings settings = new XmlWriterSettings();
				settings.Indent = true;
				settings.NewLineOnAttributes = true;

				using (
						Stream xsltStream =
								Assembly.GetExecutingAssembly().GetManifestResourceStream(
										"WeSay.LexicalModel.Migration.populateDefinitionFromGloss.xslt")
						)
				{
					XslTransformWithProgress transformer = new XslTransformWithProgress(
							temp1, outputPath, xsltStream, "//sense");
					state.StatusLabel = "Populating Definitions from Glosses";
					transformer.Transform(state);
				}

				MoveTempOverRealAndBackup(pathToLift, outputPath);
			}
			catch (Exception error)
			{
				state.ExceptionThatWasEncountered = error;
				state.State = ProgressState.StateValue.StoppedWithError;
				throw;
				// this will put the exception in the e.Error arg of the RunWorkerCompletedEventArgs
			}
		}