Beispiel #1
0
        private void MenuUpdateVersion_Click(object sender, EventArgs e)
        {
            string version = null;

            foreach (ListItem listItem in ContentList.SelectedItems)
            {
                S3SAListItem item = listItem as S3SAListItem;
                if (item == null)
                {
                    continue;
                }

                version = item.Version;

                if (!string.IsNullOrEmpty(version))
                {
                    break;
                }
            }

            TextInput dialog = new TextInput("Version", version);

            if (dialog.ShowDialog() != System.Windows.Forms.DialogResult.OK)
            {
                return;
            }

            if (version == dialog.Result)
            {
                return;
            }

            version = dialog.Result;

            foreach (ListItem listItem in ContentList.SelectedItems)
            {
                S3SAListItem item = listItem as S3SAListItem;
                if (item == null)
                {
                    continue;
                }

                item.Version = version;
            }

            sChanged = true;
        }
Beispiel #2
0
        private void MenuUpdateVersion_Click(object sender, EventArgs e)
        {
            string version = null;

            foreach (ListItem listItem in ContentList.SelectedItems)
            {
                S3SAListItem item = listItem as S3SAListItem;
                if (item == null) continue;

                version = item.Version;

                if (!string.IsNullOrEmpty(version))
                {
                    break;
                }
            }

            TextInput dialog = new TextInput("Version", version);
            if (dialog.ShowDialog() != System.Windows.Forms.DialogResult.OK) return;

            if (version == dialog.Result) return;

            version = dialog.Result;

            foreach (ListItem listItem in ContentList.SelectedItems)
            {
                S3SAListItem item = listItem as S3SAListItem;
                if (item == null) continue;

                item.Version = version;
            }

            sChanged = true;
        }
Beispiel #3
0
        private void MenuRenameSTBL_Click(object sender, EventArgs e)
        {
            string scriptName = null;

            foreach (ListItem item in ContentList.Items)
            {
                if (item is S3SAListItem)
                {
                    scriptName = item.Text;
                    break;
                }
            }

            TextInput dialog = new TextInput("HashName and Prefix", scriptName);

            if (dialog.ShowDialog() != System.Windows.Forms.DialogResult.OK)
            {
                return;
            }

            string[] results = dialog.Result.Split(' ');

            ulong result = FNV64.GetHash(results[0]);

            string orig = result.ToString("X16");

            int origValue = int.Parse(orig.Substring(0, 2), System.Globalization.NumberStyles.HexNumber, null);

            if (origValue < STBL.Count)
            {
                result++;

                orig = result.ToString("X16");
            }

            string part = orig.Substring(2);

            string prefix = null;

            if (results.Length > 1)
            {
                prefix = results[1] + " ";
            }

            foreach (string aPrefix in STBL.Keys)
            {
                ulong instance = Convert.ToUInt64("0x" + aPrefix + part, 16);

                bool found = false;
                foreach (IResourceIndexEntry entry in CurrentPackage.FindAll(key => ((key.ResourceType == (uint)ResourceType.STBL))))
                {
                    string instanceStr = entry["Instance"];

                    if (instanceStr.Substring(2, 2) == aPrefix)
                    {
                        found = true;
                        break;
                    }
                }

                if (!found)
                {
                    STBLListItem stblItem = new STBLListItem();

                    if (stblItem.AddNew(instance, CurrentPackage, true))
                    {
                        ContentList.Items.Add(stblItem);
                    }
                }
            }

            foreach (ListItem item in ContentList.Items)
            {
                if (!(item is STBLListItem))
                {
                    continue;
                }

                item.Instance = "0x" + STBL.GetPrefix(item.Instance) + part;

                item.Name = "Strings " + prefix + STBL.GetProperName(item.Instance);

                sChanged = true;
            }
        }
Beispiel #4
0
        private void MenuRenameSTBL_Click(object sender, EventArgs e)
        {
            string scriptName = null;

            foreach (ListItem item in ContentList.Items)
            {
                if (item is S3SAListItem)
                {
                    scriptName = item.Text;
                    break;
                }
            }

            TextInput dialog = new TextInput("HashName and Prefix", scriptName);

            if (dialog.ShowDialog() != System.Windows.Forms.DialogResult.OK) return;

            string[] results = dialog.Result.Split(' ');

            ulong result = FNV64.GetHash(results[0]);

            string orig = result.ToString("X16");
            
            int origValue = int.Parse(orig.Substring(0,2), System.Globalization.NumberStyles.HexNumber, null);
            if (origValue < STBL.Count)
            {
                result++;

                orig = result.ToString("X16");
            }

            string part = orig.Substring(2);

            string prefix = null;
            if (results.Length > 1)
            {
                prefix = results[1] + " ";
            }

            foreach(string aPrefix in STBL.Keys)
            {
                ulong instance = Convert.ToUInt64("0x" + aPrefix + part, 16);

                bool found = false;
                foreach (IResourceIndexEntry entry in CurrentPackage.FindAll(key => ((key.ResourceType == (uint)ResourceType.STBL))))
                {
                    string instanceStr = entry["Instance"];

                    if (instanceStr.Substring(2, 2) == aPrefix)
                    {
                        found = true;
                        break;
                    }
                }

                if (!found)
                {
                    STBLListItem stblItem = new STBLListItem();

                    if (stblItem.AddNew(instance, CurrentPackage, true))
                    {
                        ContentList.Items.Add(stblItem);
                    }
                }
            }

            foreach (ListItem item in ContentList.Items)
            {
                if (!(item is STBLListItem)) continue;

                item.Instance = "0x" + STBL.GetPrefix(item.Instance) + part;

                item.Name = "Strings " + prefix + STBL.GetProperName(item.Instance);

                sChanged = true;
            }
        }