/* XChat Theme Manager * * Copyright (C) 2012 Patrick Griffs * Copyright (C) 2012 Berke Viktor * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ using System; using System.Collections.Generic; using System.Collections; using System.ComponentModel; using System.Data; using System.Drawing; using System.IO; /* using System.IO.Compression; */ using System.IO.Packaging; using System.Linq; using System.Text; using System.Windows.Forms; using System.Net; namespace thememan { public partial class XTM : Form { public string appdata = (Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\X-Chat 2\\"); public string home = (Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "/.xchat2/"); public string xchatdir; public string themedir = "themes\\"; OpenFileDialog importDialog; public XTM () { InitializeComponent (); if (File.Exists ("portable-mode")) xchatdir = ("config\\"); else if (Directory.Exists (appdata)) xchatdir = (appdata); else if (Directory.Exists (home)) { xchatdir = (home); themedir = "themes/"; } else Console.WriteLine("Install not found"); ListThemes(); } private void ListThemes() { themelist.Items.Clear(); if (Directory.Exists(xchatdir + themedir)) { foreach (string theme in Directory.GetDirectories(xchatdir + themedir)) { themelist.Items.Add(theme.Remove(0, xchatdir.Length + themedir.Length)); } } else { Directory.CreateDirectory(xchatdir + themedir); } if (themelist.Items.Count == 0) { applybutton.Enabled = false; } else { themelist.SetSelected(0, true); } } private void ShowColors(List> themecolors) { List labels = this.Controls.OfType