コード例 #1
0
ファイル: Form1.cs プロジェクト: emberimp/NITW-Dialogue-Tool
        private void loadAssetFile(string filepath, bool setupMode = false)
        {
            Dictionary <string, yarnFile> yarnFiles = UnityAssetFile.read(filepath);

            foreach (KeyValuePair <string, yarnFile> entry in yarnFiles)
            {
                yarnFile yf = entry.Value;

                if (yf.yarnFileName.Length > 0)
                {
                    if (rootz.yarnFiles.ContainsKey(yf.yarnFileName))
                    {
                        rootz.yarnFiles[yf.yarnFileName] = yf;
                    }
                    else
                    {
                        rootz.yarnFiles.Add(yf.yarnFileName, yf);
                    }

                    if (!setupMode)
                    {
                        JsonUtil.saveYarnDictionary(rootz);
                    }
                }
            }
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: emberimp/NITW-Dialogue-Tool
        private void restoryYarn(yarnFile f, bool log = false)
        {
            if (log)
            {
                Log("Restoring original dialogue content of " + f.yarnFileName + ".txt...", true);
            }

            string yarnDir = AppDomain.CurrentDomain.BaseDirectory + @"\yarn files";

            if (!Directory.Exists(yarnDir))
            {
                Directory.CreateDirectory(yarnDir);
            }

            string yarnPath = Path.Combine(yarnDir, f.yarnFileName) + ".txt";

            File.WriteAllText(yarnPath, f.originalContent);

            UnityAssetFile.write(f.yarnFileName, ref rootz);

            f.lastModified = File.GetLastWriteTime(yarnPath);
            f.edited       = false;

            JsonUtil.saveYarnDictionary(rootz);

            if (log)
            {
                Log("Restoring original dialogue content of " + f.yarnFileName + ".txt done", true);
            }
        }
コード例 #3
0
ファイル: Form1.cs プロジェクト: emberimp/NITW-Dialogue-Tool
        private void updateDgvFilesRow(int rowIndex)
        {
            string   yarnKey       = dgvFiles.Rows[rowIndex].Cells["columnFile"].Value.ToString().Replace(".txt", "");
            yarnFile yarn          = rootz.yarnFiles[yarnKey];
            int      archiveNumber = Convert.ToInt32(Path.GetFileNameWithoutExtension(yarn.assetsFilePath).Replace("sharedassets", ""));

            dgvFiles.Rows[rowIndex].SetValues(archiveNumber, yarnKey + ".txt", yarn.edited, yarn.lastModified);
        }