public void AddRange(EathenaConfigFileCollection FileCollection) { foreach (string Key in FileCollection.Keys) { mFiles.Add(Key.GetPathParts("conf"), FileCollection[Key]); } }
public static EathenaConfigFileCollection Load(string Name) { EathenaConfigFileCollection files = new EathenaConfigFileCollection(); EathenaConfigFile config = new EathenaConfigFile(); if (Directory.Exists(Name) == false) { if (ConfParser.ReadFile(Name, out config) == true) { files.Add(Name.GetPathParts("conf"), config); } return(files); } string[] Files = Directory.GetFiles(Name, "*.conf"); for (int i = 0; i < Files.Length; i++) { if (ConfParser.ReadFile(Files[i], out config) == true) { files.Add(Files[i].GetPathParts("conf"), config); } } string[] Dirs = Directory.GetDirectories(Name); for (int i = 0; i < Dirs.Length; i++) { files.AddRange(ConfParser.Load(Dirs[i])); } return(files); }
private void btnMenuImport_Click(object sender, EventArgs e) { string path = string.Empty; OpenFileDialog dlg = new OpenFileDialog(); dlg.Filter = "eACGUI XML Export (*.xml)|*.xml"; if (dlg.ShowDialog() != DialogResult.OK) { return; } mFiles = new EathenaConfigFileCollectionSerializeable().Import(dlg.FileName); if (mFiles == null) { Tools.Error("Fehler beim Importieren", "Das Importieren der Datei ist fehlgeschlagen!\nFalls dies öfter vorkommt, wende dich an GodLesZ!"); return; } FileTree.Nodes.Clear(); foreach (string key in mFiles.Keys) { FileTree.Nodes.Add(key); } Tools.Info("Import erfolgreich Abgeschlossen", "Der Config Import wurde erfolgreich abgeschlossen!\n\nAber beachte:\nWenn du nun speicherst werden deine Config Datein mit den soeben geladenen komplett ersetzt! (Backup vorhanden)"); }
public EathenaConfigFileCollectionSerializeable(EathenaConfigFileCollection col) { mFiles = new List <EathenaConfigFile>(); foreach (string key in col.Keys) { mFiles.Add(col[key]); } }
public EathenaConfigFileCollection ToNormal() { EathenaConfigFileCollection col = new EathenaConfigFileCollection(); for (int i = 0; i < mFiles.Count; i++) { col.Add(mFiles[i].Filename.GetPathParts("conf"), mFiles[i]); } return(col); }
public static EathenaConfigFileCollection Load( string Name ) { EathenaConfigFileCollection files = new EathenaConfigFileCollection(); EathenaConfigFile config = new EathenaConfigFile(); if( Directory.Exists( Name ) == false ) { if( ConfParser.ReadFile( Name, out config ) == true ) files.Add( Name.GetPathParts( "conf" ), config ); return files; } string[] Files = Directory.GetFiles( Name, "*.conf" ); for( int i = 0; i < Files.Length; i++ ) if( ConfParser.ReadFile( Files[ i ], out config ) == true ) files.Add( Files[ i ].GetPathParts( "conf" ), config ); string[] Dirs = Directory.GetDirectories( Name ); for( int i = 0; i < Dirs.Length; i++ ) files.AddRange( ConfParser.Load( Dirs[ i ] ) ); return files; }
private void btnConfImport_Click(object sender, EventArgs e) { string path = string.Empty; OpenFileDialog dlg = new OpenFileDialog(); dlg.Filter = "eACGUI XML Export (*.xml)|*.xml"; if (dlg.ShowDialog() != DialogResult.OK) { return; } mFilesExtern = new EathenaConfigFileCollectionSerializeable().Import(dlg.FileName); if (mFilesExtern == null) { Tools.Error("Fehler beim Importieren", "Das Importieren der Datei ist fehlgeschlagen!\nFalls dies öfter vorkommt, wende dich an GodLesZ!"); return; } DevComponents.Editors.ComboItem item; foreach (string key in mFilesMy.Keys) { if (comboFiles.Items.Contains(key) == false) { item = new DevComponents.Editors.ComboItem(); item.TextAlignment = StringAlignment.Far; item.Text = key; comboFiles.Items.Add(item); } } if (comboFiles.SelectedIndex != -1) { comboFiles_SelectedIndexChanged(null, EventArgs.Empty); // try to select in both Combo's the same File } Tools.Info("Import erfolgreich Abgeschlossen", "Der Config Import wurde erfolgreich abgeschlossen!\nDu kannst die importieren Datein nun in der rechten DropDown Box auswählen."); }
public frmMerge(EathenaConfigFileCollection Files) { mFilesMy = Files; InitializeComponent(); }
private bool LoadSettings() { string path = Properties.Settings.Default.ConfigDirectory; mBaseColorScheme = Properties.Settings.Default.GUITheme; chkSettingSaveOnExit.Checked = Properties.Settings.Default.SaveOnExit; chkSettingComments.Checked = Properties.Settings.Default.ShowComments; chkSettingBackup.Checked = Properties.Settings.Default.CreateBackup; do { // is <path> valid? if( path.IsNullOrEmpty() || System.IO.Directory.Exists( path ) == false ) { FolderBrowserDialog dlg = new FolderBrowserDialog(); dlg.Description = "Bitte wähle deinen eAthena Config Ordner aus!\nz.B.: C:/eAthena/conf/"; if( dlg.ShowDialog() != DialogResult.OK ) { path = string.Empty; // let the rest know what he did... break; } string[] pathParts = dlg.SelectedPath.Split( new char[] { '\\' } ); if( pathParts.Length == 0 || pathParts[ pathParts.Length - 1 ].ToLower() != "conf" ) { path = string.Empty; Tools.Error( "Fehler im Pfad", "Dein angegebener Pfad is ungültig!\nDu musst einen eAthena Config Ordner auswählen!\n\nz.B.: C:/eAthena/conf/" ); continue; } // he selected a Dir! path = dlg.SelectedPath; } // searching for Files in the dir if( path != string.Empty ) mFiles = ConfParser.Load( path ); if( mFiles != null && mFiles.Count > 0 ) // found some, break out! break; // nothing found, continue? if( MessageBoxEx.Show( "Es wurden keine Config Datein in dem Ordner gefunden!\nBitte wähle den richtigen Ordner aus!\n\nBeispiel: C:/eAthena/conf/\n\n\nMöchtest du es nochmal versuchen?", "Config Fehler", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error ) == DialogResult.Cancel ) break; // reset if we continue so the first check show us the Dialog again path = string.Empty; } while( true ); if( mFiles.Count == 0 ) // breaked out, no continue :/ return false; // all valid, save the dir if( path != Properties.Settings.Default.ConfigDirectory ) Properties.Settings.Default.ConfigDirectory = path; return true; }
private void btnMenuImport_Click( object sender, EventArgs e ) { string path = string.Empty; OpenFileDialog dlg = new OpenFileDialog(); dlg.Filter = "eACGUI XML Export (*.xml)|*.xml"; if( dlg.ShowDialog() != DialogResult.OK ) return; mFiles = new EathenaConfigFileCollectionSerializeable().Import( dlg.FileName ); if( mFiles == null ) { Tools.Error( "Fehler beim Importieren", "Das Importieren der Datei ist fehlgeschlagen!\nFalls dies öfter vorkommt, wende dich an GodLesZ!" ); return; } FileTree.Nodes.Clear(); foreach( string key in mFiles.Keys ) FileTree.Nodes.Add( key ); Tools.Info( "Import erfolgreich Abgeschlossen", "Der Config Import wurde erfolgreich abgeschlossen!\n\nAber beachte:\nWenn du nun speicherst werden deine Config Datein mit den soeben geladenen komplett ersetzt! (Backup vorhanden)" ); }
private bool LoadSettings() { string path = Properties.Settings.Default.ConfigDirectory; mBaseColorScheme = Properties.Settings.Default.GUITheme; chkSettingSaveOnExit.Checked = Properties.Settings.Default.SaveOnExit; chkSettingComments.Checked = Properties.Settings.Default.ShowComments; chkSettingBackup.Checked = Properties.Settings.Default.CreateBackup; do { // is <path> valid? if (path.IsNullOrEmpty() || System.IO.Directory.Exists(path) == false) { FolderBrowserDialog dlg = new FolderBrowserDialog(); dlg.Description = "Bitte wähle deinen eAthena Config Ordner aus!\nz.B.: C:/eAthena/conf/"; if (dlg.ShowDialog() != DialogResult.OK) { path = string.Empty; // let the rest know what he did... break; } string[] pathParts = dlg.SelectedPath.Split(new char[] { '\\' }); if (pathParts.Length == 0 || pathParts[pathParts.Length - 1].ToLower() != "conf") { path = string.Empty; Tools.Error("Fehler im Pfad", "Dein angegebener Pfad is ungültig!\nDu musst einen eAthena Config Ordner auswählen!\n\nz.B.: C:/eAthena/conf/"); continue; } // he selected a Dir! path = dlg.SelectedPath; } // searching for Files in the dir if (path != string.Empty) { mFiles = ConfParser.Load(path); } if (mFiles != null && mFiles.Count > 0) // found some, break out! { break; } // nothing found, continue? if (MessageBoxEx.Show("Es wurden keine Config Datein in dem Ordner gefunden!\nBitte wähle den richtigen Ordner aus!\n\nBeispiel: C:/eAthena/conf/\n\n\nMöchtest du es nochmal versuchen?", "Config Fehler", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error) == DialogResult.Cancel) { break; } // reset if we continue so the first check show us the Dialog again path = string.Empty; } while(true); if (mFiles.Count == 0) // breaked out, no continue :/ { return(false); } // all valid, save the dir if (path != Properties.Settings.Default.ConfigDirectory) { Properties.Settings.Default.ConfigDirectory = path; } return(true); }
public void AddRange( EathenaConfigFileCollection FileCollection ) { foreach( string Key in FileCollection.Keys ) mFiles.Add( Key.GetPathParts( "conf" ), FileCollection[ Key ] ); }
public EathenaConfigFileCollection ToNormal() { EathenaConfigFileCollection col = new EathenaConfigFileCollection(); for( int i = 0; i < mFiles.Count; i++ ) col.Add( mFiles[ i ].Filename.GetPathParts( "conf" ), mFiles[ i ] ); return col; }
public EathenaConfigFileCollectionSerializeable( EathenaConfigFileCollection col ) { mFiles = new List<EathenaConfigFile>(); foreach( string key in col.Keys ) mFiles.Add( col[ key ] ); }
private void btnConfImport_Click( object sender, EventArgs e ) { string path = string.Empty; OpenFileDialog dlg = new OpenFileDialog(); dlg.Filter = "eACGUI XML Export (*.xml)|*.xml"; if( dlg.ShowDialog() != DialogResult.OK ) return; mFilesExtern = new EathenaConfigFileCollectionSerializeable().Import( dlg.FileName ); if( mFilesExtern == null ) { Tools.Error( "Fehler beim Importieren", "Das Importieren der Datei ist fehlgeschlagen!\nFalls dies öfter vorkommt, wende dich an GodLesZ!" ); return; } DevComponents.Editors.ComboItem item; foreach( string key in mFilesMy.Keys ) if( comboFiles.Items.Contains( key ) == false ) { item = new DevComponents.Editors.ComboItem(); item.TextAlignment = StringAlignment.Far; item.Text = key; comboFiles.Items.Add( item ); } if( comboFiles.SelectedIndex != -1 ) comboFiles_SelectedIndexChanged( null, EventArgs.Empty ); // try to select in both Combo's the same File Tools.Info( "Import erfolgreich Abgeschlossen", "Der Config Import wurde erfolgreich abgeschlossen!\nDu kannst die importieren Datein nun in der rechten DropDown Box auswählen." ); }
public frmMerge( EathenaConfigFileCollection Files ) { mFilesMy = Files; InitializeComponent(); }