Beispiel #1
0
        private PrOD treeViewToPrOD()
        {
            List <string>    names  = new List <string>();
            List <PrOD.Mesh> meshes = new List <PrOD.Mesh>();

            //names
            foreach (TreeNode node in root.Nodes)
            {
                if (!names.Contains(node.Text))
                {
                    names.Add(node.Text);
                }
            }
            names.Sort();

            //meshes
            foreach (TreeNode node in root.Nodes)
            {
                PrOD.Mesh mesh = new PrOD.Mesh();
                mesh.name       = node.Text;
                mesh.nameOffset = PrOD.getNameOffset(names, mesh.name);

                mesh.instancesCount = (uint)node.Nodes.Count;
                treeNodeToMesh(mesh, node);

                meshes.Add(mesh);
            }
            meshes.Sort(customCmp);

            PrOD prod = new PrOD(names, meshes);

            return(prod);
        }
Beispiel #2
0
 private void Form1_DragDrop(object sender, DragEventArgs e)
 {
     inPath = null;
     string[] s = (string[])e.Data.GetData(DataFormats.FileDrop, false);
     for (int i = 0; i < s.Length; i++)
     {
         if (s[i].Trim() != "")
         {
             byte[] bytes = File.ReadAllBytes(s[i]);
             isYaz0 = Yaz0.IsYaz0(bytes);
             if (isYaz0)
             {
                 m_PrOD = new PrOD(Yaz0.decode(bytes));
             }
             else
             {
                 m_PrOD = new PrOD(bytes);
             }
             ShowPrOD();
             this.Text   = "PrODEditor" + "(" + s[i] + ")";
             this.inPath = s[i];
             break;
         }
     }
 }
Beispiel #3
0
        private void SaveClick(object sender, EventArgs e)
        {
            PrOD prOD = treeViewToPrOD();

            byte[] bytes = prOD.getBytes();
            if (inPath != null)
            {
                if (isYaz0)
                {
                    File.WriteAllBytes(inPath, Yaz0.encode(bytes));
                }
                else
                {
                    File.WriteAllBytes(inPath, bytes);
                }
            }
            MessageBox.Show("Save finished");
        }