Example #1
0
		/// <summary>
		/// Create a TempLiftFile based on a pre-existing file, which will be deleted when this is disposed.
		/// </summary>
		public static TempLiftFile TrackExisting(string path)
		{
			Debug.Assert(File.Exists(path));
			TempLiftFile t = new TempLiftFile();
			t._path = path;
			return t;
		}
Example #2
0
        /// <summary>
        /// Create a TempLiftFile based on a pre-existing file, which will be deleted when this is disposed.
        /// </summary>
        public new static TempLiftFile TrackExisting(string path)
        {
            Debug.Assert(File.Exists(path));
            TempLiftFile t = new TempLiftFile();

            t.Path = path;
            return(t);
        }
        public GroupOfConflictingLiftFiles()
        {
            Folder = new TemporaryFolder("ChorusTest");

            string ancestor = @"<entry id='one' guid='F169EB3D-16F2-4eb0-91AA-FDB91636F8F6'>
                        <lexical-unit>
                            <form lang='a'>
                                <text>original</text>
                            </form>
                        </lexical-unit>
                     </entry>";
            string bob = ancestor.Replace("original", "bob says");
            string sally = ancestor.Replace("original", "sally says");
            AncestorFile = new TempLiftFile("ancestor.lift", Folder, ancestor, "0.12");
            BobFile = new TempLiftFile("bob.lift", Folder, bob, "0.12");
            SallyFile = new TempLiftFile("sally.lift", Folder, sally, "0.12");
        }
		private void Run(string contents, Action test)
		{
			using (var input = new TempLiftFile(contents, "0.13"))
			{
				using (var repo = new LiftLexEntryRepository(input.Path))
				{
					EntrySplitter.Run(repo, _progress);
				}

				_resultDom.Load(input.Path);


				var bakPathname = input.Path + ".bak";
				if (File.Exists(bakPathname))
					File.Delete(bakPathname);
			}

			test();
		}
		private void Run(string contents, string[] traitsWithMultiplicity)
		{
			contents = contents.Replace("GUID1", "guid='" + Guid.NewGuid() + "'");
			contents = contents.Replace("GUID2", "guid='" + Guid.NewGuid() + "'");
			contents = contents.Replace("GUID3", "guid='" + Guid.NewGuid() + "'");
			contents = contents.Replace("GUID4", "guid='" + Guid.NewGuid() + "'");
			using (var input = new TempLiftFile(contents, "0.13"))
			{
				using (var repo = new LiftLexEntryRepository(input.Path))
				{
					var ws = HomographMerger.GuessPrimaryLexicalFormWritingSystem(repo, _progress);
					HomographMerger.Merge(repo, ws, traitsWithMultiplicity, _progress);
				}

				_resultDom.Load(input.Path);

				//removing these tombstones simplifies our assertions, later
				foreach (XmlNode deletedEntry in _resultDom.SelectNodes("//entry[@dateDeleted]"))
				{
					deletedEntry.ParentNode.RemoveChild(deletedEntry);
				}
				var bakPathname = input.Path + ".bak";
				if (File.Exists(bakPathname))
					File.Delete(bakPathname);
			}
		}