Our members are dedicated to PASSION and PURPOSE without drama!

BetSoftware Loader - 2014-05-05

Started by VLS, May 05, 2014, 06:02:29 AM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

VLS

[attachmini=1]

Relevant sources below.

Email/Paypal: betselectiongmail.com
-- Victor

VLS

Code (csharp) Select
//
//  MainForm.cs
//
//  Author:
//       Victor L. Senior <betselection﹫gmail.com>
//
//  Website:
//       http://betselection.cc
//
//  Copyright (c) 2014 Victor L. Senior
//
//  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 3 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, see <http://www.gnu.org/licenses/>.

using System;
using System.Drawing;
using System.Windows.Forms;
using System.Reflection;
using System.Diagnostics;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.IO;
using System.Xml;
using System.Xml.XPath;
using System.Threading;
using System.Globalization;
using System.Windows.Forms.VisualStyles;

namespace BetSoftware_Loader
{
   /// <summary>
   /// Main form.
   /// </summary>
   public class MainForm : Form
   {
      // Directory tags for each module
      private Dictionary<string, Dictionary<string, string>> tags = new Dictionary<string, Dictionary<string, string>>();
      // Application directory
      private string appDir = Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar;
      // Form declarations
      private ToolStripStatusLabel tsslStatus;
      private StatusStrip ss;
      private Button bAddOut;
      private ListBox lbOutput;
      private Button bReloadOutput;
      private TabPage tpOutput;
      private Button bAddDisplay;
      private ListBox lbDisplay;
      private Button bReloadDisplay;
      private TabPage tpDisplay;
      private Button bAddMM;
      private ListBox lbMM;
      private Button bReloadMM;
      private TabPage tpMM;
      private Button bAddBS;
      private ListBox lbBS;
      private Button bReloadBS;
      private TabPage tpBS;
      private Button bReloadInput;
      private Button bAddInput;
      private ListBox lbInput;
      private TabPage tpInput;
      private Button bReloadUtilities;
      private Button bAddUtilities;
      private ListBox lbUtilities;
      private TabPage tpUtilities;
      private TabControl tcMain;
      private Button bLaunch;
      private Button bUp;
      private Button bDown;
      private Button bDelete;
      private Label lLauncher;
      private Label lWeb;
      private TreeView tvLaunch;
      private LinkLabel llWeb;
      private ToolStripMenuItem aboutToolStripMenuItem;
      private ToolStripMenuItem helpToolStripMenuItem;
      private ToolStripMenuItem savepositionToolStripMenuItem;
      private ToolStripMenuItem saveSizeToolStripMenuItem;
      private ToolStripMenuItem alwaysOntopToolStripMenuItem;
      private ToolStripMenuItem askOnExitToolStripMenuItem;
      private ToolStripMenuItem undoStepsToolStripMenuItem;
      private ToolStripMenuItem optionsToolStripMenuItem;
      private ToolStripMenuItem exitToolStripMenuItem;
      private ToolStripMenuItem fileToolStripMenuItem;
      private MenuStrip ms;
      // XML settings Filename
      string xmlFile = Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + "BetSoftware.xml";

      /// <summary>
      /// Initializes a new instance of the MainForm class.
      /// </summary>
      public MainForm()
      {
         TreeNode treeNode1 = new TreeNode("Utilities");
         TreeNode treeNode2 = new TreeNode("Input");
         TreeNode treeNode3 = new TreeNode("Bet selection");
         TreeNode treeNode4 = new TreeNode("Money Management");
         TreeNode treeNode5 = new TreeNode("Display");
         TreeNode treeNode6 = new TreeNode("Output");
         ms = new MenuStrip();
         fileToolStripMenuItem = new ToolStripMenuItem();
         exitToolStripMenuItem = new ToolStripMenuItem();
         optionsToolStripMenuItem = new ToolStripMenuItem();
         undoStepsToolStripMenuItem = new ToolStripMenuItem();
         alwaysOntopToolStripMenuItem = new ToolStripMenuItem();
         askOnExitToolStripMenuItem = new ToolStripMenuItem();
         saveSizeToolStripMenuItem = new ToolStripMenuItem();
         savepositionToolStripMenuItem = new ToolStripMenuItem();
         helpToolStripMenuItem = new ToolStripMenuItem();
         aboutToolStripMenuItem = new ToolStripMenuItem();
         llWeb = new LinkLabel();
         tvLaunch = new TreeView();
         lWeb = new Label();
         lLauncher = new Label();
         bDelete = new Button();
         bDown = new Button();
         bUp = new Button();
         bLaunch = new Button();
         tcMain = new TabControl();
         tpUtilities = new TabPage();
         lbUtilities = new ListBox();
         bAddUtilities = new Button();
         bReloadUtilities = new Button();
         tpInput = new TabPage();
         lbInput = new ListBox();
         bAddInput = new Button();
         bReloadInput = new Button();
         tpBS = new TabPage();
         bReloadBS = new Button();
         lbBS = new ListBox();
         bAddBS = new Button();
         tpMM = new TabPage();
         bReloadMM = new Button();
         lbMM = new ListBox();
         bAddMM = new Button();
         tpDisplay = new TabPage();
         bReloadDisplay = new Button();
         lbDisplay = new ListBox();
         bAddDisplay = new Button();
         tpOutput = new TabPage();
         bReloadOutput = new Button();
         lbOutput = new ListBox();
         bAddOut = new Button();
         ss = new StatusStrip();
         tsslStatus = new ToolStripStatusLabel();
         ms.SuspendLayout();
         tcMain.SuspendLayout();
         tpUtilities.SuspendLayout();
         tpInput.SuspendLayout();
         tpBS.SuspendLayout();
         tpMM.SuspendLayout();
         tpDisplay.SuspendLayout();
         tpOutput.SuspendLayout();
         ss.SuspendLayout();
         SuspendLayout();
         //
         // ms
         //
         ms.Items.AddRange(new ToolStripItem[]
         {
            fileToolStripMenuItem,
            optionsToolStripMenuItem,
            helpToolStripMenuItem
         });
         ms.Location = new Point(0, 0);
         ms.Name = "ms";
         ms.Size = new Size(551, 24);
         ms.TabIndex = 21;
         ms.Text = "menuStrip1";
         //
         // fileToolStripMenuItem
         //
         fileToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[]
         {
            exitToolStripMenuItem
         });
         fileToolStripMenuItem.Name = "fileToolStripMenuItem";
         fileToolStripMenuItem.Size = new Size(37, 20);
         fileToolStripMenuItem.Text = "&File";
         //
         // exitToolStripMenuItem
         //
         exitToolStripMenuItem.Name = "exitToolStripMenuItem";
         exitToolStripMenuItem.Size = new Size(92, 22);
         exitToolStripMenuItem.Text = "E&xit";
         exitToolStripMenuItem.Click += new EventHandler(ExitToolStripMenuItem_Click);
         //
         // optionsToolStripMenuItem
         //
         optionsToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[]
         {
            //undoStepsToolStripMenuItem,
            alwaysOntopToolStripMenuItem,
            askOnExitToolStripMenuItem,
            //saveSizeToolStripMenuItem,
            //savepositionToolStripMenuItem
         });
         optionsToolStripMenuItem.Name = "optionsToolStripMenuItem";
         optionsToolStripMenuItem.Size = new Size(61, 20);
         optionsToolStripMenuItem.Text = "&Options";
         //
         // undoStepsToolStripMenuItem
         //
         undoStepsToolStripMenuItem.Name = "undoStepsToolStripMenuItem";
         undoStepsToolStripMenuItem.Size = new Size(193, 22);
         undoStepsToolStripMenuItem.Text = "Set &undo steps (10)";
         //
         // alwaysOntopToolStripMenuItem
         //
         alwaysOntopToolStripMenuItem.Checked = true;
         alwaysOntopToolStripMenuItem.CheckState = CheckState.Checked;
         alwaysOntopToolStripMenuItem.Name = "alwaysOntopToolStripMenuItem";
         alwaysOntopToolStripMenuItem.Size = new Size(193, 22);
         alwaysOntopToolStripMenuItem.Text = "Always on &top";
         alwaysOntopToolStripMenuItem.Click += new EventHandler(alwaysOntopToolStripMenuItem_Click);
         //
         // askOnExitToolStripMenuItem
         //
         askOnExitToolStripMenuItem.Checked = true;
         askOnExitToolStripMenuItem.CheckState = CheckState.Checked;
         askOnExitToolStripMenuItem.Name = "askOnExitToolStripMenuItem";
         askOnExitToolStripMenuItem.Size = new Size(152, 22);
         askOnExitToolStripMenuItem.Text = "&Ask on exit";
         askOnExitToolStripMenuItem.Click += new EventHandler(ToolStripMenuItem_Click);
         //
         // saveSizeToolStripMenuItem
         //
         saveSizeToolStripMenuItem.Checked = true;
         saveSizeToolStripMenuItem.CheckState = CheckState.Checked;
         saveSizeToolStripMenuItem.Name = "saveSizeToolStripMenuItem";
         saveSizeToolStripMenuItem.Size = new Size(193, 22);
         saveSizeToolStripMenuItem.Text = "Save modules size";
         saveSizeToolStripMenuItem.Click += new EventHandler(ToolStripMenuItem_Click);
         //
         // savepositionToolStripMenuItem
         //
         savepositionToolStripMenuItem.Checked = true;
         savepositionToolStripMenuItem.CheckState = CheckState.Checked;
         savepositionToolStripMenuItem.Name = "savepositionToolStripMenuItem";
         savepositionToolStripMenuItem.Size = new Size(193, 22);
         savepositionToolStripMenuItem.Text = "Save modules &position";
         savepositionToolStripMenuItem.Click += new EventHandler(ToolStripMenuItem_Click);
         //
         // helpToolStripMenuItem
         //
         helpToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[]
         {
            aboutToolStripMenuItem
         });
         helpToolStripMenuItem.Name = "helpToolStripMenuItem";
         helpToolStripMenuItem.Size = new Size(44, 20);
         helpToolStripMenuItem.Text = "&Help";
         //
         // aboutToolStripMenuItem
         //
         aboutToolStripMenuItem.Name = "aboutToolStripMenuItem";
         aboutToolStripMenuItem.Size = new Size(116, 22);
         aboutToolStripMenuItem.Text = "&About...";
         aboutToolStripMenuItem.Click += new EventHandler(AboutToolStripMenuItem_Click);
         //
         // llWeb
         //
         llWeb.Location = new Point(217, 214);
         llWeb.Name = "llWeb";
         llWeb.Size = new Size(135, 13);
         llWeb.TabIndex = 37;
         llWeb.TabStop = true;
         llWeb.Text = "www.BetSelection.cc";
         llWeb.Visible = true;
         llWeb.LinkClicked += new LinkLabelLinkClickedEventHandler(LlWeb_LinkClicked);
         //
         // tvLaunch
         //
         tvLaunch.Enabled = false;
         tvLaunch.HideSelection = false;
         tvLaunch.Location = new Point(9, 230);
         tvLaunch.Name = "tvLaunch";
         treeNode1.Name = "nUtilities";
         treeNode1.Text = "Utilities";
         treeNode2.Name = "nInput";
         treeNode2.Text = "Input";
         treeNode3.Name = "nBS";
         treeNode3.Text = "Bet selection";
         treeNode4.Name = "nMM";
         treeNode4.Text = "Money Management";
         treeNode5.Name = "nDisplay";
         treeNode5.Text = "Display";
         treeNode6.Name = "nOutput";
         treeNode6.Text = "Output";
         tvLaunch.Nodes.AddRange(new TreeNode[]
         {
            treeNode1,
            treeNode2,
            treeNode3,
            treeNode4,
            treeNode5,
            treeNode6
         });
         tvLaunch.Size = new Size(328, 122);
         tvLaunch.TabIndex = 34;
         tvLaunch.Visible = true;
         //
         // lWeb
         //
         lWeb.AutoSize = true;
         lWeb.Font = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Italic, GraphicsUnit.Point, ((byte)(0)));
         lWeb.Location = new Point(186, 215);
         lWeb.Name = "lWeb";
         lWeb.Size = new Size(33, 13);
         lWeb.TabIndex = 35;
         lWeb.Text = "Web:";
         lWeb.Visible = true;
         //
         // lLauncher
         //
         lLauncher.AutoSize = true;
         lLauncher.Enabled = false;
         lLauncher.Font = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Bold, GraphicsUnit.Point, ((byte)(0)));
         lLauncher.Location = new Point(6, 214);
         lLauncher.Name = "lLauncher";
         lLauncher.Size = new Size(64, 13);
         lLauncher.TabIndex = 36;
         lLauncher.Text = "Launcher:";
         lLauncher.Visible = true;
         //
         // bDelete
         //
         bDelete.Enabled = false;
         bDelete.Location = new Point(110, 354);
         bDelete.Name = "bDelete";
         bDelete.Size = new Size(47, 23);
         bDelete.TabIndex = 33;
         bDelete.Text = "Del";
         bDelete.UseVisualStyleBackColor = true;
         bDelete.Visible = true;
         bDelete.Click += new System.EventHandler(BDelete_Click);
         //
         // bDown
         //
         bDown.Enabled = false;
         bDown.Location = new Point(59, 354);
         bDown.Name = "bDown";
         bDown.Size = new Size(47, 23);
         bDown.TabIndex = 32;
         bDown.Text = "Down";
         bDown.UseVisualStyleBackColor = true;
         bDown.Visible = true;
         bDown.Click += new System.EventHandler(BDown_Click);
         //
         // bUp
         //
         bUp.Enabled = false;
         bUp.Location = new Point(9, 354);
         bUp.Name = "bUp";
         bUp.Size = new Size(47, 23);
         bUp.TabIndex = 30;
         bUp.Text = "Up";
         bUp.UseVisualStyleBackColor = true;
         bUp.Visible = true;
         bUp.Click += new System.EventHandler(BUp_Click);
         //
         // bLaunch
         //
         bLaunch.Enabled = false;
         bLaunch.Font = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Bold, GraphicsUnit.Point, ((byte)(0)));
         bLaunch.Location = new Point(202, 354);
         bLaunch.Name = "bLaunch";
         bLaunch.Size = new Size(135, 23);
         bLaunch.TabIndex = 31;
         bLaunch.Text = "Launch!";
         bLaunch.UseVisualStyleBackColor = true;
         bLaunch.Visible = true;
         bLaunch.Click += new System.EventHandler(BLaunch_Click);
         //
         // tcMain
         //
         tcMain.Controls.Add(tpUtilities);
         tcMain.Controls.Add(tpInput);
         tcMain.Controls.Add(tpBS);
         tcMain.Controls.Add(tpMM);
         tcMain.Controls.Add(tpDisplay);
         tcMain.Controls.Add(tpOutput);
         tcMain.Location = new Point(6, 28);
         tcMain.Name = "tcMain";
         tcMain.SelectedIndex = 0;
         tcMain.Size = new Size(335, 173);
         tcMain.TabIndex = 29;
         tcMain.Visible = true;
         //
         // tpUtilities
         //
         tpUtilities.Controls.Add(lbUtilities);
         tpUtilities.Controls.Add(bAddUtilities);
         tpUtilities.Controls.Add(bReloadUtilities);
         tpUtilities.Location = new Point(4, 22);
         tpUtilities.Name = "tpUtilities";
         tpUtilities.Size = new Size(327, 147);
         tpUtilities.TabIndex = 6;
         tpUtilities.Text = "Utilities";
         tpUtilities.UseVisualStyleBackColor = true;
         //
         // lbUtilities
         //
         lbUtilities.FormattingEnabled = true;
         lbUtilities.Location = new Point(8, 12);
         lbUtilities.Name = "lbUtilities";
         lbUtilities.SelectionMode = SelectionMode.MultiSimple;
         lbUtilities.Size = new Size(311, 108);
         lbUtilities.Sorted = true;
         lbUtilities.TabIndex = 9;
         //
         // bAddUtilities
         //
         bAddUtilities.Font = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Bold);
         bAddUtilities.Location = new Point(192, 121);
         bAddUtilities.Name = "bAddUtilities";
         bAddUtilities.Size = new Size(127, 23);
         bAddUtilities.TabIndex = 8;
         bAddUtilities.Tag = "nUtilities";
         bAddUtilities.Text = "Add";
         bAddUtilities.UseVisualStyleBackColor = true;
         //
         // bReloadUtilities
         //
         bReloadUtilities.Location = new Point(8, 121);
         bReloadUtilities.Name = "bReloadUtilities";
         bReloadUtilities.Size = new Size(56, 23);
         bReloadUtilities.TabIndex = 7;
         bReloadUtilities.Text = "Reload";
         bReloadUtilities.UseVisualStyleBackColor = true;
         //
         // tpInput
         //
         tpInput.Controls.Add(lbInput);
         tpInput.Controls.Add(bAddInput);
         tpInput.Controls.Add(bReloadInput);
         tpInput.Location = new Point(4, 22);
         tpInput.Name = "tpInput";
         tpInput.Padding = new Padding(3);
         tpInput.Size = new Size(327, 147);
         tpInput.TabIndex = 0;
         tpInput.Text = "Input";
         tpInput.UseVisualStyleBackColor = true;
         //
         // lbInput
         //
         lbInput.FormattingEnabled = true;
         lbInput.Location = new Point(8, 12);
         lbInput.Name = "lbInput";
         lbInput.SelectionMode = SelectionMode.MultiSimple;
         lbInput.Size = new Size(311, 108);
         lbInput.Sorted = true;
         lbInput.TabIndex = 6;
         //
         // bAddInput
         //
         bAddInput.Font = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Bold);
         bAddInput.Location = new Point(192, 121);
         bAddInput.Name = "bAddInput";
         bAddInput.Size = new Size(127, 23);
         bAddInput.TabIndex = 5;
         bAddInput.Tag = "nInput";
         bAddInput.Text = "Add";
         bAddInput.UseVisualStyleBackColor = true;
         //
         // bReloadInput
         //
         bReloadInput.Location = new Point(8, 121);
         bReloadInput.Name = "bReloadInput";
         bReloadInput.Size = new Size(56, 23);
         bReloadInput.TabIndex = 1;
         bReloadInput.Text = "Reload";
         bReloadInput.UseVisualStyleBackColor = true;
         //
         // tpBS
         //
         tpBS.Controls.Add(bReloadBS);
         tpBS.Controls.Add(lbBS);
         tpBS.Controls.Add(bAddBS);
         tpBS.Location = new Point(4, 22);
         tpBS.Name = "tpBS";
         tpBS.Padding = new Padding(3);
         tpBS.Size = new Size(327, 147);
         tpBS.TabIndex = 1;
         tpBS.Text = "Bet S.";
         tpBS.UseVisualStyleBackColor = true;
         //
         // bReloadBS
         //
         bReloadBS.Location = new Point(8, 121);
         bReloadBS.Name = "bReloadBS";
         bReloadBS.Size = new Size(56, 23);
         bReloadBS.TabIndex = 5;
         bReloadBS.Text = "Reload";
         bReloadBS.UseVisualStyleBackColor = true;
         //
         // lbBS
         //
         lbBS.FormattingEnabled = true;
         lbBS.Location = new Point(8, 12);
         lbBS.Name = "lbBS";
         lbBS.SelectionMode = SelectionMode.MultiSimple;
         lbBS.Size = new Size(311, 108);
         lbBS.Sorted = true;
         lbBS.TabIndex = 4;
         //
         // bAddBS
         //
         bAddBS.Font = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Bold);
         bAddBS.Location = new Point(192, 121);
         bAddBS.Name = "bAddBS";
         bAddBS.Size = new Size(127, 23);
         bAddBS.TabIndex = 1;
         bAddBS.Tag = "nBS";
         bAddBS.Text = "Add";
         bAddBS.UseVisualStyleBackColor = true;
         //
         // tpMM
         //
         tpMM.Controls.Add(bReloadMM);
         tpMM.Controls.Add(lbMM);
         tpMM.Controls.Add(bAddMM);
         tpMM.Location = new Point(4, 22);
         tpMM.Name = "tpMM";
         tpMM.Padding = new Padding(3);
         tpMM.Size = new Size(327, 147);
         tpMM.TabIndex = 2;
         tpMM.Text = "Mon. M.";
         tpMM.UseVisualStyleBackColor = true;
         //
         // bReloadMM
         //
         bReloadMM.Location = new Point(8, 121);
         bReloadMM.Name = "bReloadMM";
         bReloadMM.Size = new Size(56, 23);
         bReloadMM.TabIndex = 7;
         bReloadMM.Text = "Reload";
         bReloadMM.UseVisualStyleBackColor = true;
         //
         // lbMM
         //
         lbMM.FormattingEnabled = true;
         lbMM.Location = new Point(8, 12);
         lbMM.Name = "lbMM";
         lbMM.SelectionMode = SelectionMode.MultiSimple;
         lbMM.Size = new Size(311, 108);
         lbMM.Sorted = true;
         lbMM.TabIndex = 6;
         //
         // bAddMM
         //
         bAddMM.Font = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Bold);
         bAddMM.Location = new Point(192, 121);
         bAddMM.Name = "bAddMM";
         bAddMM.Size = new Size(127, 23);
         bAddMM.TabIndex = 5;
         bAddMM.Tag = "nMM";
         bAddMM.Text = "Add";
         bAddMM.UseVisualStyleBackColor = true;
         //
         // tpDisplay
         //
         tpDisplay.Controls.Add(bReloadDisplay);
         tpDisplay.Controls.Add(lbDisplay);
         tpDisplay.Controls.Add(bAddDisplay);
         tpDisplay.Location = new Point(4, 22);
         tpDisplay.Name = "tpDisplay";
         tpDisplay.Size = new Size(327, 147);
         tpDisplay.TabIndex = 3;
         tpDisplay.Text = "Display";
         tpDisplay.UseVisualStyleBackColor = true;
         //
         // bReloadDisplay
         //
         bReloadDisplay.Location = new Point(8, 121);
         bReloadDisplay.Name = "bReloadDisplay";
         bReloadDisplay.Size = new Size(56, 23);
         bReloadDisplay.TabIndex = 7;
         bReloadDisplay.Text = "Reload";
         bReloadDisplay.UseVisualStyleBackColor = true;
         //
         // lbDisplay
         //
         lbDisplay.FormattingEnabled = true;
         lbDisplay.Location = new Point(8, 12);
         lbDisplay.Name = "lbDisplay";
         lbDisplay.SelectionMode = SelectionMode.MultiSimple;
         lbDisplay.Size = new Size(311, 108);
         lbDisplay.Sorted = true;
         lbDisplay.TabIndex = 6;
         //
         // bAddDisplay
         //
         bAddDisplay.Font = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Bold);
         bAddDisplay.Location = new Point(192, 121);
         bAddDisplay.Name = "bAddDisplay";
         bAddDisplay.Size = new Size(127, 23);
         bAddDisplay.TabIndex = 5;
         bAddDisplay.Tag = "nDisplay";
         bAddDisplay.Text = "Add";
         bAddDisplay.UseVisualStyleBackColor = true;
         //
         // tpOutput
         //
         tpOutput.Controls.Add(bReloadOutput);
         tpOutput.Controls.Add(lbOutput);
         tpOutput.Controls.Add(bAddOut);
         tpOutput.Location = new Point(4, 22);
         tpOutput.Name = "tpOutput";
         tpOutput.Size = new Size(327, 147);
         tpOutput.TabIndex = 5;
         tpOutput.Text = "Output";
         tpOutput.UseVisualStyleBackColor = true;
         //
         // bReloadOutput
         //
         bReloadOutput.Location = new Point(8, 121);
         bReloadOutput.Name = "bReloadOutput";
         bReloadOutput.Size = new Size(56, 23);
         bReloadOutput.TabIndex = 7;
         bReloadOutput.Text = "Reload";
         bReloadOutput.UseVisualStyleBackColor = true;
         //
         // lbOutput
         //
         lbOutput.FormattingEnabled = true;
         lbOutput.Location = new Point(8, 12);
         lbOutput.Name = "lbOutput";
         lbOutput.SelectionMode = SelectionMode.MultiSimple;
         lbOutput.Size = new Size(311, 108);
         lbOutput.Sorted = true;
         lbOutput.TabIndex = 6;
         //
         // bAddOut
         //
         bAddOut.Font = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Bold, GraphicsUnit.Point, ((byte)(0)));
         bAddOut.Location = new Point(192, 121);
         bAddOut.Name = "bAddOut";
         bAddOut.Size = new Size(127, 23);
         bAddOut.TabIndex = 5;
         bAddOut.Tag = "nOutput";
         bAddOut.Text = "Add";
         bAddOut.UseVisualStyleBackColor = true;
         //
         // ss
         //
         ss.Items.AddRange(new ToolStripItem[]
         {
            tsslStatus
         });
         ss.Location = new Point(0, 425);
         ss.Name = "ss";
         ss.Size = new Size(551, 22);
         ss.TabIndex = 26;
         //
         // tsslStatus
         //
         tsslStatus.Font = new Font("Segoe UI", 9F, ((FontStyle)((FontStyle.Bold | FontStyle.Italic))), GraphicsUnit.Point, ((byte)(0)));
         tsslStatus.ForeColor = Color.Blue;
         tsslStatus.Name = "tsslStatus";
         tsslStatus.Size = new Size(95, 17);
         tsslStatus.Text = "1) Choose desired module, then click 'Add'";
         //
         // MainForm
         //
         AutoScaleDimensions = new SizeF(6F, 13F);
         AutoScaleMode = AutoScaleMode.None;
         FormBorderStyle = FormBorderStyle.FixedSingle;
         ClientSize = new Size(354, 403);
         StartPosition = FormStartPosition.CenterScreen;
         Controls.Add(ms);
         Controls.Add(llWeb);
         Controls.Add(tvLaunch);
         Controls.Add(lWeb);
         Controls.Add(lLauncher);
         Controls.Add(bDelete);
         Controls.Add(bDown);
         Controls.Add(bUp);
         Controls.Add(bLaunch);
         Controls.Add(tcMain);
         Controls.Add(ss);
         Name = "MainForm";
         Text = "BetSoftware v0.1";
         Load += new EventHandler(MainForm_Load);
         FormClosing += new FormClosingEventHandler(MainForm_FormClosing);
         ms.ResumeLayout(false);
         ms.PerformLayout();
         tcMain.ResumeLayout(false);
         tpUtilities.ResumeLayout(false);
         tpInput.ResumeLayout(false);
         tpBS.ResumeLayout(false);
         tpMM.ResumeLayout(false);
         tpDisplay.ResumeLayout(false);
         tpOutput.ResumeLayout(false);
         ss.ResumeLayout(false);
         ss.PerformLayout();
         ResumeLayout(false);
         PerformLayout();

         // Set icon
         Icon = new Icon(Assembly.GetExecutingAssembly().GetManifestResourceStream("BetSoftware_Loader.atom_256_96_48_32_24_16.ico"));

         // File Size
         FileInfo xmlInfo = new FileInfo(xmlFile);

         // Check for XML file's existence and length
         if (File.Exists(xmlFile) && xmlInfo.Length > 0)
         {
            // Set XPath Document               
            XPathDocument document = new XPathDocument(xmlFile);

            // Create XPath Navigator
            XPathNavigator navigator = document.CreateNavigator();

            // Process Options
            foreach (XPathNavigator section in navigator.Select("/BetSoftware/Options"))
            {
               foreach (XPathNavigator node in section.SelectChildren(XPathNodeType.All))
               {
                  // Toggle options
                  foreach (ToolStripMenuItem tsmi in optionsToolStripMenuItem.DropDownItems)
                  {
                     // Set CheckState
                     if (tsmi.Name == node.Name + "ToolStripMenuItem")
                     {
                        // Load from file
                        tsmi.CheckState = (node.InnerXml == "Checked" ? CheckState.Checked : CheckState.Unchecked);
                     }
                  }
               }
            }
         }

         /*
         // Load game form
         GameForm gForm = new GameForm();

         // Make it visible
         gForm.ShowDialog();

         // Unload
         gForm.Dispose();

         // Load mode form
         ModeForm mForm = new ModeForm();

         // Make it visible
         mForm.ShowDialog();
         */

         //TODO Fix: Fake GameForm selection
         Data.Game = "roulette";

         //TODO Fix: separate in two functions 1) set directories 2) load modules;
         LoadModules(true);
      }



(continued below)

Email/Paypal: betselectiongmail.com
-- Victor

VLS

Code (csharp) Select
/// <summary>
/// Exit tool strip menu item click.
/// </summary>
private void ExitToolStripMenuItem_Click(object sender, EventArgs e)
{
// Close
Close();
}

/// <summary>
/// Launches web browser to BetSelection.cc
/// </summary>
void LlWeb_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
// Launch site
Process.Start("http://betselection.cc");
}

/// <summary>
/// Add module
/// </summary>
private void BAdd_Click(object sender, EventArgs e)
{
// Set listbox
ListBox lb = null;

switch (((Button)sender).Tag.ToString())
{
// Utilities
case "nUtilities":
lb = lbUtilities;
break;

// Input
case "nInput":
lb = lbInput;
break;

// Bet selection
case "nBS":
lb = lbBS;
break;

// Money management
case "nMM":
lb = lbMM;
break;

// Display
case "nDisplay":
lb = lbDisplay;
break;

// Output
case "nOutput":
lb = lbOutput;
break;
}

// Check there's something to add
if (lb.SelectedIndex > -1)
{
// Declare string for item text
String itemText;

// Iterate selected items
foreach (Object sel in lb.SelectedItems)
{
// Make string
itemText = sel as String;

// Check if it's unique
if (!tvLaunch.Nodes[((Button)sender).Tag.ToString()].Nodes.ContainsKey(itemText))
{
// Add to TreeView
tvLaunch.Nodes[((Button)sender).Tag.ToString()].Nodes.Add(itemText, itemText);
}
}
}

// Change status text
tsslStatus.Text = "2) Set launch order, then click 'Launch'";

// Enable
tvLaunch.Enabled = true;
bUp.Enabled = true;
bDown.Enabled = true;
bDelete.Enabled = true;
bLaunch.Enabled = true;

// Expand all nodes
tvLaunch.ExpandAll();
}

/// <summary>
/// Moves selected module up in TreeView
/// </summary>
void BUp_Click(object sender, EventArgs e)
{
// Check it isn't null
if (tvLaunch.SelectedNode != null && tvLaunch.SelectedNode.Parent != null && tvLaunch.SelectedNode.Index > 0)
{
// Suspend redraws
tvLaunch.SuspendLayout();

// Save selected node
TreeNode node = tvLaunch.SelectedNode;

// Set parent
TreeNode parent = tvLaunch.SelectedNode.Parent;

// Set index
int index = tvLaunch.SelectedNode.Index;

// Remove it
parent.Nodes.RemoveAt(index);

// Insert it again
parent.Nodes.Insert(index - 1, node);

//select the node
tvLaunch.SelectedNode = parent.Nodes[index - 1];

// Resume redrawing
tvLaunch.ResumeLayout();

// Refresh
tvLaunch.Refresh();
}

// Focus treeview
tvLaunch.Focus();
}

/// <summary>
/// Moves selected module down in TreeView
/// </summary>
void BDown_Click(object sender, EventArgs e)
{
// Check it isn't null
if (tvLaunch.SelectedNode != null && tvLaunch.SelectedNode.Parent != null && tvLaunch.SelectedNode.Index < tvLaunch.SelectedNode.Parent.Nodes.Count - 1)
{
// Suspend redraws
tvLaunch.SuspendLayout();

// Save selected node
TreeNode node = tvLaunch.SelectedNode;

// Set parent
TreeNode parent = tvLaunch.SelectedNode.Parent;

// Set index
int index = tvLaunch.SelectedNode.Index;

// Remove it
parent.Nodes.RemoveAt(index);

// Insert it again
parent.Nodes.Insert(index + 1, node);

//select the node
tvLaunch.SelectedNode = tvLaunch.SelectedNode.Parent.Nodes[index + 1];

// Resume redrawing
tvLaunch.ResumeLayout();

// Refresh
tvLaunch.Refresh();
}

// Focus treeview
tvLaunch.Focus();
}

/// <summary>
/// Launch button
/// </summary>
private void BLaunch_Click(object sender, EventArgs e)
{
// Namespace string
string nSpace = string.Empty;

/* Assign */

/* Utilities */
foreach (TreeNode tn in tvLaunch.Nodes["nUtilities"].Nodes)
{
// Set namespace
nSpace = DisplayNameToNameSpace(tn.Text);

// Load assembly
Assembly asm = Assembly.LoadFile(GetDllPath(tn.Text, "Utilities", tags["Utilities"][nSpace]));

// Add to Utilities dict
Modules.Utilities.Dict.Add(nSpace, asm);

// Add to Utilities list
Modules.Utilities.List.Add(nSpace);

// Utilities module
Modules.Utilities.Dict[nSpace].GetType(nSpace + ".Comm").GetMethod("Init", BindingFlags.Static | BindingFlags.Public).Invoke(null, new object[] { Data.NameSpace });
}

/* Input */
foreach (TreeNode tn in tvLaunch.Nodes["nInput"].Nodes)
{
// Set namespace
nSpace = DisplayNameToNameSpace(tn.Text);

// Load assembly
Assembly asm = Assembly.LoadFile(GetDllPath(tn.Text, "Input", tags["Input"][nSpace]));

// Add to input dict
Modules.Input.Dict.Add(nSpace, asm);

// Add to input list
Modules.Input.List.Add(nSpace);

// Init module
Modules.Input.Dict[nSpace].GetType(nSpace + ".Comm").GetMethod("Init", BindingFlags.Static | BindingFlags.Public).Invoke(null, new object[] { Data.NameSpace });
}

/* Bet Selection */
foreach (TreeNode tn in tvLaunch.Nodes["nBS"].Nodes)
{
// Set namespace
nSpace = DisplayNameToNameSpace(tn.Text);

// Load assembly
Assembly asm = Assembly.LoadFile(GetDllPath(tn.Text, "BetSelection", tags["BetSelection"][nSpace]));

// Add to Bet Selection dict
Modules.BS.Dict.Add(nSpace, asm);

// Add to Bet Selection list
Modules.BS.List.Add(nSpace);

// Init module
Modules.BS.Dict[nSpace].GetType(nSpace + ".Comm").GetMethod("Init", BindingFlags.Static | BindingFlags.Public).Invoke(null, new object[] { Data.NameSpace });
}

/* Money Management */
foreach (TreeNode tn in tvLaunch.Nodes["nMM"].Nodes)
{
// Set namespace
nSpace = DisplayNameToNameSpace(tn.Text);

// Load assembly
Assembly asm = Assembly.LoadFile(GetDllPath(tn.Text, "MoneyManagement", tags["MoneyManagement"][nSpace]));

// Add to Money Management dict
Modules.MM.Dict.Add(nSpace, asm);

// Add to Money Management list
Modules.MM.List.Add(nSpace);

// Init module
Modules.MM.Dict[nSpace].GetType(nSpace + ".Comm").GetMethod("Init", BindingFlags.Static | BindingFlags.Public).Invoke(null, new object[] { Data.NameSpace });
}

/* Display */
foreach (TreeNode tn in tvLaunch.Nodes["nDisplay"].Nodes)
{
// Set namespace
nSpace = DisplayNameToNameSpace(tn.Text);

// Load assembly
Assembly asm = Assembly.LoadFile(GetDllPath(tn.Text, "Display", tags["Display"][nSpace]));

// Add to display dict
Modules.Display.Dict.Add(nSpace, asm);

// Add to display list
Modules.Display.List.Add(nSpace);

// Init module
Modules.Display.Dict[nSpace].GetType(nSpace + ".Comm").GetMethod("Init", BindingFlags.Static | BindingFlags.Public).Invoke(null, new object[] { Data.NameSpace });
}

/* Output */
foreach (TreeNode tn in tvLaunch.Nodes["nOutput"].Nodes)
{
// Set namespace
nSpace = DisplayNameToNameSpace(tn.Text);

// Load assembly
Assembly asm = Assembly.LoadFile(GetDllPath(tn.Text, "Output", tags["Output"][nSpace]));

// Add to Output dict
Modules.Output.Dict.Add(nSpace, asm);

// Add to Output list
Modules.Output.List.Add(nSpace);

// Init module
Modules.Output.Dict[nSpace].GetType(nSpace + ".Comm").GetMethod("Init", BindingFlags.Static | BindingFlags.Public).Invoke(null, new object[] { Data.NameSpace });
}

/* Re-enable (a bit more efficient than comparing on every iteration) */

// Enable link
llWeb.Enabled = true;

// Change color
lWeb.ForeColor = Color.Red;

// Enable web label
lWeb.Enabled = true;

// Enabe status label
ss.Enabled = true;

// Set status label
tsslStatus.Text = "3) Close program when finished. --Or visit our web!";
}

/// <summary>
/// Remove currently selected module from tree
/// </summary>
private void BDelete_Click(object sender, EventArgs e)
{
// Check it isn't null
if (tvLaunch.SelectedNode != null && tvLaunch.SelectedNode.Parent != null)
{
// Delete node
tvLaunch.SelectedNode.Remove();
}
}

/// <summary>
/// Changes a display name to its .dll representation
/// </summary>
private string GetDllPath(string displayName, string folder)
{
return string.Empty;
}

/// <summary>
/// Changes a display name to its .dll representation
/// </summary>
private string GetDllPath(string displayName, string folder, string subfolder)
{
// Check strings are there
if (displayName.Length > 0 && folder.Length > 0)
{
// Replace and return
return appDir + folder + Path.DirectorySeparatorChar + subfolder + Path.DirectorySeparatorChar + DisplayNameToNameSpace(displayName) + ".dll";
}

// Return empty string by default
return String.Empty;
}

/// <summary>
/// Load event for main form
/// </summary>
void MainForm_Load(object sender, EventArgs e)
{
// Select tpInput
tcMain.SelectedTab = tpInput;

/* Handle options */

// Always on top
if (alwaysOntopToolStripMenuItem.Checked)
{
// On top
this.TopMost = true;
}

/* Event handlers */

// Buttons
Button[] buttons = new Button[] { bAddBS, bAddDisplay, bAddInput, bAddMM, bAddOut, bAddUtilities };

// Handler
foreach (Button b in buttons)
{
// Attach
b.Click += new EventHandler(BAdd_Click);
}

// Load modules
LoadModules(false);
}

/// <summary>
/// Handles form closing
/// </summary>
void MainForm_FormClosing(object sender, FormClosingEventArgs e)
{
// Check if must ask
if (askOnExitToolStripMenuItem.Checked)
{
// Ask
if (MessageBox.Show("Would you like to exit now?", "Confirm exit", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) != DialogResult.Yes)
{
// Cancel form close
e.Cancel = true;

// Exit procedure
return;
}
}

/* Save XML */

// Instantiate XmlTextWriter
XmlTextWriter writer = new XmlTextWriter(xmlFile, null);

// Set formatting
writer.Formatting = Formatting.Indented;
writer.Indentation = 4;

// Document start
writer.WriteStartDocument();

// Root start
writer.WriteStartElement("BetSoftware");

// Options start
writer.WriteStartElement("Options");

// Write options
foreach (ToolStripMenuItem tsmi in optionsToolStripMenuItem.DropDownItems)
{
// Save checked status
writer.WriteElementString(tsmi.Name.Replace("ToolStripMenuItem", ""), tsmi.CheckState.ToString());
}

// Options end
writer.WriteEndElement();

// Root start
writer.WriteEndElement();

// Document end
writer.WriteEndDocument();

// Close writer
writer.Close();
}

/// <summary>
/// Generic event handler for ToolStripMenuItem
/// </summary>
void ToolStripMenuItem_Click(object sender, EventArgs e)
{
// Toggle
((ToolStripMenuItem)sender).Checked = !((ToolStripMenuItem)sender).Checked;
}

/// <summary>
/// Shows about form
/// </summary>
void AboutToolStripMenuItem_Click(object sender, EventArgs e)
{
// Display about msg
MessageBox.Show("Coded by Victor/VLS for BetSelection.cc" + Environment.NewLine + Environment.NewLine + "(2014-04-02 / Version 0.1)", "About BetSoftware", MessageBoxButtons.OK, MessageBoxIcon.Information);
}

/// <summary>
/// Sets TopMost
/// </summary>
void alwaysOntopToolStripMenuItem_Click(object sender, EventArgs e)
{
// Set
this.TopMost = !alwaysOntopToolStripMenuItem.Checked;

// Toggle
ToolStripMenuItem_Click(sender, e);
}

/// <summary>
/// Check/creates directories and loads modules
/// </summary>
private void LoadModules(bool init)
{
// Temporary string array
string[] tempSA;

// List of string to hold modules
List<string> mods = new List<string>();

// Prepare or clear tags
SetTags();

/* Clear listboxes */

lbUtilities.Items.Clear();
lbInput.Items.Clear();
lbBS.Items.Clear();
lbMM.Items.Clear();
lbDisplay.Items.Clear();
lbOutput.Items.Clear();

/* Utilities */

// Check for an existent directory
if (!Directory.Exists(appDir + "Utilities"))
{
// Not present, create it
Directory.CreateDirectory(appDir + "Utilities");

// Create subdirectories for games
Directory.CreateDirectory(appDir + "Utilities" + Path.DirectorySeparatorChar + "Roulette");
Directory.CreateDirectory(appDir + "Utilities" + Path.DirectorySeparatorChar + "Baccarat");
}
else if (!init)
{

/* Add modules to Utilities list */

// Append current game modules to list
if (Directory.Exists(appDir + "Utilities" + Path.DirectorySeparatorChar + UpperFirst(Data.Game)))
{
// Current game
tempSA = Directory.GetFiles(appDir + "Utilities" + Path.DirectorySeparatorChar + UpperFirst(Data.Game), "*.dll");

// Populate
for (int i = 0; i < tempSA.Length; i++)
{
// Add current module to list
mods.Add(tempSA[i]);

// Set matching current module tag
tags["Utilities"].Add(DisplayNameToNameSpace(GetDisplayNameFromPath(tempSA[i])), UpperFirst(Data.Game));
}
}

// Iterate mods
foreach (string mod in mods)
{
// Get file name
lbUtilities.Items.Add(GetDisplayNameFromPath(mod));
}

// Set module counter
if (lbUtilities.Items.Count > 0)
{
// Display count
tpUtilities.Text = "Util. (" + lbUtilities.Items.Count + ")";
}
else
{
// Initial label
tpUtilities.Text = "Utilities";
}
}

/* Input */

// Check for an existent directory
if (!Directory.Exists(appDir + "Input"))
{
// Not present, create it
Directory.CreateDirectory(appDir + "Input");

// Create subdirectories for games
Directory.CreateDirectory(appDir + "Input" + Path.DirectorySeparatorChar + "Roulette");
Directory.CreateDirectory(appDir + "Input" + Path.DirectorySeparatorChar + "Baccarat");
}
else if (!init)
{
/* Add modules to input list */

// Clear list
mods.Clear();

// Append current game modules to list
if (Directory.Exists(appDir + "Input" + Path.DirectorySeparatorChar + UpperFirst(Data.Game)))
{
// Current game
tempSA = Directory.GetFiles(appDir + "Input" + Path.DirectorySeparatorChar + UpperFirst(Data.Game), "*.dll");

// Populate
for (int i = 0; i < tempSA.Length; i++)
{
// Add current module to list
mods.Add(tempSA[i]);

// Set matching current module tag
tags["Input"].Add(DisplayNameToNameSpace(GetDisplayNameFromPath(tempSA[i])), UpperFirst(Data.Game));
}
}

// Iterate
foreach (string mod in mods)
{
// Get file name
lbInput.Items.Add(GetDisplayNameFromPath(mod));
}

// Set module counter
if (lbInput.Items.Count > 0)
{
// Display count
tpInput.Text = "Input (" + lbInput.Items.Count + ")";
}
else
{
// Initial label
tpInput.Text = "Input";
}
}

/* BetSelection */

// Check for an existent directory
if (!Directory.Exists(appDir + "BetSelection"))
{
// Not present, create it
Directory.CreateDirectory(appDir + "BetSelection");

// Create subdirectories for games
Directory.CreateDirectory(appDir + "BetSelection" + Path.DirectorySeparatorChar + "Roulette");
Directory.CreateDirectory(appDir + "BetSelection" + Path.DirectorySeparatorChar + "Baccarat");
}
else if (!init)
{
/* Add modules to BetSelection list */

// Clear list
mods.Clear();

// Append current game modules to list
if (Directory.Exists(appDir + "BetSelection" + Path.DirectorySeparatorChar + UpperFirst(Data.Game)))
{
// Current game
tempSA = Directory.GetFiles(appDir + "BetSelection" + Path.DirectorySeparatorChar + UpperFirst(Data.Game), "*.dll");

// Populate
for (int i = 0; i < tempSA.Length; i++)
{
// Add current module to list
mods.Add(tempSA[i]);

// Set matching current module tag
tags["BetSelection"].Add(DisplayNameToNameSpace(GetDisplayNameFromPath(tempSA[i])), UpperFirst(Data.Game));
}
}

// Iterate mods
foreach (string mod in mods)
{
// Get file name
lbBS.Items.Add(GetDisplayNameFromPath(mod));
}

// Set module counter
if (lbBS.Items.Count > 0)
{
// Display count
tpBS.Text = "Bet S. (" + lbBS.Items.Count + ")";
}
else
{
// Initial label
tpBS.Text = "Bet S.";
}
}

/* MoneyManagement */

// Check for an existent directory
if (!Directory.Exists(appDir + "MoneyManagement"))
{
// Not present, create it
Directory.CreateDirectory(appDir + "MoneyManagement");

// Create subdirectories for games
Directory.CreateDirectory(appDir + "MoneyManagement" + Path.DirectorySeparatorChar + "Roulette");
Directory.CreateDirectory(appDir + "MoneyManagement" + Path.DirectorySeparatorChar + "Baccarat");
}
else if (!init)
{
/* Add modules to MoneyManagement list */

// Clear list
mods.Clear();

// Append current game modules to list
if (Directory.Exists(appDir + "MoneyManagement" + Path.DirectorySeparatorChar + UpperFirst(Data.Game)))
{
// Current game
tempSA = Directory.GetFiles(appDir + "MoneyManagement" + Path.DirectorySeparatorChar + UpperFirst(Data.Game), "*.dll");

// Populate
for (int i = 0; i < tempSA.Length; i++)
{
// Add current module to list
mods.Add(tempSA[i]);

// Set matching current module tag
tags["MoneyManagement"].Add(DisplayNameToNameSpace(GetDisplayNameFromPath(tempSA[i])), UpperFirst(Data.Game));
}
}

// Iterate mods
foreach (string mod in mods)
{
// Get file name
lbMM.Items.Add(GetDisplayNameFromPath(mod));
}

// Set module counter
if (lbMM.Items.Count > 0)
{
// Display count
tpMM.Text = "Mon. M. (" + lbMM.Items.Count + ")";
}
else
{
// Initial label
tpMM.Text = "Mon. M.";
}
}

/* Display */

// Check for an existent directory
if (!Directory.Exists(appDir + "Display"))
{
// Not present, create it
Directory.CreateDirectory(appDir + "Display");

// Create subdirectories for games
Directory.CreateDirectory(appDir + "Display" + Path.DirectorySeparatorChar + "Roulette");
Directory.CreateDirectory(appDir + "Display" + Path.DirectorySeparatorChar + "Baccarat");
}
else if (!init)
{
/* Add modules to Display list */

// Clear list
mods.Clear();

// Append current game modules to list
if (Directory.Exists(appDir + "Display" + Path.DirectorySeparatorChar + UpperFirst(Data.Game)))
{
// Current game
tempSA = Directory.GetFiles(appDir + "Display" + Path.DirectorySeparatorChar + UpperFirst(Data.Game), "*.dll");

// Populate
for (int i = 0; i < tempSA.Length; i++)
{
// Add current module to list
mods.Add(tempSA[i]);

// Set matching current module tag
tags["Display"].Add(DisplayNameToNameSpace(GetDisplayNameFromPath(tempSA[i])), UpperFirst(Data.Game));
}
}

// Iterate mods
foreach (string mod in mods)
{
// Get file name
lbDisplay.Items.Add(GetDisplayNameFromPath(mod));
}

// Set module counter
if (lbDisplay.Items.Count > 0)
{
// Display count
tpDisplay.Text = "Disp. (" + lbDisplay.Items.Count + ")";
}
else
{
// Initial label
tpDisplay.Text = "Display";
}
}

/* Output */

// Check for an existent directory
if (!Directory.Exists(appDir + "Output"))
{
// Not present, create it
Directory.CreateDirectory(appDir + "Output");

// Create subdirectories for games
Directory.CreateDirectory(appDir + "Output" + Path.DirectorySeparatorChar + "Roulette");
Directory.CreateDirectory(appDir + "Output" + Path.DirectorySeparatorChar + "Baccarat");
}
else if (!init)
{
/* Add modules to Output list */

// Clear list
mods.Clear();

// Append current game modules to list
if (Directory.Exists(appDir + "Output" + Path.DirectorySeparatorChar + UpperFirst(Data.Game)))
{
// Current game
tempSA = Directory.GetFiles(appDir + "Output" + Path.DirectorySeparatorChar + UpperFirst(Data.Game), "*.dll");

// Populate
for (int i = 0; i < tempSA.Length; i++)
{
// Add current module to list
mods.Add(tempSA[i]);

// Set matching current module tag
tags["Output"].Add(DisplayNameToNameSpace(GetDisplayNameFromPath(tempSA[i])), UpperFirst(Data.Game));
}
}

// Iterate mods
foreach (string mod in mods)
{
// Get file name
lbOutput.Items.Add(GetDisplayNameFromPath(mod));
}

// Set module counter
if (lbOutput.Items.Count > 0)
{
// Display count
tpOutput.Text = "Output (" + lbOutput.Items.Count + ")";
}
else
{
// Initial label
tpOutput.Text = "Output";
}
}
}

/// <summary>
/// Prepares tags dictionary
/// </summary>
private void SetTags()
{
// Check if there's something
if (tags.Count > 0)
{
// Clear 'em
tags.Clear();
}

// Populate base
tags.Add("Utilities", new Dictionary<string, string>());
tags.Add("Input", new Dictionary<string, string>());
tags.Add("BetSelection", new Dictionary<string, string>());
tags.Add("MoneyManagement", new Dictionary<string, string>());
tags.Add("Display", new Dictionary<string, string>());
tags.Add("Output", new Dictionary<string, string>());
}

/// <summary>
/// Changes a path to its display name representation
/// </summary>
private string GetDisplayNameFromPath(string filePath)
{
// Check there's something to act upon
if (filePath.Length > 0)
{
// File name without extension
string FileNameWithoutExtension = Path.GetFileNameWithoutExtension(filePath);

// Make replacements
string displayName = NameSpaceToDisplayName(FileNameWithoutExtension);

// Return proper Display Name
return displayName;
}

// Return empty string by default
return String.Empty;
}

/// <summary>
/// Changes a display name to namespace
/// </summary>
private string DisplayNameToNameSpace(string displayName)
{
// Check strings are there
if (displayName.Length > 0)
{
// Match with regular expression
MatchCollection matches = Regex.Matches(displayName, @"[^a-zA-Z0-9_]");

// Walk reversed
for (int i = matches.Count - 1; i >= 0; i--)
{
// Handle space
if (matches[i].Value == " ")
{
// Remove original
displayName = displayName.Remove(matches[i].Index, 1);

// Insert replacement
displayName = displayName.Insert(matches[i].Index, "__");

// Next iteration
continue;
}

// Set encoding
UTF32Encoding encoding = new UTF32Encoding();

// Get current bytes
byte[] bytes = encoding.GetBytes(matches[i].Value.ToCharArray());

// Remove original
displayName = displayName.Remove(matches[i].Index, 1);

// Insert replacement
displayName = displayName.Insert(matches[i].Index, "_" + BitConverter.ToInt32(bytes, 0).ToString() + "_");
}

// Return processed display name
return displayName;
}

// Return empty string by default
return String.Empty;
}

/// <summary>
/// Changes namespace to display name by naming convention
/// </summary>
/// <param name="nameSpace">string Passed namespace</param>
/// <returns>String with replacements</returns>
private string NameSpaceToDisplayName(string nameSpace)
{
// Match with regular expression
MatchCollection matches = Regex.Matches(nameSpace, @"_[0-9]+_");

// Walk reversed
for (int i = matches.Count - 1; i >= 0; i--)
{
/* Validate odd underscores */

// Counter
int count = 0;

// Get underscores
for (int j = matches[i].Index; j >= 0; j--)
{
// Check for non-underscore
if (nameSpace[j].ToString() != "_")
{
// Halt flow
break;
}

// Rise counter
count++;
}

// Check for odd
if ((count % 2) == 0)
{
// Move to next iteration
continue;
}

// Convert
try
{
// Declare
Int32 int32Val;

// Parse from string
if (Int32.TryParse(matches[i].Value.Replace("_", ""), NumberStyles.Integer, null, out int32Val))
{
// Remove original
nameSpace = nameSpace.Remove(matches[i].Index, matches[i].Length);

// Insert replacement
nameSpace = nameSpace.Insert(matches[i].Index, char.ConvertFromUtf32(int32Val).ToString());
}
}
catch (Exception e)
{
// Let is fall through
}
}

// Replace double-space with single
nameSpace = nameSpace.Replace("__", " ");

// Processed namespace back
return nameSpace;
}

/// <summary>
/// Converts passed string's first letter to uppercase
/// </summary>
/// <param name="text">String to work with</param>
/// <returns>String with first letter in uppercase and the rest in lowercase</returns>
private string UpperFirst(string text)
{
// Check there's something to work with
if (text.Length > 1)
{
// Make title case
text = text[0].ToString().ToUpper() + text.Substring(1).ToLower();
}

// Return
return text;
}

/// <summary>
/// The entry point of the program, where the program control starts and ends.
/// </summary>
[STAThread]
public static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
}
}
}

Email/Paypal: betselectiongmail.com
-- Victor

VLS

Code (csharp) Select
//
//  Modules.cs
//
//  Author:
//       Victor L. Senior <betselection﹫gmail.com>
//
//  Website:
//       [url]http://betselection.cc[/url]
//
//  Copyright (c) 2014 Victor L. Senior
//
//  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 3 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, see <http://www.gnu.org/licenses/>.

using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;

namespace BetSoftware_Loader
{
   /// <summary>
   /// Keeps track of modules
   /// </summary>
   public static class Modules
   {
      /// <summary>
      /// Utilities class
      /// </summary>
      public static class Utilities
      {
         /* Dictionary to hold Assemblies */
         // Variable
         private static Dictionary<string, Assembly> _Dict = new Dictionary<string, Assembly>();
         // Property
         public static Dictionary<string, Assembly> Dict
         {
            get { return _Dict; }
            set { _Dict = value; }
         }
         /* List to hold an ordered representation of module names */
         // Variable
         private static List<string> _List = new List<string>();
         // Property
         public static List<string> List
         {
            get { return _List; }
            set { _List = value; }
         }
      }

      /// <summary>
      /// Input class
      /// </summary>
      public static class Input
      {
         /* Dictionary to hold Assemblies */
         // Variable
         private static Dictionary<string, Assembly> _Dict = new Dictionary<string, Assembly>();
         // Property
         public static Dictionary<string, Assembly> Dict
         {
            get { return _Dict; }
            set { _Dict = value; }
         }
         /* List to hold an ordered representation of module names */
         // Variable
         private static List<string> _List = new List<string>();
         // Property
         public static List<string> List
         {
            get { return _List; }
            set { _List = value; }
         }
      }

      /// <summary>
      /// Bet Selection class
      /// </summary>
      public static class BS
      {
         /* Dictionary to hold Assemblies */
         // Variable
         private static Dictionary<string, Assembly> _Dict = new Dictionary<string, Assembly>();
         // Property
         public static Dictionary<string, Assembly> Dict
         {
            get { return _Dict; }
            set { _Dict = value; }
         }
         /* List to hold an ordered representation of module names */
         // Variable
         private static List<string> _List = new List<string>();
         // Property
         public static List<string> List
         {
            get { return _List; }
            set { _List = value; }
         }
      }

      /// <summary>
      /// Money Management class
      /// </summary>
      public static class MM
      {
         /* Dictionary to hold Assemblies */
         // Variable
         private static Dictionary<string, Assembly> _Dict = new Dictionary<string, Assembly>();
         // Property
         public static Dictionary<string, Assembly> Dict
         {
            get { return _Dict; }
            set { _Dict = value; }
         }
         /* List to hold an ordered representation of module names */
         // Variable
         private static List<string> _List = new List<string>();
         // Property
         public static List<string> List
         {
            get { return _List; }
            set { _List = value; }
         }
      }

      /// <summary>
      /// Display class
      /// </summary>
      public static class Display
      {
         /* Dictionary to hold Assemblies */
         // Variable
         private static Dictionary<string, Assembly> _Dict = new Dictionary<string, Assembly>();
         // Property
         public static Dictionary<string, Assembly> Dict
         {
            get { return _Dict; }
            set { _Dict = value; }
         }
         /* List to hold an ordered representation of module names */
         // Variable
         private static List<string> _List = new List<string>();
         // Property
         public static List<string> List
         {
            get { return _List; }
            set { _List = value; }
         }
      }

      /// <summary>
      /// Output class
      /// </summary>
      public static class Output
      {
         /* Dictionary to hold Assemblies */
         // Variable
         private static Dictionary<string, Assembly> _Dict = new Dictionary<string, Assembly>();
         // Property
         public static Dictionary<string, Assembly> Dict
         {
            get { return _Dict; }
            set { _Dict = value; }
         }
         /* List to hold an ordered representation of module names */
         // Variable
         private static List<string> _List = new List<string>();
         // Property
         public static List<string> List
         {
            get { return _List; }
            set { _List = value; }
         }
      }

      /// <summary>
      /// Loop class (For input modules)
      /// </summary>
      public static class Loop
      {
         /* List to hold an ordered representation of module names */
         // Variable
         private static List<string> _List = new List<string>();
         // Property
         public static List<string> List
         {
            get { return _List; }
            set { _List = value; }
         }
      }
   }
}


Code (csharp) Select
//
//  Comm.cs
//
//  Author:
//       Victor L. Senior <betselection﹫gmail.com>
//
//  Website:
//       [url]http://betselection.cc[/url]
//
//  Copyright (c) 2014 Victor L. Senior
//
//  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 3 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, see <http://www.gnu.org/licenses/>.
//
using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
using System.Windows.Forms;

namespace BetSoftware_Loader
{
   public static class Comm
   {
      /// <summary>
      /// Receive message
      /// </summary>
      public static string Receive(string sender, string type, string msg)
      {
         /*          Receive event */

         // Check type
         switch (type)
         {
         // Input
            case "input":

               // Set last hand
               Data.Last = msg;

               /*                Set loop modules */
               if (msg == "-L")
               {
                  // Check if sender is NOT present on list
                  if (!Modules.Loop.List.Contains(sender))
                  {
                     // Add it
                     Modules.Loop.List.Add(sender);
                  }
                  else
                  {
                     // Remove it
                     Modules.Loop.List.Remove(sender);
                  }
               }

               /*                Broadcast */

               // Bet Selection
               foreach (string ns in Modules.BS.List)
               {
                  // Send message (TODO Parse messages)
                  Comm.Send(ns, "bs", Data.Last + Environment.NewLine + Data.Bet);
               }

               // Money Management
               foreach (string ns in Modules.MM.List)
               {
                  // Send message (TODO Parse messages)
                  Comm.Send(ns, "mm", Data.Last + Environment.NewLine + Data.Bet);
               }

               // Display
               foreach (string ns in Modules.Display.List)
               {
                  // Send message (TODO Parse messages)
                  Comm.Send(ns, "display", Data.Last + Environment.NewLine + Data.Bet);
               }

               // Output
               foreach (string ns in Modules.Output.List)
               {
                  // Send message (TODO Parse messages)
                  Comm.Send(ns, "output", Data.Last + Environment.NewLine + Data.Bet);
               }

               // Input: Registered for loop
               foreach (string ns in Modules.Output.List)
               {
                  // Send message (TODO Parse messages)
                  Comm.Send(ns, "input", "-L");
               }

               // Halt flow
               break;

         // Bet Selection
            case "bs":

               // Halt flow
               break;

         // Money Management
            case "MM":

               // Halt flow
               break;

         // Display
            case "display":

               // Halt flow
               break;

         // Output
            case "output":

               // Halt flow
               break;

         // Everything else
            default:

               // Nothing to do
               return string.Empty;
         }

         // OK signal
         return "-K";
      }

      /// <summary>
      /// Send message
      /// </summary>
      public static string Send(string target, string type, string msg)
      {
         /*          Retrieve assembly */

         // Declare it
         Assembly Asm = null;

         // Check type
         switch (type)
         {
         // Input
            case "input":

               // Set Assembly
               Asm = Modules.Input.Dict[target];

               break;

         // Bet Selection
            case "bs":

               // Set Assembly
               Asm = Modules.BS.Dict[target];

               break;

         // Money Management
            case "mm":

               // Set Assembly
               Asm = Modules.MM.Dict[target];

               break;

         // Display
            case "display":

               // Set Assembly
               Asm = Modules.Display.Dict[target];

               break;

         // Output
            case "output":

               // Set Assembly
               Asm = Modules.Output.Dict[target];

               break;

         // Everything else
            default:
               // Nothing to do
               return string.Empty;

         }

         /*          Send the actual message */

         // Try to send message
         try
         {
            // Send
            object ret = Asm.GetType(target + ".Comm").GetMethod("Receive", BindingFlags.Static | BindingFlags.Public).Invoke(null, new object[]
            {
               "BetSoftware_Loader",
               "loader",
               msg
            }
                         );

            // Return
            return (string)ret;
         }
         catch (Exception)
         {
            // Let it fall through
         }

         return string.Empty;
      }
   }
}


Code (csharp) Select
//
//  Data.cs
//
//  Author:
//       Victor L. Senior <betselection﹫gmail.com>
//
//  Copyright (c) 2014 Victor L. Senior
//
//  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 3 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, see <http://www.gnu.org/licenses/>.
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Reflection;
using System.Text;

namespace BetSoftware_Loader
{
   public static class Data
   {
      /*         NameSpace */
      // Variable
      private static string _NameSpace = MethodBase.GetCurrentMethod().DeclaringType.ToString().Split('.')[0];
      // Property
      public static string NameSpace
      {
         get { return _NameSpace; }
         set { _NameSpace = value; }
      }
      /*         Game */
      // Variable
      private static string _Game;
      // Property
      public static string Game
      {
         get { return _Game; }
         set { _Game = value; }
      }
      /*         Mode */
      // Variable
      private static string _Mode;
      // Property
      public static string Mode
      {
         get { return _Mode; }
         set { _Mode = value; }
      }
      /*         Last */
      // Variable
      private static string _Last;
      // Property
      public static string Last
      {
         get { return _Last; }
         set { _Last = value; }
      }
      /*         Bet */
      // Variable
      private static string _Bet;
      // Property
      public static string Bet
      {
         get { return _Bet; }
         set { _Bet = value; }
      }
      /*         Messages */
      // Variable
      private static List<KeyValuePair<string, string>> _Msg = new List<KeyValuePair<string,string>>();
      // Property
      public static List<KeyValuePair<string, string>> Msg
      {
         get { return _Msg; }
         set { _Msg = value; }
      }
      /*         Icon */
      // Variable
      private static Icon _Icon;
      // Property
      public static Icon Icon
      {
         get { return _Icon; }
         set { _Icon = value; }
      }
   }
}

Email/Paypal: betselectiongmail.com
-- Victor