public MainWindow()
        {
            InitializeComponent();

            var compressedFileFormats = new string[] { ".7z", ".rar", ".zip" };

            _ManagerInstance = Core.Manager.CreateInstance(new DependencyManager(), compressedFileFormats);
            var fullList = Manager.supportedImageFormats.Concat(compressedFileFormats).Select(x => $"*{x}").ToArray();

            fileFilterList = $"Dreamcast Game ({string.Join("; ", fullList)})|{string.Join(';', fullList)}";

            this.Loaded += (ss, ee) =>
            {
                HaveGDIShrinkBlacklist = File.Exists(Constants.GdiShrinkBlacklistFile);
                FillDriveList();
            };
            this.Closing         += MainWindow_Closing;
            this.PropertyChanged += MainWindow_PropertyChanged;
            Manager.ItemList.CollectionChanged += ItemList_CollectionChanged;

            SevenZip.SevenZipExtractor.SetLibraryPath(Environment.Is64BitProcess ? "7z64.dll" : "7z.dll");

            bool.TryParse(ConfigurationManager.AppSettings["ShowAllDrives"], out showAllDrives);
            if (bool.TryParse(ConfigurationManager.AppSettings["UseBinaryString"], out bool useBinaryString))
            {
                Converter.ByteSizeToStringConverter.UseBinaryString = useBinaryString;
            }

            TempFolder = Path.GetTempPath();
            Title      = "GD MENU Card Manager " + Constants.Version;

            //showAllDrives = true;

            DataContext = this;
        }
Exemple #2
0
        public MainWindow()
        {
            InitializeComponent();
#if DEBUG
            //this.AttachDevTools();
            //this.OpenDevTools();
#endif

            var compressedFileFormats = new string[] { ".7z", ".rar", ".zip" };
            _ManagerInstance = GDMENUCardManager.Core.Manager.CreateInstance(new DependencyManager(), compressedFileFormats);
            var fullList = Manager.supportedImageFormats.Concat(compressedFileFormats).ToArray();
            fileFilterList = new List <FileDialogFilter>
            {
                new FileDialogFilter
                {
                    Name       = $"Dreamcast Game ({string.Join("; ", fullList.Select(x => $"*{x}"))})",
                    Extensions = fullList.Select(x => x.Substring(1)).ToList()
                }
            };

            this.Opened += (ss, ee) => { FillDriveList(); };

            this.Closing         += MainWindow_Closing;
            this.PropertyChanged += MainWindow_PropertyChanged;
            Manager.ItemList.CollectionChanged += ItemList_CollectionChanged;

            //config parsing. all settings are optional and must reverse to default values if missing
            bool.TryParse(ConfigurationManager.AppSettings["ShowAllDrives"], out showAllDrives);
            if (bool.TryParse(ConfigurationManager.AppSettings["UseBinaryString"], out bool useBinaryString))
            {
                Converter.ByteSizeToStringConverter.UseBinaryString = useBinaryString;
            }
            if (int.TryParse(ConfigurationManager.AppSettings["CharLimit"], out int charLimit))
            {
                GdItem.namemaxlen = Math.Min(255, Math.Max(charLimit, 1));
            }

            TempFolder = Path.GetTempPath();
            Title      = "GD MENU Card Manager " + Constants.Version;

            //showAllDrives = true;

            DataContext = this;
        }
        public MainWindow()
        {
            InitializeComponent();
#if DEBUG
            //this.AttachDevTools();
            //this.OpenDevTools();
#endif

            var compressedFileFormats = new string[] { ".zip" };
            _ManagerInstance = GDMENUCardManager.Core.Manager.CreateInstance(new DependencyManager(), compressedFileFormats);
            var fullList = Manager.supportedImageFormats.Concat(compressedFileFormats).ToArray();
            fileFilterList = new List <FileDialogFilter>
            {
                new FileDialogFilter
                {
                    Name       = $"Dreamcast Game ({string.Join("; ", fullList.Select(x => $"*{x}"))})",
                    Extensions = fullList.Select(x => x.Substring(1)).ToList()
                }
            };

            this.Opened += (ss, ee) => { FillDriveList(); };

            this.Closing         += MainWindow_Closing;
            this.PropertyChanged += MainWindow_PropertyChanged;
            Manager.ItemList.CollectionChanged += ItemList_CollectionChanged;

            //todo implement
            //showAllDrives = ;
            //bool.TryParse(ConfigurationManager.AppSettings["ShowAllDrives"], out showAllDrives);
            //if (bool.TryParse(ConfigurationManager.AppSettings["UseBinaryString"], out bool useBinaryString))
            //    Converter.ByteSizeToStringConverter.UseBinaryString = useBinaryString;

            TempFolder = Path.GetTempPath();
            Title      = "GD MENU Card Manager " + Constants.Version;

            //showAllDrives = true;

            DataContext = this;
        }