Ejemplo n.º 1
0
 public MainForm()
 {
     InitializeComponent();
     StatusManager.RegisterDelegate(this.logTextBox.AppendText);
     ContentManager.SetGraphicsDevice(GraphicsDeviceService.AddRef(this.Handle, 50, 50).GraphicsDevice);
     StatusManager.AddLog("ROSE Online UI Editor Vs 2.0 By Jiwan : Ready to use");
 }
Ejemplo n.º 2
0
 public void Load(string path)
 {
     try
     {
         this.xmlPath = path;
         using (System.IO.StreamReader sr = new System.IO.StreamReader(path))
         {
             this.codeTextBox.Text = sr.ReadToEnd();
             sr.Close();
         }
         StatusManager.AddLog("XML successfully loaded : \"" + path + "\"");
     }
     catch (Exception e)
     {
         StatusManager.AddLog("XML can't be load : " + e.Message);
     }
 }
Ejemplo n.º 3
0
        public void Load(string filePath, ClientType clientType)
        {
            StatusManager.AddLog("Starting loading TSI : " + filePath);
            try
            {
                this.Path       = filePath;
                this.clientType = clientType;
                BinaryReader br       = new BinaryReader(File.Open(filePath, FileMode.Open));
                short        DDSCount = br.ReadInt16();
                this.listDDS = new List <DDS>(DDSCount);
                for (int i = 0; i < DDSCount; i++)
                {
                    DDS newDDS = new DDS();
                    newDDS.Path      = RoseFile.ReadSString(ref br);
                    newDDS.ColourKey = br.ReadInt32();
                    this.listDDS.Add(newDDS);
                }

                short TotalementCount = br.ReadInt16();

                for (int i = 0; i < DDSCount; i++)
                {
                    short ElementCount = br.ReadInt16();
                    listDDS[i].ListDDS_element = new List <DDS.DDSElement>(ElementCount);
                    for (int a = 0; a < ElementCount; a++)
                    {
                        DDS.DDSElement newElement = new DDS.DDSElement();
                        newElement.OwnerId = br.ReadInt16();
                        newElement.X       = br.ReadInt32();
                        newElement.Y       = br.ReadInt32();
                        newElement.Width   = br.ReadInt32() - newElement.X;
                        newElement.Height  = br.ReadInt32() - newElement.Y;
                        newElement.Color   = br.ReadInt32();
                        newElement.Name    = RoseFile.ReadFString(ref br, 0x20);
                        listDDS[i].ListDDS_element.Add(newElement);
                    }
                }
                br.Close();
                StatusManager.AddLog("TSI successfully loaded");
            }
            catch (Exception e)
            {
                StatusManager.AddLog("Error loading TSI : " + e.Message);
            }
        }
 public void Load(string path)
 {
     try
     {
         this.DDSPath = path;
         Texture2D texture = ContentManager.Instance().GetTexture(path);
         texture.Save("Temporary Files\\" + this.Text + ".png", ImageFileFormat.Png);
         FileStream fs = new FileStream("Temporary Files\\" + this.Text + ".png", FileMode.Open);
         pictureBox.Image = Image.FromStream(fs);
         fs.Close();
         File.Delete("Temporary Files\\" + this.Text + ".png");
         GC.Collect();
         StatusManager.AddLog("DDS successfully loaded : '" + path + "'");
     }
     catch (Exception e)
     {
         StatusManager.AddLog("Error to open : '" + path + "' [" + e.Message + "]");
     }
 }
Ejemplo n.º 5
0
        public void Save(string filePath)
        {
            try
            {
                this.Path = filePath;
                BinaryWriter bw = new BinaryWriter(File.Open(filePath, FileMode.Create));
                bw.Write((short)listDDS.Count);
                int totalElementCount = 0;
                listDDS.ForEach(delegate(DDS dds)
                {
                    RoseFile.WriteSString(ref bw, dds.Path);
                    bw.Write(dds.ColourKey);
                    totalElementCount += dds.ListDDS_element.Count;
                });

                bw.Write((short)totalElementCount);

                listDDS.ForEach(delegate(DDS dds)
                {
                    bw.Write((short)dds.ListDDS_element.Count);
                    dds.ListDDS_element.ForEach(delegate(DDS.DDSElement dds_element)
                    {
                        bw.Write((short)dds_element.OwnerId);
                        bw.Write((int)dds_element.X);
                        bw.Write((int)dds_element.Y);
                        bw.Write((int)dds_element.Width + dds_element.X);
                        bw.Write((int)dds_element.Height + dds_element.Y);
                        bw.Write((int)dds_element.Color);
                        RoseFile.WriteFString(ref bw, dds_element.Name, 0x20);
                    });
                });
                bw.Close();
                StatusManager.AddLog("TSI successfully saved");
            }
            catch (Exception e)
            {
                StatusManager.AddLog("Error saving TSI : " + e.Message);
            }
        }
Ejemplo n.º 6
0
        public void Load(string filePath)
        {
            try
            {
                StatusManager.AddLog("Starting loading XML : " + filePath);
                XPathDocument  xmlFile      = new XPathDocument(File.Open(filePath, FileMode.Open));
                XPathNavigator xmlNavigator = xmlFile.CreateNavigator();
                xmlNavigator.MoveToRoot();
                xmlNavigator.MoveToFirstChild();

                if (xmlNavigator.Name == "Root_Element")
                {
                    base.Load(xmlNavigator);

                    if (xmlNavigator.GetAttribute("DEFAULT_VISIBLE", "") != string.Empty)
                    {
                        DefaultVisible = Convert.ToBoolean(xmlNavigator.GetAttribute("DEFAULTVISIBLE", ""));
                    }
                    if (xmlNavigator.GetAttribute("EXTENT", "") != string.Empty)
                    {
                        Extent = Convert.ToBoolean(xmlNavigator.GetAttribute("EXTENT", ""));
                    }
                    if (xmlNavigator.GetAttribute("Modal", "") != string.Empty)
                    {
                        Modal = Convert.ToBoolean(xmlNavigator.GetAttribute("Modal", ""));
                    }
                    if (xmlNavigator.GetAttribute("DEFAULT_X", "") != string.Empty)
                    {
                        DefaultPosX = Convert.ToInt32(xmlNavigator.GetAttribute("DEFAULT_X", ""));
                    }
                    if (xmlNavigator.GetAttribute("DEFAULT_Y", "") != string.Empty)
                    {
                        DefaultPosY = Convert.ToInt32(xmlNavigator.GetAttribute("DEFAULT_Y", ""));
                    }
                    if (xmlNavigator.GetAttribute("ADJUST_X", "") != string.Empty)
                    {
                        DefaultAdjustPosX = Convert.ToInt32(xmlNavigator.GetAttribute("ADJUST_X", ""));
                    }
                    if (xmlNavigator.GetAttribute("ADJUST_Y", "") != string.Empty)
                    {
                        DefaultAdjustPosY = Convert.ToInt32(xmlNavigator.GetAttribute("ADJUST_Y", ""));
                    }
                    if (xmlNavigator.GetAttribute("SHOWSID", "") != string.Empty)
                    {
                        ShowSoundID = Convert.ToInt32(xmlNavigator.GetAttribute("SHOWSID", ""));
                    }
                    if (xmlNavigator.GetAttribute("HIDESID", "") != string.Empty)
                    {
                        HideSoundID = Convert.ToInt32(xmlNavigator.GetAttribute("HIDESID", ""));
                    }
                    if (xmlNavigator.HasChildren)
                    {
                        xmlNavigator.MoveToFirstChild();
                        listElement.Add(ElementConstructor.CreateElement(xmlNavigator));
                        while (xmlNavigator.MoveToNext())
                        {
                            listElement.Add(ElementConstructor.CreateElement(xmlNavigator));
                        }
                    }
                    StatusManager.AddLog("XML Successfully loaded");
                }
                else
                {
                    StatusManager.AddLog("No \"Root_Element\" in XML file");
                }
            }
            catch (Exception e)
            {
                StatusManager.AddLog("Error loading XML : " + e.Message);
            }
        }
Ejemplo n.º 7
0
        public static Caption CreateElement(XPathNavigator xmlNavigator)
        {
            string elmtName = xmlNavigator.Name;

            if (elmtName == "CAPTION" || elmtName == "STATIC")
            {
                Caption newCaption = new Caption();
                newCaption.Load(xmlNavigator);
                return(newCaption);
            }
            else if (elmtName == "IMAGE" || elmtName == "TOPIMAGE" || elmtName == "MIDDLEIMAGE" || elmtName == "BOTTOMIMAGE")
            {
                Image newImage = new Image();
                newImage.Load(xmlNavigator);
                return(newImage);
            }
            else if (elmtName == "COMBOBOX" || elmtName == "JCOMBOBOX")
            {
                ComboBox newComboBox = new ComboBox();
                newComboBox.Load(xmlNavigator);
                return(newComboBox);
            }
            else if (elmtName == "BUTTON" || elmtName == "PREVBUTTON" || elmtName == "NEXTBUTTON" || elmtName == "PUSHBUTTON")
            {
                Button newButton = new Button();
                newButton.Load(xmlNavigator);
                return(newButton);
            }
            else if (elmtName == "EDITBOX")
            {
                EditBox newEditBox = new EditBox();
                newEditBox.Load(xmlNavigator);
                return(newEditBox);
            }
            else if (elmtName == "TABBEDPANE")
            {
                TabbedPane newTabbedPane = new TabbedPane();
                newTabbedPane.Load(xmlNavigator);
                return(newTabbedPane);
            }
            else if (elmtName == "TAB")
            {
                Tab newTab = new Tab();
                newTab.Load(xmlNavigator);
                return(newTab);
            }
            else if (elmtName == "TABBUTTON")
            {
                TabbedButton newTabbedButton = new TabbedButton();
                newTabbedButton.Load(xmlNavigator);
                return(newTabbedButton);
            }
            else if (elmtName == "RADIOBUTTON")
            {
                RadioButton newRadioButton = new RadioButton();
                newRadioButton.Load(xmlNavigator);
                return(newRadioButton);
            }
            else if (elmtName == "GUAGE")
            {
                Guage newGuage = new Guage();
                newGuage.Load(xmlNavigator);
                return(newGuage);
            }
            else if (elmtName == "LISTBOX")
            {
                ListBox newListBox = new ListBox();
                newListBox.Load(xmlNavigator);
                return(newListBox);
            }
            else if (elmtName == "SCROLLBAR")
            {
                ScrollBar newScrollBar = new ScrollBar();
                newScrollBar.Load(xmlNavigator);
                return(newScrollBar);
            }
            else if (elmtName == "SCROLLBOX")
            {
                ScrollBox newScrollBox = new ScrollBox();
                newScrollBox.Load(xmlNavigator);
                return(newScrollBox);
            }
            else if (elmtName == "CHECKBOX")
            {
                CheckBox newCheckBox = new CheckBox();
                newCheckBox.Load(xmlNavigator);
                return(newCheckBox);
            }
            else if (elmtName == "JLISTBOX")
            {
                JListBox newJListBox = new JListBox();
                newJListBox.Load(xmlNavigator);
                return(newJListBox);
            }
            else if (elmtName == "ZLISTBOX")
            {
                ZListBox newZListBox = new ZListBox();
                newZListBox.Load(xmlNavigator);
                return(newZListBox);
            }
            else if (elmtName == "PANE")
            {
                Pane newPane = new Pane();
                newPane.Load(xmlNavigator);
                return(newPane);
            }
            else if (elmtName == "TABLE")
            {
                Table newTable = new Table();
                newTable.Load(xmlNavigator);
                return(newTable);
            }
            else
            {
                StatusManager.AddLog("Unknow element in xml : " + elmtName);
                return(null);
            }
        }
Ejemplo n.º 8
0
        private void OpenButton_Click(object sender, EventArgs e)
        {
            folderBrowserDialog.Description = @"Select your client folder : 
for exemple C:\Game\Rose Online";

            if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
            {
                controlNode.Nodes.Clear();
                ContentManager.Instance().ClearAll();
                //Clear spriteManager too

                clientFolder = new DirectoryInfo(folderBrowserDialog.SelectedPath);
                ContentManager.SetRootPath(folderBrowserDialog.SelectedPath);
                StatusManager.AddLog("Root Folder : " + folderBrowserDialog.SelectedPath);

                if (Directory.Exists(folderBrowserDialog.SelectedPath + "\\3DDATA\\CONTROL"))
                {
                    StatusManager.AddLog("Control Folder has been found at : " + folderBrowserDialog.SelectedPath + "\\3DDATA\\CONTROL");
                    ContentManager.SetControlFolderPath(folderBrowserDialog.SelectedPath + "\\3DDATA\\CONTROL");
                }
                else
                {
                    StatusManager.AddLog("Control Folder can't be found : it should be at " + folderBrowserDialog.SelectedPath + "\\3DDATA\\CONTROL");
                    return;
                }

                if (Directory.Exists(folderBrowserDialog.SelectedPath + "\\3DDATA\\CONTROL\\RES"))
                {
                    StatusManager.AddLog("Res Folder has been found at : " + folderBrowserDialog.SelectedPath + "\\3DDATA\\CONTROL\\RES");
                    ContentManager.SetResFolderPath(folderBrowserDialog.SelectedPath + "\\3DDATA\\CONTROL\\RES");
                }
                else
                {
                    StatusManager.AddLog("Res Folder can't be found : it should be at " + folderBrowserDialog.SelectedPath + "\\3DDATA\\CONTROL\\RES");
                    return;
                }
                if (Directory.Exists(folderBrowserDialog.SelectedPath + "\\3DDATA\\CONTROL\\XML"))
                {
                    StatusManager.AddLog("XML Folder has been found at : " + folderBrowserDialog.SelectedPath + "\\3DDATA\\CONTROL\\XML");
                    ContentManager.SetXMLFolderPath(folderBrowserDialog.SelectedPath + "\\3DDATA\\CONTROL\\XML");
                }
                else
                {
                    StatusManager.AddLog("XML Folder can't be found : it should be at " + folderBrowserDialog.SelectedPath + "\\3DDATA\\CONTROL\\XML");
                    return;
                }


                DirectoryInfo resFolder            = new DirectoryInfo(ContentManager.GetResFolderPath());
                DevComponents.AdvTree.Node resNode = new DevComponents.AdvTree.Node();
                resNode.Image = global::Rose_online_UI_Editor.Properties.Resources.SmallOpenDocument;
                resNode.Text  = resFolder.Name;

                StatusManager.AddLog("Creating file tree ...");
                StatusManager.AddLog("Preloading TSI and Sprites");
                foreach (FileInfo file in resFolder.GetFiles())
                {
                    if (file.Extension.ToLower() == ".dds" || file.Extension.ToLower() == ".tsi")
                    {
                        DevComponents.AdvTree.Node newFileNode = new DevComponents.AdvTree.Node();
                        newFileNode.Text = file.Name;
                        newFileNode.Name = file.Extension.ToLower();

                        switch (file.Extension.ToLower())
                        {
                        case ".dds":
                            newFileNode.Image = global::Rose_online_UI_Editor.Properties.Resources.SmallPictureLogo;
                            //ajouter un sprite dans le spritemanager pour chaque dds trouvé !!!!
                            break;

                        case ".tsi":
                            newFileNode.Image = global::Rose_online_UI_Editor.Properties.Resources.SmallTSILogo;
                            TSI newTSI = ContentManager.Instance().GetTSI(ContentManager.resFolderPartialPath + "\\" + file.Name);
                            SpriteManager.Instance().GenerateSpritesFromTSI(newTSI);
                            break;
                        }
                        resNode.Nodes.Add(newFileNode);
                    }
                }

                DirectoryInfo xmlFolder            = new DirectoryInfo(ContentManager.GetXMLFolderPath());
                DevComponents.AdvTree.Node xmlNode = new DevComponents.AdvTree.Node();
                xmlNode.Image = global::Rose_online_UI_Editor.Properties.Resources.SmallOpenDocument;
                xmlNode.Text  = xmlFolder.Name;
                foreach (FileInfo file in xmlFolder.GetFiles())
                {
                    if (file.Extension.ToLower() == ".xml")
                    {
                        DevComponents.AdvTree.Node newFileNode = new DevComponents.AdvTree.Node();
                        newFileNode.Text  = file.Name;
                        newFileNode.Name  = file.Extension.ToLower();
                        newFileNode.Image = global::Rose_online_UI_Editor.Properties.Resources.SmallxmlLogo;
                        xmlNode.Nodes.Add(newFileNode);
                    }
                }
                controlNode.Nodes.Add(resNode);
                controlNode.Nodes.Add(xmlNode);
            }
        }