Exemple #1
0
        private string[] Import(string File)
        {
            var Ori = Wrapper.Import(File);

            OriStrs = new string[Ori.LongLength];
            Ori.CopyTo(OriStrs, 0);

            for (uint i = 0; i < Ori.LongLength; i++)
            {
                if (i % (Ori.LongLength > 5000 ? 55 : 15) == 0)
                {
                    lblState.Text = string.Format("Initializing... ({0}/{1} Lines)", i, Ori.LongLength);
                    Application.DoEvents();
                }
                foreach (IOptimizator Optimizator in EnabledOptimizators)
                {
                    try {
                        if (Optimizator is DialogueFilter)
                        {
                            continue;
                        }

                        Optimizator.AfterOpen(ref Ori[i], i);
                    } catch { }
                }
            }

            var Filter = new DialogueFilter();

            string[] Strs = null;
            if (IsEnabled(Filter))
            {
                ValidList = ValidDialogueList(Ori);
                List <string> List = new List <string>();
                for (uint i = 0; i < Ori.LongLength; i++)
                {
                    if (ValidList[i])
                    {
                        List.Add(Ori[i]);
                    }
                }

                Strs = List.ToArray();
            }

            return(Strs ?? Ori);
        }
Exemple #2
0
        private void PreviewDialoguesClick(object sender, EventArgs e)
        {
            OpenFileDialog fd = new OpenFileDialog();

            fd.Filter = "All Files|*.*";
            if (fd.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            Wrapper Wrapper = new Wrapper();
            var     Content = Wrapper.Import(fd.FileName, TryLastPluginFirst: true);

            for (uint i = 0; i < Content.LongLength; i++)
            {
                if (i % (Content.LongLength > 5000 ? 55 : 15) == 0)
                {
                    lblState.Text = string.Format("Initializing... ({0}/{1} Lines)", i, Content.LongLength);
                    Application.DoEvents();
                }
                foreach (IOptimizator Optimizator in EnabledOptimizators)
                {
                    try {
                        Optimizator.AfterOpen(ref Content[i], i);
                    } catch { }
                }
            }

            for (uint i = 0; i < Content.LongLength; i++)
            {
                if (i % (Content.LongLength > 5000 ? 55 : 15) == 0)
                {
                    lblState.Text = string.Format("Finishing... ({0}/{1} Lines)", i, Content.LongLength);
                    Application.DoEvents();
                }
                foreach (IOptimizator Optimizator in EnabledOptimizators)
                {
                    try {
                        Optimizator.BeforeTranslate(ref Content[i], i);
                    } catch { }
                }
            }

            ShowStrings(Content, NewFile: true);
            lblState.Text = "IDLE";
        }