/////////////////////////////////////////////////////////////////////////////////////////////////// ////////////BUILD FROM MUTABLE OBJECT ////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// #region Constructors and Destructors /// <summary> /// Initializes a new instance of the <see cref="ReportPeriodTargetCore"/> class. /// </summary> /// <param name="parent"> /// The parent. /// </param> /// <param name="itemMutableObject"> /// The sdmxObject. /// </param> /// <exception cref="SdmxSemmanticException"> /// Throws Validate exception. /// </exception> public ReportPeriodTargetCore(IIdentifiableObject parent, IReportPeriodTargetMutableObject itemMutableObject) : base(itemMutableObject, parent) { this.textType = TextType.GetFromEnum(TextEnumType.ObservationalTimePeriod); if (itemMutableObject.StartTime != null) { this.startTime = new SdmxDateCore(itemMutableObject.StartTime, TimeFormatEnumType.DateTime); } if (itemMutableObject.EndTime != null) { this.endTime = new SdmxDateCore(itemMutableObject.EndTime, TimeFormatEnumType.DateTime); } if (itemMutableObject.TextType != null) { this.textType = itemMutableObject.TextType; } try { this.Validate(); } catch (SdmxSemmanticException e) { throw new SdmxSemmanticException(e, ExceptionCode.FailValidation, this); } }
public void AddLine(TextType txtType, String text) { string indent = ""; switch ((int)txtType) { // HeaderOpenBlock case 0: indent = " "; break; // Header case 1: indent = " "; break; // Indent1 case 2: indent = " "; break; // CloseBlock case 3: indent = " )"; break; // EmptyLine case 4: indent = ""; break; } _text = _text.AddLast(indent + text); _type = _type.AddLast(txtType); }
/// <summary> /// Get Global String /// </summary> /// <param name="tag"></param> /// <returns></returns> public String GetText(TextType tag) { String strText = String.Empty; _stringDic.TryGetValue(tag.ToString(), out strText); strText = String.IsNullOrEmpty(strText) ? tag.ToString() : strText.Replace("&", "&"); return strText; }
private TextType AddKeyWordProperty(TextType propType, string name, string value, ContentType property) { if (propType == null) { propType = new TextType(property); m_docText.AddTextType(propType); } TextNode newNode = new TextNode(); newNode.AddParent(propType); propType.AddChild(newNode); newNode.AddInfo(new NodeInfo() { name = "Name", type = DataType.String, value = name }); newNode.AddInfo(new NodeInfo() { name = "Value", type = DataType.String, value = value }); return propType; }
internal TextDescriptor(TextType typeText, int start, int len, bool bold) { StartPos = start; Length = len; TypeText = typeText; Bold = bold; }
/////////////////////////////////////////////////////////////////////////////////////////////////// ////////////BUILD FROM MUTABLE OBJECTS ////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// #region Constructors and Destructors /// <summary> /// Initializes a new instance of the <see cref="DataSetTargetCore"/> class. /// </summary> /// <param name="itemMutableObject"> /// The agencyScheme. /// </param> /// <param name="parent"> /// The parent. /// </param> /// <exception cref="SdmxSemmanticException"> Throws SdmxSemmanticException. /// </exception> /// <exception cref="SdmxSemmanticException"> /// Throws Validate exception. /// </exception> public DataSetTargetCore(IDataSetTargetMutableObject itemMutableObject, IMetadataTarget parent) : base(itemMutableObject, parent) { this.textType = TextType.GetFromEnum(TextEnumType.DataSetReference); try { this.textType = itemMutableObject.TextType; } catch (SdmxSemmanticException ex) { throw new SdmxSemmanticException(ex, ExceptionCode.ObjectStructureConstructionError, this.Urn); } catch (Exception th) { throw new SdmxException(th, ExceptionCode.ObjectStructureConstructionError, this.Urn); } try { this.Validate(); } catch (SdmxSemmanticException ex1) { throw new SdmxSemmanticException(ex1, ExceptionCode.ObjectStructureConstructionError, this.Urn); } catch (Exception th1) { throw new SdmxException(th1, ExceptionCode.ObjectStructureConstructionError, this.Urn); } }
private float FontCGSizeorTextType (TextType type, int level) { float fontSize = 0; switch (type) { case TextType.Title: fontSize = 88; break; case TextType.Chapter: fontSize = 94; break; case TextType.Code: fontSize = 36; break; case TextType.Subtitle: fontSize = 64; break; case TextType.Body: fontSize = level == 0 ? 50 : 40; break; default: fontSize = 56; break; } return fontSize; }
private void HandleOleLinks(TextType links) { for (int i = 0; i < links.GetChildCount(); i++) { IAbstractTextNode iChild = links.GetChild(i); ProcessChildNode(iChild); } }
/// <summary> /// 获得文字 /// </summary> /// <param name="defaultText"></param> /// <param name="tag"></param> /// <returns></returns> public static string GetText(string defaultText, TextType tag) { if (IsUseDefaultLanguage || tag == TextType.UseDefaultLanguage) return defaultText; string strText; StringResource.StringDic.TryGetValue(tag.ToString(), out strText); strText = string.IsNullOrEmpty(strText) ? tag.ToString() : strText.Replace("&", "&"); return strText; }
public Task1() { InitializeComponent(); new Task2().Show(); _current = TextType.In; }
public void OnClassificationChanged(SnapshotSpan span, TextType type) { _isDockerfile = true; _textType = type; var handler = this.ClassificationChanged; if (handler != null) handler(this, new ClassificationChangedEventArgs(span)); }
public void RaiseClassificationChanged(SnapshotSpan span, TextType type) { _isRobotsTxt = true; _textType = type; var handler = this.ClassificationChanged; if (handler != null) handler(this, new ClassificationChangedEventArgs(span)); }
private void ProcessSchemaValidationError(CodedStatusMessageType errorMessage, SchemaValidationException e) { foreach (string error in e.GetValidationErrors()) { TextType text = new TextType(); errorMessage.Text.Add(text); text.TypedValue = error; } }
public static void handleNumberkeyDown(TextType _texttype, ref KeyEventArgs e, NumberType _NumberType, NumberPower __NumberPower) { bool result = true; bool numericKeys = ( ((e.KeyCode >= Keys.D0 && e.KeyCode <= Keys.D9) || (e.KeyCode >= Keys.NumPad0 && e.KeyCode <= Keys.NumPad9)) && e.Modifiers != Keys.Shift); bool ctrlA = e.KeyCode == Keys.A && e.Modifiers == Keys.Control; bool mark = (e.KeyCode == Keys.OemMinus && __NumberPower != NumberPower.positiveOnly) || (e.KeyCode == Keys.Oemplus && __NumberPower != NumberPower.NegativeOnly); bool comma = (_NumberType != NumberType.Integer && (e.KeyData == Keys.Decimal || e.KeyCode == Keys.Oemcomma || e.KeyCode == Keys.OemPeriod)); bool editKeys = ( (e.KeyCode == Keys.Z && e.Modifiers == Keys.Control) || (e.KeyCode == Keys.X && e.Modifiers == Keys.Control) || (e.KeyCode == Keys.C && e.Modifiers == Keys.Control) || (e.KeyCode == Keys.V && e.Modifiers == Keys.Control) || e.KeyCode == Keys.Delete || e.KeyCode == Keys.Back); bool navigationKeys = ( e.KeyCode == Keys.Up || e.KeyCode == Keys.Right || e.KeyCode == Keys.Down || e.KeyCode == Keys.Left || e.KeyCode == Keys.Home || e.KeyCode == Keys.End); switch (_texttype) { case TextType.IsNumber: { if (!(numericKeys || editKeys || navigationKeys || mark || comma)) { if (ctrlA) // Do select all as OS/Framework does not always seem to implement this. // SelectAll(); result = false; } if (!result) // If not valid key then suppress and handle. { e.SuppressKeyPress = true; e.Handled = true; if (ctrlA) { } // Do Nothing! } break; } case TextType.IsdateTime: break; case TextType.IsMail: break; case TextType.IsString: break; case TextType.IsTel: break; } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="DummyTextToken"/> class. /// </summary> /// <param name="text">The text.</param> /// <param name="textType">Type of the text.</param> /// <param name="isParagraphStart">if set to <c>true</c> text token starts a paragraph. /// </param> /// <param name="isNoteStart">if set to <c>true</c> text token starts a note.</param> /// <param name="paraStyleName">Name of the paragraph style.</param> /// <param name="charStyleName">Name of the character style.</param> /// <param name="icuLocale">The icu locale.</param> /// ------------------------------------------------------------------------------------ public DummyTextToken(string text, TextType textType, bool isParagraphStart, bool isNoteStart, string paraStyleName, string charStyleName, string icuLocale) { m_text = text; m_textType = textType; m_isParagraphStart = isParagraphStart; m_isNoteStart = isNoteStart; m_paraStyleName = paraStyleName; m_charStyleName = charStyleName; m_iculocale = icuLocale; }
public override Stream ProcessPart(Stream partData, DocumentText discoveryText, RelatedPartProvider relPartProvider, DocumentProcessingActions action) { //this is for the discovery on open documents - the copy loses all other macro information except this items //specifying macro content - there is a single vbaproject.bin file containing all macros //so far this appears to be valid if (DocumentProcessor.ActionIncludesCleaning(action)) return null; if (action == DocumentProcessingActions.PassThrough) return partData; if (m_bInterestedInMacros) { List<IAbstractTextType> ttypes = discoveryText.GetTextTypes(ContentType.Macro); TextType macro = null; if (ttypes.Count > 0) { macro = (TextType)ttypes[0]; } else { macro = new TextType(ContentType.Macro); discoveryText.AddTextType(macro); } TextNode macroNode = new TextNode(); NodeInfo ni = new NodeInfo(); ni.name = "Id"; ni.value = m_id; ni.type = DataType.String; macroNode.AddInfo(ni); ni = new NodeInfo(); ni.name = "Target"; ni.value = m_target; ni.type = DataType.String; macroNode.AddInfo(ni); ni = new NodeInfo(); ni.name = "Type"; ni.value = m_type; ni.type = DataType.String; macroNode.AddInfo(ni); macro.AddChild(macroNode); } Initialize(); ConstructFilter(partData, discoveryText, action); ExecuteFilter(); return m_outStream; }
public TextNodeBuilder(TextType textType, List<NodeInfo> additionalInfo, string nameForContentProperty) { m_textType = textType; m_textNode = new TextNode(); m_nameForContentProperty = nameForContentProperty; if (additionalInfo != null) { foreach (NodeInfo ni in additionalInfo) m_textNode.AddInfo(ni); } }
/// <summary> /// Get Global String /// </summary> /// <param name="tag"></param> /// <returns></returns> public String GetText(TextType tag) { String strText = String.Empty; _stringDic.TryGetValue(tag.ToString(), out strText); if (String.IsNullOrEmpty(strText)) { strText = tag.ToString(); } else { strText = strText.Replace("&", "&"); } return strText; }
/// <summary> /// Initializes a new instance of the <see cref="ReportPeriodTargetMutableCore"/> class. /// </summary> /// <param name="objTarget"> /// The agencySchemeMutable target. /// </param> public ReportPeriodTargetMutableCore(IReportPeriodTarget objTarget) : base(objTarget) { this.textType = objTarget.TextType; if (objTarget.StartTime != null) { this.startTime = objTarget.StartTime.Date; } if (objTarget.EndTime != null) { this.startTime = objTarget.EndTime.Date; } }
public string ToText(double Number,TextType txt) { if((int)txt == 1) { return ConvertText(Number, "Upper"); } else if((int)txt == 2) { return ConvertText(Number, "Lower"); } else { return "Error !"; } }
/// <summary> /// 获得国际化文字 /// </summary> /// <param name="tag"></param> /// <returns></returns> public string GetText(TextType tag) { String strText = String.Empty ; //使用TryGetValue方法防止出现不存在的字符,同时比Exist提高效率 _stringDic.TryGetValue(tag.ToString(),out strText); if (strText == null) { strText = tag.ToString(); } else { strText = XMLUtility.XMLDecode(strText); } return strText; }
/// <summary> /// Add status message from <paramref name="ex"/> to <paramref name="statusMessage"/> /// </summary> /// <param name="statusMessage"> /// The status message /// </param> /// <param name="ex"> /// The exception /// </param> public void AddStatus(StatusMessageType statusMessage, Exception ex) { if (ex == null) { statusMessage.status = StatusTypeConstants.Success; } else { statusMessage.status = StatusTypeConstants.Failure; var tt = new TextType(); statusMessage.MessageText.Add(tt); var exception = ex as SdmxException; tt.TypedValue = exception != null ? exception.FullMessage : ex.Message; } }
public void SpawnText(string text, TextType type, Vector3 worldPosition) { var position = Camera.main.WorldToViewportPoint(worldPosition); Transform textPrefab = DamageText; switch (type) { case TextType.Damage: textPrefab = DamageText; break; case TextType.Healing: textPrefab = HealingText; break; default: break; } var popup = (Transform)GameObject.Instantiate(textPrefab, position, Quaternion.identity); popup.guiText.text = text; }
public static string Pascalize(this string text, TextType type = TextType.Auto) { type = GetTextType(text, type); switch (type) { case TextType.Normal: return text.PascalizeNormalText(); case TextType.Underscored: return text.PascalizeUnderscoredText(); case TextType.LowerCamelCase: return text.PascalizeLowerCamelCaseText(); case TextType.Pascalized: return text; default: throw new ArgumentOutOfRangeException(nameof(type), type, null); } }
/////////////////////////////////////////////////////////////////////////////////////////////////// ////////////BUILD FROM MUTABLE OBJECTS ////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// #region Constructors and Destructors /// <summary> /// Initializes a new instance of the <see cref="KeyDescriptorValuesTargetCore"/> class. /// </summary> /// <param name="parent"> /// The parent. /// </param> /// <param name="itemMutableObject"> /// The agencyScheme. /// </param> /// <exception cref="SdmxSemmanticException"> Throws SdmxSemmanticException. /// </exception> public KeyDescriptorValuesTargetCore(IMetadataTarget parent, IKeyDescriptorValuesTargetMutableObject itemMutableObject) : base(itemMutableObject, parent) { this.textType = TextType.GetFromEnum(TextEnumType.KeyValues); try { this.textType = itemMutableObject.TextType; } catch (SdmxSemmanticException ex) { throw new SdmxSemmanticException(ex, ExceptionCode.ObjectStructureConstructionError, this.Urn); } catch (Exception th) { throw new SdmxException(th, ExceptionCode.ObjectStructureConstructionError, this.Urn); } this.Validate(); }
private NSColor ColorForTextType (TextType type, int level) { NSColor color = null; switch (type) { case TextType.Subtitle: color = NSColor.FromDeviceRgba (160.0f / 255.0f, 182.0f / 255.0f, 203.0f / 255.0f, 1); break; case TextType.Code: color = level == 0 ? NSColor.White : NSColor.FromDeviceRgba (242.0f / 255.0f, 173.0f / 255.0f, 24.0f / 255.0f, 1); break; case TextType.Body: if (level == 2) color = NSColor.FromDeviceRgba (115.0f / 255.0f, 170.0f / 255.0f, 230.0f / 255.0f, 1); break; default: color = NSColor.White; break; } return color; }
public DocumentText Execute() { _docText = new DocumentText(); _paraType = new TextType(ContentType.Paragraph); _docText.AddTextType(_paraType); _builder = new StringBuilder(); _iPos = 0; // Properties try { foreach (KeyValuePair<string, string> kvp in Workshare.Pdf.Reader.GetProperties(_file, _password)) { AddProperty(kvp.Key, kvp.Value); } } catch(Exception ex) { AddError(ex.Message); } // Content try { foreach (string paragraph in Workshare.Pdf.Reader.GetParagraphs(_file, _password)) { AddText(paragraph); NewParagraph(); } } catch(Exception ex) { AddError(ex.Message); } return _docText; }
/// <summary> /// Build error response. /// </summary> /// <param name="exception"> /// The exception. /// </param> /// <param name="exceptionCode"> /// The exception code. /// </param> /// <returns> /// The <see cref="XTypedElement"/>. /// </returns> public virtual XTypedElement BuildErrorResponse(Exception exception, string exceptionCode) { var errorDocument = new Error(); var errorMessage = new CodedStatusMessageType(); errorDocument.ErrorMessage.Add(errorMessage); errorMessage.code = exceptionCode; while (exception != null) { var text = new TextType(); errorMessage.Text.Add(text); if (string.IsNullOrEmpty(exception.Message)) { if (exception.InnerException != null) { text.TypedValue = exception.InnerException.Message; } } else { text.TypedValue = exception.Message; } if (exception.GetType() == typeof(SchemaValidationException)) { ProcessSchemaValidationError(errorMessage, (SchemaValidationException)exception); } else { ProcessThrowable(errorMessage, exception); } exception = exception.InnerException; } return errorDocument; }
public static string numericGetRegex(TextType _TextType, NumberType _numbertype, NumberPower _NumberPower ) { string Regex = ""; if (_TextType == TextType.IsNumber) { ///جزء العلامة الاشارة switch (_NumberPower) { case NumberPower.positiveOrNegative: Regex +="("+PositivePt +"|"+ negativePt +")"; break; case NumberPower.NegativeOnly: Regex += negativePt ; break; case NumberPower.positiveOnly: Regex += PositivePt; break; } /// جزء العلامة العشرية switch (_numbertype ) { case NumberType.Integer: Regex += IntegerPt; break; case NumberType.Decimalonly: Regex += DecimalPt; break; case NumberType.Decimal : Regex +="("+IntegerPt+"|"+ IntegerPt + DecimalPt+")"; break; } Regex += "$"; } return Regex ; }
const int lookAheadLength = (3 * maxTextFragmentSize) / 2; // More so that we do not get small "what was inserted" fragments /// <summary> /// Reads text and optionaly separates it into fragments. /// It can also return empty set for no appropriate text input. /// Make sure you enumerate it only once /// </summary> IEnumerable <AXmlObject> ReadText(TextType type) { bool lookahead = false; while (true) { AXmlText text; if (TryReadFromCacheOrNew(out text, t => t.Type == type)) { // Cached text found yield return(text); continue; // Read next fragment; the method can handle "no text left" } text.Type = type; // Limit the reading to just a few characters // (the first character not to be read) int fragmentEnd = Math.Min(this.CurrentLocation + maxTextFragmentSize, this.InputLength); // Look if some futher text has been already processed and align so that // we hit that chache point. It is expensive so it is off for the first run if (lookahead) { // Note: Must fit entity AXmlObject nextFragment = trackedSegments.GetCachedObject <AXmlText>(this.CurrentLocation + maxEntityLength, lookAheadLength - maxEntityLength, t => t.Type == type); if (nextFragment != null) { fragmentEnd = Math.Min(nextFragment.StartOffset, this.InputLength); AXmlParser.Log("Parsing only text ({0}-{1}) because later text was already processed", this.CurrentLocation, fragmentEnd); } } lookahead = true; text.StartOffset = this.CurrentLocation; int start = this.CurrentLocation; // Whitespace would be skipped anyway by any operation TryMoveToNonWhiteSpace(fragmentEnd); int wsEnd = this.CurrentLocation; // Try move to the terminator given by the context if (type == TextType.WhiteSpace) { TryMoveToNonWhiteSpace(fragmentEnd); } else if (type == TextType.CharacterData) { while (true) { if (!TryMoveToAnyOf(new char[] { '<', ']' }, fragmentEnd)) { break; // End of fragment } if (TryPeek('<')) { break; } if (TryPeek(']')) { if (TryPeek("]]>")) { OnSyntaxError(text, this.CurrentLocation, this.CurrentLocation + 3, "']]>' is not allowed in text"); } TryMoveNext(); continue; } throw new Exception("Infinite loop"); } } else if (type == TextType.Comment) { // Do not report too many errors bool errorReported = false; while (true) { if (!TryMoveTo('-', fragmentEnd)) { break; // End of fragment } if (TryPeek("-->")) { break; } if (TryPeek("--") && !errorReported) { OnSyntaxError(text, this.CurrentLocation, this.CurrentLocation + 2, "'--' is not allowed in comment"); errorReported = true; } TryMoveNext(); } } else if (type == TextType.CData) { while (true) { // We can not use use TryMoveTo("]]>", fragmentEnd) because it may incorectly accept "]" at the end of fragment if (!TryMoveTo(']', fragmentEnd)) { break; // End of fragment } if (TryPeek("]]>")) { break; } TryMoveNext(); } } else if (type == TextType.ProcessingInstruction) { while (true) { if (!TryMoveTo('?', fragmentEnd)) { break; // End of fragment } if (TryPeek("?>")) { break; } TryMoveNext(); } } else if (type == TextType.UnknownBang) { TryMoveToAnyOf(new char[] { '<', '>' }, fragmentEnd); } else { throw new Exception("Uknown type " + type); } text.ContainsOnlyWhitespace = (wsEnd == this.CurrentLocation); // Terminal found or real end was reached; bool finished = this.CurrentLocation < fragmentEnd || IsEndOfFile(); if (!finished) { // We have to continue reading more text fragments // If there is entity reference, make sure the next segment starts with it to prevent framentation int entitySearchStart = Math.Max(start + 1 /* data for us */, this.CurrentLocation - maxEntityLength); int entitySearchLength = this.CurrentLocation - entitySearchStart; if (entitySearchLength > 0) { // Note that LastIndexOf works backward int entityIndex = input.LastIndexOf('&', this.CurrentLocation - 1, entitySearchLength); if (entityIndex != -1) { GoBack(entityIndex); } } } text.EscapedValue = GetText(start, this.CurrentLocation); if (type == TextType.CharacterData) { // Normalize end of line first text.Value = Dereference(text, NormalizeEndOfLine(text.EscapedValue), start); } else { text.Value = text.EscapedValue; } text.EndOffset = this.CurrentLocation; if (text.EscapedValue.Length > 0) { OnParsed(text); yield return(text); } if (finished) { yield break; } } }
/// <summary> /// Exports a single level, model or animation file as text. /// </summary> /// <param name="source">Source pathname.</param> /// <param name="type">Type of text conversion.</param> /// <param name="destination">Destination pathname. Leave blank to export in the same folder with a swapped extension.</param> /// <param name="basicDX">Use the SADX2004 format for Basic models.</param> public static void ConvertFileToText(string source, TextType type, string destination = "", bool basicDX = true, bool overwrite = true) { string outext = ".c"; string extension = Path.GetExtension(source); switch (extension.ToLowerInvariant()) { case ".sa2lvl": case ".sa1lvl": if (type == TextType.CStructs || type == TextType.NJA) { if (destination == "") { destination = Path.Combine(Path.GetDirectoryName(source), Path.GetFileNameWithoutExtension(source) + outext); } if (!overwrite && File.Exists(destination)) { while (File.Exists(destination)) { destination = destination = Path.Combine(Path.GetDirectoryName(destination), Path.GetFileNameWithoutExtension(destination) + "_" + outext); } } LandTable land = LandTable.LoadFromFile(source); List <string> labels = new List <string>() { land.Name }; LandTableFormat fmt = land.Format; using (StreamWriter sw = File.CreateText(destination)) { if (type == TextType.CStructs) { sw.Write("/* Sonic Adventure "); switch (land.Format) { case LandTableFormat.SA1: case LandTableFormat.SADX: if (basicDX) { sw.Write("DX"); fmt = LandTableFormat.SADX; } else { sw.Write("1"); fmt = LandTableFormat.SA1; } break; case LandTableFormat.SA2: sw.Write("2"); fmt = LandTableFormat.SA2; break; case LandTableFormat.SA2B: sw.Write("2 Battle"); fmt = LandTableFormat.SA2B; break; } sw.WriteLine(" LandTable"); sw.WriteLine(" * "); sw.WriteLine(" * Generated by DataToolbox"); sw.WriteLine(" * "); if (!string.IsNullOrEmpty(land.Description)) { sw.Write(" * Description: "); sw.WriteLine(land.Description); sw.WriteLine(" * "); } if (!string.IsNullOrEmpty(land.Author)) { sw.Write(" * Author: "); sw.WriteLine(land.Author); sw.WriteLine(" * "); } sw.WriteLine(" */"); sw.WriteLine(); } land.ToStructVariables(sw, fmt, labels, null, type == TextType.NJA); sw.Flush(); sw.Close(); } } break; case ".sa1mdl": case ".sa2mdl": ModelFile modelFile = new ModelFile(source); NJS_OBJECT model = modelFile.Model; List <NJS_MOTION> animations = new List <NJS_MOTION>(modelFile.Animations); if (type == TextType.CStructs) { outext = ".c"; if (destination == "") { destination = Path.Combine(Path.GetDirectoryName(source), Path.GetFileNameWithoutExtension(source) + outext); } if (!overwrite && File.Exists(destination)) { while (File.Exists(destination)) { destination = destination = Path.Combine(Path.GetDirectoryName(destination), Path.GetFileNameWithoutExtension(destination) + "_" + outext); } } using (StreamWriter sw = File.CreateText(destination)) { sw.Write("/* NINJA "); switch (modelFile.Format) { case ModelFormat.Basic: case ModelFormat.BasicDX: if (basicDX) { sw.Write("Basic (with Sonic Adventure DX additions)"); } else { sw.Write("Basic"); } break; case ModelFormat.Chunk: sw.Write("Chunk"); break; case ModelFormat.GC: sw.Write("GC"); break; } sw.WriteLine(" model"); sw.WriteLine(" * "); sw.WriteLine(" * Generated by DataToolbox"); sw.WriteLine(" * "); if (modelFile != null) { if (!string.IsNullOrEmpty(modelFile.Description)) { sw.Write(" * Description: "); sw.WriteLine(modelFile.Description); sw.WriteLine(" * "); } if (!string.IsNullOrEmpty(modelFile.Author)) { sw.Write(" * Author: "); sw.WriteLine(modelFile.Author); sw.WriteLine(" * "); } } sw.WriteLine(" */"); sw.WriteLine(); List <string> labels_m = new List <string>() { model.Name }; model.ToStructVariables(sw, basicDX, labels_m, null); foreach (NJS_MOTION anim in animations) { anim.ToStructVariables(sw); } sw.Flush(); sw.Close(); } } else if (type == TextType.NJA) { outext = ".nja"; bool isDup = destination.ToLowerInvariant().Contains(".dup"); if (destination == "") { destination = Path.Combine(Path.GetDirectoryName(source), Path.GetFileNameWithoutExtension(source) + outext); } if (!overwrite && File.Exists(destination)) { while (File.Exists(destination)) { destination = Path.Combine(Path.GetDirectoryName(destination), Path.GetFileNameWithoutExtension(destination) + "_" + outext); } } using (StreamWriter sw2 = File.CreateText(destination)) { List <string> labels_nj = new List <string>() { model.Name }; model.ToNJA(sw2, labels_nj, null, isDup); sw2.Flush(); sw2.Close(); } } break; case ".saanim": NJS_MOTION animation = NJS_MOTION.Load(source); if (type == TextType.CStructs) { outext = ".c"; if (destination == "") { destination = Path.Combine(Path.GetDirectoryName(source), Path.GetFileNameWithoutExtension(source) + outext); } if (!overwrite && File.Exists(destination)) { while (File.Exists(destination)) { destination = destination = Path.Combine(Path.GetDirectoryName(destination), Path.GetFileNameWithoutExtension(destination) + "_" + outext); } } using (StreamWriter sw = File.CreateText(destination)) { sw.WriteLine("/* NINJA Motion"); sw.WriteLine(" * "); sw.WriteLine(" * Generated by DataToolbox"); sw.WriteLine(" * "); sw.WriteLine(" */"); sw.WriteLine(); animation.ToStructVariables(sw); sw.Flush(); sw.Close(); } } else if (type == TextType.JSON) { outext = ".json"; if (destination == "") { destination = Path.Combine(Path.GetDirectoryName(source), Path.GetFileNameWithoutExtension(source) + outext); } if (!overwrite && File.Exists(destination)) { while (File.Exists(destination)) { destination = destination = Path.Combine(Path.GetDirectoryName(destination), Path.GetFileNameWithoutExtension(destination) + "_" + outext); } } JsonSerializer js = new JsonSerializer() { Culture = System.Globalization.CultureInfo.InvariantCulture }; using (TextWriter tw = File.CreateText(destination)) using (JsonTextWriter jtw = new JsonTextWriter(tw) { Formatting = Formatting.Indented }) js.Serialize(jtw, animation); } else if (type == TextType.NJA) { outext = animation.IsShapeMotion() ? ".nas" : ".nam"; bool isDum = destination.ToLowerInvariant().Contains(".dum"); if (destination == "") { destination = Path.Combine(Path.GetDirectoryName(source), Path.GetFileNameWithoutExtension(source) + outext); } if (!overwrite && File.Exists(destination)) { while (File.Exists(destination)) { destination = destination = Path.Combine(Path.GetDirectoryName(destination), Path.GetFileNameWithoutExtension(destination) + "_" + outext); } } using (StreamWriter sw2 = File.CreateText(destination)) { animation.ToNJA(sw2, null, isDum); sw2.Flush(); sw2.Close(); } } break; case ".satex": SplitTools.NJS_TEXLIST texlist = SplitTools.NJS_TEXLIST.Load(source); if (type == TextType.CStructs) { outext = ".c"; if (destination == "") { destination = Path.Combine(Path.GetDirectoryName(source), Path.GetFileNameWithoutExtension(source) + outext); } if (!overwrite && File.Exists(destination)) { while (File.Exists(destination)) { destination = destination = Path.Combine(Path.GetDirectoryName(destination), Path.GetFileNameWithoutExtension(destination) + "_" + outext); } } using (StreamWriter sw = File.CreateText(destination)) { sw.WriteLine("/* NINJA Texlist"); sw.WriteLine(" * "); sw.WriteLine(" * Generated by DataToolbox"); sw.WriteLine(" * "); sw.WriteLine(" */"); sw.WriteLine(); texlist.ToStruct(sw); sw.Flush(); sw.Close(); } } else if (type == TextType.NJA) { outext = ".tls"; if (destination == "") { destination = Path.Combine(Path.GetDirectoryName(source), Path.GetFileNameWithoutExtension(source) + outext); } if (!overwrite && File.Exists(destination)) { while (File.Exists(destination)) { destination = destination = Path.Combine(Path.GetDirectoryName(destination), Path.GetFileNameWithoutExtension(destination) + "_" + outext); } } using (StreamWriter sw2 = File.CreateText(destination)) { texlist.ToNJA(sw2); sw2.Flush(); sw2.Close(); } } break; } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Gets a list if TextTokenSubstrings conataining the references and character offsets /// where repeated words occur. /// </summary> /// <param name="tokens">The tokens (from the data source) to check for repeated words. /// </param> /// <param name="_desiredKey">If looking for occurrences of a specific repeated word, /// set this to be that word; otherwise pass an empty string.</param> /// <returns></returns> /// ------------------------------------------------------------------------------------ public List <TextTokenSubstring> GetReferences(IEnumerable <ITextToken> tokens, string desiredKey) { #if DEBUG List <ITextToken> AllTokens = new List <ITextToken>(tokens); if (AllTokens.Count == 0) { // Keep the compiler from complaining about assigning to a variable, but not using it. } #endif characterCategorizer = m_checksDataSource.CharacterCategorizer; // Get a string of words that may be validly repeated. // Words are separated by blanks. ValidItems = m_checksDataSource.GetParameterValue("RepeatableWords"); // List of words that are known to be not repeatable. InvalidItems = m_checksDataSource.GetParameterValue("NonRepeatableWords"); TextType prevTextType = TextType.Other; m_repeatedWords = new List <TextTokenSubstring>(); ProcessRepeatedWords bodyProcessor = new ProcessRepeatedWords(characterCategorizer, m_repeatedWords, desiredKey); ProcessRepeatedWords noteProcessor = new ProcessRepeatedWords(characterCategorizer, m_repeatedWords, desiredKey); foreach (ITextToken tok in tokens) { if (tok.IsParagraphStart) { noteProcessor.Reset(); bodyProcessor.Reset(); } if (tok.TextType == TextType.Note) { if (tok.IsNoteStart) { noteProcessor.Reset(); } noteProcessor.ProcessToken(tok); } // When we leave a caption, we start over checking for repeated words. // A caption is a start of a paragraph, so we already start over // when we encounter a picture caption. if (prevTextType == TextType.PictureCaption) { noteProcessor.Reset(); } if (tok.TextType == TextType.Verse || tok.TextType == TextType.Other) { noteProcessor.Reset(); bodyProcessor.ProcessToken(tok); } if (tok.TextType == TextType.ChapterNumber) { bodyProcessor.Reset(); } prevTextType = tok.TextType; } return(m_repeatedWords); }
private static TextType GetTextType(string text, TextType type) => type == TextType.Auto ? GetTextType(text) : type;
public static string GetText(int offset, int length, TextType texttype, bool ignorecc) { string ret = string.Empty; switch (texttype) { case TextType.Japanese: List <byte> stringBytes = new List <byte>(); for (int i = 0; i < length; i++) { ushort ch = Rom.ReadUShort(offset); if (ch == 0xFFFF) { if (!ignorecc) { stringBytes.AppendString("[FFFF]"); } break; } offset += 2; if (ch >= 0xEF00) { if (!ignorecc) { stringBytes.AppendString("[" + ch.ToString("X4")); if (ch == 0xff22) { } if (M3CC.CCLookup.ContainsKey(ch)) { CC c = M3CC.CCLookup[ch]; for (int j = 0; j < c.args; j++) { stringBytes.AppendString(" " + Rom.ReadUShort(offset).ToString("X4")); offset += 2; } } stringBytes.AppendString("]"); } if ((ch == 0xFF01) || (ch == 0xFF32) || (ch == 0xFF03)) { // Newline stringBytes.AppendString(Environment.NewLine); } continue; } ch = (ushort)(ch % JapaneseMap.Length); ushort code = JapaneseMap[ch]; stringBytes.Add((byte)((code >> 8) & 0xFF)); stringBytes.Add((byte)(code & 0xFF)); } byte[] converted = Encoding.Convert(SJIS, Unicode, stringBytes.ToArray()); ret = Unicode.GetString(converted); break; case TextType.EnglishWide: for (int i = 0; i < length; i++) { ushort ch = Rom.ReadUShort(offset); if (ch == 0xFFFF) { break; } offset += 2; if (ch >= 0xEF00) { if (ignorecc) { if ((ch == 0xFF01) || (ch == 0xFF32) || (ch == 0xFF03)) { // Newline ret += Environment.NewLine; } } else { ret += "[" + ch.ToString("X4") + "]"; } continue; } ch &= 0xFF; ret += EnglishMap[ch]; } break; case TextType.EnglishShort: case TextType.EnglishShortRaw: bool obfuscated = texttype == TextType.EnglishShort; for (int i = 0; i < length; i++) { byte ch = Rom.DecodeByte(offset, obfuscated); // Check for control codes if (ch == 0xEF) { // EF is a custom control code ret += "[EF"; ret += Rom.DecodeByte(offset + 1, obfuscated).ToString("X2") + "]"; offset++; } else if (ch >= 0xF0) { // Special case: 0xFF = end if (ch == 0xFF) { ret += "[FFFF]"; break; } // Else: get the cc length int cclen = ch & 0xF; // Get the control byte byte ccbyte = Rom.DecodeByte(offset + 1, obfuscated); bool doNewLine = ((ccbyte == 0x01) || (ccbyte == 0x32) || (ccbyte == 0x03)); // Print the result ret += "[FF" + ccbyte.ToString("X2"); // Get the arguments ushort[] args = new ushort[cclen]; for (int j = 0; j < cclen; j++) { ret += " " + Rom.DecodeUShort(offset + 2 + (j << 1), obfuscated).ToString("X4"); } ret += "]"; if (doNewLine) { ret += Environment.NewLine; } offset += 1 + (cclen << 1); } else { ret += EnglishMap[ch]; } offset++; } break; } return(ret); }
/// <summary> /// 读取定位块数据 /// </summary> /// <param name="sc">文本流</param> private void ReadLocation(StreamReader sc, object o, TextType t, LastType l = LastType.NA) { if (sc.EndOfStream) { return; } string data = sc.ReadLine();//读取#下一行,判断该值为那个类型 if (Const.LocationMap.IsMatch(data)) { //获取作为MAP的int数值 int num = int.Parse(Const.LocationMap.Match(data).Value); //将该map添加进字典 Dictionary <int, Dictionary <int, List <ViewData> > > temp; //从现有队列尝试获取已有值,如果没有建立新的 if (!this.structure.TryGetValue(num, out temp)) { temp = new Dictionary <int, Dictionary <int, List <ViewData> > >(); this.structure.Add(num, temp); } //根据规则 MAP下一级为Event //跳过下一个# sc.ReadLine(); //跳过两者间空格 sc.ReadLine(); //跳过EVENT的上方# sc.ReadLine(); this.nowMap = num; //递归读取 this.ReadLocation(sc, temp, t, LastType.Map); } if (Const.LocationEvent.IsMatch(data)) { if (o == null) { return; } //获取作为Event的int数值 int num = int.Parse(Const.LocationEvent.Match(data).Value); Dictionary <int, List <ViewData> > temp = null; //EVENT块属于三级数据关系中位,需要额外考虑 if (l == LastType.Map)//说明o来自于map传递值,此时只需要直接在其中添加新的Event项目 { if (!((o as Dictionary <int, Dictionary <int, List <ViewData> > >)).TryGetValue(num, out temp)) { temp = new Dictionary <int, List <ViewData> >(); (o as Dictionary <int, Dictionary <int, List <ViewData> > >).Add(num, temp); } } else if (l == LastType.Page)//说明o来自于page结束后的传值,需要对应的map下的event字典 { //获取当前map下的event字典 Dictionary <int, Dictionary <int, List <ViewData> > > _temp = this.structure[this.nowMap]; if (!(_temp.TryGetValue(num, out temp))) { temp = new Dictionary <int, List <ViewData> >(); _temp.Add(num, temp); } } //跳过下一个# sc.ReadLine(); //跳过两者间空格 sc.ReadLine(); //跳过PAGE的上方# sc.ReadLine(); this.ReadLocation(sc, temp, t, LastType.Event); } if (Const.LocationPage.IsMatch(data)) { if (o == null) { return; } //进入PAGE块,说明object已经传递了Page对应的索引 //获取作为Page的int数值 int num = int.Parse(Const.LocationPage.Match(data).Value); bool isHas = true; //特殊处理,准备进入Page内部的文本块递归 List <ViewData> temp; if (!(o as Dictionary <int, List <ViewData> >).TryGetValue(num, out temp)) { temp = new List <ViewData>(); (o as Dictionary <int, List <ViewData> >).Add(num, temp); isHas = false; } //temp用于存储文本块的链表 //跳过Page下面的# sc.ReadLine(); //如果该page存在 if (isHas) { //两者的文本块结构应该相同 IEnumerator <ViewData> next = temp.GetEnumerator(); next.MoveNext();//推进到第一个元素 SaveAs(t, next.Current, new string[1] { sc.ReadLine() }); //第一个元素应该为文本块开始的第一个虚线 next.MoveNext(); //推进到正式文本块 ReadNewBlock(sc, next, t); } else { //page不存在,直接压入数据 ViewData dt = new ViewData(); //读取PAGE下第一个----对应的参数并压入相应的List中 SaveAs(t, dt, new string[1] { sc.ReadLine() }); temp.Add(dt); ReadNewBlock(sc, temp, t); } if (sc.EndOfStream)//到达最后一个page { return; } sc.ReadLine();//根据规则,page块结束不是文档结束就是下一个EVENT/MAP/EVENT,跳过### ReadLocation(sc, o, t, LastType.Page); } //都没匹配到,说明该行非法【DM规则#与#之间应为map/event/page】 return; }
public ConfirmOperationFormView(TextType inputType = TextType.TreatAsText) { Message = new LabellessReadOnlyView("div", inputType); Confirm = new InputTypeButtonActionView(I18n.Translate("Confirm")) .With(x => x.MarkAsFormsDefaultButton()); }
public void GetNextPart_ReturnsCorrectPartWithSimpleText_WhenGetsStringNotEmptyText(string text, string expectedFirstPartText, TextType expectedFirstPartType) { var parser = GetCommonParser(text); var expectedPart = new TextPart(expectedFirstPartText, expectedFirstPartType); parser.GetNextPart().Should() .BeEquivalentTo(expectedPart); }
internal static bool ShouldTransform(char[] array, char ch, ref int i, out TextType textType) { // Are we at the start of a potential placeholder (e.g. "{?...}") if (ch == '{' && i < array.Length - 2) { int j = i; // Consume all the digits while (j < array.Length - 1 && char.IsDigit(array[++j])) { } if (array[j] == ':') { // Consume all of any format specifier (e.g. "{0:yyyy}" for a DateTime) while (j < array.Length - 1 && array[++j] != '}') { } } if (array[j] == '}') { i = j; textType = TextType.Format; return(false); } } else if (ch == '<' && i < array.Length - 2) { // Are we at the start of a potential HTML tag (e.g. "<a/>") int j = i; textType = TextType.HtmlSelfClosing; char next = array[i + 1]; if ((next >= 'a' && next <= 'z') || (next >= 'A' && next <= 'Z') || next == '/') { if (next == '/') { textType = TextType.HtmlEnd; } // Consume all of the tag while (j < array.Length - 1 && array[++j] != '>') { } if (textType != TextType.HtmlEnd && array[j - 1] != '/') { textType = TextType.HtmlStart; } if (array[j] == '>') { i = j; return(false); } } } textType = TextType.None; return(true); }
private static void ShowLoreDialogue(GameObject shiny, string key, string sheetTitle, TextType textType) { GameObject dialogueManager = GameObject.Find("DialogueManager"); GameObject textObj = dialogueManager.transform.Find("Text").gameObject; textObj.LocateMyFSM("Dialogue Page Control").FsmVariables.GetFsmGameObject("Requester").Value = shiny; // Set position of text box if (textType == TextType.MajorLore) { textObj.transform.SetPositionY(2.44f); dialogueManager.transform.Find("Stop").gameObject.transform.SetPositionY(-0.23f); dialogueManager.transform.Find("Arrow").gameObject.transform.SetPositionY(-0.3f); } switch (textType) { default: case TextType.LeftLore: break; case TextType.Lore: case TextType.MajorLore: textObj.GetComponent <TMPro.TextMeshPro>().alignment = TMPro.TextAlignmentOptions.Top; break; } textObj.GetComponent <DialogueBox>().StartConversation(key, sheetTitle); }
/// <summary> /// Shows a screen text message on the HUD. /// </summary> /// <param name="message">The text message that will be shown.</param> /// <param name="priority">Message priority, usually ranging from 1 to 5.</param> /// <param name="textLocation">Location of the text.</param> /// <param name="textMode">The mode of the text.</param> /// <param name="textType">The type of the text.</param> public static void ShowScreenTextMessage(string message, int priority, TextLocation textLocation, TextMode textMode, TextType textType) { _setErrorMsgString(message); if (eventAddress == IntPtr.Zero) { eventAddress = _ASM.InjectForAddress(new byte[] { 0x24 }, memory.ProcessHandle); } ASMBuilder asm = new ASMBuilder(); asm.MovECX((uint)eventAddress.ToInt32()); asm.Push(priority); // priority asm.Push((int)textLocation); // location asm.Push((int)textMode); // mode asm.Push((uint)textType); // type asm.Push(0x0); // unknown asm.Push(Addrs.UIAddrs.STATIC_ERROR_ALLOCATED_MSG); // mesage asm.Push(0x0); // unknown asm.MovEAX(EFLASHER_GENERIC); // sub_67C290 asm.CallEAX(); asm.Return(); _ASM.Call(asm.ToArray(), memory.ProcessHandle); }
float ExtrusionDepthForTextType(TextType type) { return(type == TextType.Chapter ? 10.0f : TEXT_DEPTH); }
SCNNode NodeWithText(string message, TextType type, int level) { var textNode = SCNNode.Create(); // Bullet if (type == TextType.Bullet) { if (level == 0) { message = "• " + message; } else { var bullet = SCNNode.Create(); bullet.Geometry = SCNPlane.Create(10.0f, 10.0f); bullet.Geometry.FirstMaterial.Diffuse.Contents = NSColor.FromDeviceRgba((float)(160 / 255.0), (float)(182 / 255.0), (float)(203 / 255.0), 1); bullet.Position = new SCNVector3(80, 30, 0); bullet.Geometry.FirstMaterial.LightingModelName = SCNLightingModel.Constant; bullet.Geometry.FirstMaterial.WritesToDepthBuffer = false; bullet.RenderingOrder = 1; textNode.AddChildNode(bullet); message = "\t\t\t\t" + message; } } // Text attributes var extrusion = ExtrusionDepthForTextType(type); var text = SCNText.Create(message, extrusion); textNode.Geometry = text; text.Flatness = TEXT_FLATNESS; text.ChamferRadius = (extrusion == 0 ? 0 : TEXT_CHAMFER); text.Font = FontForTextType(type, level); // Layout var layoutManager = new NSLayoutManager(); var leading = layoutManager.DefaultLineHeightForFont(text.Font); var descender = text.Font.Descender; int newlineCount = (((text.String.ToString()).Split('\n'))).Length; textNode.Pivot = SCNMatrix4.CreateTranslation(0, -descender + newlineCount * leading, 0); if (type == TextType.Chapter) { var min = new SCNVector3(); var max = new SCNVector3(); textNode.GetBoundingBox(ref min, ref max); textNode.Position = new SCNVector3(-11, (-min.Y + textNode.Pivot.M42) * TEXT_SCALE, 7); textNode.Scale = new SCNVector3(TEXT_SCALE, TEXT_SCALE, TEXT_SCALE); textNode.Rotation = new SCNVector4(0, 1, 0, (float)(Math.PI / 270.0)); } else { textNode.Position = new SCNVector3(-16, CurrentBaseline, 0); textNode.Scale = new SCNVector3(TEXT_SCALE, TEXT_SCALE, TEXT_SCALE); } // Material if (type == TextType.Chapter) { var frontMaterial = SCNMaterial.Create(); var sideMaterial = SCNMaterial.Create(); frontMaterial.Emission.Contents = NSColor.DarkGray; frontMaterial.Diffuse.Contents = ColorForTextType(type, level); sideMaterial.Diffuse.Contents = NSColor.LightGray; textNode.Geometry.Materials = new SCNMaterial[] { frontMaterial, frontMaterial, sideMaterial, frontMaterial, frontMaterial }; } else { // Full white emissive material (visible even when there is no light) textNode.Geometry.FirstMaterial = SCNMaterial.Create(); textNode.Geometry.FirstMaterial.Diffuse.Contents = NSColor.Black; textNode.Geometry.FirstMaterial.Emission.Contents = ColorForTextType(type, level); // Don't write to the depth buffer because we don't want the text to be reflected textNode.Geometry.FirstMaterial.WritesToDepthBuffer = false; // Render last textNode.RenderingOrder = 1; } return(textNode); }
public int Execute() { string strGUID = Guid.NewGuid().ToString(); int realImportNum = 0; Excel _excel = new Excel(); DataTable dt = new DataTable(); switch (TextType) { case "ASTM": s_ASTM ASTM = new s_ASTM(); realImportNum = ASTM.Execute(IiSheet, strGUID); break; case "Digitimes": s_Digitimes Digi = new s_Digitimes(); realImportNum = Digi.Execute(IiSheet, strGUID); break; case "EV": s_EV EV = new s_EV(); realImportNum = EV.Execute(IiSheet, strGUID); break; case "Goldfire": s_IHS IHS = new s_IHS(); realImportNum = IHS.Execute(IiSheet, strGUID); break; case "JCR": s_JCR JCR = new s_JCR(); realImportNum = JCR.Execute(IiSheet, strGUID); break; case "nature": s_nature nature = new s_nature(); realImportNum = nature.Execute(IiSheet, strGUID); break; case "Oxford": s_Oxford Oxford = new s_Oxford(); realImportNum = Oxford.Execute(IiSheet, strGUID); break; case "Science": s_Science Science = new s_Science(); realImportNum = Science.Execute(IiSheet, strGUID); break; // //phase II below // case "ACM": s_ACM ACM = new s_ACM(); realImportNum = ACM.Execute(IiSheet, strGUID); break; case "ACS": s_ACS ACS = new s_ACS(); realImportNum = ACS.Execute(IiSheet, strGUID); break; case "IEEE": s_IEEE IEEE = new s_IEEE(); realImportNum = IEEE.Execute(IiSheet, strGUID); break; case "SDOL": s_SDOL SDOL = new s_SDOL(); realImportNum = SDOL.Execute(IiSheet, strGUID); break; case "SPIE": s_SPIE SPIE = new s_SPIE(); realImportNum = SPIE.Execute(IiSheet, strGUID); break; case "TI": s_TI TI = new s_TI(); realImportNum = TI.Execute(IiSheet, strGUID); break; case "Wiley": s_Wiley Wiley = new s_Wiley(); realImportNum = Wiley.Execute(IiSheet, strGUID); break; case "天下": s_TangShang TangShang = new s_TangShang(); realImportNum = TangShang.Execute(IiSheet, strGUID); break; case "萬方": s_WangFang WangFang = new s_WangFang(); realImportNum = WangFang.Execute(IiSheet, strGUID); break; case "通用": dt = _excel.ImportExecl(IiSheet); s_Utility Utility = new s_Utility(); realImportNum = Utility.Execute(dt, strGUID, Year, Month); break; case "工程": dt = _excel.ImportExecl(IiSheet); s_Engineering Engineering = new s_Engineering(); realImportNum = Engineering.Execute(dt, strGUID); break; case "聯合知識庫": dt = _excel.ImportExecl(IiSheet); s_Union Union = new s_Union(); realImportNum = Union.Execute(dt, strGUID); break; case "SciFinder": dt = _excel.ImportExecl(IiSheet); s_SciFinder SciFinder = new s_SciFinder(); realImportNum = SciFinder.Execute(dt, strGUID); break; } //每一次匯入都要做log,判斷等不等於零是因為沒資料就不要做log if (TextType.Trim() != "通用" && realImportNum != 0) { string yearMonth = Year + Month + "01"; DateTime dTime = DateTime.ParseExact(yearMonth, "yyyyMMdd", CultureInfo.InvariantCulture); //通用的log自己在裡面做 saveLog(realImportNum, strGUID, TextType, dTime); } //做完匯入之後再把工研人塞入 UpdateEmpno(strGUID); //由於在通用的表單裡面,有些資料會有email,但是沒IP跟工號, //而也有可能是有工號沒IP沒EMAIL //所以要再等根據IP更新之後 //2016/02/02 由於Goldfile有可能會用中文姓名+部門+單位來當WHERE條件,所以在這裡多一步去補上 if ((TextType.Trim() == "通用" || TextType.Trim() == "Goldfire" || TextType.Trim() == "TI" || TextType.Trim() == "聯合知識庫" || TextType.Trim() == "SciFinder") && realImportNum != 0) { UpdateUtility(strGUID); } return(realImportNum); }
public ShowMessageFlow(string message, string title, TextType textType = TextType.TreatAsText) { _msg = new InformationalMessageForm(message, title, textType); }
public static void SetText(int offset, int length, TextType texttype, string str) { switch (texttype) { case TextType.Japanese: // Get the string as bytes byte[] b = Unicode.GetBytes(str); // Convert to SJIS byte[] s = Encoding.Convert(Unicode, SJIS, b); // Replace ASCII with SJIS List <byte> bb = new List <byte>(); for (int i = 0; i < s.Length; i++) { byte ch = s[i]; if (ch < 0x80) { // ASCII ushort us = JapaneseAsciiMap[ch]; // Write it as big-endian bb.Add((byte)((us >> 8) & 0xFF)); bb.Add((byte)(us & 0xFF)); } else { // SJIS bb.Add(ch); bb.Add(s[i + 1]); i++; } } // Get the original character values ushort[] u = new ushort[bb.Count >> 1]; for (int i = 0; i < u.Length; i++) { ushort uu = (ushort)((bb[i << 1] << 8) | (bb[(i << 1) | 1])); if (JapaneseMapInverse.ContainsKey(uu)) { u[i] = JapaneseMapInverse[uu]; } else { u[i] = 0; } } // Write them for (int i = 0; i < Math.Min(length, u.Length); i++) { Rom.WriteUShort(offset + (i << 1), u[i]); } for (int i = Math.Min(length, u.Length); i < length; i++) { Rom.WriteUShort(offset + (i << 1), 0xFFFF); } break; case TextType.EnglishWide: // Write each character straight-up G for (int i = 0; i < Math.Min(length, str.Length); i++) { char c = str[i]; if (EnglishMapInverse.ContainsKey(c)) { Rom.WriteUShort(offset + (i << 1), EnglishMapInverse[c]); } else { Rom.WriteUShort(offset + (i << 1), 0); } } for (int i = Math.Min(length, str.Length); i < length; i++) { Rom.WriteUShort(offset + (i << 1), 0xFFFF); } break; case TextType.EnglishShort: break; default: return; } }
/// <summary> /// Reads text. /// </summary> void ReadText(TextType type) { var text = new InternalText(); var frame = BeginInternalObject(text); text.Type = type; int start = this.CurrentLocation; int fragmentEnd = inputLength; // Whitespace would be skipped anyway by any operation TryMoveToNonWhiteSpace(fragmentEnd); int wsEnd = this.CurrentLocation; // Try move to the terminator given by the context if (type == TextType.WhiteSpace) { TryMoveToNonWhiteSpace(fragmentEnd); } else if (type == TextType.CharacterData) { while (true) { if (!TryMoveToAnyOf(new char[] { '<', ']' }, fragmentEnd)) { break; // End of fragment } if (TryPeek('<')) { break; } if (TryPeek(']')) { if (TryPeek("]]>")) { OnSyntaxError(this.CurrentLocation, this.CurrentLocation + 3, "']]>' is not allowed in text"); } TryMoveNext(); continue; } throw new InternalException("Infinite loop"); } } else if (type == TextType.Comment) { // Do not report too many errors bool errorReported = false; while (true) { if (!TryMoveTo('-', fragmentEnd)) { break; // End of fragment } if (TryPeek("-->")) { break; } if (TryPeek("--") && !errorReported) { OnSyntaxError(this.CurrentLocation, this.CurrentLocation + 2, "'--' is not allowed in comment"); errorReported = true; } TryMoveNext(); } } else if (type == TextType.CData) { while (true) { // We can not use use TryMoveTo("]]>", fragmentEnd) because it may incorectly accept "]" at the end of fragment if (!TryMoveTo(']', fragmentEnd)) { break; // End of fragment } if (TryPeek("]]>")) { break; } TryMoveNext(); } } else if (type == TextType.ProcessingInstruction) { while (true) { if (!TryMoveTo('?', fragmentEnd)) { break; // End of fragment } if (TryPeek("?>")) { break; } TryMoveNext(); } } else if (type == TextType.UnknownBang) { TryMoveToAnyOf(new char[] { '<', '>' }, fragmentEnd); } else { throw new InternalException("Unknown type " + type); } text.ContainsOnlyWhitespace = (wsEnd == this.CurrentLocation); string escapedValue = GetText(start, this.CurrentLocation); if (type == TextType.CharacterData) { text.Value = Dereference(escapedValue, start); } else { text.Value = escapedValue; } text.Value = GetCachedString(text.Value); EndInternalObject(frame, storeNewObject: this.CurrentLocation > start); }
public static void handleNumberkeyDown(TextType _texttype, ref KeyEventArgs e, NumberType _NumberType, NumberPower __NumberPower) { bool result = true; bool numericKeys = ( ((e.KeyCode >= Keys.D0 && e.KeyCode <= Keys.D9) || (e.KeyCode >= Keys.NumPad0 && e.KeyCode <= Keys.NumPad9)) && e.Modifiers != Keys.Shift); bool ctrlA = e.KeyCode == Keys.A && e.Modifiers == Keys.Control; bool mark = (e.KeyCode == Keys.OemMinus && __NumberPower != NumberPower.positiveOnly) || (e.KeyCode == Keys.Oemplus && __NumberPower != NumberPower.NegativeOnly); bool comma = (_NumberType != NumberType.Integer && (e.KeyData == Keys.Decimal || e.KeyCode == Keys.Oemcomma || e.KeyCode == Keys.OemPeriod)); bool editKeys = ( (e.KeyCode == Keys.Z && e.Modifiers == Keys.Control) || (e.KeyCode == Keys.X && e.Modifiers == Keys.Control) || (e.KeyCode == Keys.C && e.Modifiers == Keys.Control) || (e.KeyCode == Keys.V && e.Modifiers == Keys.Control) || e.KeyCode == Keys.Delete || e.KeyCode == Keys.Back); bool navigationKeys = ( e.KeyCode == Keys.Up || e.KeyCode == Keys.Right || e.KeyCode == Keys.Down || e.KeyCode == Keys.Left || e.KeyCode == Keys.Home || e.KeyCode == Keys.End); switch (_texttype) { case TextType.IsNumber: { if (!(numericKeys || editKeys || navigationKeys || mark || comma)) { if (ctrlA) // Do select all as OS/Framework does not always seem to implement this. // SelectAll(); { result = false; } } if (!result) // If not valid key then suppress and handle. { e.SuppressKeyPress = true; e.Handled = true; if (ctrlA) { } // Do Nothing! } break; } case TextType.IsdateTime: break; case TextType.IsMail: break; case TextType.IsString: break; case TextType.IsTel: break; } }
public static void HandleMessage ( Entity parent, string text, string name, ushort hue, MessageType type, byte font, TextType textType, bool unicode = false, string lang = null ) { if (string.IsNullOrEmpty(text)) { return; } Profile currentProfile = ProfileManager.CurrentProfile; if (currentProfile != null && currentProfile.OverrideAllFonts) { font = currentProfile.ChatFont; unicode = currentProfile.OverrideAllFontsIsUnicode; } switch (type) { case MessageType.Command: case MessageType.Encoded: case MessageType.System: case MessageType.Party: break; case MessageType.Guild: if (currentProfile.IgnoreGuildMessages) { return; } break; case MessageType.Alliance: if (currentProfile.IgnoreAllianceMessages) { return; } break; case MessageType.Spell: { //server hue color per default if (!string.IsNullOrEmpty(text) && SpellDefinition.WordToTargettype.TryGetValue(text, out SpellDefinition spell)) { if (currentProfile != null && currentProfile.EnabledSpellFormat && !string.IsNullOrWhiteSpace(currentProfile.SpellDisplayFormat)) { ValueStringBuilder sb = new ValueStringBuilder(currentProfile.SpellDisplayFormat.AsSpan()); { sb.Replace("{power}".AsSpan(), spell.PowerWords.AsSpan()); sb.Replace("{spell}".AsSpan(), spell.Name.AsSpan()); text = sb.ToString().Trim(); } sb.Dispose(); } //server hue color per default if not enabled if (currentProfile != null && currentProfile.EnabledSpellHue) { if (spell.TargetType == TargetType.Beneficial) { hue = currentProfile.BeneficHue; } else if (spell.TargetType == TargetType.Harmful) { hue = currentProfile.HarmfulHue; } else { hue = currentProfile.NeutralHue; } } } goto case MessageType.Label; } default: case MessageType.Focus: case MessageType.Whisper: case MessageType.Yell: case MessageType.Regular: case MessageType.Label: case MessageType.Limit3Spell: if (parent == null) { break; } TextObject msg = CreateMessage ( text, hue, font, unicode, type, textType ); msg.Owner = parent; if (parent is Item it && !it.OnGround) { msg.X = DelayedObjectClickManager.X; msg.Y = DelayedObjectClickManager.Y; msg.IsTextGump = true; bool found = false; for (LinkedListNode <Gump> gump = UIManager.Gumps.Last; gump != null; gump = gump.Previous) { Control g = gump.Value; if (!g.IsDisposed) { switch (g) { case PaperDollGump paperDoll when g.LocalSerial == it.Container: paperDoll.AddText(msg); found = true; break; case ContainerGump container when g.LocalSerial == it.Container: container.AddText(msg); found = true; break; case TradingGump trade when trade.ID1 == it.Container || trade.ID2 == it.Container: trade.AddText(msg); found = true; break; } } if (found) { break; } } } parent.AddMessage(msg); break; } MessageReceived.Raise ( new MessageEventArgs ( parent, text, name, hue, type, font, textType, unicode, lang ), parent ); }
public static string GetText(int offset, TextType texttype, bool ignorecc) { return(GetText(offset, 1024, texttype, ignorecc)); }
public static MvcHtmlString AppTextBoxFor <TModel, TProperty>(this HtmlHelper <TModel> htmlHelper, Expression <Func <TModel, TProperty> > expression, string pageId, string styleTage, TextType textType = TextType.Text) { string name = ExpressionHelper.GetExpressionText(expression); string id = name + pageId; object data = ModelMetadata.FromLambdaExpression <TModel, TProperty>(expression, htmlHelper.ViewData).Model; TagBuilder tg = new TagBuilder("input"); tg.MergeAttribute("name", name, true); tg.MergeAttribute("class", "text" + styleTage); tg.GenerateId(id); if (data != null) { tg.MergeAttribute("value", data.ToString()); } if (textType == TextType.Password) { tg.MergeAttribute("type", "password"); } else if (textType == TextType.Hidden) { tg.MergeAttribute("type", "hidden"); } else { tg.MergeAttribute("type", "text"); } return(MvcHtmlString.Create(tg.ToString(TagRenderMode.Normal))); }
public TextTranslationEventArgs(String text, TextType type = TextType.Unknown, TextSource source = TextSource.Unknown) { Text = text; Type = type; Source = source; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="DummyTextToken"/> class. /// </summary> /// <param name="text">The text.</param> /// <param name="textType">Type of the text.</param> /// <param name="isParagraphStart">if set to <c>true</c> text token starts a paragraph. /// </param> /// <param name="isNoteStart">if set to <c>true</c> text token starts a note.</param> /// <param name="paraStyleName">Name of the paragraph style.</param> /// <param name="charStyleName">Name of the character style.</param> /// ------------------------------------------------------------------------------------ public DummyTextToken(string text, TextType textType, bool isParagraphStart, bool isNoteStart, string paraStyleName, string charStyleName) : this(text, textType, isParagraphStart, isNoteStart, paraStyleName, charStyleName, null) { }
public async void Print(object text, TextType type) { this.LST.Print(text.ToString(), type); }
public void AddField(string InfoName, FieldDataType DataType, string GroupName, TextType TextType = TextType.Libre, IntType IntType = IntType.Nombre, int?minValue = null, int?maxValue = null, bool HaveMany = false, bool Required = false, string Defaults = null) { CustomField cf = new CustomField { InfoName = InfoName, DataType = DataType, HaveMany = HaveMany, required = Required, Defaults = Defaults }; switch (DataType) { case FieldDataType.String: { cf.TextType = TextType; break; }; case FieldDataType.Int: { cf.IntType = IntType; cf.Min = minValue; cf.Max = maxValue; break; }; case FieldDataType.Decimal: case FieldDataType.Double: { cf.Min = minValue; cf.Max = maxValue; break; }; case FieldDataType.DateTime: {; break; }; default: {; break; }; } var group = _db.CustomGroups.Where(g => g.GroupName == GroupName).Single(); group.CustomFields.Add(cf); _db.Entry(group).State = EntityState.Modified; _db.SaveChanges(); }
public ActionResult AddField(string InfoName, FieldDataType DataType, int GroupID, TextType TextType = TextType.Libre, IntType IntType = IntType.Nombre, int?minValue = null, int?maxValue = null, string HaveMany = "no", string Required = "no", int Echelle = 5, string Defaults = null) { string def = ""; if (Defaults != null) { var Listedefaults = Defaults.Trim().Split('\r', '\n'); foreach (var item in Listedefaults) { def += String.IsNullOrWhiteSpace(item) ? "" : ";" + item; } } var group = _db.CustomGroups.Find(GroupID); var fields = group.CustomFields; if (fields.Where(g => g.InfoName == InfoName).FirstOrDefault() == null) { if (maxValue == null) { maxValue = Echelle; } service.AddField(InfoName, DataType, group.GroupName, TextType, IntType, minValue, maxValue, HaveMany == "on", Required == "on", def); return(Json("OK")); } else { return(Json("NO")); } }
internal TextChunk(string text, int start, TextType originator, bool bold) { Attributes = new TextDescriptor(originator, start, text.Length, bold); Text = text; }
public void addText(TextType newText) { text.addText(newText); }
public void Append(TextType type, string text, object tag, RoutedEventHandler linkCallback) { _lastElement = this.AppendTextBlock(type, text, tag, linkCallback); this.ScrollToEnd(); }
/////////////////////////////////////////////////////////////////////////////////////////////////// ////////////BUILD FROM V2.1 SCHEMA ////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Initializes a new instance of the <see cref="ReportPeriodTargetCore"/> class. /// </summary> /// <param name="reportPeriodTargetType"> /// The report period target type. /// </param> /// <param name="parent"> /// The parent. /// </param> /// <exception cref="SdmxSemmanticException"> /// Throws Validate exception. /// </exception> protected internal ReportPeriodTargetCore(ReportPeriodTargetType reportPeriodTargetType, IMetadataTarget parent) : base( reportPeriodTargetType, SdmxStructureType.GetFromEnum(SdmxStructureEnumType.ReportPeriodTarget), parent) { this.textType = TextType.GetFromEnum(TextEnumType.ObservationalTimePeriod); if (reportPeriodTargetType.LocalRepresentation != null) { RepresentationType repType = reportPeriodTargetType.LocalRepresentation; if (repType.TextFormat != null) { if (repType.TextFormat.startTime != null) { this.startTime = new SdmxDateCore(repType.TextFormat.startTime.ToString()); } if (repType.TextFormat.endTime != null) { this.endTime = new SdmxDateCore(repType.TextFormat.endTime.ToString()); } if (repType.TextFormat.textType != null) { this.textType = TextTypeUtil.GetTextType(repType.TextFormat.textType); } } } try { this.Validate(); } catch (SdmxSemmanticException e) { throw new SdmxSemmanticException(e, ExceptionCode.FailValidation, this); } }
public GetTextQuery(string textTypeId, string text = null, string id = null) { Id = id; Text = text; SelectedTextType = TextType.FromId(textTypeId); }