CoreMerge.cs
/// <summary>
/// Gather the strings from a core.lvl file or .txt file in the correct string format.
/// </summary>
/// <param name="file"></param>
Gather the strings from a core.lvl file or .txt file in the correct string format.
Gather the strings from a core . lvl file or . txt file in the correct string format .
public void GatherStrings(string file)
        {
            if (file.EndsWith(".lvl", StringComparison.InvariantCultureIgnoreCase))
            {
                UcfbHelper ucfbFileHelper = new UcfbHelper();
                ucfbFileHelper.FileName = file;
                ucfbFileHelper.InitializeRead();
                Chunk cur = null;
                while ((cur = ucfbFileHelper.RipChunk(false)) != null)
                {
                    if (cur.Type == "Locl")
                    {
                        cur.LocHelper = new LocHelper(cur.GetAssetData());
                        string allStrings = cur.LocHelper.GetAllStrings();
                        if (mStringsToAdd.ContainsKey(cur.Name))
                        {
                            StringBuilder sb = mStringsToAdd[cur.Name];
                            if (sb[sb.Length - 1] != '\n')
                                sb.Append("\n");
                            sb.Append(allStrings);
                        }
                        else
                        {
                            mStringsToAdd.Add(cur.Name, new StringBuilder(allStrings));
                        }
                    }
                }
            }
            else if (file.EndsWith(".txt", StringComparison.InvariantCultureIgnoreCase))
            {
                int slashLoc = file.LastIndexOf('\\');
                string langName = "";
                if (slashLoc > -1)
                {
                    langName = file.Substring(slashLoc + 1).Replace(".txt", "");
                    string allStrings = File.ReadAllText(file);
                    if (mStringsToAdd.ContainsKey(langName))
                    {
                        StringBuilder sb = mStringsToAdd[langName];
                        if (sb[sb.Length - 1] != '\n')
                            sb.Append("\n");
                        sb.Append(allStrings);
                    }
                    else
                    {
                        mStringsToAdd.Add(langName, new StringBuilder(allStrings));
                    }
                }
            }
            else
            {
                Console.WriteLine("skipping file '{0}'", file);
            }
        }
public void GatherStrings ( string file ) { if ( file . EndsWith ( " " , StringComparison . InvariantCultureIgnoreCase ) ) { UcfbHelper ucfbFileHelper = new UcfbHelper ( ) ; ucfbFileHelper . FileName = file ; ucfbFileHelper . InitializeRead ( ) ; Chunk cur = null ; while ( ( cur = ucfbFileHelper . RipChunk ( false ) ) != null ) { if ( cur . Type == " " ) { cur . LocHelper = new LocHelper ( cur . GetAssetData ( ) ) ; string allStrings = cur . LocHelper . GetAllStrings ( ) ; if ( mStringsToAdd . ContainsKey ( cur . Name ) ) { StringBuilder sb = mStringsToAdd [ cur . Name ] ; if ( sb [ sb . Length - 1 ] != ' \n ' ) sb . Append ( " \n " ) ; sb . Append ( allStrings ) ; } else { mStringsToAdd . Add ( cur . Name , new StringBuilder ( allStrings ) ) ; } } } } else if ( file . EndsWith ( " " , StringComparison . InvariantCultureIgnoreCase ) ) { int slashLoc = file . LastIndexOf ( ' \\ ' ) ; string langName = " " ; if ( slashLoc > - 1 ) { langName = file . Substring ( slashLoc + 1 ) . Replace ( " " , " " ) ; string allStrings = File . ReadAllText ( file ) ; if ( mStringsToAdd . ContainsKey ( langName ) ) { StringBuilder sb = mStringsToAdd [ langName ] ; if ( sb [ sb . Length - 1 ] != ' \n ' ) sb . Append ( " \n " ) ; sb . Append ( allStrings ) ; } else { mStringsToAdd . Add ( langName , new StringBuilder ( allStrings ) ) ; } } } else { Console . WriteLine ( " " , file ) ; } }
Gather the strings from a core.lvl file or .txt file in the correct string format.
Gather the strings from a core . lvl file or . txt file in the correct string format .
file
string
None