private void BUT_paramfileload_Click(object sender, EventArgs e)
        {
            var filepath = Application.StartupPath + Path.DirectorySeparatorChar + CMB_paramfiles.Text;

            try
            {
                var data = GitHubContent.GetFileContent("diydrones", "ardupilot",
                                                        ((GitHubContent.FileInfo)CMB_paramfiles.SelectedValue).path);

                File.WriteAllBytes(filepath, data);

                var param2 = ParamFile.loadParamFile(filepath);

                var paramCompareForm = new ParamCompare(null, MainV2.comPort.MAV.param, param2);

                paramCompareForm.dtlvcallback += paramCompareForm_dtlvcallback;

                ThemeManager.ApplyThemeTo(paramCompareForm);
                if (paramCompareForm.ShowDialog() == DialogResult.OK)
                {
                    CustomMessageBox.Show("Loaded parameters, please make sure you write them!", "Loaded");
                }

                // no activate the user needs to click write.
                //this.Activate();
            }
            catch (Exception ex)
            {
                CustomMessageBox.Show("Failed to load file.\n" + ex);
            }
        }
Example #2
0
        private void refreshToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ParamFile selectedParam = (ParamFile)dgvRows.DataSource;

            PARAM.Row selectedRow = (PARAM.Row)dgvCells.DataSource;

            LoadRegulation(regulationPath);

            dgvParams.ClearSelection();
            foreach (DataGridViewRow row in dgvParams.Rows)
            {
                if (((ParamFile)row.DataBoundItem).Name == selectedParam.Name)
                {
                    row.Cells[0].Selected = true;
                }
            }

            dgvRows.ClearSelection();
            foreach (DataGridViewRow row in dgvRows.Rows)
            {
                if (((PARAM.Row)row.DataBoundItem).ID == selectedRow.ID)
                {
                    row.Cells[0].Selected = true;
                }
            }
        }
        private void BUT_compare_Click(object sender, EventArgs e)
        {
            var param2 = new Hashtable();

            using (var ofd = new OpenFileDialog
            {
                AddExtension = true,
                DefaultExt = ".param",
                RestoreDirectory = true,
                Filter = "Param List|*.param;*.parm"
            })
            {
                var dr = ofd.ShowDialog();
                if (dr == DialogResult.OK)
                {
                    param2 = ParamFile.loadParamFile(ofd.FileName);

                    var paramCompareForm = new ParamCompare(null, MainV2.comPort.MAV.param, param2);

                    paramCompareForm.dtlvcallback += paramCompareForm_dtlvcallback;

                    ThemeManager.ApplyThemeTo(paramCompareForm);
                    paramCompareForm.ShowDialog();
                }
            }
        }
        private void BUT_save_Click(object sender, EventArgs e)
        {
            using (var sfd = new SaveFileDialog
            {
                AddExtension = true,
                DefaultExt = ".param",
                RestoreDirectory = true,
                Filter = "Param List|*.param;*.parm"
            })
            {
                var dr = sfd.ShowDialog();
                if (dr == DialogResult.OK)
                {
                    var data = new Hashtable();
                    foreach (DataGridViewRow row in Params.Rows)
                    {
                        try
                        {
                            var value = double.Parse(row.Cells[1].Value.ToString());

                            data[row.Cells[0].Value.ToString()] = value;
                        }
                        catch (Exception)
                        {
                            CustomMessageBox.Show(Strings.InvalidNumberEntered + " " + row.Cells[0].Value);
                        }
                    }

                    ParamFile.SaveParamFile(sfd.FileName, data);
                }
            }
        }
Example #5
0
 private void openParam(string f)
 {
     p = new ParamFile(f);
     for (int i = 0; i < p.Groups.Count; i++)
     {
         if (p.Groups[i] is ParamGroup)
         {
             TreeNode[] children = new TreeNode[((ParamGroup)p.Groups[i]).EntryCount];
             for (int j = 0; j < ((ParamGroup)p.Groups[i]).EntryCount; j++)
             {
                 TreeNode child = new TreeNode("Entry [" + j + "]");
                 int[]    temp1 = new int[2];
                 temp1[0]    = i;
                 temp1[1]    = j;
                 child.Tag   = temp1;
                 children[j] = child;
             }
             TreeNode parent = new TreeNode("Group [" + i + "]", children);
             int[]    temp   = new int[2];
             temp[0]    = i;
             temp[1]    = 0;
             parent.Tag = temp;
             treeView1.Nodes.Add(parent);
         }
         else
         {
             int[] temp = { i, 0 };
             treeView1.Nodes.Add(new TreeNode("Group [" + i + "]")
             {
                 Tag = temp
             });
         }
     }
     fillTable(0, 0);
 }
Example #6
0
 private void saveToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (IDEMode == IDE_MODE.Project)
     {
         if (Manager.Projects.Count > 0)
         {
             foreach (var proj in Manager.Projects.Values)
             {
                 proj.Save();
             }
         }
     }
     else if (IDEMode == IDE_MODE.Fighter)
     {
         foreach (var keypair in ScriptFiles)
         {
             keypair.Value.Export(Path.GetFileName(keypair.Key));
         }
         MotionTable.Export(
             Path.Combine(Path.GetDirectoryName(ScriptFiles.Keys[0]), "motion.mtable"));
     }
     else if (IDEMode == IDE_MODE.File)
     {
         if (ScriptFiles.Count > 0)
         {
             ScriptFiles.Values[0].Export(ScriptFiles.Keys[0]);
         }
         else if (ParamFile != null)
         {
             ParamFile.Export(ParamFile.Filepath);
         }
     }
 }
        private void saveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ParamFile paramFile = (ParamFile)dgvRows.DataSource;
            string    format    = paramFile.Param.ParamType;

            Directory.CreateDirectory("Layouts");
            layouts[format].Write($"Layouts\\{format}.xml");
        }
Example #8
0
 public static void SetCameraFromSTPRM(ParamFile stprm)
 {
     if (stprm != null)
     {
         float fov = (float)RenderTools.GetValueFromParamFile(stprm, 0, 0, 6);
         Runtime.fov         = fov * ((float)Math.PI / 180.0f);
         Runtime.renderDepth = (float)RenderTools.GetValueFromParamFile(stprm, 0, 0, 77);
     }
 }
Example #9
0
        private void loadparamsfromfile(string fn, bool offline = false)
        {
            var param2 = ParamFile.loadParamFile(fn);

            var           loaded  = 0;
            var           missed  = 0;
            List <string> missing = new List <string>();

            foreach (string name in param2.Keys)
            {
                var set   = false;
                var value = param2[name].ToString();
                // set param table as well
                foreach (DataGridViewRow row in Params.Rows)
                {
                    if (name == "FORMAT_VERSION")
                    {
                        continue;
                    }
                    if (row.Cells[0].Value.ToString() == name)
                    {
                        set = true;
                        if (row.Cells[1].Value.ToString() != value)
                        {
                            row.Cells[1].Value = value;
                        }
                        break;
                    }
                }

                if (offline && !set)
                {
                    set = true;
                }

                if (set)
                {
                    loaded++;
                }
                else
                {
                    missed++;
                    missing.Add(name);
                }
            }

            if (missed > 0)
            {
                string list = "";
                foreach (var item in missing)
                {
                    list += item + " ";
                }
                CustomMessageBox.Show("Missing " + missed + " params\n" + list, "No matching Params", MessageBoxButtons.OK);
            }
        }
Example #10
0
        public static void SetCameraValuesFromParam(Camera camera, ParamFile stprm)
        {
            if (stprm == null)
            {
                return;
            }

            camera.FovDegrees   = (float)Params.ParamTools.GetParamValue(stprm, 0, 0, 6);
            camera.FarClipPlane = (float)Params.ParamTools.GetParamValue(stprm, 0, 0, 77);
        }
Example #11
0
        public void SetValuesFromStprm(ParamFile stprm)
        {
            if (stprm == null)
            {
                return;
            }
            float newFov = (float)ParamTools.GetParamValue(stprm, 0, 0, 6);

            fovRadians  = newFov * ((float)Math.PI / 180.0f);
            renderDepth = (float)ParamTools.GetParamValue(stprm, 0, 0, 77);
        }
        private void loadparamsfromfile(string fn)
        {
            var param2 = ParamFile.loadParamFile(fn);

            foreach (string name in param2.Keys)
            {
                var value = param2[name].ToString();

                checkandupdateparam(name, value);
            }
        }
Example #13
0
        public void WritePrcFile <T>(string outputFile, T inputObj)
        {
            //Open file
            var t = new ParamFile();

            //Write recursively
            WritePrc(t.Root, inputObj, inputObj.GetType().GetProperties());

            //Save
            t.Save(outputFile);
        }
Example #14
0
 public ParamNode(string path) : base(path, "", false)
 {
     try
     {
         // TODO: This lacks necessary error checking.
         Param = new ParamFile(AbsolutePath);
         ParamNodeContainer.AddFile(this);
     }
     catch (System.Exception)
     {
     }
 }
Example #15
0
        public static void BatchExportLightSetValues()
        {
            // Get the source model folder and then the output folder.
            using (var sourceFolderSelect = new FolderSelectDialog())
            {
                sourceFolderSelect.Title = "Stages Directory";
                if (sourceFolderSelect.ShowDialog() == DialogResult.OK)
                {
                    using (var outputFolderSelect = new FolderSelectDialog())
                    {
                        outputFolderSelect.Title = "Output Directory";
                        if (outputFolderSelect.ShowDialog() == DialogResult.OK)
                        {
                            StringBuilder miscCsv     = new StringBuilder();
                            StringBuilder lightSetCsv = new StringBuilder();
                            StringBuilder fogCsv      = new StringBuilder();
                            StringBuilder unkCsv      = new StringBuilder();

                            string[] files = Directory.GetFiles(outputFolderSelect.SelectedPath, "*.bin", SearchOption.AllDirectories);
                            foreach (string file in files)
                            {
                                if (!(file.Contains("light_set")))
                                {
                                    continue;
                                }

                                ParamFile lightSet;
                                try
                                {
                                    lightSet = new ParamFile(file);
                                }
                                catch (NotImplementedException)
                                {
                                    continue;
                                }

                                // Hardcoding this because all lightsets are structured the same way.
                                // Use basic csv formatting to open in excel, sheets, etc.
                                string[] directories = file.Split('\\');
                                string   stageName   = directories[directories.Length - 3]; // get stage folder name

                                AppendMiscValues(miscCsv, stageName, lightSet);
                                AppendLightSetValues(lightSetCsv, stageName, lightSet);
                                AppendFogSetValues(fogCsv, stageName, lightSet);
                                AppendUnknownValues(unkCsv, stageName, lightSet);
                            }

                            SaveLightSetValues(outputFolderSelect, miscCsv, lightSetCsv, fogCsv, unkCsv);
                        }
                    }
                }
            }
        }
Example #16
0
        private static Vector3 CreateFogColorFromFogSet(ParamFile lightSet, int i)
        {
            float hue = (float)RenderTools.GetValueFromParamFile(lightSet, 2, 1 + i, 0);
            float saturation = (float)RenderTools.GetValueFromParamFile(lightSet, 2, 1 + i, 1);
            float value = (float)RenderTools.GetValueFromParamFile(lightSet, 2, 1 + i, 2);
            float fogR = 0.0f, fogB = 0.0f, fogG = 0.0f;

            ColorTools.HSV2RGB(hue, saturation, value, out fogR, out fogG, out fogB);
            Vector3 color = new Vector3(fogR, fogG, fogB);

            return(color);
        }
Example #17
0
        public static LightColor CreateFogColorFromFogSet(ParamFile lightSet, int fogIndex)
        {
            // First fog is probably for characters.
            float      hue        = (float)ParamTools.GetParamValue(lightSet, 2, 1 + fogIndex, 0);
            float      saturation = (float)ParamTools.GetParamValue(lightSet, 2, 1 + fogIndex, 1);
            float      value      = (float)ParamTools.GetParamValue(lightSet, 2, 1 + fogIndex, 2);
            LightColor color      = new LightColor();

            color.H = hue;
            color.S = saturation;
            color.V = value;
            return(color);
        }
Example #18
0
 private static void UnpackParamFile(Options options)
 {
     using (FileStream inputStream = new FileStream(options.InputPath, FileMode.Open, FileAccess.Read))
     {
         ParamFile paramFile = ParamFile.ReadParamFile(inputStream);
         foreach (var entry in paramFile.Entries)
         {
             string entryName      = $"{entry.Id:D10}.{paramFile.StructName}";
             string outputFilePath = Path.Combine(options.OutputPath, entryName);
             Directory.CreateDirectory(Path.GetDirectoryName(outputFilePath));
             File.WriteAllBytes(outputFilePath, entry.Data);
         }
     }
 }
Example #19
0
        public static void BatchExportParamValuesAsCsv(string paramName)
        {
            using (var sourceFolderSelect = new FolderSelectDialog())
            {
                sourceFolderSelect.Title = "Source Directory";
                if (sourceFolderSelect.ShowDialog() == DialogResult.OK)
                {
                    using (var outputFolderSelect = new FolderSelectDialog())
                    {
                        outputFolderSelect.Title = "Output Directory";
                        if (outputFolderSelect.ShowDialog() == DialogResult.OK)
                        {
                            string[] files = Directory.GetFiles(outputFolderSelect.SelectedPath, "*.bin", SearchOption.AllDirectories);
                            foreach (string file in files)
                            {
                                if (!(file.Contains(paramName)))
                                {
                                    continue;
                                }

                                ParamFile paramFile;
                                try
                                {
                                    paramFile = new ParamFile(file);
                                }
                                catch (NotImplementedException)
                                {
                                    continue;
                                }

                                string fileDisplayName = file.Replace(sourceFolderSelect.SelectedPath, "");

                                for (int i = 0; i < paramFile.Groups.Count; i++)
                                {
                                    StringBuilder groupValues = new StringBuilder(fileDisplayName + ",");
                                    foreach (var entry in paramFile.Groups[i].Values)
                                    {
                                        groupValues.Append(entry.Value + ",");
                                    }

                                    string fileName = outputFolderSelect.SelectedPath;
                                    File.AppendAllText(fileName + "\\" + paramName + " Group" + i + " Values.csv", groupValues.ToString() + "\n");
                                }
                            }
                        }
                    }
                }
            }
        }
Example #20
0
 private void openParam(string f)
 {
     p = new ParamFile(f);
     for (int i = 0; i < p.Groups.Count; i++)
     {
         if (p.Groups[i] is ParamGroup)
         {
             TreeNode[] children = new TreeNode[((ParamGroup)p.Groups[i]).EntryCount];
             for (int j = 0; j < ((ParamGroup)p.Groups[i]).EntryCount; j++)
             {
                 TreeNode child = new TreeNode(getEntryName(i, j));
                 children[j] = child;
             }
             TreeNode parent = new TreeNode(getGroupName(i), children);
             treeView1.Nodes.Add(parent);
         }
         else
         {
             int entryCount = -1;
             if (labelFile != null)
             {
                 foreach (IniLabels.Label label in labelFile.labels)
                 {
                     if (label.type == IniLabels.Label.LabelType.Group && label.group == i && label.entries != -1)
                     {
                         entryCount = label.entries;
                     }
                 }
             }
             if (entryCount == -1)
             {
                 treeView1.Nodes.Add(new TreeNode(getGroupName(i)));
             }
             else
             {
                 TreeNode[] children = new TreeNode[entryCount];
                 for (int j = 0; j < entryCount; j++)
                 {
                     TreeNode child = new TreeNode(getEntryName(i, j));
                     children[j] = child;
                 }
                 TreeNode parent = new TreeNode(getGroupName(i), children);
                 treeView1.Nodes.Add(parent);
             }
         }
     }
     treeView1.SelectedNode = null;
 }
Example #21
0
        private static DirectionalLight CreateDirectionalLightFromLightSet(ParamFile lightSet, int lightNumber, string name)
        {
            bool  enabled    = (uint)RenderTools.GetValueFromParamFile(lightSet, 1, lightNumber, 1) == 1;
            float hue        = (float)RenderTools.GetValueFromParamFile(lightSet, 1, lightNumber, 2);
            float saturation = (float)RenderTools.GetValueFromParamFile(lightSet, 1, lightNumber, 3);
            float value      = (float)RenderTools.GetValueFromParamFile(lightSet, 1, lightNumber, 4);

            float rotX = (float)RenderTools.GetValueFromParamFile(lightSet, 1, lightNumber, 5);
            float rotY = (float)RenderTools.GetValueFromParamFile(lightSet, 1, lightNumber, 6);
            float rotZ = (float)RenderTools.GetValueFromParamFile(lightSet, 1, lightNumber, 7);

            DirectionalLight newLight = new DirectionalLight(hue, saturation, value, 0, 0, 0, rotX, rotY, rotZ, name);

            newLight.enabled = enabled; // doesn't render properly for some stages
            return(newLight);
        }
        private void loadparamsfromfile(string fn, bool offline = false)
        {
            var param2 = ParamFile.loadParamFile(fn);

            foreach (string name in param2.Keys)
            {
                var value = param2[name].ToString();

                if (offline)
                {
                    MainV2.comPort.MAV.param.Add(new MAVLink.MAVLinkParam(name, double.Parse(value),
                                                                          MAVLink.MAV_PARAM_TYPE.REAL32));
                }

                checkandupdateparam(name, value);
            }
        }
Example #23
0
        public LightSetParam(string fileName)
        {
            paramFile = new ParamFile(fileName);
            for (int i = 0; i < stageDiffuseLights.Length; i++)
            {
                stageDiffuseLights[i] = CreateDirectionalLightFromLightSet(paramFile, i, "Stage " + (i + 1));
            }

            for (int i = 0; i < stageFogSet.Length; i++)
            {
                stageFogSet[i] = CreateFogColorFromFogSet(paramFile, i);
            }

            characterDiffuse  = CreateCharDiffuseLightFromLightSet(paramFile);
            characterDiffuse2 = CreateDirectionalLightFromLightSet(paramFile, 0, "Diffuse2");
            characterDiffuse3 = CreateDirectionalLightFromLightSet(paramFile, 1, "Diffuse3");
            fresnelLight      = CreateFresnelLightFromLightSet(paramFile);
        }
Example #24
0
        public static DirectionalLight CreateDirectionalLightFromLightSet(ParamFile lightSet, int lightIndex, string name)
        {
            bool    enabled = (uint)ParamTools.GetParamValue(lightSet, 1, lightIndex, 1) == 1;
            Vector3 hsv     = new Vector3(0);

            hsv.X = (float)ParamTools.GetParamValue(lightSet, 1, lightIndex, 2);
            hsv.Y = (float)ParamTools.GetParamValue(lightSet, 1, lightIndex, 3);
            hsv.Z = (float)ParamTools.GetParamValue(lightSet, 1, lightIndex, 4);

            float rotX = (float)ParamTools.GetParamValue(lightSet, 1, lightIndex, 5);
            float rotY = (float)ParamTools.GetParamValue(lightSet, 1, lightIndex, 6);
            float rotZ = (float)ParamTools.GetParamValue(lightSet, 1, lightIndex, 7);

            DirectionalLight newLight = new DirectionalLight(hsv, new Vector3(0), rotX, rotY, rotZ, name);

            newLight.enabled = enabled; // doesn't render properly for some stages
            return(newLight);
        }
Example #25
0
        private void saveAsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (IDEMode == IDE_MODE.Project)
            {
                if (fsDlg.ShowDialog() == DialogResult.OK)
                {
                    throw new NotImplementedException("Saving workspaces not yet supported");

                    //if (Manager.Projects.Count > 0)
                    //    foreach (var proj in Manager.Projects.Values)
                    //        proj.Save();
                }
            }
            else if (IDEMode == IDE_MODE.Fighter)
            {
                if (fsDlg.ShowDialog() == DialogResult.OK)
                {
                    foreach (var keypair in ScriptFiles)
                    {
                        keypair.Value.Export(Path.Combine(fsDlg.SelectedPath, Path.GetFileName(keypair.Key)));
                    }
                    MotionTable.Export(Path.Combine(fsDlg.SelectedPath, "motion.mtable"));
                }
            }
            else if (IDEMode == IDE_MODE.File)
            {
                if (ScriptFiles.Count > 0)
                {
                    sfDlg.FileName = Path.GetFileNameWithoutExtension(ScriptFiles.Keys[0]);
                    if (sfDlg.ShowDialog() == DialogResult.OK)
                    {
                        ScriptFiles.Values[0].Export(sfDlg.FileName);
                    }
                }
                else if (ParamFile != null)
                {
                    sfDlg.FileName = Path.GetFileNameWithoutExtension(ParamFile.Filepath);
                    if (sfDlg.ShowDialog() == DialogResult.OK)
                    {
                        ParamFile.Export(sfDlg.FileName);
                    }
                }
            }
        }
Example #26
0
        public static HemisphereFresnel CreateFresnelLightFromLightSet(ParamFile lightSet)
        {
            Vector3 hsvGround = new Vector3(0);

            hsvGround.X = (float)ParamTools.GetParamValue(lightSet, 0, 0, 8);
            hsvGround.Y = (float)ParamTools.GetParamValue(lightSet, 0, 0, 9);
            hsvGround.Z = (float)ParamTools.GetParamValue(lightSet, 0, 0, 10);

            Vector3 hsvSky = new Vector3(0);

            hsvSky.X = (float)ParamTools.GetParamValue(lightSet, 0, 0, 11);
            hsvSky.Y = (float)ParamTools.GetParamValue(lightSet, 0, 0, 12);
            hsvSky.Z = (float)ParamTools.GetParamValue(lightSet, 0, 0, 13);

            float skyAngle    = (float)ParamTools.GetParamValue(lightSet, 0, 0, 14);
            float groundAngle = (float)ParamTools.GetParamValue(lightSet, 0, 0, 15);

            return(new HemisphereFresnel(hsvGround, hsvSky, skyAngle, groundAngle, "Fresnel"));
        }
Example #27
0
        public static DirectionalLight CreateCharDiffuseLightFromLightSet(ParamFile lightSet)
        {
            Vector3 diffuseHsv = new Vector3(0);

            diffuseHsv.X = (float)ParamTools.GetParamValue(lightSet, 0, 0, 29);
            diffuseHsv.Y = (float)ParamTools.GetParamValue(lightSet, 0, 0, 30);
            diffuseHsv.Z = (float)ParamTools.GetParamValue(lightSet, 0, 0, 31);

            Vector3 ambientHsv = new Vector3(0);

            ambientHsv.X = (float)ParamTools.GetParamValue(lightSet, 0, 0, 33);
            ambientHsv.Y = (float)ParamTools.GetParamValue(lightSet, 0, 0, 34);
            ambientHsv.Z = (float)ParamTools.GetParamValue(lightSet, 0, 0, 35);

            float rotX = (float)ParamTools.GetParamValue(lightSet, 1, 4, 5);
            float rotY = (float)ParamTools.GetParamValue(lightSet, 1, 4, 6);
            float rotZ = (float)ParamTools.GetParamValue(lightSet, 1, 4, 7);

            return(new DirectionalLight(diffuseHsv, ambientHsv, 0, 0, 0, "Diffuse"));
        }
Example #28
0
        public void AssmebleEncrypted(XmlDocument doc, string fileLocation, string labelsFileLocation)
        {
            stringToHashLabels = new OrderedDictionary <string, ulong>();
            if (!string.IsNullOrEmpty(labelsFileLocation))
            {
                try
                {
                    stringToHashLabels = LabelIO.GetStringHashDict(labelsFileLocation);
                }
                catch (Exception ex)
                {
                    UiHelper.PopUpMessage(ex.Message);
                    return;
                }
            }

            file = new ParamFile(Node2ParamStruct(doc.DocumentElement));

            file.Save(fileLocation);
        }
Example #29
0
        private XmlDocument ReadProject(string filepath)
        {
            ProjPath = filepath;
            var proj = new XmlDocument();

            proj.Load(filepath);

            var node = proj.SelectSingleNode("//Project");

            this.Text     = ProjName = node.Attributes["Name"].Value;
            this.ToolVer  = node.Attributes["ToolVer"].Value;
            this.GameVer  = node.Attributes["GameVer"].Value;
            this.Platform = node.Attributes["Platform"].Value;

            node = proj.SelectSingleNode("//Project/ACMD");
            foreach (XmlNode child in node.ChildNodes)
            {
                OpenFile(Path.GetDirectoryName(filepath) + $"/{child.Attributes["include"].Value}");
            }

            node = proj.SelectSingleNode("//Project/MSC");
            foreach (XmlNode child in node.ChildNodes)
            {
                OpenFile(Path.GetDirectoryName(filepath) + $"/{child.Attributes["include"].Value}");
            }

            node       = proj.SelectSingleNode("//Project/ATTR");
            Attributes = new ParamFile(Path.GetDirectoryName(filepath) + $"/{node.Attributes["include"].Value}");

            node             = proj.SelectSingleNode("//Project/PARAMS");
            Fighter_Param_vl = new ParamFile(Path.GetDirectoryName(filepath) + $"/{node.Attributes["include"].Value}");

            node         = proj.SelectSingleNode("//Project/ANIM");
            MotionFolder = Path.GetDirectoryName(filepath) + "/ANIM";
            foreach (XmlNode child in node.ChildNodes)
            {
                ANIM_FILES.Add(child.Attributes["include"].Value);
                Runtime.ParseAnim($"{MotionFolder}/{child.Attributes["include"].Value.Substring(5)}", ref _animHashes);
            }
            return(proj);
        }
Example #30
0
        public T ReadPrcFile <T>(string inputFile) where T : new()
        {
            //Validate file
            if (!File.Exists(inputFile))
            {
                throw new Exception($"PRC File does not exist: {inputFile}");
            }

            //Open file
            var t = new ParamFile();

            t.Open(inputFile);

            //Init object
            var outputObj = new T();

            //Parse recursively
            ReadPrc(t.Root, outputObj, null);

            return(outputObj);
        }