예제 #1
0
        public void ConvertSectionTest()
        {
            LC4Convertor target = new LC4Convertor();

            TestProject.Denisenko_Cutting_Converting_LC4ConvertorAccessor accessor = new TestProject.Denisenko_Cutting_Converting_LC4ConvertorAccessor(target);

            ParametersCollection parameters = new ParametersCollection();

            parameters.CutterThickness = 10M;
            CuttingScheme scheme = new CuttingScheme();

            scheme.Width      = 1000M;
            scheme.Height     = 1000M;
            scheme.Parameters = parameters;
            Section someSection = null;

            scheme.Cut(scheme.RootSection, 20M, CutType.Vertical, out someSection);

            Section prevSection = null;
            Section input       = scheme.RootSection.NestedSections[0];
            Section cut         = scheme.RootSection.NestedSections[1];

            LC4Section expected = new LC4Section();

            expected.Size        = LC4Numeric.FromNonScaled(30);
            expected.SectionType = LC4SectionType.Anschnitt;
            LC4Section actual;

            actual = accessor.ConvertSection(input, prevSection, cut);

            Assert.AreEqual <LC4Section>(expected, actual, "Denisenko.Cutting.Converting.LC4Convertor.ConvertSection did not return the expec" +
                                         "ted value.");
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
예제 #2
0
파일: LC4Parser.cs 프로젝트: shtspk/raskroy
        private void LoadSection(List <LC4Section> parentCollection)
        {
            LC4Section operation = new LC4Section();

            Byte[] pad;
            pad = ReadBytes(7);

            operation.SectionType  = (LC4SectionType)Enum.Parse(typeof(LC4SectionType), ReadString());
            operation.CopyString   = ReadString();
            operation.Size         = ReadNumeric();
            operation.SomeInteger1 = ReadInt32();
            pad = ReadBytes(2);
            ReadInt32();             // skip type code
            pad = ReadBytes(2);
            operation.SomeInteger2 = ReadInt32();
            pad = ReadBytes(4);
            operation.SomeInteger3 = ReadInt32();
            pad = ReadBytes(7);
            operation.SomeInteger4 = ReadInt32();

            pad = ReadBytes(7);
            Int32 subOperationsCount = ReadInt32();

            for (Int32 i = 0; i < subOperationsCount; i++)
            {
                LoadSection(operation.NestedSections);
            }

            pad = ReadBytes(3);

            parentCollection.Add(operation);
        }
예제 #3
0
        private void LoadSection(List<LC4Section> parentCollection)
        {
            LC4Section operation = new LC4Section();

            Byte[] pad;
            pad = m_fmt.ReadBytes(7);

            operation.SectionType = (LC4SectionType)Enum.Parse(typeof(LC4SectionType), m_fmt.ReadString());
            operation.CopyString = m_fmt.ReadString();
            operation.Size = m_fmt.ReadNumeric();
            operation.SomeInteger1 = m_fmt.ReadInt32();
            pad = m_fmt.ReadBytes(2);
            m_fmt.ReadInt32(); // skip type code
            pad = m_fmt.ReadBytes(2);
            operation.SomeInteger2 = m_fmt.ReadInt32();
            pad = m_fmt.ReadBytes(4);
            operation.SomeInteger3 = m_fmt.ReadInt32();
            pad = m_fmt.ReadBytes(7);
            operation.SomeInteger4 = m_fmt.ReadInt32();

            pad = m_fmt.ReadBytes(7);
            Int32 subOperationsCount = m_fmt.ReadInt32();

            for (Int32 i = 0; i < subOperationsCount; i++)
                LoadSection(operation.NestedSections);

            pad = m_fmt.ReadBytes(3);

            parentCollection.Add(operation);
        }
예제 #4
0
파일: LC4Parser.cs 프로젝트: shtspk/raskroy
 private void SaveSection(LC4Section section)
 {
     WriteBytes(new Byte[] { 1, 0, 1, 5, 0, 2, 0 });
     WriteString(section.SectionType.ToString());
     WriteString(section.CopyString);
     WriteNumeric(section.Size);
     WriteInt32(section.SomeInteger1);
     WriteBytes(new Byte[] { 17, 0 });
     WriteInt32((Int32)section.SectionType);             // operation type
     WriteBytes(new Byte[] { 18, 0 });
     WriteInt32(section.SomeInteger2);
     WriteBytes(new Byte[] { 5, 0, 1, 0 });
     WriteInt32(section.SomeInteger3);
     WriteBytes(new Byte[] { 1, 0, 1, 5, 0, 1, 0 });
     WriteInt32(section.SomeInteger4);
     WriteBytes(new Byte[] { 1, 0, 1, 5, 0, 1, 0 });
     WriteInt32(section.NestedSections.Count);
     foreach (LC4Section nestedSection in section.NestedSections)
     {
         SaveSection(nestedSection);
     }
     WriteBytes(new Byte[] { 1, 0, 0 });
 }