示例#1
0
        public static void batchExport(GrannyContext grannyContext, string unitListFile)
        {
            StreamReader streamReader = new StreamReader(unitListFile);

            string directory = Path.GetDirectoryName(unitListFile);

            string regexString = "(.+);(.*);(.*);(.*)";

            string       outFilename  = unitListFile.Replace(".dat", "_new.dat");
            StreamWriter outputWriter = new StreamWriter(new FileStream(outFilename, FileMode.Create));

            while (!streamReader.EndOfStream)
            {
                string currentLine = streamReader.ReadLine();

                Regex           regex = new Regex(regexString);
                MatchCollection mc    = regex.Matches(currentLine);
                foreach (Match m in mc)
                {
                    string      gr2Filename = m.Groups[1].Value.Trim().ToLower();
                    IGrannyFile grannyFile  = grannyContext.LoadGrannyFile(directory + "\\" + gr2Filename);
                    NexusBuddyApplicationForm.loadedFile = grannyFile;
                    NexusBuddyApplicationForm.form.refreshAppData();
                    List <string> fileTextureMaps = exportAllModelsToCN6(grannyFile, true);

                    string animationFilenames = m.Groups[2].Value.Trim();
                    string textureFilenames   = m.Groups[3].Value.Trim();
                    string prettyName         = m.Groups[4].Value.Trim();

                    var fileTextureSet = new HashSet <string>(fileTextureMaps);

                    if (String.IsNullOrEmpty(textureFilenames))
                    {
                        textureFilenames = string.Join(",", fileTextureSet);
                    }

                    string newline = gr2Filename + ";" + animationFilenames + ";" + textureFilenames + ";" + prettyName;

                    outputWriter.WriteLine(newline);
                }
            }
            streamReader.Close();
            outputWriter.Close();
            File.Delete(unitListFile);
            File.Move(outFilename, unitListFile);
        }
        public static void batchExport(GrannyContext grannyContext, string unitListFile)
        {
            StreamReader streamReader = new StreamReader(unitListFile);

            string directory = Path.GetDirectoryName(unitListFile);

            string regexString = "(.*);(.*);(.*);(.*)";

            while (!streamReader.EndOfStream)
            {
                string currentLine = streamReader.ReadLine();

                Regex           regex = new Regex(regexString);
                MatchCollection mc    = regex.Matches(currentLine);
                foreach (Match m in mc)
                {
                    string      gr2Filename = m.Groups[1].Value.Trim().ToLower();
                    IGrannyFile grannyFile  = grannyContext.LoadGrannyFile(directory + "\\" + gr2Filename);
                    NexusBuddyApplicationForm.loadedFile = grannyFile;
                    NexusBuddyApplicationForm.form.refreshAppData();
                    exportAllModelsToNB2(grannyFile);
                }
            }
        }