Exemple #1
0
        // 비어 있는 Tra 항목 테스트 할것...
        public bool ImportTraFile(string path, TLKTextCollection TlkTexts)
        {
            var encoding = TlkTexts.TextEncoding;
            var TraBytes = new List <byte[]>();
            var MAXCNT   = 524288;

            using (var fs = new FileStream(path, FileMode.Open))
            {
                using (var br = new BinaryReader(fs))
                {
                    var cnt = fs.Length / MAXCNT;
                    var mod = fs.Length % MAXCNT;

                    for (int i = 0; i < cnt; i++)
                    {
                        SplitTraText(br.ReadBytes(MAXCNT), encoding, ref TraBytes);
                    }

                    SplitTraText(br.ReadBytes((int)mod), encoding, ref TraBytes);
                }
            }

            if (TraBytes.Count <= 0)
            {
                return(false);
            }

            var TRATexts     = new (int, string)[TraBytes.Count];
Exemple #2
0
        public bool ExportTraFile(string savepath, TLKTextCollection texts, int[] compareIndex)
        {
            if (string.IsNullOrEmpty(savepath) || texts == null)
            {
                return(false);
            }

            var digits = texts.Last().Index.ToString().Length;

            int textCnt  = texts.Count;
            int comCnt   = compareIndex.Count();
            var entryArr = new string[comCnt];

            using (var ori = TLKFILE.Open(texts.FilePath, true))
            {
                var encoding = texts.TextEncoding;

                for (int i = 0; i < comCnt; i++)
                {
                    var result = string.Empty;

                    if (compareIndex[i] < textCnt)
                    {
                        result = encoding.GetString(ori.GetEntryResourceName(compareIndex[i])).Replace("\0", "");
                    }

                    if (string.IsNullOrEmpty(result))
                    {
                        entryArr[i] = result;
                    }

                    else
                    {
                        entryArr[i] = " [" + result + "]";
                    }
                }
            }

            using (var ws = new StreamWriter(File.Create(savepath)))
            {
                var tempIndex = 0;
                for (int i = 0; i < comCnt; i++)
                {
                    tempIndex = compareIndex[i];
                    if (tempIndex < textCnt)
                    {
                        ws.WriteLine(string.Format(@"@{0} = ~{1}~ {2}", tempIndex.ToString().PadRight(digits, ' '), texts[tempIndex].Text, entryArr[i]));
                    }
                }
            }

            return(true);
        }
        public MergeTabItem(IGlobalContexts global, TLKTextCollection first, TLKTextCollection second) : base(global)
        {
            _Collection[0] = first;
            _Collection[1] = second;

            _First.IsCompare  = true;
            _Second.IsCompare = true;

            Tabs = new DiffTabsModel();

            Tabs.Add(new DiffTabItem(global.Settings)
            {
                ContextName = "Red"
            });
            Tabs.Add(new DiffTabItem(global.Settings)
            {
                ContextName = "Blue"
            });

            TabSelectedItem = Tabs[0];

            Initialize();
        }