예제 #1
0
        public void SetResolutionForDuplicate(long id, Upload506Resolution resolution)
        {
            var updateItem = Duplicates.FirstOrDefault(i => i.idfCase == id);

            if (updateItem != null)
            {
                updateItem.Item.Resolution = (int)resolution;
            }
        }
예제 #2
0
        private void CreateFileForDuplicates()
        {
            // new ID = max ID + 1 to avoid duplicates
            int newId = SetNextID();

            string currentFile             = string.Empty;
            string tstringsModifiedContent = $"#Default{Environment.NewLine}";

            foreach (Xstr duplicate in Duplicates)
            {
                Xstr originalXstr = Lines.FirstOrDefault(x => x.Text == duplicate.Text);

                // if duplicated text exists in another xstr in the original file, then copy its ID
                if (originalXstr != null)
                {
                    duplicate.Id      = originalXstr.Id;
                    duplicate.Treated = true;
                }
                // if there is another duplicate with the same text, we can reuse the same ID to avoid new duplicates in the new file
                else if (tstringsModifiedContent.Contains(duplicate.Text))
                {
                    Xstr result = Duplicates.FirstOrDefault(x => x.Treated && x.Text == duplicate.Text);

                    if (result != null)
                    {
                        duplicate.Id      = result.Id;
                        duplicate.Treated = true;
                    }
                    else
                    {
                        throw new Exception();
                    }
                }
                else
                {
                    duplicate.Id = newId;
                    newId++;

                    // add the name of the file in comment
                    if (currentFile != duplicate.FileName)
                    {
                        currentFile              = duplicate.FileName;
                        tstringsModifiedContent += $"{Environment.NewLine}; {duplicate.FileName}{Environment.NewLine}";
                    }

                    tstringsModifiedContent += $"{Environment.NewLine}{duplicate.Id}, {duplicate.Text}{Environment.NewLine}";
                    duplicate.Treated        = true;
                }

                Parent.IncreaseProgress(Sender, CurrentProgress++);
            }

            tstringsModifiedContent += $"{Environment.NewLine}#End";

            Utils.CreateFileWithPath(Path.Combine(DestinationFolder, "tables/tstringsModified-tlc.tbm"), tstringsModifiedContent);
        }