Esempio n. 1
0
        /// <summary>
        /// Parses group header
        /// </summary>
        /// <param name="segment">
        /// The edi segment
        /// </param>
        protected override void CreateGroupHeader(string segment)
        {
            Result.Groups.Add(new Group());
            Result.Groups.Last().Messages = new List <Message>();

            Result.Groups.Last().Ung = SegmentParser.ParseLine <S_UNG>(segment, InterchangeContext).Deserialize <S_UNG>();
        }
Esempio n. 2
0
        public void SegmentParser_UnescapeLiterals_2()
        {
            string escaped = "<ut Type=\"start\" RightEdge=\"angle\">&lt;f&quot;TimesNewRomanPSMT&quot;&gt;</ut>Effectively managing employee meals means balancing profit objectives with people objectives.";

            var result = SegmentParser.UnescapeLiterals(escaped);

            Assert.AreEqual("<ut Type=\"start\" RightEdge=\"angle\"><f\"TimesNewRomanPSMT\"></ut>Effectively managing employee meals means balancing profit objectives with people objectives.", result);
        }
Esempio n. 3
0
        private string ParseSegment(Dictionary <string, string> under100, List <char> segment)
        {
            string        segmentResult;
            SegmentParser segmentParser = Factory.CreateSegmentParser(under100, LocalizedSyntax.Joiner);

            segmentResult = segmentParser.Parse(segment);
            return(segmentResult);
        }
Esempio n. 4
0
        public void Valid_Segment_Should_Return_Number(string segment, string expectedResult)
        {
            var parser = new SegmentParser();
            var result = parser.GetNumberForSegment(segment);

            System.Console.WriteLine(result);
            Assert.True(result == expectedResult);
        }
Esempio n. 5
0
        public void SegmentParser_UnescapeLiterals_1()
        {
            string escaped = "some &amp; text with &lt;pseudo-tags&gt;";

            var result = SegmentParser.UnescapeLiterals(escaped);

            Assert.AreEqual(@"some & text with <pseudo-tags>", result);
        }
        public void AccessingEntity_NonExistingProperty()
        {
            var model = new StubModel(
                m => m.EntitySet("catalogs", new List <Catalog1>().AsQueryable())
                );

            SegmentParser.parse("/catalogs(1)/Something", String.Empty, model);
        }
Esempio n. 7
0
        /// <summary>
        /// Lexical analysis of the message
        /// </summary>
        /// <param name="segments">The edi segments.</param>
        /// <param name="envelopes">The edi envelopes.</param>
        /// <param name="interchangeContext">The interchange context.</param>
        /// <returns>The pased edi message.</returns>
        public static Message Analyze(List <string> segments, List <string> envelopes, InterchangeContext interchangeContext)
        {
            // Read the message context from the envelope headers
            var messageContext = new MessageContext(envelopes, interchangeContext);

            // This will read through the grammar and will build an xml

            // Get the grammar from the context
            var messageGrammar = ParseTree.LoadFrom(messageContext.SystemType,
                                                    pt => pt.IsMessage || pt.IsGroup || pt.IsChoice || pt.IsAll || pt.IsLoopOfLoops);
            // Set the position in the grammar
            var lastSegment = messageGrammar.Children.First();

            // Create the xml root of the parsed edi
            var ediXml = ToXml(messageGrammar, interchangeContext);
            // Set the position in the xml
            var lastXElement = ediXml;

            // Iterate trough the segment lines
            foreach (var segment in segments)
            {
                try
                {
                    // Find the next segment grammar
                    var currSeg = lastSegment.FindNextSegment(new SegmentFullName(segment, interchangeContext, messageContext.Format));
                    // Build the segment hierarchy
                    // This will move to the required level up for the segment parents: groups, choices, all and loop of loops,
                    // until another group is reached.
                    var segmentTree = GetSegmentTree(currSeg, lastSegment);
                    // Intersect the grammar with the parsed xml.
                    // The new chunk will be attched to this intersection point.
                    lastXElement = lastXElement.AncestorsAndSelf().Last(xe => xe.Name.LocalName == segmentTree.First().Parent.Name);

                    // Attach each bit
                    foreach (var parseTree in segmentTree)
                    {
                        // Parse if a segment, otherwise convert to xml
                        var element = parseTree.IsSegment
                            ? SegmentParser.ParseLine(parseTree, segment, interchangeContext)
                            : ToXml(parseTree, interchangeContext);

                        // Attach to the xml
                        lastXElement.Add(element);
                        // Set the last attached as the attachment point as we iterate from the top parent to the bottom segment
                        lastXElement = element;
                    }

                    // Reset the position in the grammar
                    lastSegment = currSeg;
                }
                catch (Exception ex)
                {
                    throw new ParserException("Failed at line: " + segment, ex);
                }
            }

            return(new Message(ediXml, messageContext));
        }
        public void Process(string fullPath, SegmentOp operation, ODataModel model,
                            string contentType = "application/atom+xml",
                            string accept      = "application/atom+xml",
                            Stream inputStream = null)
        {
            _body = new StringBuilder();

            var segments = SegmentParser.parse(fullPath, String.Empty, model);

            _response = new ResponseParameters(null, Encoding.UTF8, new StringWriter(_body), 200);

            var callbacks = new ProcessorCallbacks(
                (rt, item) =>
            {
                _accessSingle.Add(new Tuple <ResourceType, object>(rt, item));
                return(true);
            },
                (rt, items) =>
            {
                _accessMany.Add(new Tuple <ResourceType, IEnumerable>(rt, items));
                return(true);
            },
                (rt, item) =>
            {
                _created.Add(new Tuple <ResourceType, object>(rt, item));
                return(true);
            },
                (rt, item) =>
            {
                _updated.Add(new Tuple <ResourceType, object>(rt, item));
                return(true);
            },
                (rt, item) =>
            {
                _removed.Add(new Tuple <ResourceType, object>(rt, item));
                return(true);
            }
                );

            SegmentProcessor.Process(operation, segments,

                                     callbacks,

                                     new RequestParameters(
                                         model,
                                         model as IDataServiceMetadataProvider,
                                         new DataServiceMetadataProviderWrapper(model),
                                         contentType,
                                         Encoding.UTF8,
                                         inputStream,
                                         new Uri("http://localhost/base/"),
                                         new [] { accept }
                                         ),

                                     _response
                                     );
        }
Esempio n. 9
0
        public void SegmentParser_GetTag_StandaloneTag()
        {
            string value = "<ut Type=\"start\" RightEdge=\"angle\"/>";

            SegmentElement actual = SegmentParser.GetTag(value);

            Assert.AreEqual(TagType.Standalone, (actual as Tag).Type);
            Assert.AreEqual(@"ut", (actual as Tag).TagID);
            Assert.IsNotNull((actual as Tag).Anchor);
        }
Esempio n. 10
0
        public void AccessingEntityByKey_2()
        {
            var model = new StubModel(
                m => m.EntitySet("catalogs", new List <Catalog1>().AsQueryable())
                );
            var segments = SegmentParser.parse("/catalogs(10)", String.Empty, model);

            Asserts.ExpectingSegmentsCount(segments, 1);
            Asserts.IsEntityType(segments.ElementAt(0), Key: "10", Name: "catalogs", resource: model.GetResourceType("catalogs").Value);
        }
Esempio n. 11
0
        public void Valid_Two_Segment_Should_Return_2()
        {
            var parser  = new SegmentParser();
            var segment = " _ \r\n" +
                          " _|\r\n" +
                          "|_ ";

            var result = parser.GetNumberForSegment(segment);

            Assert.True(result == "2");
        }
Esempio n. 12
0
        public void SegmentParser_CreateSegment_WithEscaped()
        {
            ScoringResult  scoringResult  = new ScoringResult();
            SearchSettings searchSettings = new SearchSettings();
            CultureInfo    culture        = CultureInfo.GetCultureInfo("en-US");
            string         matchResult    = "<ut Type=\"start\" RightEdge=\"angle\">&lt;f&quot;TimesNewRomanPSMT&quot;&gt;</ut>Effectively managing employee meals means balancing profit objectives with people objectives.";

            var actual = SegmentParser.CreateSegment(scoringResult, searchSettings, matchResult, culture);

            Assert.AreEqual("<f\"TimesNewRomanPSMT\">Effectively managing employee meals means balancing profit objectives with people objectives.", actual.ToPlain());
        }
Esempio n. 13
0
        public void Valid_One_Segment_Should_Return_1()
        {
            var parser  = new SegmentParser();
            var segment = "   \r\n" +
                          "  |\r\n" +
                          "  |";

            var result = parser.GetNumberForSegment(segment);

            Assert.True(result == "1");
        }
Esempio n. 14
0
 /// <summary>
 /// Parses the group trailer.
 /// </summary>
 /// <param name="group">
 /// EDI segment.
 /// </param>
 protected override void CreateGroupTrailer(XElement group)
 {
     try
     {
         Result.Add(SegmentParser.ParseXml <S_UNE>(FindSegment(group, EdiSegments.Une), InterchangeContext));
     }
     catch (ParserException)
     {
         // skip exception as edifact groups are optional
     }
 }
Esempio n. 15
0
        public void AccessingEntityAndPropValue_2()
        {
            var model = new StubModel(
                m => m.EntitySet("catalogs", new List <Catalog1>().AsQueryable())
                );
            var segments = SegmentParser.parse("/catalogs(1)/Name/$value", String.Empty, model);

            Asserts.ExpectingSegmentsCount(segments, 3);
            Asserts.IsEntityType(segments.ElementAt(0), Key: "1", Name: "catalogs", resource: model.GetResourceType("catalogs").Value);
            Asserts.IsPropertySingle(segments.ElementAt(1), "Name");
            Asserts.IsMeta_Value(segments.ElementAt(2));
        }
Esempio n. 16
0
        public void SegmentParser_CreateSegment_OneStartTagWithoutEscaped()
        {
            ScoringResult  scoringResult  = new ScoringResult();
            SearchSettings searchSettings = new SearchSettings();
            CultureInfo    culture        = CultureInfo.GetCultureInfo("en-US");
            string         matchResult    = "<ut Type=\"start\" RightEdge=\"angle\">Effectively managing employee meals means balancing profit objectives with people objectives.";

            var actual = SegmentParser.CreateSegment(scoringResult, searchSettings, matchResult, culture);

            Assert.IsTrue(actual.ToString().Contains("Effectively managing employee meals means balancing profit objectives with people objectives."));
            Assert.AreEqual("Effectively managing employee meals means balancing profit objectives with people objectives.", actual.ToPlain());
        }
Esempio n. 17
0
        public void AccessingEntity_And_OneToManyRelationshipWithKey_()
        {
            var model = new StubModel(
                m =>
            {
                m.EntitySet("catalogs", new List <Catalog2>().AsQueryable());
                m.EntitySet("products", new List <Product2>().AsQueryable());
            });
            var segments = SegmentParser.parse("/catalogs(1)/Products(2)/", String.Empty, model);

            Asserts.ExpectingSegmentsCount(segments, 2);
            Asserts.IsEntityType(segments.ElementAt(0), Key: "1", Name: "catalogs", resource: model.GetResourceType("catalogs").Value);
            Asserts.IsPropertySingle(segments.ElementAt(1), name: "Products", key: "2");
        }
Esempio n. 18
0
        /// <summary>
        /// Parses an edi message
        /// </summary>
        /// <param name="typedMessage">
        /// The Xml edi.
        /// </param>
        protected void CreateSegments(XElement typedMessage)
        {
            // Clear all empty nodes
            typedMessage.Descendants().Where(d => string.IsNullOrEmpty(d.Value)).Remove();
            typedMessage.Descendants().Where(d => string.IsNullOrWhiteSpace(d.Value)).Remove();

            var messageContext = new MessageContext(typedMessage, InterchangeContext);

            // Get all segments, which are not parents of other segments
            foreach (var segment in typedMessage.Descendants().Where(d => d.Name.LocalName.StartsWith("S_") &&
                                                                     !d.Elements().Any(e => e.Name.LocalName.StartsWith("S_"))))
            {
                Result.Add(SegmentParser.ParseXml(messageContext.SystemType, segment, InterchangeContext));
            }
        }
Esempio n. 19
0
        public void AccessingEntity_And_OneToManyRelationship_1()
        {
            var model = new StubModel(
                m =>
            {
                m.EntitySet("catalogs", new List <Catalog2>().AsQueryable());
                m.EntitySet("products", new List <Product2>().AsQueryable());
            });
            var segments = SegmentParser.parse("/catalogs(1)/Products/", String.Empty, model);

            Asserts.ExpectingSegmentsCount(segments, 2);
            Asserts.IsEntityType(segments.ElementAt(0), Key: "1", Name: "catalogs", resource: model.GetResourceType("catalogs").Value);

            // Not sure which one this should be? Products or catalog?
            Asserts.IsPropertyCollection(segments.ElementAt(1), Name: "Products", resource: model.GetResourceType("products").Value);
        }
Esempio n. 20
0
        private SegmentType UnescapeSegment(StringSegment segment, out string segmentValue)
        {
            segmentValue = null;

            var parser = new SegmentParser(this, segment.String, segment.Start, segment.End);

            if (parser.Type == SegmentType.PartialCapture)
            {
                this.OnError("Missing closing brace.", segment.End - 1, 1);
            }
            else if (parser.Type != SegmentType.Error)
            {
                segmentValue = parser.Value;
            }

            return(parser.Type);
        }
Esempio n. 21
0
        public void SegmentParser_CreateSegment_GeneralAndPlainString()
        {
            ScoringResult  scoringResult  = new ScoringResult();
            SearchSettings searchSettings = new SearchSettings();
            CultureInfo    culture        = CultureInfo.GetCultureInfo("en-US");
            string         matchResult    = "some plain string";

            var actual = SegmentParser.CreateSegment(scoringResult, searchSettings, matchResult, culture);

            Assert.AreEqual(CultureInfo.GetCultureInfo("en-US"), actual.Culture);
            Assert.AreEqual("en-US", actual.CultureName);
            Assert.AreEqual(1, actual.Elements.Count);
            Assert.IsFalse(actual.HasPairedTags);
            Assert.IsFalse(actual.HasPlaceables);
            Assert.IsFalse(actual.HasTags);
            Assert.IsFalse(actual.IsEmpty);
            Assert.IsTrue(actual.IsValid());
            Assert.AreEqual("some plain string", actual.ToPlain());
            Assert.AreEqual("some plain string", actual.ToString());
        }
Esempio n. 22
0
 /// <summary>
 /// Parses interchange trailer
 /// </summary>
 /// <param name="segment">
 /// The edi segment
 /// </param>
 protected override void CreateInterchangeTrailer(string segment)
 {
     Result.Unz = SegmentParser.ParseLine <S_UNZ>(segment, InterchangeContext).Deserialize <S_UNZ>();
 }
Esempio n. 23
0
        /// <summary>
        /// Lexically analyses a message.
        /// </summary>
        /// <param name="segments">The EDI segments.</param>
        /// <param name="envelopes">The EDI envelopes.</param>
        /// <param name="interchangeContext">The interchange context.</param>
        /// <returns>The passed Edi message.</returns>
        public static Message Analyze(List <string> segments, List <string> envelopes, InterchangeContext interchangeContext)
        {
            // Read the message context from the envelope headers
            var messageContext = new MessageContext(envelopes, interchangeContext);

            // This will read through the grammar and will build an XML

            // Get the grammar from the context
            var messageGrammar = ParseTree.LoadFrom(messageContext.SystemType,
                                                    pt => pt.IsMessage || pt.IsGroup || pt.IsChoice || pt.IsAll || pt.IsLoopOfLoops);
            // Set the position in the grammar
            var lastSegment = messageGrammar.Children.First();

            // Create the XML root of the parsed EDI
            var ediXml = ToXml(messageGrammar, interchangeContext);
            // Set the position in the XML
            var lastXElement = ediXml;

            // Iterate trough the segment lines
            foreach (var segment in segments)
            {
                try
                {
                    var segmentContext = new SegmentContext(segment, interchangeContext, messageContext.Format);

                    Logger.Log(string.Format("Segment to find: {0}", segmentContext.ToPropertiesString()));

                    // Jump back to HL segment if needed
                    if (segmentContext.IsJump())
                    {
                        XElement hlParent;
                        if (segmentContext.ParentId != null)
                        {
                            // Parent HL, start right after it
                            hlParent = ediXml.Descendants().Single(d => d.Name.LocalName.StartsWith("S_HL") &&
                                                                   d.Elements().First().Value ==
                                                                   segmentContext.ParentId);
                            var hl = messageGrammar.Descendants().Single(pt => pt.Name == hlParent.Name.LocalName);
                            lastSegment = hl.Parent.Children[1];
                        }
                        else
                        {
                            // Root HL, start from it
                            hlParent = ediXml.Descendants().First(d => d.Name.LocalName.StartsWith("S_HL"));
                            var hl = messageGrammar.Descendants().Single(pt => pt.Name == hlParent.Name.LocalName);
                            lastSegment = hl;
                        }
                    }

                    // Find the next segment grammar
                    var currSeg = lastSegment.FindNextSegment(segmentContext);

                    Logger.Log(string.Format("Segment found: {0}", currSeg.Name));

                    // Build the segment hierarchy
                    // This will move to the required level up for the segment parents: groups, choices, all and loop of loops,
                    // until another group is reached.
                    var segmentTree = GetSegmentTree(currSeg, lastSegment);
                    // Intersect the grammar with the parsed XML.
                    // The new chunk will be attached to this intersection point.
                    lastXElement =
                        lastXElement.AncestorsAndSelf().Last(xe => xe.Name.LocalName == segmentTree.First().Parent.Name);

                    // Attach each bit
                    foreach (var parseTree in segmentTree)
                    {
                        // Parse if a segment, otherwise convert to XML
                        var element = parseTree.IsSegment
                            ? SegmentParser.ParseLine(parseTree, segment, interchangeContext)
                            : ToXml(parseTree, interchangeContext);

                        // Attach to the XML
                        lastXElement.Add(element);
                        // Set the last attached as the attachment point as we iterate from the top parent to the bottom segment
                        lastXElement = element;
                    }

                    // Reset the position in the grammar
                    lastSegment = currSeg;
                }
                catch (Exception ex)
                {
                    throw new ParserException("Failed at line: " + segment, ex);
                }
            }

            return(new Message(ediXml, messageContext));
        }
Esempio n. 24
0
 /// <summary>
 /// Parses interchange header
 /// </summary>
 /// <param name="segment">
 /// The edi segment
 /// </param>
 protected override void CreateInterchangeHeader(string segment)
 {
     Result.Isa = SegmentParser.ParseLine <S_ISA>(segment, InterchangeContext).Deserialize <S_ISA>();
 }
Esempio n. 25
0
 /// <summary>
 /// Parses the group trailer.
 /// </summary>
 /// <param name="group">
 /// EDI segment.
 /// </param>
 protected override void CreateGroupTrailer(XElement group)
 {
     Result.Add(SegmentParser.ParseXml <S_GE>(FindSegment(group, EdiSegments.Ge), InterchangeContext));
 }
Esempio n. 26
0
 public SegmentService()
 {
     configurationManager = new ConfigurationManager();
     segmentParser        = new SegmentParser();
     htmlLoader           = new HtmlLoader();
 }
Esempio n. 27
0
        public Dictionary <int, ShaderUniformSet> GetDescriptorSetLayouts()
        {
            Dictionary <int, ShaderUniformSet> sets = new Dictionary <int, ShaderUniformSet>();

            IEnumerable <DescriptorSegment> descriptorSegments = _segmentCollection.GetSegments <DescriptorSegment>();

            for (int i = 0; i < descriptorSegments.Count(); i++)
            {
            }

            /*
             * if (!sets.ContainsKey(set))
             * {
             *  sets.Add(set, new ShaderUniformSet(set));
             * }
             * sets[set].ShaderUniforms.Add(shaderUniform);*/

            MatchCollection matches = Regex.Matches(code, @"layout *\( *(( *std140 *| *set *= *\d*) *, *){0,1} *binding *= *\d*\) *(readonly){0,1} *(buffer|uniform) ");

            for (int i = 0; i < matches.Count; i++)
            {
                Match match = matches[i];

                int    set      = 0;
                string theMatch = match.ToString();
                if (theMatch.Contains("set"))
                {
                    set = int.Parse(theMatch.Substring(theMatch.IndexOf("set"), theMatch.IndexOf(",") - theMatch.IndexOf("set")).Replace("set", string.Empty).Replace("=", string.Empty).Trim());
                }
                int binding = int.Parse(theMatch.Substring(theMatch.IndexOf("binding"), theMatch.IndexOf(")") - theMatch.IndexOf("binding")).Replace("binding", string.Empty).Replace("=", string.Empty).Trim());

                string bufferOrUniformSegment = Regex.Match(theMatch, @"(buffer |uniform )").ToString();

                string codeSegment = SegmentParser.GetWholeCodeSegment(code, match.Index);

                DescriptorType descriptorType;
                string         name;

                uint   size = 0;
                string segmentAfterBufferOrUniform = codeSegment.Substring(codeSegment.IndexOf(bufferOrUniformSegment, StringComparison.InvariantCultureIgnoreCase) + bufferOrUniformSegment.Length);
                if (codeSegment.Contains("{"))
                {
                    descriptorType = Constants.GlslToCustomDescriptorTypeConverter.Convert(bufferOrUniformSegment.Trim());

                    int openingIndex = segmentAfterBufferOrUniform.IndexOf("{");
                    int closingIndex = segmentAfterBufferOrUniform.IndexOf("}");

                    name = Util.KillDuplicateWhiteSpaces(segmentAfterBufferOrUniform.Substring(0, openingIndex));

                    string pushconstantSegment  = segmentAfterBufferOrUniform.Substring(openingIndex + 1, closingIndex - openingIndex - 1);
                    IEnumerable <string> fields = pushconstantSegment.Split(';').Select(s => s.Trim());

                    List <ShaderVariable> variables = ShaderVariableParser.Parse(fields);

                    size = (uint)variables.Sum(v => v.Size);
                }
                else
                {
                    string[] typeAndName = Util.KillDuplicateWhiteSpaces(segmentAfterBufferOrUniform).Split(' ');

                    string glslType = typeAndName[0];
                    descriptorType = Constants.GlslToDescriptorType[glslType];

                    name = typeAndName[1];
                }


                ShaderUniform shaderUniform = new ShaderUniform()
                {
                    Name           = name,
                    Binding        = binding,
                    DescriptorType = descriptorType,
                    StageFlags     = ShaderStage,
                    Size           = size,
                };


                if (!sets.ContainsKey(set))
                {
                    sets.Add(set, new ShaderUniformSet(set));
                }
                sets[set].ShaderUniforms.Add(shaderUniform);
            }

            matches = Regex.Matches(code, @"layout *\(.*\) *uniform *image2D *");
            for (int i = 0; i < matches.Count; i++)
            {
                Match match = matches[i];

                int    set      = 0;
                string theMatch = match.ToString();
                if (theMatch.Contains("set"))
                {
                    set = int.Parse(theMatch.Substring(theMatch.IndexOf("set"), theMatch.IndexOf(",") - theMatch.IndexOf("set")).Replace("set", string.Empty).Replace("=", string.Empty).Trim());
                }
                int binding = int.Parse(theMatch.Substring(theMatch.IndexOf("binding"), Math.Min(theMatch.LastIndexOf(","), theMatch.IndexOf(")")) - theMatch.IndexOf("binding")).Replace("binding", string.Empty).Replace("=", string.Empty).Trim());

                string bufferOrUniformSegment = Regex.Match(theMatch, @"(buffer |uniform )").ToString();

                string codeSegment = SegmentParser.GetWholeCodeSegment(code, match.Index);

                DescriptorType descriptorType;
                string         name;

                string segmentAfterBufferOrUniform = codeSegment.Substring(codeSegment.IndexOf(bufferOrUniformSegment, StringComparison.InvariantCultureIgnoreCase) + bufferOrUniformSegment.Length);
                if (codeSegment.Contains("{"))
                {
                    descriptorType = Constants.GlslToCustomDescriptorTypeConverter.Convert(bufferOrUniformSegment.Trim());

                    int openingIndex = segmentAfterBufferOrUniform.IndexOf("{");
                    int closingIndex = segmentAfterBufferOrUniform.IndexOf("}");

                    name = Util.KillDuplicateWhiteSpaces(segmentAfterBufferOrUniform.Substring(0, openingIndex));

                    string pushconstantSegment  = segmentAfterBufferOrUniform.Substring(openingIndex + 1, closingIndex - openingIndex - 1);
                    IEnumerable <string> fields = pushconstantSegment.Split(';').Select(s => s.Trim());

                    List <ShaderVariable> variables = ShaderVariableParser.Parse(fields);
                }
                else
                {
                    string[] typeAndName = Util.KillDuplicateWhiteSpaces(segmentAfterBufferOrUniform).Split(' ');

                    string glslType = typeAndName[0];
                    descriptorType = Constants.GlslToDescriptorType[glslType];

                    name = typeAndName[1];
                }


                ShaderUniform shaderUniform = new ShaderUniform()
                {
                    Name           = name,
                    Binding        = binding,
                    DescriptorType = descriptorType,
                    StageFlags     = ShaderStage,
                };


                if (!sets.ContainsKey(set))
                {
                    sets.Add(set, new ShaderUniformSet(set));
                }
                sets[set].ShaderUniforms.Add(shaderUniform);
            }

            return(sets);
        }
Esempio n. 28
0
 /// <summary>
 /// Parses group trailer
 /// </summary>
 /// <param name="segment">
 /// The edi segment
 /// </param>
 protected override void CreateGroupTrailer(string segment)
 {
     Result.Groups.Last().Une = SegmentParser.ParseLine <S_UNE>(segment, InterchangeContext).Deserialize <S_UNE>();
 }
Esempio n. 29
0
 /// <summary>
 /// Parses the interchange header.
 /// </summary>
 /// <param name="xmlEdi">
 /// EDI segment.
 /// </param>
 protected override void CreateInterchangeHeader(XElement xmlEdi)
 {
     Result.Add(SegmentParser.ParseXml <S_UNB>(FindSegment(xmlEdi, EdiSegments.Unb), InterchangeContext));
 }
Esempio n. 30
0
 /// <summary>
 /// Parses the interchange trailer.
 /// </summary>
 /// <param name="xmlEdi">
 /// EDI segment.
 /// </param>
 protected override void CreateInterchangeTrailer(XElement xmlEdi)
 {
     Result.Add(SegmentParser.ParseXml <S_IEA>(FindSegment(xmlEdi, EdiSegments.Iea), InterchangeContext));
 }