Пример #1
0
        public void LoadParatext5Project()
        {
            using (ScrObjWrapper wrapper = new ScrObjWrapper())
            {
                IScrImportSet settings = m_scr.FindOrCreateDefaultImportSettings(TypeOfImport.Paratext5);
                settings.StartRef = new BCVRef(1, 1, 1);
                settings.EndRef   = new BCVRef(66, 22, 21);
                TempSFFileMaker fileMaker = new TempSFFileMaker();

                string fileName = fileMaker.CreateFile("EXO",
                                                       new string[] { @"\mt Exodus", @"\c 1", @"\v 1 This is fun!" });
                settings.AddFile(fileName, ImportDomain.Main, null, null);

                wrapper.LoadScriptureProject(settings);
                Assert.IsFalse(wrapper.BooksPresent.Contains(1));
                Assert.IsTrue(wrapper.BooksPresent.Contains(2));
                string       sText, sMarker;
                ImportDomain domain;
                Assert.IsTrue(wrapper.GetNextSegment(out sText, out sMarker, out domain));
                Assert.AreEqual(fileName, wrapper.CurrentFileName);
                Assert.AreEqual(1, wrapper.CurrentLineNumber);
                Assert.AreEqual(new BCVRef(2, 1, 0), wrapper.SegmentFirstRef);
                Assert.AreEqual(new BCVRef(2, 1, 0), wrapper.SegmentLastRef);
                Assert.AreEqual(2, wrapper.ExternalPictureFolders.Count);
                Assert.AreEqual(Cache.LangProject.LinkedFilesRootDir, wrapper.ExternalPictureFolders[0]);
                Assert.AreEqual(Environment.GetFolderPath(Environment.SpecialFolder.MyPictures),
                                wrapper.ExternalPictureFolders[1]);
            }
        }
Пример #2
0
		public void LoadParatext5Project()
		{
			CheckDisposed();

			ScrObjWrapper wrapper = new ScrObjWrapper();
			ScrImportSet settings = new ScrImportSet();
			Cache.LangProject.TranslatedScriptureOA.ImportSettingsOC.Add(settings);
			settings.ImportTypeEnum = TypeOfImport.Paratext5;
			settings.StartRef = new BCVRef(1, 1, 1);
			settings.EndRef = new BCVRef(66, 22, 21);
			using (TempSFFileMaker fileMaker = new TempSFFileMaker())
			{
				string fileName = fileMaker.CreateFile("EXO",
					new string[] {@"\mt Exodus", @"\c 1", @"\v 1 This is fun!"});
				settings.AddFile(fileName, ImportDomain.Main, null, 0);

				wrapper.LoadScriptureProject(settings);
				Assert.IsFalse(wrapper.BooksPresent.Contains(1));
				Assert.IsTrue(wrapper.BooksPresent.Contains(2));
				string sText, sMarker;
				ImportDomain domain;
				Assert.IsTrue(wrapper.GetNextSegment(out sText, out sMarker, out domain));
				Assert.AreEqual(fileName, wrapper.CurrentFileName);
				Assert.AreEqual(1, wrapper.CurrentLineNumber);
				Assert.AreEqual(new BCVRef(2, 1, 0), wrapper.SegmentFirstRef);
				Assert.AreEqual(new BCVRef(2, 1, 0), wrapper.SegmentLastRef);
				Assert.AreEqual(2, wrapper.ExternalPictureFolders.Count);
				Assert.AreEqual(Cache.LangProject.ExternalLinkRootDir,
					wrapper.ExternalPictureFolders[0]);
				Assert.AreEqual(Environment.GetFolderPath(Environment.SpecialFolder.MyPictures),
					wrapper.ExternalPictureFolders[1]);
			}
		}
Пример #3
0
        public void LoadP6ProjectForAnnotationOnlyImportWithOnlyBTProjectSet()
        {
            using (ScrObjWrapper wrapper = new ScrObjWrapper())
            {
                IScrImportSet settings = m_scr.FindOrCreateDefaultImportSettings(TypeOfImport.Paratext6);

                Unpacker.UnPackParatextTestProjects();
                settings.ParatextBTProj        = "KAM";
                settings.StartRef              = new BCVRef(1, 1, 1);
                settings.EndRef                = new BCVRef(66, 22, 21);
                settings.ImportAnnotations     = true;
                settings.ImportBackTranslation = false;
                settings.ImportTranslation     = false;
                wrapper.LoadScriptureProject(settings);
                string       sText, sMarker;
                ImportDomain domain;
                Assert.IsTrue(wrapper.GetNextSegment(out sText, out sMarker, out domain));
                Assert.AreEqual(Path.Combine(Unpacker.PTProjectDirectory, @"KAM\Figures"), wrapper.ExternalPictureFolders[0]);
            }
        }
Пример #4
0
		public void LoadP6ProjectForAnnotationOnlyImportWithOnlyScriptureProjectSet()
		{
			using (ScrObjWrapper wrapper = new ScrObjWrapper())
			{
				IScrImportSet settings = m_scr.FindOrCreateDefaultImportSettings(TypeOfImport.Paratext6);

				Unpacker.UnPackParatextTestProjects();
				settings.ParatextScrProj = "KAM";
				settings.StartRef = new BCVRef(1, 1, 1);
				settings.EndRef = new BCVRef(66, 22, 21);
				settings.ImportAnnotations = true;
				settings.ImportBackTranslation = false;
				settings.ImportTranslation = false;
				wrapper.LoadScriptureProject(settings);
				string sText, sMarker;
				ImportDomain domain;
				Assert.IsTrue(wrapper.GetNextSegment(out sText, out sMarker, out domain));
				Assert.AreEqual(3, wrapper.ExternalPictureFolders.Count);
				Assert.AreEqual(Path.Combine(Unpacker.PTProjectDirectory, @"KAM\Figures"), wrapper.ExternalPictureFolders[0]);
			}
		}
Пример #5
0
        public void LoadP6ProjectForAnnotationOnlyImportWithOnlyScriptureProjectSet()
        {
            CheckDisposed();

            ScrObjWrapper wrapper  = new ScrObjWrapper();
            ScrImportSet  settings = new ScrImportSet();

            Cache.LangProject.TranslatedScriptureOA.ImportSettingsOC.Add(settings);

            Unpacker.UnPackParatextTestProjects();
            RegistryData regData = Unpacker.PrepareRegistryForPTData();

            try
            {
                settings.ImportTypeEnum        = TypeOfImport.Paratext6;
                settings.ParatextScrProj       = "KAM";
                settings.StartRef              = new BCVRef(1, 1, 1);
                settings.EndRef                = new BCVRef(66, 22, 21);
                settings.ImportAnnotations     = true;
                settings.ImportBackTranslation = false;
                settings.ImportTranslation     = false;
                wrapper.LoadScriptureProject(settings);
                string       sText, sMarker;
                ImportDomain domain;
                Assert.IsTrue(wrapper.GetNextSegment(out sText, out sMarker, out domain));
                Assert.AreEqual(3, wrapper.ExternalPictureFolders.Count);
                Assert.AreEqual(@"C:\~IWTEST~\KAM\Figures", wrapper.ExternalPictureFolders[0]);
            }
            finally
            {
                if (regData != null)
                {
                    regData.RestoreRegistryData();
                }
                Unpacker.RemoveParatextTestProjects();
            }
        }
Пример #6
0
		/// <summary>
		/// Executes in two distinct scenarios.
		///
		/// 1. If disposing is true, the method has been called directly
		/// or indirectly by a user's code via the Dispose method.
		/// Both managed and unmanaged resources can be disposed.
		///
		/// 2. If disposing is false, the method has been called by the
		/// runtime from inside the finalizer and you should not reference (access)
		/// other managed objects, as they already have been garbage collected.
		/// Only unmanaged resources can be disposed.
		/// </summary>
		/// <param name="disposing"></param>
		/// <remarks>
		/// If any exceptions are thrown, that is fine.
		/// If the method is being done in a finalizer, it will be ignored.
		/// If it is thrown by client code calling Dispose,
		/// it needs to be handled by fixing the bug.
		///
		/// If subclasses override this method, they should call the base implementation.
		/// </remarks>
		protected override void Dispose(bool disposing)
		{
			//Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************");
			// Must not be run more than once.
			if (m_isDisposed)
				return;

			if (disposing)
			{
				// Dispose managed resources here.
			}

			// Dispose unmanaged resources here, whether disposing is true or false.
			if (m_cpe != null && Marshal.IsComObject(m_cpe))
				Marshal.ReleaseComObject(m_cpe);
			m_cpe = null;
			m_settings = null;
			m_SOWrapper = null;
			m_sSegmentText = null;
			m_sMarker = null;
			m_styleProxy = null;
			m_vernParaStyleProxy = null;
			m_vernTextProps = null;
			m_analTextProps = null;
			m_styleProxies = null;
			m_notesStyleProxies = null;
			m_lastPara = null;
			m_BookTitleParaProxy = null;
			m_DefaultFootnoteParaProxy = null;
			m_TsStringFactory = null;
			m_BTFootnoteStrBldr = null;
			m_CurrParaPictures = null;
			m_CurrParaFootnotes = null;
			m_BTPendingPictures = null;
			m_CurrBTFootnote = null;
			m_sBtFootnoteParaStyle = null;
			m_BtFootnoteStrBldrs = null;
			m_PendingAnnotations = null;
			m_BTfootnoteIndex = null;
			m_sCharStyleEndMarker = null;
			m_sFootnoteEndMarker = null;
			m_sCharStyleBeginMarker = null;
			m_sFootnoteBeginMarker = null;
			m_scrTranslatorAnnotationDef = null;

			base.Dispose(disposing);
		}
Пример #7
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Initialize the scripture object wrapper.
		/// </summary>
		/// <remarks>Virtual for testing override purposes.</remarks>
		/// ------------------------------------------------------------------------------------
		protected virtual void InitScriptureObject()
		{
			SOWrapper = new ScrObjWrapper();
		}
Пример #8
0
		public void LoadP6ProjectForAnnotationOnlyImportWithOnlyScriptureProjectSet()
		{
			CheckDisposed();

			ScrObjWrapper wrapper = new ScrObjWrapper();
			ScrImportSet settings = new ScrImportSet();
			Cache.LangProject.TranslatedScriptureOA.ImportSettingsOC.Add(settings);

			Unpacker.UnPackParatextTestProjects();
			RegistryData regData = Unpacker.PrepareRegistryForPTData();
			try
			{
				settings.ImportTypeEnum = TypeOfImport.Paratext6;
				settings.ParatextScrProj = "KAM";
				settings.StartRef = new BCVRef(1, 1, 1);
				settings.EndRef = new BCVRef(66, 22, 21);
				settings.ImportAnnotations = true;
				settings.ImportBackTranslation = false;
				settings.ImportTranslation = false;
				wrapper.LoadScriptureProject(settings);
				string sText, sMarker;
				ImportDomain domain;
				Assert.IsTrue(wrapper.GetNextSegment(out sText, out sMarker, out domain));
				Assert.AreEqual(3, wrapper.ExternalPictureFolders.Count);
				Assert.AreEqual(@"C:\~IWTEST~\KAM\Figures", wrapper.ExternalPictureFolders[0]);
			}
			finally
			{
				if (regData != null)
					regData.RestoreRegistryData();
				Unpacker.RemoveParatextTestProjects();
			}
		}