コード例 #1
0
        private void l2ini_Click(object sender, EventArgs e)
        {
            StatusLabel.Text = Localizate.getMessage(Word.PLEASE_WAIT);
            var form = new FastL2INIOptionForm();

            form.ShowDialog();
        }
コード例 #2
0
        private static void Main()
        {
            LogService.init();
            RConfig.Instance.load();
            Localizate.load();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            SplashForm.Instance.Show();

            //Thread.Sleep(2000);

            _log.Info("Program started");

            MessageBox.parentForm = MainForm.Instance;

            SplashForm.Instance.Close();
            try
            {
                Application.Run(MainForm.Instance);
                _log.Info("Quit program");
            }
            catch (Exception e)
            {
                _log.Info("Exception: Program.Main(): " + e, e);
            }
        }
コード例 #3
0
        public EditForm(String title, DatParser d)
        {
            InitializeComponent();
            _parser = d;

            _listView.BackColor             = ConvertUtilities.HtmlColorToColor(RConfig.Instance.EditorBackColor);
            _listView.ColumnWidthChanged   += _listView_ColumnWidthChanged;
            _listView.RetrieveVirtualItem  += _listView_RetrieveVirtualItem;
            _listView.ItemSelectionChanged += _listView_ItemSelectionChanged;
            _listView.ColumnClick          += _listView_ColumnClick;

            _propertyGid.PropertyValueChanged += _propertyGid_PropertyValueChanged;
            searchColumn.SelectedIndexChanged += _searchColumn_SelectedIndexChanged;
            searchText.KeyUp += _seatchText_KeyUp;
            KeyUp            += EditForm_KeyUp;

            Text = Localizate.getMessage(Word.EDITOR) + ": " + title;

            Definition info = d.getDefinition();

            PropertyInfo[] parray = info.GetType().GetProperties();

            foreach (PropertyInfo property in parray)
            {
                if (property.CanWrite)
                {
                    addHeader(property.Name);

                    searchColumn.Items.Add(property.Name);
                }
            }
        }
コード例 #4
0
        protected void updateLastFolders()
        {
            lastFoldersToolStripMenuItem.DropDownItems.Clear();
            if (RConfig.Instance.LastFolders.Count == 0)
            {
                ToolStripMenuItem empty = new ToolStripMenuItem(Localizate.getMessage(Word.EMPTY));
                empty.Enabled = false;
                lastFoldersToolStripMenuItem.DropDownItems.Add(empty);
                return;
            }

            foreach (String s in RConfig.Instance.LastFolders)
            {
                ToolStripMenuItem itemOpen = new ToolStripMenuItem(s);
                itemOpen.Click += new EventHandler(itemOpen_Click);

                lastFoldersToolStripMenuItem.DropDownItems.Add(itemOpen);
            }

            lastFoldersToolStripMenuItem.DropDownItems.Add(new ToolStripSeparator());

            ToolStripMenuItem item = new ToolStripMenuItem(Localizate.getMessage(Word.CLEAR_BUTTON));

            item.Click += new EventHandler(clearClick);

            lastFoldersToolStripMenuItem.DropDownItems.Add(item);
        }
コード例 #5
0
        public AboutForm(bool splash)
        {
            _splash = splash;
            //pictureBox2.Image = Resources.logo;
            InitializeComponent();
            pictureBox2.Image = Resources.Fire;
            // Титул
            Text = String.Format(Localizate.getMessage(Word.HIDE_MENU_ABOUT), "Path Editor");
            // Имя продукта
            labelProductName.Text = AssemblyProduct;
            // Версия продукта
            labelVersion.Text = AssemblyVersion;
            // компания
            labelCompanyName.Text = AssemblyCompany;
            // информация
            // this.textBoxDescription.BackColor = Color.Black;
            textBoxDescription.Text = Localizate.getMessage(Word.DESCRIPTION);

            //локализация
            Pname.Text   = Localizate.getMessage(Word.PRODUCT_NAME);
            Version.Text = Localizate.getMessage(Word.VERSION);
            Company.Text = Localizate.getMessage(Word.COMPANY);
            Author.Text  = Localizate.getMessage(Word.AUTHOR);
            Info.Text    = Localizate.getMessage(Word.INFO);
        }
コード例 #6
0
ファイル: MSG.cs プロジェクト: nikolajjakubets/path-editor
 public MSG(String title, String msg)
 {
     InitializeComponent();
     Name           = title;
     TextError.Text = msg;
     Text           = title;
     CloseBtn.Text  = Localizate.getMessage(Word.MENU_FILE_QUIT);
 }
コード例 #7
0
        private void OkBtn_Click(object sender, EventArgs e)
        {
            RConfig.Instance.save();

            Localizate.load();

            Close();
        }
コード例 #8
0
        private void SaveBtn_Click(object sender, EventArgs e)
        {
            try
            {
                StatusLabel.Text      = Localizate.getMessage(Word.PLEASE_WAIT);
                FileNameCombo.Enabled = false;
                Enabled = false;

                if (DatDatas.Count == 0)
                {
                    StatusLabel.Text = Localizate.getMessage(Word.ERROR) +
                                       Localizate.getMessage(Word.SYSTEM_FOLDER_IS_EMPTY);
                    return;
                }
                string fname = Path.Combine(RConfig.Instance.LineageDirectory, selectedComboName);
                if (RConfig.Instance.SaveBakFiles)
                {
                    try
                    {
                        if (File.Exists(Path.ChangeExtension(fname, ".bak")))
                        {
                            File.Delete(Path.ChangeExtension(fname, ".bak"));
                        }

                        File.Move(fname, Path.ChangeExtension(fname, ".bak"));
                    }
                    catch (Exception)
                    {
                    }
                }
                var f = new BinaryWriter(File.OpenWrite(fname), Encoding.Default);
                if (f == null)
                {
                    return;
                }

                DatInfo.Compile(f, DatDatas);
                f.Close();

                L2EncDec.Encrypt(selectedComboName, 413);
            }
            catch (Exception ex)
            {
                _log.Info("Exception: " + ex, ex);
            }
            finally
            {
                Enabled = true;
                FileNameCombo.Enabled = true;

                onEnd();
            }
            StatusLabel.Text = Localizate.getMessage(Word.COMPLETE) +
                               String.Format(Localizate.getMessage(Word.SAVED_DATA), DatDatas.Count);
        }
コード例 #9
0
        private void LoadBtn_Click(object sender, EventArgs e)
        {
            try
            {
                StatusLabel.Text      = Localizate.getMessage(Word.PLEASE_WAIT);
                FileNameCombo.Enabled = false;
                Enabled = false;

                DatInfo_init();
                if (DatInfo == null)
                {
                    return;
                }

                if (!File.Exists(Path.Combine(RConfig.Instance.LineageDirectory, selectedComboName)))
                {
                    StatusLabel.Text = Localizate.getMessage(Word.ERROR) + " " +
                                       Localizate.getMessage(Word.FILE_NOT_FOUND);
                    return;
                }

                BinaryReader f = L2EncDec.Decrypt(selectedComboName, Encoding.Default);
                if (f == null)
                {
                    return;
                }

                DatDatas = DatInfo.Parse(f);

                f.Close();

                importBtn2.Enabled   = true;
                exportBtn2.Enabled   = true;
                SaveBtn2.Enabled     = true;
                editorBtn.Enabled    = true;
                _mergeButton.Enabled = true;
            }
            catch (Exception ex)
            {
                _log.Info("Exception" + ex, ex);
            }
            finally
            {
                Enabled = true;
                FileNameCombo.Enabled = true;

                onEnd();

                Forms_Update();
            }
            StatusLabel.Text = Localizate.getMessage(Word.COMPLETE) +
                               String.Format(Localizate.getMessage(Word.LOADED_DATA), DatDatas.Count);
        }
コード例 #10
0
        private void saveButton_Click(object sender, EventArgs e)
        {
            MainForm.Instance.DatDatas.Clear();

            foreach (ListViewItem item in _items)
            {
                MainForm.Instance.DatDatas.Add(item.Tag as Definition);
            }

            MainForm.Instance.StatusLabel.Text = Localizate.getMessage(Word.COMPLETE) +
                                                 String.Format(Localizate.getMessage(Word.IMPORTED_DATA),
                                                               MainForm.Instance.DatDatas.Count);
        }
コード例 #11
0
        private void OpenIniButton_Click(object sender, EventArgs e)
        {
            if (selectedIniComboName == null || selectedIniIntFile == null)
            {
                return;
            }

            Lineage2Ver ver = (Lineage2Ver)selectedIniIntFile.GetType().GetField(selectedIniIntFile.ToString()).GetCustomAttributes(typeof(Lineage2Ver), true)[0];

            // пожалуста подождите
            StatusLabel.Text = Localizate.getMessage(Word.PLEASE_WAIT);

            if (!File.Exists(Path.Combine(RConfig.Instance.LineageDirectory, selectedIniComboName)))
            {
                StatusLabel.Text = Localizate.getMessage(Word.ERROR) + " " + Localizate.getMessage(Word.FILE_NOT_FOUND);
                return;
            }

            try
            {
                BinaryReader f = L2EncDec.Decrypt(selectedIniComboName, Encoding.Default);
                if (f == null)
                {
                    return;
                }
                char[] IniText = f.ReadChars((int)f.BaseStream.Length);
                f.Close();
                IniTextBox.Text = new String(IniText);
            }
            catch (Exception ex)
            {
                _log.Info("Exception: " + ex, ex);
            }
            finally
            {
                Enabled = true;
                FileNameCombo.Enabled = true;
                savel2ini.Enabled     = true;
                clearl2ini.Enabled    = true;
                IniTextBox.Enabled    = true;
                EnCod.Text            = ver.Ver.ToString();
                Char     c  = '\n';
                String[] st = IniTextBox.Text.Split(c);
                Counts.Text = st.Length.ToString();
                IniTextBox.Update();
            }
            StatusLabel.Text = "";
        }
コード例 #12
0
        public void Config_Load()
        {
            DirectoryDialog.Description = Localizate.getMessage(Word.PLEASE_SELECT_SYSTEM_FOLDER);

            // Check DatFile Directory
            if (!Directory.Exists(RConfig.Instance.LineageDirectory))
            {
                new MessageBox(Localizate.getMessage(Word.SYSTEM_FOLDER_IS_EMPTY), true);

                DirectoryDialog.RootFolder = Environment.SpecialFolder.MyComputer;
                if (DirectoryDialog.ShowDialog() == DialogResult.OK)
                {
                    RConfig.Instance.LineageDirectory = DirectoryDialog.SelectedPath;
                    RConfig.Instance.save();
                }
            }
        }
コード例 #13
0
        // кнопка для запуска л2.
        private void StartL2_Click(object sender, EventArgs e)
        {
            if (RConfig.Instance.MiniOnStart)
            {
                Hide();
                WindowState      = FormWindowState.Minimized;
                HideIcon.Visible = true;
            }

            if (!File.Exists(RConfig.Instance.LineageFileToRun))
            {
                var msg = new MSG(Localizate.getMessage(Word.ERROR), Localizate.getMessage(Word.FILE_NOT_FOUND));
                msg.ShowDialog();
                return;
            }

            Process.Start(RConfig.Instance.LineageFileToRun);
        }
コード例 #14
0
        public MessageBox(string message, string title, bool info)
        {
            InitializeComponent();


            if (title == TextError)
            {
                title = Localizate.getMessage(Word.ERROR);
            }
            else
            {
                title = Localizate.getMessage(Word.INFO);
            }

            Text      = String.Format(TitleFormat, title);
            text.Text = String.Format(MessageFormat, message);

            if (info)
            {
                picture.Image = Resources.Information;
            }

            if (parentForm != null)
            {
                if (parentForm.InvokeRequired)
                {
                    ShowDialogDelegate d = ShowDialog;
                    parentForm.Invoke(d, parentForm);
                }
                else
                {
                    ShowDialog(parentForm);
                }
            }
            else
            {
                ShowDialog();
            }
        }
コード例 #15
0
        private void pathSystem_Click_1(object sender, EventArgs e)
        {
            try
            {
                StatusLabel.Text      = Localizate.getMessage(Word.PLEASE_WAIT);
                FileNameCombo.Enabled = false;
                Enabled = false;

                L2EncDec.SystemPatcher();
            }
            catch (Exception ex)
            {
                _log.Info("Exception: " + ex, ex);
            }
            finally
            {
                Enabled = true;
                FileNameCombo.Enabled  = true;
                StatusProgress.Visible = false;
            }
            StatusLabel.Text = Localizate.getMessage(Word.COMPLETE) +
                               Localizate.getMessage(Word.COMPLETE_PATH_SYSTEM_FOLDER);
        }
コード例 #16
0
 private void OptionForm_Load(object sender, EventArgs e)
 {
     Text = Localizate.getMessage(Word.MENU_SERVICE_SETTINGS);
 }
コード例 #17
0
        private void ExpBtn_Click(object sender, EventArgs e)
        {
            String FName = "";
            long   RecNo = 1;

            try
            {
                StatusLabel.Text      = Localizate.getMessage(Word.PLEASE_WAIT);
                FileNameCombo.Enabled = false;
                Enabled = false;

                if (DatDatas.Count == 0)
                {
                    StatusLabel.Text = Localizate.getMessage(Word.ERROR) +
                                       Localizate.getMessage(Word.SYSTEM_FOLDER_IS_EMPTY);
                    return;
                }

                ExportDialog.InitialDirectory = Application.StartupPath;
                ExportDialog.FileName         = selectedComboName.Substring(0, selectedComboName.LastIndexOf("."));

                ExportDialog.Filter      = "Tab-SeparatedValues files (*.tsv)|*.tsv";
                ExportDialog.FilterIndex = 1;

                ExportDialog.RestoreDirectory = true;

                if (ExportDialog.ShowDialog() == DialogResult.OK)
                {
                    Encoding enc = Encoding.GetEncoding(RConfig.Instance.TextEncoding);
                    var      sr  = new StreamWriter(ExportDialog.FileName, false, enc);

                    // Write Headers
                    sr.Write("# ");
                    for (int i = 0; i < DatInfo.getFieldNames().Count; i++)
                    {
                        Definition info = DatDatas[0];
                        FName = DatInfo.getFieldNames()[i];
                        FieldInfo FType = DatInfo.getDefinition().GetType().GetField(FName);

                        if (FType == null)
                        {
                            continue;
                        }

                        Object obj = FType.GetValue(info);
                        if (obj == null)
                        {
                            continue;
                        }

                        if (obj is IType)
                        {
                            var type = (IType)obj;

                            type.writeHeader(FName, sr);
                        }
                        else
                        {
                            throw new NotImplementedException("Type " + obj.GetType().Name + " is not implement IType");
                        }
                    }
                    sr.Write("\r\n");

                    onStart(DatDatas.Count);

                    // Write Datas
                    for (int i = 0; i < DatDatas.Count; i++)
                    {
                        Definition info = DatDatas[i];
                        for (int j = 0; j < DatInfo.getFieldNames().Count; j++)
                        {
                            FName = DatInfo.getFieldNames()[j];
                            FieldInfo FType = DatInfo.getDefinition().GetType().GetField(FName);
                            if (FType == null)
                            {
                                continue;
                            }
                            String TmpStr = "";

                            if (FType.GetValue(info) != null)
                            {
                                Object obj = FType.GetValue(info);

                                if (obj is IType)
                                {
                                    var type = (IType)obj;
                                    TmpStr = type.ToString();
                                }
                                else
                                {
                                    throw new NotImplementedException("Type " + obj.GetType().Name +
                                                                      " is not implement IType");
                                }

                                sr.Write(TmpStr);

                                if (j < DatInfo.getFieldNames().Count - 1)
                                {
                                    sr.Write('\t');
                                }
                            }
                        }

                        sr.Write("\r\n");

                        setValue(i);

                        RecNo++;
                    }
                    sr.Close();
                }
                else
                {
                    return;
                }
            }
            catch (Exception ex)
            {
                _log.Info("Exception: " + ex, ex);
            }
            finally
            {
                Enabled = true;
                FileNameCombo.Enabled = true;

                onEnd();
            }

            StatusLabel.Text = Localizate.getMessage(Word.COMPLETE) +
                               String.Format(Localizate.getMessage(Word.EXPORTED_DATA), DatDatas.Count);
        }
コード例 #18
0
        private void ImpBtn_Click(object sender, EventArgs e)
        {
            String FName  = "";
            String FValue = "";
            long   RecNo  = 1;

            try
            {
                StatusLabel.Text      = Localizate.getMessage(Word.PLEASE_WAIT);
                FileNameCombo.Enabled = false;
                Enabled = false;

                ImportDialog.InitialDirectory = RConfig.Instance.LineageDirectory;
                ImportDialog.FileName         = selectedComboName.Substring(0, selectedComboName.LastIndexOf("."));
                ImportDialog.Filter           = "Tab-SeparatedValues files (*.tsv)|*.tsv";
                ImportDialog.FilterIndex      = 1;
                ImportDialog.RestoreDirectory = true;

                if (ImportDialog.ShowDialog() == DialogResult.OK)
                {
                    DatInfo_init();
                    string       line = "";
                    Encoding     enc  = Encoding.GetEncoding(RConfig.Instance.TextEncoding);
                    StreamReader sr   = new StreamReader(ImportDialog.FileName, enc);

                    onStart((int)sr.BaseStream.Length);

                    while ((line = sr.ReadLine()) != null)
                    {
                        if (line.StartsWith("#"))
                        {
                            continue;
                        }

                        String[] TmpStr = line.Split(new[] { '\t' });

                        for (int i = 0; i < TmpStr.Length; i++)
                        {
                            TmpStr[i] = TmpStr[i].Trim(new[] { '"' });
                        }

                        Definition item = DatInfo.getDefinition();

                        for (int i = 0, j = 0; i < DatInfo.getFieldNames().Count; i++, j++)
                        {
                            FName  = DatInfo.getFieldNames()[i];
                            FValue = TmpStr[j];
                            FieldInfo FType = DatInfo.getDefinition().GetType().GetField(FName);

                            if (FType == null)
                            {
                                continue;
                            }

                            Type   type = FType.FieldType;
                            Object obj  = type.InvokeMember(null, BindingFlags.CreateInstance, null, null, null);

                            if (obj is IType)
                            {
                                var format = (IType)obj;

                                format.parse(TmpStr[j], TmpStr, j, out j);

                                FType.SetValue(item, format);
                            }
                            else
                            {
                                throw new NotImplementedException("Type " + obj.GetType().Name +
                                                                  " is not implement IType");
                            }
                        }

                        DatDatas.Add(item);
                        setValue((int)sr.BaseStream.Length);
                        RecNo++;
                    }
                    sr.Close();

                    SaveBtn2.Enabled   = true;
                    exportBtn2.Enabled = true;
                }
                else
                {
                    return;
                }
            }
            catch (Exception ex)
            {
                _log.Info("Exception: " + ex, ex);
            }
            finally
            {
                Enabled = true;
                FileNameCombo.Enabled = true;

                onEnd();

                Forms_Update();
            }
            StatusLabel.Text = Localizate.getMessage(Word.COMPLETE) +
                               String.Format(Localizate.getMessage(Word.IMPORTED_DATA), DatDatas.Count);
        }
コード例 #19
0
        private void FastL2INIOptionForm_Load(object sender, EventArgs e)
        {
            Localizate.load();
            try
            {
                BinaryReader f = L2EncDec.Decrypt("l2.ini", Encoding.Default);
                if (f == null)
                {
                    return;
                }
                char[] IniText = f.ReadChars((int)f.BaseStream.Length);
                f.Close();
                L2Edit.Text = new String(IniText);


                for (int i = 0; i < L2Edit.Lines.Length; i++)
                {
                    if (L2Edit.Lines[i].StartsWith("ServerAddr="))
                    {
                        String   s  = L2Edit.Lines[i];
                        char     p  = '=';
                        String[] ss = s.Split(p);
                        HostText.Text = ss[1];
                    }
                    if (L2Edit.Lines[i].StartsWith("Port="))
                    {
                        String   s  = L2Edit.Lines[i];
                        char     p  = '=';
                        String[] ss = s.Split(p);
                        PortText.Text = ss[1];
                    }
                    if (L2Edit.Lines[i].StartsWith("IsL2NetLog="))
                    {
                        String   s  = L2Edit.Lines[i];
                        char     p  = '=';
                        String[] ss = s.Split(p);
                        NetLog.Checked = Boolean.Parse(ss[1]);
                    }
                    if (L2Edit.Lines[i].StartsWith("L2TestServer="))
                    {
                        String   s  = L2Edit.Lines[i];
                        char     p  = '=';
                        String[] ss = s.Split(p);
                        TestServer.Checked = Boolean.Parse(ss[1]);
                    }
                    if (L2Edit.Lines[i].StartsWith("EnableSecondWindow="))
                    {
                        String   s  = L2Edit.Lines[i];
                        char     p  = '=';
                        String[] ss = s.Split(p);
                        SeccondWind.Checked = Boolean.Parse(ss[1]);
                    }
                }

                // локализация
                Text             = Localizate.getMessage(Word.MENU_SERVICE_FAST_SETTINGS) + " : " + "l2.ini";
                InetGrop.Text    = Localizate.getMessage(Word.INTERNET_GROUP);
                OtherGroup.Text  = Localizate.getMessage(Word.OTHER_GROUP);
                SeccondWind.Text = Localizate.getMessage(Word.SECOND_CLIENT);
                TestServer.Text  = Localizate.getMessage(Word.TEST_SERVER);
                NetLog.Text      = Localizate.getMessage(Word.NETWORK_LOG);
                Host.Text        = Localizate.getMessage(Word.HOST);
                Port.Text        = Localizate.getMessage(Word.PORT);
                REfBtn.Text      = Localizate.getMessage(Word.REFRESH);
                SaveBtn.Text     = Localizate.getMessage(Word.SAVE_BUTTON);
            }
            catch (Exception ex)
            {
                _log.Info("Exception: " + ex, ex);
            }
        }
コード例 #20
0
        private void Forms_Update()
        {
            // Localizate.load();
            path.Text = RConfig.Instance.LineageDirectory;


            if (!Directory.Exists(RConfig.Instance.LineageDirectory))
            {
                startBtn2.Enabled     = false;
                OpenL2iniText.Enabled = false;
                savel2ini.Enabled     = false;
                clearl2ini.Enabled    = false;
            }
            else
            {
                startBtn2.Enabled = true;
            }

            // Локализация
            //  LoadBtn.Text = Message.getMessage("LOAD_BUTTON");
            //SaveBtn.Text = Message.getMessage("SAVE_BUTTON");

            //new
            LoadBtn2.HeaderText     = Localizate.getMessage(Word.LOAD_BUTTON);
            SaveBtn2.HeaderText     = Localizate.getMessage(Word.SAVE_BUTTON);
            importBtn2.HeaderText   = Localizate.getMessage(Word.IMPORT_BUTTON);
            exportBtn2.HeaderText   = Localizate.getMessage(Word.EXPORT_BUTTON);
            startBtn2.HeaderText    = Localizate.getMessage(Word.START_BUTTON);
            editorBtn.HeaderText    = Localizate.getMessage(Word.EDITOR);
            _mergeButton.HeaderText = Localizate.getMessage(Word.MERGE_BUTTON);

            //SaveBtn2.HeaderText = Message.getMessage("IMPORT_BUTTON");
            //ExpBtn.Text = Message.getMessage("EXPORT_BUTTON");
            startBtn2.HeaderText = Localizate.getMessage(Word.START_BUTTON);

            savel2ini.Text     = Localizate.getMessage(Word.SAVE_BUTTON);
            OpenL2iniText.Text = Localizate.getMessage(Word.OPEN_BUTTON);
            clearl2ini.Text    = Localizate.getMessage(Word.CLEAR_BUTTON);
            DatTab.Text        = Localizate.getMessage(Word.DAT_TAB);
            IniTab.Text        = Localizate.getMessage(Word.INI_TAB);
            MenuFile.Text      = Localizate.getMessage(Word.MENU_FILE);
            MenuService.Text   = Localizate.getMessage(Word.MENU_SERVICE);
            exit.Text          = Localizate.getMessage(Word.MENU_FILE_QUIT);
            pathSystem.Text    = Localizate.getMessage(Word.MENU_SERVICE_PATH_SYSTEM);
            OpenFolder.Text    = Localizate.getMessage(Word.MENU_FILE_OPEN_FOLDER);
            Settings.Text      = Localizate.getMessage(Word.MENU_SERVICE_SETTINGS);
            fastST.Text        = Localizate.getMessage(Word.MENU_SERVICE_FAST_SETTINGS);
            ChronicleInfo.Text = Localizate.getMessage(Word.CHRONICLE);
            ShowForm.Text      = Localizate.getMessage(Word.HIDE_MENU_SHOW);
            AbuotForm.Text     = String.Format(Localizate.getMessage(Word.HIDE_MENU_ABOUT), "Path Editor");
            ExitForm.Text      = Localizate.getMessage(Word.MENU_FILE_QUIT);
            CutR.Text          = Localizate.getMessage(Word.RIGHT_CLICK_CUT);
            CopyR.Text         = Localizate.getMessage(Word.RIGHT_CLICK_COPY);
            PasteR.Text        = Localizate.getMessage(Word.RIGHT_CLICK_PUT);
            SelectAll.Text     = Localizate.getMessage(Word.RIGHT_CLICK_SELECT_ALL);
            EncText.Text       = Localizate.getMessage(Word.TEXT_ENCODING);
            NumLines.Text      = Localizate.getMessage(Word.NUMBER_OF_LINES);
            //eulaPage.Text = Localizate.getMessage(Word.LICENSE);
            lockBtn.Text = Localizate.getMessage(Word.LOCK);
            lastFoldersToolStripMenuItem.Text = Localizate.getMessage(Word.LAST_FOLDERS);

            updateLastFolders();
        }
コード例 #21
0
        public void readSecond(String t)
        {
            MainForm.Instance.StatusLabel.Text = "";
            Encoding     enc = Encoding.GetEncoding(RConfig.Instance.TextEncoding);
            StreamReader sr  = new StreamReader(t, enc);


            MainForm.Instance.onStart((int)sr.BaseStream.Length);

            String line;

            while ((line = sr.ReadLine()) != null)
            {
                if (line.StartsWith("#"))
                {
                    continue;
                }

                String[] TmpStr = line.Split(new[] { '\t' });

                for (int i = 0; i < TmpStr.Length; i++)
                {
                    TmpStr[i] = TmpStr[i].Trim(new[] { '"' });
                }

                Definition item = MainForm.Instance.DatInfo.getDefinition();

                for (int i = 0, j = 0; i < MainForm.Instance.DatInfo.getFieldNames().Count; i++, j++)
                {
                    String    FName = MainForm.Instance.DatInfo.getFieldNames()[i];
                    FieldInfo FType = MainForm.Instance.DatInfo.getDefinition().GetType().GetField(FName);

                    if (FType == null)
                    {
                        continue;
                    }

                    Type   type = FType.FieldType;
                    Object obj  = type.InvokeMember(null, BindingFlags.CreateInstance, null, null, null);

                    if (obj is IType)
                    {
                        var format = (IType)obj;

                        format.parse(TmpStr[j], TmpStr, j, out j);

                        FType.SetValue(item, format);
                    }
                    else
                    {
                        throw new NotImplementedException("Type " + obj.GetType().Name +
                                                          " is not implement IType");
                    }
                }

                _secondList.Add(item);

                MainForm.Instance.setValue((int)sr.BaseStream.Length);
            }

            sr.Close();

            MainForm.Instance.onEnd();

            _statusLabel.Text = Localizate.getMessage(Word.COMPLETE) + String.Format(Localizate.getMessage(Word.IMPORTED_DATA), _secondList.Count);
        }