コード例 #1
0
        private Excel.Worksheet importFile(String fileName, String index, ReelDataType type = ReelDataType.SHFL)
        {
            String prefix = "";

            if (type == ReelDataType.SHFL)
            {
                prefix = preParseFile(fileName);
                if (prefix != "")
                {
                    prefix += underscore;
                }
            }
            // clean up the file name to use as the worksheet name
            String[] trimmedName = fileName.Split(doubleBackSlash);
            int      end         = trimmedName.Length;
            String   sheetName   = trimmedName[end - 1];

            // create a new worksheet for our reel data
            newSheet = createSheet(trimName(sheetName));
            StreamReader inputFile = new StreamReader(fileName);

            // read reels from file
            if (type == ReelDataType.SHFL)
            {
                newSheet = readEquinoxHeader(prefix, inputFile, newSheet);
            }

            // get this baby out from under foot - move it to the end of the workbook
            moveSheetToEnd(newSheet);
            return(newSheet);
        }
コード例 #2
0
 private void folderSelectOK_Click(object sender, EventArgs e)
 {
     if (selectedFolder.Text != "")
     {
         ribbon.EnableImport(true);
         importFolder = selectedFolder.Text;
         String[] fileList = Directory.GetFiles(importFolder, "paytable.cfg");
         if (fileList.Length < 1)
             reelType = ReelDataType.SHFL ;
         else
             reelType = ReelDataType.BALLY;
         Globals.Program.currUserKey.SetValue("Folder", selectedFolder.Text);
     }
     else
         ribbon.EnableImport(false);
     this.Close();
 }
コード例 #3
0
 private void folderSelectOK_Click(object sender, EventArgs e)
 {
     if (selectedFolder.Text != "")
     {
         ribbon.EnableImport(true);
         importFolder = selectedFolder.Text;
         String[] fileList = Directory.GetFiles(importFolder, "paytable.cfg");
         if (fileList.Length < 1)
         {
             reelType = ReelDataType.SHFL;
         }
         else
         {
             reelType = ReelDataType.BALLY;
         }
         Globals.Program.currUserKey.SetValue("Folder", selectedFolder.Text);
     }
     else
     {
         ribbon.EnableImport(false);
     }
     this.Close();
 }
コード例 #4
0
 public FolderSelection()
 {
     InitializeComponent();
     importFolder = "";
     reelType     = 0;
 }
コード例 #5
0
 public FolderSelection()
 {
     InitializeComponent();
     importFolder = "";
     reelType = 0;
 }
コード例 #6
0
ファイル: HeaderImport.cs プロジェクト: RichardRanft/Importer
        private Excel.Worksheet importFile(String fileName, String index, ReelDataType type = ReelDataType.SHFL)
        {
            String prefix = "";
            if (type == ReelDataType.SHFL)
            {
                prefix = preParseFile(fileName);
                if (prefix != "")
                    prefix += underscore;
            }
            // clean up the file name to use as the worksheet name
            String[] trimmedName = fileName.Split(doubleBackSlash);
            int end = trimmedName.Length;
            String sheetName = trimmedName[end - 1];

            // create a new worksheet for our reel data
            newSheet = createSheet(trimName(sheetName));
            StreamReader inputFile = new StreamReader(fileName);

            // read reels from file
            if ( type == ReelDataType.SHFL )
                newSheet = readEquinoxHeader(prefix, inputFile, newSheet);

            // get this baby out from under foot - move it to the end of the workbook
            moveSheetToEnd(newSheet);
            return newSheet;
        }
コード例 #7
0
ファイル: HeaderImport.cs プロジェクト: RichardRanft/Importer
        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");
            }
        }
コード例 #8
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");
            }
        }