예제 #1
0
        /// <summary>
        /// Convert the file to text.
        /// </summary>
        /// <returns>The file as text.</returns>
        public new string[] ToText()
        {
            //Command list.
            ReadCommandData(true);
            List <string> l = new List <string>();

            //Add header.
            l.Add(";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;");
            l.Add(";");
            l.Add("; " + Name + ".smft");
            l.Add(";     Generated By Gota's Sequence Tools");
            l.Add(";");
            l.Add(";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;");
            l.Add("");

            //For each command. Last one isn't counted.
            for (int i = 0; i < Commands.Count - 1; i++)
            {
                //Add labels.
                bool labelAdded  = false;
                var  labels      = PublicLabels.Where(x => x.Value == i).Select(x => x.Key);
                bool label0Added = false;
                foreach (var label in labels)
                {
                    if (i != 0 && !labelAdded && Commands[i - 1].CommandType == SequenceCommands.Fin)
                    {
                        l.Add(" ");
                    }
                    if (i == 0)
                    {
                        label0Added = true;
                    }
                    l.Add(label + ":");
                    labelAdded = true;
                }
                if (OtherLabels.Contains(i))
                {
                    if (i != 0 && !labelAdded && Commands[i - 1].CommandType == SequenceCommands.Fin)
                    {
                        l.Add(" ");
                    }
                    if (i != 0)
                    {
                        l.Add("_command_" + i + ":");
                    }
                    //else if (Commands[i - 1].CommandType == SequenceCommands.Fin) { l.Add("Command_" + i + ":"); }
                    labelAdded = true;
                }
                if (i == 0 && !label0Added)
                {
                    l.Add("Sequence_Start:");
                }

                //Add command.
                l.Add("\t" + Commands[i].ToString());
            }

            //Return the list.
            return(l.ToArray());
        }
예제 #2
0
        /// <summary>
        /// Convert the file to text.
        /// </summary>
        /// <returns>The file as text.</returns>
        public new string[] ToText()
        {
            //Command list.
            List <string> l = new List <string>();

            //Add header.
            l.Add(";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;");
            l.Add(";");
            l.Add("; " + Name + ".mus");
            l.Add(";     Generated By Nitro Studio 2");
            l.Add(";");
            l.Add(";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;");
            l.Add("");

            //Add sequence table.
            l.Add("@SEQ_TABLE");
            for (int i = 0; i < Sequences.Count; i++)
            {
                string s = "";
                var    e = Sequences[i];
                s += (e.Name == null ? ("Sequence_" + Sequences[i].Index) : e.Name) + " = " + Sequences[i].Index + ":\t";
                s += Labels.Keys.ElementAt(i) + ",\t";
                s += (e.Bank == null ? e.ReadingBankId.ToString() : e.Bank.Name) + ",\t";
                s += e.Volume + ",\t";
                s += e.ChannelPriority + ",\t";
                s += e.PlayerPriority + ",\t";
                s += (e.Player == null ? e.ReadingPlayerId.ToString() : e.Player.Name);
                l.Add(s);
            }

            //Add sequence data.
            l.Add("");
            l.Add("@SEQ_DATA");

            //For each command. Last one isn't counted.
            for (int i = 0; i < Commands.Count - 1; i++)
            {
                //Add labels.
                bool labelAdded = false;
                var  labels     = PublicLabels.Where(x => x.Value == i).Select(x => x.Key);
                foreach (var label in labels)
                {
                    if (i != 0 && !labelAdded && Commands[i - 1].CommandType == SequenceCommands.Fin)
                    {
                        l.Add(" ");
                    }
                    l.Add(label + ":");
                    labelAdded = true;
                }
                if (OtherLabels.Contains(i))
                {
                    if (i != 0 && !labelAdded && Commands[i - 1].CommandType == SequenceCommands.Fin)
                    {
                        l.Add(" ");
                    }
                    l.Add("Command_" + i + ":");
                    labelAdded = true;
                }

                //Add command.
                l.Add("\t" + Commands[i].ToString());
            }

            //Return the list.
            return(l.ToArray());
        }