Beispiel #1
0
        private void SaveProtos(List<ItemProto> Protos)
        {
            if (CurrentProto != null)
                SetProtoGUI(CurrentProto, false);
            SaveFileDialog SaveFile = new SaveFileDialog();
            SaveFile.OverwritePrompt = true;
            SaveFile.RestoreDirectory = true;
            SaveFile.Filter = "Protofile (*.fopro)|*.fopro";
            if (SaveFile.ShowDialog() == DialogResult.OK)
            {
                ItemProtoParser ProtoParser = new ItemProtoParser();
                ProtoParser.SaveProtosToFile(SaveFile.FileName, Utils.GetVersion(), FOObj, Protos, CustomInterface.CustomFields, Config.FormatWithSpace);
            }

            changeStatus("Saved protos.");
        }
Beispiel #2
0
        bool LoadProtoList(string Path)
        {
            // Parse stuff
            ItemProtoParser ProtoParser = new ItemProtoParser();
            int Count = LoadedProtos.Count;
            if (ProtoParser.LoadProtosFromFile(Path, Utils.GetVersion(), FOObj, LoadedProtos, CustomInterface.CustomFields))
            {
                Message.Show("Some protos already loaded have been overwritten because they had the same proto id, for information on which protos, see ObjectEditor.log",
                      System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
            }
            lstProtos.SetObjects(LoadedProtos);

            if (Count == LoadedProtos.Count)
            {
                Message.Show("Invalid file or version of the proto. No item data found.", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return false;
            }
            return true;
        }
Beispiel #3
0
        private void saveListToRespectiveFilesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Dictionary<String, List<ItemProto>> FileProtoList = new Dictionary<string, List<ItemProto>>();
            List<ItemProto> Prots = new List<ItemProto>();
            foreach (ItemProto Prot in lstProtos.FilteredObjects) Prots.Add(Prot);
            if (Prots.Count > 0)
            {
                foreach (ItemProto Prot in lstProtos.FilteredObjects)
                {
                    if (String.IsNullOrEmpty(Prot.FileName))
                    {
                        Message.Show("Item " + Prot.Name + " [" + Prot.ProtoId + "] has no filename assigned, and therefore can't be saved.", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        continue;
                    }

                    if (FileProtoList.ContainsKey(Prot.FileName))
                        FileProtoList[Prot.FileName].Add(Prot);
                    else
                    {
                        FileProtoList[Prot.FileName] = new List<ItemProto>();
                        FileProtoList[Prot.FileName].Add(Prot);
                    }
                }
                foreach(KeyValuePair<String, List<ItemProto>> kvp in FileProtoList)
                {
                    ItemProtoParser ProtoParser = new ItemProtoParser();
                    if (CurrentProto != null)
                        SetProtoGUI(CurrentProto, false);
                    ProtoParser.SaveProtosToFile(kvp.Key, Utils.GetVersion(), FOObj, kvp.Value, CustomInterface.CustomFields, Config.FormatWithSpace);
                }
            }
            else
                Message.Show("No items in filtered list.", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
Beispiel #4
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            this.Text = "FOnline Object Editor " + Utils.GetVersion();
            MainObj = this;

            System.Windows.Forms.ToolTip ToolTip = new System.Windows.Forms.ToolTip();
            ToolTip.SetToolTip(this.txtSearch, "Enter text to search for in any visible column (name, pid, script function etc.). Case insensitive.");

            this.Size = new Size(Config.WindowSizeX, Config.WindowSizeY);
            this.Location = new Point(Config.WindowLocationX, Config.WindowLocationY);

            if (!Data.LoadDefines(Config))
                Exit();

            OptionsForm = new frmOptions(Config);
            Utils.SerializeObjectListView("." + Path.DirectorySeparatorChar + "listview.bin", ref lstProtos, true);
            InitGuiDefines();
            SetListViewFormatters();

            Translate.WriteTemplateLanguageFile(this);

            Data.Init();
            InitData();

            SetTabPages();
            ItemProtoParser ProtoParser = new ItemProtoParser();

            if (Config.ScriptingEnabled)
            {
                Utils.Log("Starting script thread...");
                ScriptThread = new Thread(new ThreadStart(UpdateScripts_Tick));
                ScriptThread.Start();
            }

            Utils.Log("Initializing successful.");
        }