コード例 #1
0
        public void MyKeyUp(object sender, KeyEventArgs e)
        {
            if (e.KeyData.ToString() == "Insert")
            {
                quicksave();
            }
            if (e.KeyData.ToString() == "Delete")
            {
                quickload();
            }

            if (Mobius.Options.getHacks()[16] == true)
            {
                SavedLoc[] locs = SavedLoc.LoadLocations("saved.xml");

                foreach (SavedLoc loc in locs)
                {
                    if (e.KeyData.ToString() == loc.Key.ToString())
                    {
                        this.mX.SetValue(loc.X);
                        this.mY.SetValue(loc.Y);
                        this.mZ.SetValue(loc.Z);
                    }
                }
            }
        }
コード例 #2
0
 public void LoadLocationsFromFile()
 {
     this.lstSavedLocs.Nodes.Clear();
     SavedLoc[] locs = SavedLoc.LoadLocations("saved.xml");
     foreach (SavedLoc loc in locs)
     {
         this.AddNewLocation(loc);
     }
 }
コード例 #3
0
        private void quicksave()
        {
            SavedLoc loc = new SavedLoc(this.txtLocationName.Text, this.mX.GetFloat(), this.mY.GetFloat(), this.mZ.GetFloat(), this.txtKey.Text);

            this.quicklocx      = loc.X;
            this.quicklocy      = loc.Y;
            this.quicklocz      = loc.Z;
            this.txtStatus.Text = this.txtStatus.Text + "Quicksaved Location:\r\n" + "X: " + this.quicklocx + "\r\n" + "Y: " + this.quicklocy + "\r\n" + "Z: " + this.quicklocz + "\r\n";
            quicksaved          = true;
        }
コード例 #4
0
 private void btnSaveLoc_Click(object sender, System.EventArgs e)
 {
     if (this.mX != null & this.mY != null & this.mZ != null)
     {
         addedLocations = true;
         SavedLoc loc = new SavedLoc(this.txtLocationName.Text, this.mX.GetFloat(), this.mY.GetFloat(), this.mZ.GetFloat(), this.txtKey.Text);
         this.AddNewLocation(loc);
         this.txtLocationName.Text = "";
     }
 }
コード例 #5
0
        private void AddNewLocation(SavedLoc loc)
        {
            ExpandedTreeNode node = new ExpandedTreeNode(loc.Name);

            node.AssociatedObject = loc;
            node.Nodes.Add(String.Format("X: {0}", loc.X));
            node.Nodes.Add(String.Format("Y: {0}", loc.Y));
            node.Nodes.Add(String.Format("Z: {0}", loc.Z));
            node.Nodes.Add(String.Format("Key: {0}", loc.Key));
            this.lstSavedLocs.Nodes.Add(node);
        }
コード例 #6
0
        private void lstSavedLocs_DoubleClick(object sender, System.EventArgs e)
        {
            if (this.lstSavedLocs.SelectedNode is ExpandedTreeNode)
            {
                ExpandedTreeNode node = (ExpandedTreeNode)this.lstSavedLocs.SelectedNode;

                if (this.mX != null & this.mY != null & this.mZ != null & node.AssociatedObject is SavedLoc)
                {
                    SavedLoc loc = (SavedLoc)node.AssociatedObject;
                    this.mX.SetValue(loc.X);
                    this.mY.SetValue(loc.Y);
                    this.mZ.SetValue(loc.Z);
                }
            }
        }
コード例 #7
0
        private void SaveLocationsToFile()
        {
            if (this.lstSavedLocs.Nodes.Count > 0)
            {
                SavedLoc[] locs = new SavedLoc[this.lstSavedLocs.Nodes.Count];

                int i = 0;
                foreach (ExpandedTreeNode node in this.lstSavedLocs.Nodes)
                {
                    locs[i] = (SavedLoc)node.AssociatedObject;
                    i++;
                }

                SavedLoc.SaveLocations("saved.xml", locs);
            }
        }
コード例 #8
0
        private void menuItem1_Click(object sender, System.EventArgs e)
        {
            if (this.lstSavedLocs.SelectedNode is ExpandedTreeNode)
            {
                frmLocEdit       editForm = new frmLocEdit();
                ExpandedTreeNode node     = (ExpandedTreeNode)this.lstSavedLocs.SelectedNode;

                SavedLoc loc = (SavedLoc)node.AssociatedObject;

                editForm.editName = loc.Name;
                editForm.editX    = loc.X.ToString();
                editForm.editY    = loc.Y.ToString();
                editForm.editZ    = loc.Z.ToString();
                editForm.ShowDialog();
            }

            LoadLocationsFromFile();
        }
コード例 #9
0
        public static SavedLoc[] LoadLocations(string filePath)
        {
            System.Collections.ArrayList list;
            list = new System.Collections.ArrayList();

            if (System.IO.File.Exists(filePath))
            {
                XmlDocument doc = new XmlDocument();
                doc.Load(filePath);


                XmlNodeList nodes = doc.SelectNodes("//location");

                foreach (XmlNode node in nodes)
                {
                    SavedLoc loc = new SavedLoc();
                    foreach (XmlNode childNode in node.ChildNodes)
                    {
                        if (childNode.Name == "name")
                        {
                            loc.Name = childNode.InnerText;
                        }
                        else if (childNode.Name == "x")
                        {
                            loc.X = float.Parse(childNode.InnerText);
                        }
                        else if (childNode.Name == "y")
                        {
                            loc.Y = float.Parse(childNode.InnerText);
                        }
                        else if (childNode.Name == "z")
                        {
                            loc.Z = float.Parse(childNode.InnerText);
                        }
                        else if (childNode.Name == "key")
                        {
                            loc.Key = childNode.InnerText;
                        }
                    }
                    list.Add(loc);
                }
            }
            return((SavedLoc[])list.ToArray(typeof(SavedLoc)));
        }
コード例 #10
0
ファイル: SavedLoc.cs プロジェクト: BackupTheBerlios/mobius
        public static void SaveLocations(string filePath, SavedLoc[] locations)
        {
            System.IO.FileStream stream = System.IO.File.Create(filePath);
            XmlTextWriter xml = new XmlTextWriter(stream, System.Text.Encoding.ASCII);

            xml.Formatting = Formatting.Indented;
            xml.Indentation = 2;
            xml.IndentChar = ' ';

            xml.WriteStartDocument(true);

            xml.WriteStartElement("saved");

            foreach(SavedLoc loc in locations)
            {
                xml.WriteStartElement("location");

                xml.WriteStartElement("name");
                xml.WriteString(loc.Name);
                xml.WriteEndElement();

                xml.WriteStartElement("x");
                xml.WriteString(loc.X.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("y");
                xml.WriteString(loc.Y.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("z");
                xml.WriteString(loc.Z.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("key");
                xml.WriteString(loc.Key.ToString());
                xml.WriteEndElement();

                xml.WriteEndElement();
            }

            xml.WriteEndElement();
            xml.WriteEndDocument();

            xml.Flush();
            stream.Flush();

            xml.Close();
            stream.Close();
        }
コード例 #11
0
 private void menuItem2_Click(object sender, System.EventArgs e)
 {
     SavedLoc.RemoveLoc("saved.xml", this.lstSavedLocs.SelectedNode.Text);
     this.lstSavedLocs.SelectedNode.Remove();
 }
コード例 #12
0
 private void btnSave_Click(object sender, System.EventArgs e)
 {
     SavedLoc.EditMember("saved.xml", this.editName, this.txtName.Text, this.txtX.Text, this.txtY.Text, this.txtZ.Text);
     this.Close();
 }
コード例 #13
0
ファイル: MainForm.cs プロジェクト: BackupTheBerlios/mobius
 private void AddNewLocation(SavedLoc loc)
 {
     ExpandedTreeNode node = new ExpandedTreeNode(loc.Name);
     node.AssociatedObject = loc;
     node.Nodes.Add(String.Format("X: {0}", loc.X));
     node.Nodes.Add(String.Format("Y: {0}", loc.Y));
     node.Nodes.Add(String.Format("Z: {0}", loc.Z));
     node.Nodes.Add(String.Format("Key: {0}",loc.Key));
     this.lstSavedLocs.Nodes.Add(node);
 }
コード例 #14
0
ファイル: MainForm.cs プロジェクト: BackupTheBerlios/mobius
 private void btnSaveLoc_Click(object sender, System.EventArgs e)
 {
     if (this.mX != null & this.mY != null & this.mZ != null)
     {
         addedLocations=true;
         SavedLoc loc = new SavedLoc(this.txtLocationName.Text, this.mX.GetFloat(), this.mY.GetFloat(), this.mZ.GetFloat(),this.txtKey.Text);
         this.AddNewLocation(loc);
         this.txtLocationName.Text = "";
     }
 }
コード例 #15
0
ファイル: MainForm.cs プロジェクト: BackupTheBerlios/mobius
 private void quicksave()
 {
     SavedLoc loc = new SavedLoc(this.txtLocationName.Text, this.mX.GetFloat(), this.mY.GetFloat(), this.mZ.GetFloat(),this.txtKey.Text);
     this.quicklocx = loc.X;
     this.quicklocy = loc.Y;
     this.quicklocz = loc.Z;
     this.txtStatus.Text = this.txtStatus.Text + "Quicksaved Location:\r\n" + "X: " + this.quicklocx + "\r\n" + "Y: " + this.quicklocy + "\r\n" + "Z: " + this.quicklocz + "\r\n";
     quicksaved = true;
 }
コード例 #16
0
ファイル: MainForm.cs プロジェクト: BackupTheBerlios/mobius
        private void SaveLocationsToFile()
        {
            if (this.lstSavedLocs.Nodes.Count > 0)
            {
                SavedLoc[] locs = new SavedLoc[this.lstSavedLocs.Nodes.Count];

                int i = 0;
                foreach (ExpandedTreeNode node in this.lstSavedLocs.Nodes)
                {
                    locs[i] = (SavedLoc)node.AssociatedObject;
                    i++;
                }

                SavedLoc.SaveLocations("saved.xml", locs);
            }
        }
コード例 #17
0
ファイル: SavedLoc.cs プロジェクト: BackupTheBerlios/mobius
        public static SavedLoc[] LoadLocations(string filePath)
        {
            System.Collections.ArrayList list;
            list = new System.Collections.ArrayList();

            if (System.IO.File.Exists(filePath))
            {
                XmlDocument doc = new XmlDocument();
                doc.Load(filePath);

                XmlNodeList nodes = doc.SelectNodes("//location");

                foreach (XmlNode node in nodes)
                {
                    SavedLoc loc = new SavedLoc();
                    foreach (XmlNode childNode in node.ChildNodes)
                    {
                        if (childNode.Name == "name")
                        {
                            loc.Name = childNode.InnerText;
                        }
                        else if (childNode.Name == "x")
                        {
                            loc.X = float.Parse(childNode.InnerText);
                        }
                        else if (childNode.Name == "y")
                        {
                            loc.Y = float.Parse(childNode.InnerText);
                        }
                        else if (childNode.Name == "z")
                        {
                            loc.Z = float.Parse(childNode.InnerText);
                        }
                        else if (childNode.Name == "key")
                        {
                            loc.Key = childNode.InnerText;
                        }
                    }
                    list.Add(loc);
                }
            }
            return (SavedLoc[])list.ToArray(typeof(SavedLoc));
        }