예제 #1
0
        public void importFolder(String folder, ReelDataType type = ReelDataType.SHFL)
        {
            // CYA buddy - when the add-ins load there is apparently no active window, so
            // catch that here.
            if (excelWin == null)
                excelWin = Globals.Program.Application.ActiveWindow;
            target = Globals.Program.Application.ActiveWorkbook;
            // get a list of all header files in the selected directory
            currentFolder = folder;
            // This is the starting row for the Game Info worksheet reel match summary.
            currentReelSet = 7;
            IComparer comp = new fileSorter();

            if ( type == ReelDataType.SHFL ) // Equinox/SLV reel definition header files
                fileList = Directory.GetFiles(currentFolder, "*.h");
            if ( type == ReelDataType.BALLY ) // Alpha II paytable.cfg file
                fileList = Directory.GetFiles(currentFolder, "paytable.cfg");

            Array.Sort(fileList, comp);
            if (fileList.Length == 0)
            {
                System.Windows.Forms.MessageBox.Show("There are no header files in the selected folder.", "No Header Files Found.", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                return;
            }

            if (type == ReelDataType.SHFL)
            {
                // run down the list and import each file into an Excel sheet
                for (int index = 0; index < fileList.Length; index++)
                {
                    String name = trimName(fileList.GetValue(index).ToString()) + " Match";
                    if (findSheet(name))
                    {
                        System.Windows.Forms.DialogResult result = System.Windows.Forms.MessageBox.Show("These headers have already been imported.  Would you like to import them again?", "Re-import headers?", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Information);
                        if (result == System.Windows.Forms.DialogResult.No)
                            return;
                    }

                    // copy the match sheet template to a new worksheet
                    copyMatchSheet(fileList.GetValue(index).ToString());
                    // copy the pay sheet template to a new worksheet
                    copyPaySheet(fileList.GetValue(index).ToString());
                    // stop screen updates - reduces run time by nearly a factor of 10
                    Globals.Program.Application.ScreenUpdating = false;

                    // import the data
                    Excel.Worksheet temp = importFile(fileList.GetValue(index).ToString(), (index + 1).ToString(), type);

                    // copy the reel data to the corresponding match and pay sheets
                    updateMatchLinks(temp, fileList.GetValue(index).ToString());
                    updatePayLinks(temp, fileList.GetValue(index).ToString());
                    // let the user see that we're working
                    Globals.Program.Application.ScreenUpdating = true;
                    currentReelSet++;
                }
            }
            if (type == ReelDataType.BALLY)
            {
                m_gamePays = new BallyGamePays();
                m_gameSet = new BallyReelGame();
                importBallyFile(fileList.GetValue(0).ToString(), "1");
            }
        }
예제 #2
0
        public void importFolder(String folder, ReelDataType type = ReelDataType.SHFL)
        {
            // CYA buddy - when the add-ins load there is apparently no active window, so
            // catch that here.
            if (excelWin == null)
            {
                excelWin = Globals.Program.Application.ActiveWindow;
            }
            target = Globals.Program.Application.ActiveWorkbook;
            // get a list of all header files in the selected directory
            currentFolder = folder;
            // This is the starting row for the Game Info worksheet reel match summary.
            currentReelSet = 7;
            IComparer comp = new fileSorter();

            if (type == ReelDataType.SHFL)   // Equinox/SLV reel definition header files
            {
                fileList = Directory.GetFiles(currentFolder, "*.h");
            }
            if (type == ReelDataType.BALLY)   // Alpha II paytable.cfg file
            {
                fileList = Directory.GetFiles(currentFolder, "paytable.cfg");
            }

            Array.Sort(fileList, comp);
            if (fileList.Length == 0)
            {
                System.Windows.Forms.MessageBox.Show("There are no header files in the selected folder.", "No Header Files Found.", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                return;
            }

            if (type == ReelDataType.SHFL)
            {
                // run down the list and import each file into an Excel sheet
                for (int index = 0; index < fileList.Length; index++)
                {
                    String name = trimName(fileList.GetValue(index).ToString()) + " Match";
                    if (findSheet(name))
                    {
                        System.Windows.Forms.DialogResult result = System.Windows.Forms.MessageBox.Show("These headers have already been imported.  Would you like to import them again?", "Re-import headers?", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Information);
                        if (result == System.Windows.Forms.DialogResult.No)
                        {
                            return;
                        }
                    }

                    // copy the match sheet template to a new worksheet
                    copyMatchSheet(fileList.GetValue(index).ToString());
                    // copy the pay sheet template to a new worksheet
                    copyPaySheet(fileList.GetValue(index).ToString());
                    // stop screen updates - reduces run time by nearly a factor of 10
                    Globals.Program.Application.ScreenUpdating = false;

                    // import the data
                    Excel.Worksheet temp = importFile(fileList.GetValue(index).ToString(), (index + 1).ToString(), type);

                    // copy the reel data to the corresponding match and pay sheets
                    updateMatchLinks(temp, fileList.GetValue(index).ToString());
                    updatePayLinks(temp, fileList.GetValue(index).ToString());
                    // let the user see that we're working
                    Globals.Program.Application.ScreenUpdating = true;
                    currentReelSet++;
                }
            }
            if (type == ReelDataType.BALLY)
            {
                m_gamePays = new BallyGamePays();
                m_gameSet  = new BallyReelGame();
                importBallyFile(fileList.GetValue(0).ToString(), "1");
            }
        }