Esempio n. 1
0
        public void WriteToAnotherBlockNextTime()
        {
            var block = new MemberSubSection();

            SubSections.Add(block);
            m_BlockToWriteTo++;
        }
Esempio n. 2
0
        public override string ToString()
        {
            // Create signature block even if there are no signatures in cases where there
            // can be more than one signature. Otherwise the parameters / return type
            // docs and descriptions for the different sections get all mixed up.
            bool includeSignatureBlock = MemberItem.MultipleSignaturesPossibleForType(AssemblyKind);

            if (AssemblyKind == AssemblyType.Unknown && SignatureCount == 0)
            {
                includeSignatureBlock = false;
            }

            var sb = new StringBuilder();

            foreach (var block in SubSections)
            {
                sb.Append(block.ToString(includeSignatureBlock));
                if (block != SubSections.Last())
                {
                    sb.AppendUnixLine();
                }
            }

            return(sb.ToString());
        }
Esempio n. 3
0
 public void AddSignatureToCurrentBlock(string sig)
 {
     if (m_BlockToWriteTo > SubSections.Count - 1)
     {
         SubSections.Add(new MemberSubSection());
     }
     SubSections[m_BlockToWriteTo].SignatureList.Add(sig);
 }
Esempio n. 4
0
 private void GoToSubsection(SubSections subSectionToNavigateTo)
 {
     switch(subSectionToNavigateTo)
     {
         case SubSections.Apps:
             break;
         case SubSections.Groups:
             ShowViewModel<GroupsPageViewModel>();
             break;
         case SubSections.Users:
             ShowViewModel<UsersPageViewModel>();
             break;
         default:
             break;
     }
 }
Esempio n. 5
0
        /// <summary>
        ///     Model Geometry
        /// </summary>
        /// <param name="data"></param>
        /// <param name="ignoreVersion"></param>
        /// <param name="sectionHeader"></param>
        public G1MGeometry(Span <byte> data, bool ignoreVersion, ResourceSectionHeader sectionHeader)
        {
            if (sectionHeader.Magic != DataType.G1MG)
            {
                throw new InvalidOperationException("Not an G1MG stream");
            }

            Section = sectionHeader;
            if (!ignoreVersion && Section.Version.ToVersion() != SupportedVersion)
            {
                throw new NotSupportedException($"G1MG version {Section.Version.ToVersion()} is not supported!");
            }

            Header = MemoryMarshal.Read <ModelGeometryHeader>(data);

            var offset = SizeHelper.SizeOf <ModelGeometryHeader>();

            while (offset < data.Length)
            {
                var subSectionHeader = MemoryMarshal.Read <ModelSection>(data.Slice(offset));
                var block            = data.Slice(offset + SizeHelper.SizeOf <ModelSection>(), subSectionHeader.Size - SizeHelper.SizeOf <ModelSection>());
                offset += subSectionHeader.Size;
                var section = subSectionHeader.Magic switch
                {
                    ModelGeometrySectionType.Socket => (IG1MGSection) new G1MGSocket(block, subSectionHeader),
                    ModelGeometrySectionType.Material => new G1MGMaterial(block, subSectionHeader),
                    ModelGeometrySectionType.ShaderParam => new G1MGShaderParam(block, subSectionHeader),
                    ModelGeometrySectionType.VertexBuffer => new G1MGVertexBuffer(block, subSectionHeader),
                    ModelGeometrySectionType.VertexAttribute => new G1MGVertexAttribute(block, subSectionHeader),
                    ModelGeometrySectionType.Bone => new G1MGBone(block, subSectionHeader),
                    ModelGeometrySectionType.IndexBuffer => new G1MGIndexBuffer(block, subSectionHeader),
                    ModelGeometrySectionType.SubMesh => new G1MGSubMesh(block, subSectionHeader),
                    ModelGeometrySectionType.Mesh => new G1MGMesh(block, subSectionHeader),
                    _ => throw new NotSupportedException($"Can't handle G1MG section {subSectionHeader.Magic:F}")
                };
                SubSections.Add(section);
            }
        }
Esempio n. 6
0
        public void ShowMenu()
        {
            var isRunning = true;

            while (isRunning)
            {
                Console.WriteLine("Welcome to the best store ever!");
                foreach (var section in SubSections)
                {
                    Console.WriteLine($"{section.Section.ToString("d")}. {section.Title}");
                }
                foreach (var product in Products)
                {
                    Console.WriteLine($"{product.Id}. {product.Name}");
                }
                Console.WriteLine("0. Exit");

                var userInput = Console.ReadLine();
                int intUserInput;
                var isSuccessful = int.TryParse(userInput, out intUserInput);
                if (!isSuccessful)
                {
                    Console.WriteLine($"Please enter a number between 1 and {SubSections.Count()}");
                }
                else
                {
                    if (intUserInput == 0)
                    {
                        isRunning = false;
                    }
                }
                var enumUserInput = (SectionId)intUserInput;
                Console.WriteLine($"You chose {userInput}: {enumUserInput}");
                var subsection = SubSections.FirstOrDefault(s => s.Section == enumUserInput);
                subsection.ShowMenu();
            }
        }
 public bool IsValidForSubmission()
 {
     return((Questions == null || Questions.All(q => q.Optional || !string.IsNullOrEmpty(q.Answer))) &&
            (SubSections == null || SubSections.All(s => s.IsValidForSubmission())));
 }
 public bool IsComplete()
 {
     return((Questions == null || Questions.All(q => !string.IsNullOrEmpty(q.Answer))) &&
            (SubSections == null || SubSections.All(s => s.IsComplete())));
 }
Esempio n. 9
0
 public bool IsCsNone()
 {
     return(SubSections.Count > 0 && SubSections.All(s => s.IsCsNone));
 }
Esempio n. 10
0
 public bool IsUndoc()
 {
     return(SubSections.Count > 0 && SubSections.All(s => s.IsUndoc));
 }
Esempio n. 11
0
 public bool IsEmpty()
 {
     return(SubSections.All(e => e.IsEmpty()));
 }
Esempio n. 12
0
 internal MemberSubSection SubSectionOfSignature(string sig)
 {
     return(SubSections.FirstOrDefault(section => section.SignatureList.Contains(sig)));
 }
Esempio n. 13
0
 /// <summary>
 ///     Gets all geometry components matching
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <returns></returns>
 public IEnumerable <T> GetSections <T>() where T : class, IG1MGSection => SubSections.OfType <T>();