Esempio n. 1
0
 public override string ToString()
 {
     return(string.Format(LanguageManager.Get("NSMBPath", "ToString"), id, points.Count));
 }
Esempio n. 2
0
        public ROMUserInfo(string ROMPath)
        {
            //FilePath = ROMPath.Substring(0, ROMPath.LastIndexOf('.') + 1) + "txt";
            int lineNum = 0;

            try
            {
                //if (!System.IO.File.Exists(FilePath)) return;
                //System.IO.StreamReader s = new System.IO.StreamReader(FilePath);
                //DSFileSystem.File file = ROM.FS.getFileByName("00DUMMY");
                DSFileSystem.File        file    = ROM.FS.getFileById(131);
                string[]                 lines   = System.Text.Encoding.ASCII.GetString(file.getContents()).Split('\n');
                List <string>            curList = null;
                Dictionary <int, string> curDict = null;
                bool readDescriptions            = false;
                for (lineNum = 0; lineNum < lines.Length; lineNum++)
                {
                    string line = lines[lineNum];
                    if (line != "")
                    {
                        if (line.StartsWith("["))
                        {
                            line = line.Substring(1, line.Length - 2);
                            int num;
                            if (int.TryParse(line, out num))
                            {
                                readDescriptions = true;
                                curList          = new List <string>();
                                for (int l = 0; l < 256; l++)
                                {
                                    curList.Add("");
                                }
                                descriptions.Add(num, curList);
                            }
                            else
                            {
                                readDescriptions = false;
                                curDict          = new Dictionary <int, string>();
                                lists.Add(line, curDict);
                            }
                        }
                        else if (curList != null || curDict != null)
                        {
                            int    num  = int.Parse(line.Substring(0, line.IndexOf("=")).Trim());
                            string name = line.Substring(line.IndexOf("=") + 1).Trim();
                            if (readDescriptions)
                            {
                                if (num < 256)
                                {
                                    curList[num] = name;
                                }
                            }
                            else
                            {
                                curDict.Add(num, name);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(String.Format(LanguageManager.Get("ROMUserInfo", "ErrorRead"), lineNum + 1, ex.Message));
            }
        }