/// <summary> /// Gets the correct coding style line break chars /// </summary> public static String ProcessCodeStyleLineBreaks(String text) { String CSLB = "$(CSLB)"; Int32 nextIndex = text.IndexOfOrdinal(CSLB); if (nextIndex < 0) { return(text); } CodingStyle cs = PluginBase.Settings.CodingStyle; if (cs == CodingStyle.BracesOnLine) { return(text.Replace(CSLB, "")); } Int32 eolMode = (Int32)Globals.Settings.EOLMode; String lineBreak = LineEndDetector.GetNewLineMarker(eolMode); String result = ""; Int32 currentIndex = 0; while (nextIndex >= 0) { result += text.Substring(currentIndex, nextIndex - currentIndex) + lineBreak + GetLineIndentation(text, nextIndex); currentIndex = nextIndex + CSLB.Length; nextIndex = text.IndexOfOrdinal(CSLB, currentIndex); } return(result + text.Substring(currentIndex)); }
public virtual void FromXml(XmlElement element) { this.codingStyle = (CodingStyle)Enum.Parse(typeof(CodingStyle), element.Attributes["CodingStyle"].Value); this.ownFieldName = element.Attributes["OwnFieldName"].Value; this.foreignFieldName = element.Attributes["ForeignFieldName"].Value; this.foreignKeyColumnName = element.Attributes["ForeignKeyColumnName"].Value; this.relationDirection = (RelationDirection)Enum.Parse(typeof(RelationDirection), element.Attributes["RelationDirection"].Value); this.table = element.Attributes["Table"].Value; this.type = element.Attributes["RelationType"].Value; }
public virtual void FromXml(XmlElement element) { this.CodingStyle = (CodingStyle)CodingStyle.Parse(typeof(CodingStyle), element.Attributes["CodingStyle"].Value); this.fieldName = element.Attributes["FieldName"].Value; this.table = element.Attributes["Table"].Value; this.foreignKeyColumnName = element.Attributes["ForeignKeyColumnName"].Value; this.isComposite = bool.Parse(element.Attributes["IsComposite"].Value); this.isElement = bool.Parse(element.Attributes["IsElement"].Value); this.relationDirection = (RelationDirection)RelationDirection.Parse(typeof(RelationDirection), element.Attributes["RelationDirection"].Value); this.type = element.Attributes["RelationType"].Value; }
public override void FromXml(XmlElement element) { base.FromXml(element); this.CodingStyle = (CodingStyle)CodingStyle.Parse(typeof(CodingStyle), element.Attributes["CodingStyle"].Value); this.fieldName = element.Attributes["FieldName"].Value; this.isComposite = bool.Parse(element.Attributes["IsComposite"].Value); this.relationDirection = (RelationDirection)RelationDirection.Parse(typeof(RelationDirection), element.Attributes["RelationDirection"].Value); XmlElement masterElement = (XmlElement)element.SelectSingleNode("Master"); master = new FkRelation(); master.FromXml(masterElement); }
public override void FromXml(XmlElement element) { base.FromXml(element); this.CodingStyle = (CodingStyle)CodingStyle.Parse(typeof(CodingStyle), element.Attributes["CodingStyle"].Value); this.fieldName = element.Attributes["FieldName"].Value; this.foreignCodingStyle = (CodingStyle)CodingStyle.Parse(typeof(CodingStyle), element.Attributes["ForeignCodingStyle"].Value); this.foreignFieldName = element.Attributes["ForeignFieldName"].Value; this.foreignIsComposite = bool.Parse(element.Attributes["ForeignIsComposite"].Value); this.isComposite = bool.Parse(element.Attributes["IsComposite"].Value); this.name = element.Attributes["Name"].Value; this.owningTable = element.Attributes["OwningTable"].Value; this.relatedTable = element.Attributes["RelatedTable"].Value; this.relationDirection = (RelationDirection)RelationDirection.Parse(typeof(RelationDirection), element.Attributes["RelationDirection"].Value); this.relationName = element.Attributes["RelationName"].Value; }
/// <summary> /// Get the options for the formatter based on FD settings or manual command /// </summary> private String GetOptionData(String language) { String optionData; if (language == "cpp") { optionData = this.settingObject.Pref_AStyle_CPP; } else { optionData = this.settingObject.Pref_AStyle_Others; } if (String.IsNullOrEmpty(optionData)) { Int32 tabSize = PluginBase.Settings.TabWidth; Boolean useTabs = PluginBase.Settings.UseTabs; Int32 spaceSize = PluginBase.Settings.IndentSize; CodingStyle codingStyle = PluginBase.Settings.CodingStyle; optionData = AStyleInterface.DefaultOptions + " --mode=c"; if (language != "cpp") { optionData += "s"; // --mode=cs } if (useTabs) { optionData += " --indent=force-tab=" + tabSize.ToString(); } else { optionData += " --indent=spaces=" + spaceSize.ToString(); } if (codingStyle == CodingStyle.BracesAfterLine) { optionData += " --style=allman"; } else { optionData += " --style=attach"; } } return(optionData); }
public virtual void FromXml(XmlElement element) { this.codingStyle1 = (CodingStyle)Enum.Parse(typeof(CodingStyle), element.Attributes["CodingStyle1"].Value); this.codingStyle2 = (CodingStyle)Enum.Parse(typeof(CodingStyle), element.Attributes["CodingStyle2"].Value); this.fieldName1 = element.Attributes["FieldName1"].Value; this.fieldName2 = element.Attributes["FieldName2"].Value; this.isComposite1 = bool.Parse(element.Attributes["IsComposite1"].Value); this.isComposite2 = bool.Parse(element.Attributes["IsComposite2"].Value); Type thisType = this.GetType(); if (element.Attributes["RelatedColumn1"] != null) { NodeListSerializer.AddFixup(int.Parse(element.Attributes["RelatedColumn1"].Value), thisType.GetField("relatedColumn1", BindingFlags.Instance | BindingFlags.NonPublic), this); } if (element.Attributes["RelatedColumn2"] != null) { NodeListSerializer.AddFixup(int.Parse(element.Attributes["RelatedColumn2"].Value), thisType.GetField("relatedColumn2", BindingFlags.Instance | BindingFlags.NonPublic), this); } if (element.Attributes["RelatedTable1"] != null) { NodeListSerializer.AddFixup(int.Parse(element.Attributes["RelatedTable1"].Value), thisType.GetField("relatedNode1", BindingFlags.Instance | BindingFlags.NonPublic), this); } if (element.Attributes["RelatedTable2"] != null) { NodeListSerializer.AddFixup(int.Parse(element.Attributes["RelatedTable2"].Value), thisType.GetField("relatedNode2", BindingFlags.Instance | BindingFlags.NonPublic), this); } this.relationCardinality1 = (RelationCardinality)Enum.Parse(typeof(RelationCardinality), element.Attributes["RelationCardinality1"].Value); this.relationCardinality2 = (RelationCardinality)Enum.Parse(typeof(RelationCardinality), element.Attributes["RelationCardinality2"].Value); this.relationName = element.Attributes["RelationName"].Value; }
protected override void Parse() { if (_markerLength < 12) { throw new ArgumentOutOfRangeException( "COD marker must be at least 12 bytes long"); } Stream mem = new MemoryStream(_markerBody); byte scod = mem.ReadUInt8(); if (scod > MAX_CODSTYLE) { throw new ArgumentOutOfRangeException("CodingStyle"); } _scod = (CodingStyle)scod; byte progOrder = mem.ReadUInt8(); if (!Enum.IsDefined(typeof(ProgressionOrder), progOrder)) { throw new ArgumentOutOfRangeException( "Progression order must be 4 or less"); } Progression = (ProgressionOrder)progOrder; QualityLayers = mem.ReadUInt16(); if (QualityLayers == 0) { throw new ArgumentOutOfRangeException( "LayerCount must be strictly positive"); } byte useMct = mem.ReadUInt8(); if (useMct > 1) { throw new ArgumentOutOfRangeException("MCT must be 0 or 1"); } UseMultipleComponentTransform = useMct == 1; DecompositionLevels = mem.ReadUInt8(); if (DecompositionLevels > 32) { throw new ArgumentOutOfRangeException( "DecompositionLevels must be 32 or less"); } _cblkExpnX = mem.ReadUInt8(); _cblkExpnY = mem.ReadUInt8(); if ((_cblkExpnX > (1 << 4)) || (_cblkExpnY > (1 << 4)) || (_cblkExpnX + _cblkExpnY) > 8) { throw new ArgumentOutOfRangeException( "codeblock width and height must be at most 1K samples " + " the area of the codeblock should be at most 4K samples"); } byte cblkStyle = mem.ReadUInt8(); if (!Enum.IsDefined(typeof(CodeblockStyle), cblkStyle)) { throw new ArgumentOutOfRangeException( "coding block style must be 32 or less"); } CBlkStyle = (CodeblockStyle)cblkStyle; byte waveletFilter = mem.ReadUInt8(); if (!Enum.IsDefined(typeof(WaveletTransform), waveletFilter)) { throw new ArgumentException( "WaveletTransform undefined"); } WaveletFilter = (WaveletTransform)waveletFilter; if (UsePrecincts) { int expectedCodSize = 12 + DecompositionLevels + 1; if (_markerLength != expectedCodSize) { throw new ArgumentOutOfRangeException( "size mismatch in COD marker segment for precinct specs"); } } _ppx = new byte[DecompositionLevels + 1]; _ppy = new byte[DecompositionLevels + 1]; for (int r = 0; r <= DecompositionLevels; r++) { if (UsePrecincts) { byte val = mem.ReadUInt8(); _ppx[r] = (byte)(val & 0xF); _ppy[r] = (byte)((val >> 4) & 0xF); } else { // Table A.13 – Coding style parameter values for the // Scod parameter: // Entropy coder, precincts with PPx = 15 and PPy = 15 _ppx[r] = _ppy[r] = 0xF; } } PrecinctPartitions = _ppx .Zip(_ppy, (ppx, ppy) => new Point(ppx, ppy)) .ToList().AsReadOnly(); }