示例#1
0
文件: NVA.cs 项目: swordworld/dstools
        internal override void Read(BinaryReaderEx br)
        {
            br.BigEndian = false;
            br.AssertASCII("NVMA");
            Version = br.ReadEnum32 <NVAVersion>();
            br.ReadUInt32();                                             // File size
            br.AssertInt32(Version == NVAVersion.OldBloodborne ? 8 : 9); // Section count

            Navmeshes = new NavmeshSection(br);
            Entries1  = new Section1(br);
            Entries2  = new Section2(br);
            new Section3(br);
            Connectors = new ConnectorSection(br);
            var connectorPoints     = new ConnectorPointSection(br);
            var connectorConditions = new ConnectorConditionSection(br);

            Entries7 = new Section7(br);
            if (Version == NVAVersion.OldBloodborne)
            {
                Entries8 = new Section8(1);
            }
            else
            {
                Entries8 = new Section8(br);
            }

            foreach (Connector connector in Connectors)
            {
                connector.TakePointsAndConds(connectorPoints, connectorConditions);
            }
        }
示例#2
0
        public int getLODinitialOffset(int section1entryNumber, int lod)
        {
            //Offsets are calculated for all lods in the morphs as one set of numbers, with the total number of vertices
            //for each lod added at the end of the lod. Get the initial offset relative to the beginning of the current
            //lod, before the first section 2 offset.
            if (section1entryNumber == 0 & lod == 0)
            {
                return(0);
            }
            int offset = 0;

            for (int e = 0; e < section1entryNumber; e++)
            {                                   //add offsets for all vertices in previous entries
                int eStart = this.getSection2StartIndex(e, 0);
                int eCount = this.section2count(e);
                for (int j = eStart; j < eStart + eCount; j++)
                {
                    Section2 tmp = this.getSection2(j);
                    offset += tmp.dataOffset;
                }
            }
            for (int i = 0; i < lod; i++)      //add offsets for all vertices in previous lods in current entry
            {
                int lodStart = this.getSection2StartIndex(section1entryNumber, i);
                int lodCount = this.section2count(section1entryNumber, i);
                for (int j = lodStart; j < lodStart + lodCount; j++)
                {
                    Section2 tmp = this.getSection2(j);
                    offset += tmp.dataOffset;
                }
            }
            return(offset);
        }
示例#3
0
 /// <summary>
 /// Creates an empty NVA formatted for DS3.
 /// </summary>
 public NVA()
 {
     Version    = NVAVersion.DarkSouls3;
     Navmeshes  = new NavmeshSection(2);
     Entries1   = new Section1();
     Entries2   = new Section2();
     Connectors = new ConnectorSection();
     Entries7   = new Section7();
 }
示例#4
0
        public override int GetHashCode()
        {
            unchecked
            {
                var hash = 12;

                hash = hash * 32 + Section0.GetHashCode();
                hash = hash * 32 + Section1.GetHashCode();
                hash = hash * 32 + Section2.GetHashCode();
                hash = hash * 32 + Section3.GetHashCode();
                hash = hash * 32 + Section4.GetHashCode();
                hash = hash * 32 + Section5.GetHashCode();
                hash = hash * 32 + Section6.GetHashCode();

                return(hash);
            }
        }
示例#5
0
        public ActionResult <Section2> Load([FromBody] Section2 param)
        {
            if (param == null)
            {
                param          = new Section2();
                param._message = _localizer["No parameters."];
                return(BadRequest(param));
            }
            try
            {
                param.Item1 = (Guid.NewGuid()).ToString();

                return(Ok(param));
            }
            catch (Exception ex)
            {
                param._message = _localizer["System error Please inform system personnel.({0})", ex.Message];
                return(BadRequest(param));
            }
        }
示例#6
0
        private async void Start()
        {
            double margin = ActualHeight / 30;

            Section1.Margin = Section2.Margin = Section3.Margin = new Thickness(margin);

            var anim = new DoubleAnimation(ActualHeight / 2, ActualHeight - margin * 2, new Duration(TimeSpan.FromMilliseconds(AnimationTime)));

            anim.RepeatBehavior    = RepeatBehavior.Forever;
            anim.AutoReverse       = true;
            anim.AccelerationRatio = .85;

            Section1.Height = Section2.Height = Section3.Height = anim.From.Value;
            Section1.BeginAnimation(HeightProperty, anim);
            await Task.Delay(AnimationTime / 3);

            Section2.BeginAnimation(HeightProperty, anim);
            await Task.Delay(AnimationTime / 3);

            Section3.BeginAnimation(HeightProperty, anim);
        }
示例#7
0
        public void Test()
        {
            if (File.Exists(Section1.XsdFile))
            {
                File.Delete(Section1.XsdFile);
            }

            Section1 a = (XmlConfiguration <Section1>)ConfigurationManager.GetSection("Section1");

            Assert.AreEqual(123, a.id);
            Assert.AreEqual(432.1, a.value);
            Assert.AreEqual("hello", a.name);
            a = null;

            Section2 b = ((XmlConfiguration <Section2>)ConfigurationManager.GetSection("Section2")).Settings;

            Assert.AreEqual(123, b.id);
            Assert.AreEqual("432.1", b.value);
            Assert.AreEqual("hello", b.name);
            b = null;

            b = XmlConfiguration <Section2> .ReadConfig("Section2");

            Assert.AreEqual(123, b.id);
            Assert.AreEqual("432.1", b.value);
            Assert.AreEqual("hello", b.name);
            b = null;

            using (XmlReader rdr = new XmlTextReader(new StringReader("<Section2 id='123' value='432.1'><name>hello</name></Section2>")))
            {
                b = XmlConfiguration <Section2> .ReadXml(rdr);

                Assert.AreEqual(123, b.id);
                Assert.AreEqual("432.1", b.value);
                Assert.AreEqual("hello", b.name);
                b = null;
            }

            XmlConfiguration <Section2> .XmlSchema = System.Xml.Schema.XmlSchema.Read(
                this.GetType().Assembly.GetManifestResourceStream(this.GetType().Namespace + ".TestXmlSection2.xsd"),
                null
                );

            //now we should get an exception when reading section 2...
            try
            {
                ConfigurationManager.RefreshSection("Section2");
                b = (XmlConfiguration <Section2>)ConfigurationManager.GetSection("Section2");
            }
            catch (System.Configuration.ConfigurationErrorsException ce)
            {
                Assert.IsTrue(ce.Message.Contains("The 'value' attribute is invalid"));
                Assert.IsNotNull(ce.InnerException);
                Assert.AreEqual(typeof(XmlException), ce.InnerException.GetType());
            }
            Assert.IsNull(b);

            Section3 c = (XmlConfiguration <Section3>)ConfigurationManager.GetSection("Section3");

            Assert.AreEqual(123, c.id);
            Assert.AreEqual(new DateTime(2009, 12, 25, 0, 0, 0), c.value);
            Assert.AreEqual("hello", c.name);
            b = null;

            // the following invalid xsd will cause an exception
            File.WriteAllText(Section1.XsdFile, "<xs:schema  xmlns:xs='http://www.w3.org/2001/XMLSchema'><xs:element /></xs:schema>");
            ConfigurationManager.RefreshSection("Section1");
            string origDir = Environment.CurrentDirectory;

            Environment.CurrentDirectory = Path.GetTempPath();
            try
            {
                a = (XmlConfiguration <Section1>)ConfigurationManager.GetSection("Section1");
            }
            catch (ConfigurationErrorsException) { }
            finally
            {
                Environment.CurrentDirectory = origDir;
                File.Delete(Section1.XsdFile);
            }
            Assert.IsNull(a);
        }
示例#8
0
        internal void BGEOLODConstructor(GEOM[] lodMorphMeshes, int indexIn, out int firstVertID, out Section2[] outSection2, out Section3[] outSection3, out int indexOut)
        {
            float posLimit  = 0f;
            float normLimit = 0f;
            int   lowVertID = Int32.MaxValue;
            int   hiVertID  = 0;

            for (int seq = 0; seq < lodMorphMeshes.Length; seq++)
            {
                if (!lodMorphMeshes[seq].isMorph)
                {
                    throw new BlendException("Not a valid morph mesh!");
                }
                lowVertID = Math.Min(lodMorphMeshes[seq].minVertexID, lowVertID);
                hiVertID  = Math.Max(lodMorphMeshes[seq].maxVertexID, hiVertID);
            }
            bool overlap = false;

            if ((lodMorphMeshes.Length > 1) &&
                ((lodMorphMeshes[1].minVertexID > lodMorphMeshes[0].minVertexID & lodMorphMeshes[1].minVertexID < lodMorphMeshes[0].maxVertexID)
                 | (lodMorphMeshes[1].maxVertexID > lodMorphMeshes[0].minVertexID & lodMorphMeshes[1].maxVertexID < lodMorphMeshes[0].maxVertexID)))
            {
                overlap = true;
            }
            if ((lodMorphMeshes.Length > 2) &&
                ((lodMorphMeshes[2].minVertexID > lodMorphMeshes[0].minVertexID & lodMorphMeshes[2].minVertexID < lodMorphMeshes[0].maxVertexID)
                 | (lodMorphMeshes[2].maxVertexID > lodMorphMeshes[0].minVertexID & lodMorphMeshes[2].maxVertexID < lodMorphMeshes[0].maxVertexID)))
            {
                overlap = true;
            }
            if ((lodMorphMeshes.Length > 2) &&
                ((lodMorphMeshes[2].minVertexID > lodMorphMeshes[1].minVertexID & lodMorphMeshes[2].minVertexID < lodMorphMeshes[1].maxVertexID)
                 | (lodMorphMeshes[2].maxVertexID > lodMorphMeshes[1].minVertexID & lodMorphMeshes[2].maxVertexID < lodMorphMeshes[1].maxVertexID)))
            {
                overlap = true;
            }
            if (overlap)
            {
                if (MessageBox.Show("Your meshes have overlapping vertex IDs within\na LOD and the morph may not work correctly.\nDo you want to continue anyway?",
                                    "Vertex numbering alert", MessageBoxButtons.YesNo) == DialogResult.No)
                {
                    throw new BlendException("Vertex numbering error");
                }
            }
            int numVertIDs = hiVertID - lowVertID + 1;

            vertexData[] vertList = new vertexData[numVertIDs];
            for (int seq = 0; seq < lodMorphMeshes.Length; seq++)
            {
                for (int i = 0; i < lodMorphMeshes[seq].numberVertices; i++)
                {
                    int ID = lodMorphMeshes[seq].getVertexID(i);
                    vertList[ID - lowVertID] = new vertexData(ID, lodMorphMeshes[seq].getPosition(i), lodMorphMeshes[seq].getNormal(i));
                }
            }
            bool gap = false;

            float[] nothing = new float[3];
            for (int i = 0; i < vertList.Length; i++)
            {
                if (vertList[i] == null)
                {
                    gap         = true;
                    vertList[i] = new vertexData(i + lowVertID, nothing, nothing);
                }
            }
            if (gap)
            {
                if (MessageBox.Show("Your meshes have a gap in vertex IDs within\na LOD but the morph will probably work.\nDo you want to continue anyway?",
                                    "Vertex numbering alert", MessageBoxButtons.YesNo) == DialogResult.No)
                {
                    throw new BlendException("Vertex numbering error");
                }
            }
            Section2[]      newSect2  = new Section2[numVertIDs];
            List <Section3> listSect3 = new List <Section3>();
            int             offset    = 0 - indexIn;

            for (int i = 0; i < vertList.Length; i++)
            {
                bool hasPos  = false;
                bool hasNorm = false;
                if (Math.Abs(vertList[i].posX) > posLimit | Math.Abs(vertList[i].posY) > posLimit | Math.Abs(vertList[i].posZ) > posLimit)
                {
                    listSect3.Add(new Section3(vertList[i].posX, vertList[i].posY, vertList[i].posZ));
                    hasPos = true;
                }
                if (Math.Abs(vertList[i].normX) > normLimit | Math.Abs(vertList[i].normY) > normLimit | Math.Abs(vertList[i].normZ) > normLimit)
                {
                    listSect3.Add(new Section3(vertList[i].normX, vertList[i].normY, vertList[i].normZ));
                    hasNorm = true;
                }
                if (hasPos | hasNorm)
                {
                    newSect2[i] = new Section2(hasPos, hasNorm, offset);
                    offset      = 0;
                    if (hasPos)
                    {
                        offset++;
                    }
                    if (hasNorm)
                    {
                        offset++;
                    }
                }
                else
                {
                    newSect2[i] = new Section2(false, false, 0);
                }
            }

            firstVertID = lowVertID;
            outSection2 = newSect2;
            outSection3 = listSect3.ToArray();
            indexOut    = outSection3.Length - offset;
        }
示例#9
0
        static void Main(string[] args)
        {
            List <string> fileList = Directory.GetFiles(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), "*.xlsx").ToList <string>();

            List <Section1.Subsection1> section1_1List = new List <Section1.Subsection1>();
            List <Section1.Subsection1> section1_2List = new List <Section1.Subsection1>();
            List <Section1.Subsection1> section1_3List = new List <Section1.Subsection1>();
            List <Section1.Subsection4> section1_4List = new List <Section1.Subsection4>();
            List <Section2>             section2List   = new List <Section2>();
            List <Section3.Subsection1> section3_1List = new List <Section3.Subsection1>();
            List <Section3.Subsection2> section3_2List = new List <Section3.Subsection2>();
            List <Section3.Subsection3> section3_3List = new List <Section3.Subsection3>();
            List <Section4.Subsection1> section4_1List = new List <Section4.Subsection1>();
            List <Section4.Subsection1> section4_2List = new List <Section4.Subsection1>();
            List <Section4.Subsection3> section4_3List = new List <Section4.Subsection3>();
            List <Section5>             section5List   = new List <Section5>();
            List <Section6>             section6List   = new List <Section6>();

            string[] sectionString = new string[]
            {
                "1.1 Информация о совершенных и исполненных сделках на конец отчетного периода",
                "1.2 Информация о неисполненных сделках на конец отчетного периода",
                "1.3 Сделки за расчетный период, обязательства из которых прекращены  не в результате исполнения ",
                "1.4 Информация об изменении расчетных параметров сделок РЕПО",
                "2. Операции с денежными средствами",
                "3.1 Движение по ценным бумагам инвестора",
                "3.2 Движение по производным финансовым инструментам",
                "3.3 Информация о позиционном состоянии по производным финансовым инструментам из таблицы",
                "4.1 Информация о ценных бумагах",
                "4.2 Информация об инструментах, не квалифицированных в качестве ценной бумаги",
                "4.3 Информация о производных финансовых инструментах",
                "5. Информация о торговых площадках",
                "6. Расшифровка дополнительных кодов используемых в отчете"
            };

            // читаем каждый файл из списка и проверяем наличие в БД
            foreach (var file in fileList)
            {
                var       fileInfo = new FileInfo(file);
                DataTable dt       = LoadWorksheetInDataTable(fileInfo.FullName, "broker_rep");

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (dt.Rows[i].ItemArray[0].ToString() == sectionString[0])
                    {
                        while (dt.Rows[i].ItemArray[0].ToString() != sectionString[1])
                        {
                            Section1.Subsection1 sec = Section1.Subsection1.ReadSection(dt.Rows[i]);
                            if (sec != null)
                            {
                                section1_1List.Add(sec);
                            }
                            i = i + 1;
                        }
                    }

                    if (dt.Rows[i].ItemArray[0].ToString() == sectionString[1])
                    {
                        while (dt.Rows[i].ItemArray[0].ToString() != sectionString[2])
                        {
                            Section1.Subsection1 sec = Section1.Subsection1.ReadSection(dt.Rows[i]);
                            if (sec != null)
                            {
                                section1_2List.Add(sec);
                            }
                            i = i + 1;
                        }
                    }

                    if (dt.Rows[i].ItemArray[0].ToString() == sectionString[2])
                    {
                        while (dt.Rows[i].ItemArray[0].ToString() != sectionString[3])
                        {
                            Section1.Subsection1 sec = Section1.Subsection1.ReadSection(dt.Rows[i]);
                            if (sec != null)
                            {
                                section1_3List.Add(sec);
                            }
                            i = i + 1;
                        }
                    }

                    if (dt.Rows[i].ItemArray[0].ToString() == sectionString[3])
                    {
                        while (dt.Rows[i].ItemArray[0].ToString() != sectionString[4])
                        {
                            Section1.Subsection4 sec = Section1.Subsection4.ReadSection(dt.Rows[i]);
                            if (sec != null)
                            {
                                section1_4List.Add(sec);
                            }
                            i = i + 1;
                        }
                    }

                    if (dt.Rows[i].ItemArray[0].ToString() == sectionString[4])
                    {
                        List <Section2.Ostatki> ostatki_List = new List <Section2.Ostatki>();

                        // Остатки по валютам
                        while (true)
                        {
                            Section2.Ostatki ost = Section2.Ostatki.ReadOstatki(dt.Rows[i]);

                            // Если такая валюта уже есть в списке
                            if (ostatki_List.Count(s => s.valuta.Equals(ost.valuta)) > 0)
                            {
                                break;
                            }
                            else
                            {
                                ostatki_List.Add(ost);
                            }

                            i = i + 1;
                        }

                        string valuta = string.Empty;

                        while (dt.Rows[i].ItemArray[0].ToString() != sectionString[5])
                        {
                            Section2 sec = Section2.ReadSection(dt.Rows[i]);

                            if (sec != null)
                            {
                                sec.valuta = valuta;
                                section2List.Add(sec);
                            }
                            else
                            {
                                // Если прочитанная строка является началом валюты
                                if (ostatki_List.Count(s => s.valuta.Equals(dt.Rows[i].ItemArray[0].ToString())) > 0)
                                {
                                    valuta = dt.Rows[i].ItemArray[0].ToString();
                                }
                            }

                            i = i + 1;
                        }
                    }

                    if (dt.Rows[i].ItemArray[0].ToString() == sectionString[5])
                    {
                        while (dt.Rows[i].ItemArray[0].ToString() != sectionString[6])
                        {
                            Section3.Subsection1 sec = Section3.Subsection1.ReadSection(dt.Rows[i]);
                            if (sec != null)
                            {
                                section3_1List.Add(sec);
                            }
                            i = i + 1;
                        }
                    }

                    if (dt.Rows[i].ItemArray[0].ToString() == sectionString[6])
                    {
                        while (dt.Rows[i].ItemArray[0].ToString() != sectionString[7])
                        {
                            Section3.Subsection2 sec = Section3.Subsection2.ReadSection(dt.Rows[i]);
                            if (sec != null)
                            {
                                section3_2List.Add(sec);
                            }
                            i = i + 1;
                        }
                    }

                    if (dt.Rows[i].ItemArray[0].ToString() == sectionString[7])
                    {
                        while (dt.Rows[i].ItemArray[0].ToString() != sectionString[8])
                        {
                            Section3.Subsection3 sec = Section3.Subsection3.ReadSection(dt.Rows[i]);
                            if (sec != null)
                            {
                                section3_3List.Add(sec);
                            }
                            i = i + 1;
                        }
                    }

                    if (dt.Rows[i].ItemArray[0].ToString() == sectionString[8])
                    {
                        while (dt.Rows[i].ItemArray[0].ToString() != sectionString[9])
                        {
                            Section4.Subsection1 sec = Section4.Subsection1.ReadSection(dt.Rows[i]);
                            if (sec != null)
                            {
                                section4_1List.Add(sec);
                            }
                            i = i + 1;
                        }
                    }

                    if (dt.Rows[i].ItemArray[0].ToString() == sectionString[9])
                    {
                        while (dt.Rows[i].ItemArray[0].ToString() != sectionString[10])
                        {
                            Section4.Subsection1 sec = Section4.Subsection1.ReadSection(dt.Rows[i]);
                            if (sec != null)
                            {
                                section4_2List.Add(sec);
                            }
                            i = i + 1;
                        }
                    }

                    if (dt.Rows[i].ItemArray[0].ToString() == sectionString[10])
                    {
                        while (dt.Rows[i].ItemArray[0].ToString() != sectionString[11])
                        {
                            Section4.Subsection3 sec = Section4.Subsection3.ReadSection(dt.Rows[i]);
                            if (sec != null)
                            {
                                section4_3List.Add(sec);
                            }
                            i = i + 1;
                        }
                    }

                    if (dt.Rows[i].ItemArray[0].ToString() == sectionString[11])
                    {
                        while (dt.Rows[i].ItemArray[0].ToString() != sectionString[12])
                        {
                            Section5 sec = Section5.ReadSection(dt.Rows[i]);
                            if (sec != null && sec.kod_rezhima_torgov != sectionString[11])
                            {
                                section5List.Add(sec);
                            }
                            i = i + 1;
                        }
                    }

                    if (dt.Rows[i].ItemArray[0].ToString() == sectionString[12])
                    {
                        while (dt.Rows[i].ItemArray[0].ToString() != "АО «Тинькофф Банк»")
                        {
                            Section6 sec = Section6.ReadSection(dt.Rows[i]);
                            if (sec != null && sec.kod != sectionString[12])
                            {
                                section6List.Add(sec);
                            }
                            i = i + 1;
                        }
                    }
                }
                dt.Dispose();
            }

            Console.WriteLine($"Записей: {section1_1List.Count}. Раздел: {sectionString[0]}");
            Console.WriteLine($"Записей: {section1_2List.Count}. Раздел: {sectionString[1]}");
            Console.WriteLine($"Записей: {section1_3List.Count}. Раздел: {sectionString[2]}");
            Console.WriteLine($"Записей: {section1_4List.Count}. Раздел: {sectionString[3]}");
            Console.WriteLine($"Записей: {section2List.Count}. Раздел: {sectionString[4]}");
            Console.WriteLine($"Записей: {section3_1List.Count}. Раздел: {sectionString[5]}");
            Console.WriteLine($"Записей: {section3_2List.Count}. Раздел: {sectionString[6]}");
            Console.WriteLine($"Записей: {section3_3List.Count}. Раздел: {sectionString[7]}");
            Console.WriteLine($"Записей: {section4_1List.Count}. Раздел: {sectionString[8]}");
            Console.WriteLine($"Записей: {section4_2List.Count}. Раздел: {sectionString[9]}");
            Console.WriteLine($"Записей: {section4_3List.Count}. Раздел: {sectionString[10]}");
            Console.WriteLine($"Записей: {section5List.Count}. Раздел: {sectionString[11]}");
            Console.WriteLine($"Записей: {section6List.Count}. Раздел: {sectionString[12]}");
            Console.WriteLine("All data read");
            Console.ReadKey();
        }