/// <summary> /// Sets the value for checkboxes /// </summary> /// <param name="status">Name of the checkbox</param> /// <param name="value">true/false</param> public void SetSegmentStatus(ConfirmationLevel status, bool value) { switch (status) { case ConfirmationLevel.ApprovedSignOff: ApprovedSignOff = value; break; case ConfirmationLevel.RejectedSignOff: RejectedSignOff = value; break; case ConfirmationLevel.ApprovedTranslation: ApprovedTranslation = value; break; case ConfirmationLevel.Draft: Draft = value; break; case ConfirmationLevel.Translated: Translated = value; break; case ConfirmationLevel.RejectedTranslation: RejectedTranslation = value; break; case ConfirmationLevel.Unspecified: Unspecified = value; break; } }
private string UpdateEditedStatus(string data, ConfirmationLevel unitLevel) { string status = ""; switch (unitLevel) { case ConfirmationLevel.Translated: status = "0a"; break; case ConfirmationLevel.Draft: status = "02"; break; case ConfirmationLevel.Unspecified: status = "02"; break; case ConfirmationLevel.ApprovedTranslation: status = "0e"; break; case ConfirmationLevel.ApprovedSignOff: status = "0f"; break; case ConfirmationLevel.RejectedSignOff: status = "02"; break; case ConfirmationLevel.RejectedTranslation: status = "02"; break; default: status = "0a"; break; } Byte[] stringBytes = Encoding.Unicode.GetBytes(data); StringBuilder sbBytes = new StringBuilder(stringBytes.Length * 2); foreach (byte b in stringBytes) { sbBytes.AppendFormat("{0:X2}", b); } string changedData = status + sbBytes.ToString().Substring(2, sbBytes.ToString().Length - 2); int numberChars = changedData.Length; byte[] bytes = new byte[numberChars / 2]; for (int i = 0; i < numberChars; i += 2) { bytes[i / 2] = Convert.ToByte(changedData.Substring(i, 2), 16); } return(Encoding.Unicode.GetString(bytes)); }
private string UpdateStatus(ConfirmationLevel unitLevel) { string status; switch (unitLevel) { case ConfirmationLevel.Translated: status = "exact"; break; case ConfirmationLevel.Draft: status = "fuzzy"; break; case ConfirmationLevel.Unspecified: status = "new"; break; default: status = "new"; break; } return(status); }
/// <summary> /// Returns the segment confirmation status - based on setting /// </summary> /// <param name="segmentHasChanges"></param> /// <param name="originalStatus"></param> /// <returns></returns> private ConfirmationLevel UpdateSegmentStatus(bool segmentHasChanges, ConfirmationLevel originalStatus) { //TODO get status //update segments with tracked changes //if (segmentHasChanges && _convertSettings.ImportUpdateSegmentMode == GeneratorSettings.UpdateSegmentMode.TrackedOnly && // _convertSettings.UpdateSegmentStatusTracked) //{ // return _convertSettings.NewSegmentStatusTrackedChanges; //} //Update all segments - distinguish between segments with changes and without //if (_convertSettings.ImportUpdateSegmentMode == GeneratorSettings.UpdateSegmentMode.All) //{ //if (_convertSettings.UpdateSegmentStatusTracked && segmentHasChanges) //{ // return _convertSettings.NewSegmentStatusTrackedChanges; //} //if (_convertSettings.UpdateSegmentStatusNoTracked && !segmentHasChanges) //{ // return _convertSettings.NewSegmentStatusAll; //} //} return(originalStatus); }
private ConfirmationLevel CreateConfirmationLevel(string BilStatus) { ConfirmationLevel sdlxliffLevel = ConfirmationLevel.Unspecified; switch (BilStatus) { case "new": sdlxliffLevel = ConfirmationLevel.Unspecified; break; case "fuzzy": sdlxliffLevel = ConfirmationLevel.Draft; break; case "exact": sdlxliffLevel = ConfirmationLevel.Translated; break; default: sdlxliffLevel = ConfirmationLevel.Unspecified; break; } return(sdlxliffLevel); }
public SegmentData(int sid, int SegmentId, string segmentText, ConfirmationLevel segmentStatus, ISegment segmentContent) { Sid = sid; SegmentText = segmentText; SegmentStatus = segmentStatus; SegmentContent = segmentContent; }
private string UpdateEditedStatus(ConfirmationLevel unitLevel) { string status = ""; switch (unitLevel) { case ConfirmationLevel.Translated: status = "Translated"; break; case ConfirmationLevel.Draft: status = "Draft"; break; case ConfirmationLevel.Unspecified: status = "Draft"; break; case ConfirmationLevel.ApprovedTranslation: status = "ApprovedTranslation"; break; case ConfirmationLevel.ApprovedSignOff: status = "ApprovedSignOff"; break; case ConfirmationLevel.RejectedSignOff: status = "RejectedSignOff"; break; case ConfirmationLevel.RejectedTranslation: status = "RejectedTranslation"; break; default: status = "Translated"; break; } return status; }
private bool SkipSegment(ISegmentPair segmentPair) { ITranslationOrigin origin = segmentPair.Properties.TranslationOrigin; ConfirmationLevel confLevel = segmentPair.Properties.ConfirmationLevel; if (_convertSettings.ExcludeExportType == GeneratorSettings.ExclusionType.Locked && segmentPair.Properties.IsLocked) { return(true); } else { if (_convertSettings.ExcludeExportType == GeneratorSettings.ExclusionType.Status) { if (_convertSettings.ExcludedStatuses.Contains(confLevel)) { return(true); } } else { if (origin == null) { if (_convertSettings.DontExportNoMatch) { return(true); } else { return(false); } } if ((origin.TextContextMatchLevel == TextContextMatchLevel.SourceAndTarget) && _convertSettings.DontExportContext) { return(true); } else { if (origin.MatchPercent == 100 && _convertSettings.DontExportExact) { return(true); } if ((origin.MatchPercent > 0 && origin.MatchPercent < 100) && _convertSettings.DontExportFuzzy) { return(true); } if (origin.MatchPercent == 0 && _convertSettings.DontExportNoMatch) { return(true); } } } } return(false); }
private XElement GetEntryXhtml(string sourceText, string targetText, string segmentId, string fileId, string fileName, ConfirmationLevel confLevel, bool isLocked, MatchCollection sourceMatches, MatchCollection targetMatches, bool isEven) { var tbodyElem = new XElement(Xhtml.tbody, new XAttribute("class", isEven ? "entry-even" : "entry-odd")); var firstTrElem = new XElement(Xhtml.tr); // File id firstTrElem.Add(new XElement(Xhtml.td, new XAttribute("class", "file-id"), fileId)); // Segmend Id, Confirmation level, Locked status firstTrElem.Add( new XElement(Xhtml.td, new XAttribute("class", "seg-info"), new XElement(Xhtml.a, new XAttribute("href", "#"), new XAttribute("onclick", string.Format("window.external.ActivateSegment('{0}', '{1}'); return false;", fileId, segmentId)), new XText(segmentId)))); firstTrElem.Add( new XElement(Xhtml.td, new XAttribute("class", "seg-info"), confLevel.ToString())); firstTrElem.Add( new XElement(Xhtml.td, new XAttribute("class", "seg-info"), isLocked ? "Yes" : "No")); // File name firstTrElem.Add(new XElement(Xhtml.td, fileName)); tbodyElem.Add(firstTrElem); var secondTrElem = new XElement(Xhtml.tr); // Source segment var sourceTdElem = GetSegmentXhtml(sourceText, sourceMatches); sourceTdElem.Add(new XAttribute("colspan", "3")); secondTrElem.Add(sourceTdElem); // Target segment var targetTdElem = GetSegmentXhtml(targetText, targetMatches); targetTdElem.Add(new XAttribute("colspan", "1")); secondTrElem.Add(targetTdElem); tbodyElem.Add(secondTrElem); return(tbodyElem); }
public static void ChangeSegmentStatus(ConfirmationLevel confirmationLevel) { var _editorController = GetEditorController(); if (_editorController != null && _editorController.ActiveDocument != null) { var segmentPair = _editorController.ActiveDocument.ActiveSegmentPair; if (segmentPair != null) { segmentPair.Properties.ConfirmationLevel = confirmationLevel; _editorController.ActiveDocument.UpdateSegmentPairProperties(segmentPair, segmentPair.Properties); } } }
public static async Task <BlockParameter> GetBestTrustedBlockAsync( this IWeb3 web3, ConfirmationLevel minimalConfirmationLevel) { if (minimalConfirmationLevel > ConfirmationLevel.Zero) { var bestBlockNumber = (await web3.Eth.Blocks.GetBlockNumber.SendRequestAsync()).Value; var bestTrustedBlockNumber = bestBlockNumber - minimalConfirmationLevel; return(new BlockParameter(new HexBigInteger(bestTrustedBlockNumber))); } else { return(BlockParameter.CreateLatest()); } }
/// <summary> /// checks if segment with settings in parameters should be processed /// </summary> /// <param name="isLocked">true - locked</param> /// <param name="status">segment status</param> /// <returns>true - process</returns> public bool checkSegment(bool isLocked, ConfirmationLevel status) { // check locked setting if (isLocked && !_settings.SearchInLocked) { return(false); } // check confirmation status setting if (_settings.NotSearchStatus.Contains(status)) { return(false); } return(true); }
private ConfirmationLevel CreateConfirmationLevel(XmlNode segmentXml) { ConfirmationLevel sdlxliffLevel = ConfirmationLevel.Translated; string confirmationValue = "Translated"; if (segmentXml.SelectSingleNode("prop[@type='x-ConfirmationLevel']") != null) { confirmationValue = segmentXml.SelectSingleNode("prop[@type='x-ConfirmationLevel']").InnerText; } switch (confirmationValue) { case "Translated": sdlxliffLevel = ConfirmationLevel.Translated; break; case "Draft": sdlxliffLevel = ConfirmationLevel.Draft; break; case "ApprovedTranslation": sdlxliffLevel = ConfirmationLevel.ApprovedTranslation; break; case "ApprovedSignOff": sdlxliffLevel = ConfirmationLevel.ApprovedSignOff; break; case "RejectedTranslation": sdlxliffLevel = ConfirmationLevel.RejectedTranslation; break; case "RejectedSignOff": sdlxliffLevel = ConfirmationLevel.RejectedSignOff; break; default: sdlxliffLevel = ConfirmationLevel.Translated; break; } return(sdlxliffLevel); }
private void CollectResults(string SegmentId, string segmentText, ConfirmationLevel segmentStatus, ISegment segmentContent, List <IndexData> matches, bool isSource) { int sID; if (int.TryParse(SegmentId, out sID)) { if (isSource) { _resultSrc.Add(new SegmentData(_resultSrc.Count, sID, segmentText, segmentStatus, segmentContent)); } else { _resultTrg.Add(new SegmentData(_resultTrg.Count, sID, segmentText, segmentStatus, segmentContent)); _resultTrg[_resultTrg.Count - 1].SearchResults = matches; } } }
private ConfirmationLevel CreateConfirmationLevel(XmlNode segmentXml) { string data = segmentXml.SelectSingleNode("./@Data").InnerText; ConfirmationLevel sdlxliffLevel = ConfirmationLevel.Translated; Byte[] stringBytes = Encoding.Unicode.GetBytes(data); StringBuilder sbBytes = new StringBuilder(stringBytes.Length * 2); foreach (byte b in stringBytes) { sbBytes.AppendFormat("{0:X2}", b); } string statusCode = sbBytes.ToString().Substring(0, 2).ToLower(); if (statusCode == "02") { sdlxliffLevel = ConfirmationLevel.Unspecified; } if (statusCode == "0e") { sdlxliffLevel = ConfirmationLevel.ApprovedTranslation; } if (statusCode == "0f") { sdlxliffLevel = ConfirmationLevel.ApprovedSignOff; } if (statusCode == "0a") { sdlxliffLevel = ConfirmationLevel.Translated; } if (statusCode == "0c") { sdlxliffLevel = ConfirmationLevel.Translated; } if (statusCode == "08") { sdlxliffLevel = ConfirmationLevel.Translated; } return(sdlxliffLevel); }
public static void ChangeSegmentStatus(ConfirmationLevel confirmationLevel) { var activeDocument = GetEditorController().ActiveDocument; if (activeDocument == null) { return; } var selectedSegmentPairs = activeDocument.GetSelectedSegmentPairs().ToList(); AddSegmentPair(selectedSegmentPairs, activeDocument.ActiveSegmentPair); foreach (var segmentPair in selectedSegmentPairs) { segmentPair.Properties.ConfirmationLevel = confirmationLevel; activeDocument.UpdateSegmentPairProperties(segmentPair, segmentPair.Properties); } }
private string UpdateEditedStatus(ConfirmationLevel unitLevel) { string status; switch (unitLevel) { case ConfirmationLevel.Translated: status = "true"; break; case ConfirmationLevel.Draft: status = "true"; break; case ConfirmationLevel.Unspecified: status = "false"; break; case ConfirmationLevel.ApprovedTranslation: status = "true"; break; case ConfirmationLevel.ApprovedSignOff: status = "true"; break; case ConfirmationLevel.RejectedSignOff: status = "true"; break; case ConfirmationLevel.RejectedTranslation: status = "true"; break; default: status = "true"; break; } return(status); }
private void CollectResults(string segmentId, string segmentText, ConfirmationLevel segmentStatus, ISegment segmentContent, List <IndexData> matches, List <TagData> tags, bool isSource) { int sID; if (int.TryParse(segmentId, out sID)) { if (isSource) { ResultInSource.Add(new SegmentData(ResultInSource.Count, sID, segmentText, segmentStatus, segmentContent)); ResultInSource[ResultInSource.Count - 1].SearchResults = matches; ResultInSource[ResultInSource.Count - 1].Tags = tags; } else { ResultInTarget.Add(new SegmentData(ResultInTarget.Count, sID, segmentText, segmentStatus, segmentContent)); ResultInTarget[ResultInTarget.Count - 1].SearchResults = matches; ResultInTarget[ResultInTarget.Count - 1].Tags = tags; } } }
// ReSharper disable once InconsistentNaming public async Task ICallCreateVASPContractAsyncMethodOfVASPIndexClientWithGivenParameters() { var vaspIndex = _scenarioContext.GetContractByType <VASPIndex>(); var vaspIndexClient = new VASPIndexClient ( vaspIndex.RealAddress, _estimateGasPriceStrategy, _web3 ); var callResult = await vaspIndexClient.CreateVASPContractAsync ( from : await _accounts.GetDeployerAsync(), vaspCode : VASPCode.Parse(_scenarioContext.GetParameter("vaspCode")), owner : Address.Parse(_scenarioContext.GetParameter("owner")), channels : Channels.Parse(_scenarioContext.GetParameter("channels")), transportKey : TransportKey.Parse(_scenarioContext.GetParameter("transportKey")), messageKey : MessageKey.Parse(_scenarioContext.GetParameter("messageKey")), signingKey : SigningKey.Parse(_scenarioContext.GetParameter("signingKey")), minimalConfirmationLevel : ConfirmationLevel.Parse(_scenarioContext.GetParameter("minimalConfirmationLevel")) ); _scenarioContext.SetCallResult(callResult); }
// Methods public static string GetText(ConfirmationLevel status) { switch (status) { case ConfirmationLevel.Draft: return("Draft"); case ConfirmationLevel.Translated: return("Translated"); case ConfirmationLevel.RejectedTranslation: return("RejectedTranslation"); case ConfirmationLevel.ApprovedTranslation: return("ApprovedTranslation"); case ConfirmationLevel.RejectedSignOff: return("RejectedSignOff"); case ConfirmationLevel.ApprovedSignOff: return("ApprovedSignOff"); } return("Unspecified"); }
public SegmentStatus(ConfirmationLevel status) { _status = status; }
public object Clone() { var segmentPair = new SegmentPair(_segmentBuilder) { Id = Id, IsLocked = IsLocked, ConfirmationLevel = (ConfirmationLevel)Enum.Parse(typeof(ConfirmationLevel), ConfirmationLevel.ToString(), true), TranslationOrigin = TranslationOrigin?.Clone() as ITranslationOrigin }; foreach (var element in Source.Elements) { segmentPair.Source.Elements.Add(element.Clone() as Element); } foreach (var element in Target.Elements) { segmentPair.Target.Elements.Add(element.Clone() as Element); } return(segmentPair); }
public SegmentStatus(ConfirmationLevel status) { Status = status; }
private void UpdateTranslationOrigin(ISegment originalTarget, ISegment targetSegment, SegmentPairInfo segmentPairInfo, ConfirmationLevel importedConfirmationLevel) { SegmentVisitor.VisitSegment(originalTarget); var originalText = SegmentVisitor.Text; SegmentVisitor.VisitSegment(targetSegment); var updatedText = SegmentVisitor.Text; if (string.Compare(originalText, updatedText, StringComparison.Ordinal) != 0) { if (!string.IsNullOrEmpty(_importOptions.StatusTranslationUpdatedId)) { if (targetSegment.Properties.TranslationOrigin != null) { var currentTranslationOrigin = (ITranslationOrigin)targetSegment.Properties.TranslationOrigin.Clone(); targetSegment.Properties.TranslationOrigin.OriginBeforeAdaptation = currentTranslationOrigin; SetTranslationOrigin(targetSegment); } else { targetSegment.Properties.TranslationOrigin = _segmentBuilder.CreateTranslationOrigin(); SetTranslationOrigin(targetSegment); } var success = Enum.TryParse <ConfirmationLevel>(_importOptions.StatusTranslationUpdatedId, true, out var result); var statusTranslationUpdated = success ? result : importedConfirmationLevel; targetSegment.Properties.ConfirmationLevel = statusTranslationUpdated; } else { targetSegment.Properties.ConfirmationLevel = importedConfirmationLevel; } var status = targetSegment.Properties.ConfirmationLevel.ToString(); var match = Enumerators.GetTranslationOriginType(targetSegment.Properties.TranslationOrigin, _analysisBands); AddWordCounts(status, ConfirmationStatistics.WordCounts.Processed, segmentPairInfo); AddWordCounts(match, TranslationOriginStatistics.WordCounts.Processed, segmentPairInfo); AddWordCounts(status, ConfirmationStatistics.WordCounts.Total, segmentPairInfo); AddWordCounts(match, TranslationOriginStatistics.WordCounts.Total, segmentPairInfo); } else { if (!string.IsNullOrEmpty(_importOptions.StatusTranslationNotUpdatedId)) { var success = Enum.TryParse <ConfirmationLevel>(_importOptions.StatusTranslationNotUpdatedId, true, out var result); var statusTranslationNotUpdated = success ? result : importedConfirmationLevel; targetSegment.Properties.ConfirmationLevel = statusTranslationNotUpdated; } else { targetSegment.Properties.ConfirmationLevel = importedConfirmationLevel; } var status = targetSegment.Properties.ConfirmationLevel.ToString(); var match = Enumerators.GetTranslationOriginType(targetSegment.Properties.TranslationOrigin, _analysisBands); AddWordCounts(status, ConfirmationStatistics.WordCounts.Excluded, segmentPairInfo); AddWordCounts(match, TranslationOriginStatistics.WordCounts.Excluded, segmentPairInfo); AddWordCounts(status, ConfirmationStatistics.WordCounts.Total, segmentPairInfo); AddWordCounts(match, TranslationOriginStatistics.WordCounts.Total, segmentPairInfo); } }
public object Clone() { var segmentPair = new SegmentPair(_segmentBuilder) { Id = Id, IsLocked = IsLocked, ConfirmationLevel = (ConfirmationLevel)Enum.Parse(typeof(ConfirmationLevel), ConfirmationLevel.ToString(), true), TranslationOrigin = TranslationOrigin?.Clone() as ITranslationOrigin, Source = Source.Clone() as Source, Target = Target.Clone() as Target }; return(segmentPair); }