Inheritance: System.Windows.Forms.Form
 public frmTsk_Booking_Step1(frmMain afrmMain, string codeRoom, int CustomerType)
 {
     InitializeComponent();
     this.afrmMain = afrmMain;
     this.codeRoom = codeRoom;
     this.CustomerType = CustomerType;
 }
 //Hiennv  25/11/2014
 public frmTsk_BookingForRoom(frmMain afrmMain, string codeRoom, int customerType)
 {
     InitializeComponent();
     this.afrmMain = afrmMain;
     this.aCurrent_CodeRoom = codeRoom;
     this.customerType = customerType;
 }
Exemple #3
0
        public AddinsController(frmMain mainFormView, VideoController videoController)
        {
            m_VideoController = videoController;
            m_MainForm = mainFormView;

            m_AddinManager = new AddinManager(mainFormView, videoController);
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            studentInfo st_Info = new studentInfo();
            int count = st_Info.getTemCount();
            frmMain frm_M = new frmMain();
            frmStudentRegistation frm_Reg = new frmStudentRegistation();

            try
            {
                if (st_Info.add_StudentData() && st_Info.delete_TempData())
                {
                    DialogResult dResult = MessageBox.Show("Records added successfully.", systemMessage.MESSAGEBOXTITLE_SUCCESS, MessageBoxButtons.OK, MessageBoxIcon.Information);

                    if (dResult == DialogResult.OK)
                    {

                        frmStuden_Details frm_Stdetail = new frmStuden_Details();

                        frmMain frm_M1 = new frmMain();
                        frm_Stdetail.MdiParent = frm_M1;
                        frm_M1.mainPanel.Controls.Clear();
                        frm_M1.mainPanel.Controls.Add(frm_Stdetail);
                        frm_M1.mainPanel.Dock = DockStyle.Fill;
                        frm_Stdetail.Show();
                        this.Close();
                        fill_DataGried();

                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(systemMessage.TEMP_INSERT, systemMessage.MESSAGEBOXTITLE, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemple #5
0
 public void BtnOK_Click(object sender, EventArgs e)
 {
     computador = txtPC.Text;
     frmMain frm = new frmMain();
     frm.EnumServices();
     this.Close();
 }
        private static string GenerateTabbedComponentsQuery(frmMain mainWindow, bool filters, QueryPictureSettingsMode mode, int width, int height)
        {
            string query = string.Empty;

            // Output Settings
            query += OutputSettingsQuery(mainWindow);

            // Filters Panel
            if (filters)
                query += FiltersQuery(mainWindow);

            // Picture Settings
            query += PictureSettingsQuery(mainWindow, mode, width, height);

            // Video Settings
            query += VideoSettingsQuery(mainWindow);

            // Audio Settings
            query += AudioSettingsQuery(mainWindow);

            // Subtitles Panel
            query += mainWindow.Subtitles.GetCliQuery;

            // Chapter Markers
            query += ChapterMarkersQuery(mainWindow);

            // X264 Panel
            query += X264Query(mainWindow);

            // Extra Settings
            query += ExtraSettings();

            return query;
        }
        public PowerLogParser(frmMain frm, GameState game_state)
        {
            this.frm_main = frm;
            this.game_state = game_state;

            this.enumerator = this.Process().GetEnumerator();
        }
Exemple #8
0
        public AddinManager(frmMain mainForm, VideoController videoController)
        {
            m_MainForm = mainForm;
            m_VideoController = videoController;

            TrackingServices.RegisterTrackingHandler(new AddinTrackingHandler());
        }
Exemple #9
0
        public MapViewControl(frmMain Owner)
        {
            _Owner = Owner;

            InitializeComponent();

            ListSelect = new ContextMenuStrip();
            ListSelect.ItemClicked += ListSelect_Click;
            ListSelect.Closed += ListSelect_Close;
            UndoMessageTimer = new Timer();
            UndoMessageTimer.Tick += RemoveUndoMessage;

            OpenGLControl = Program.OpenGL1;
            pnlDraw.Controls.Add(OpenGLControl);

            GLInitializeDelayTimer = new Timer();
            GLInitializeDelayTimer.Interval = 50;
            GLInitializeDelayTimer.Tick += GLInitialize;
            GLInitializeDelayTimer.Enabled = true;

            tmrDraw = new Timer();
            tmrDraw.Tick += tmrDraw_Tick;
            tmrDraw.Interval = 1;

            tmrDrawDelay = new Timer();
            tmrDrawDelay.Tick += tmrDrawDelay_Tick;
            tmrDrawDelay.Interval = 30;

            UndoMessageTimer.Interval = 4000;
        }
 public frmTsk_SplitRoom(frmMain afrmMain, int IDBookingRs, int IDBookingRooms)
 {
     InitializeComponent();
     this.afrmMain = afrmMain;
     this.IDBookingRs = IDBookingRs;
     this.IDBookingRooms = IDBookingRooms;
 }
 public frmViewUsers(User u, frmMain mainFrame)
     : this()
 {
     this.user = u;
     this.mainFrame = mainFrame;
     this.cboRole.ItemsSource = System.Enum.GetValues(typeof(EnumRoles));
 }
 //hiennv
 public frmTsk_CheckInGoverment_ForRoomBooking_Step1(frmMain afrmMain,int IDBookingRs, DateTime CheckOutPlan)
 {
     InitializeComponent();
     this.afrmMain = afrmMain;
     this.IDBookingRs = IDBookingRs;
     this.CheckOutPlan = CheckOutPlan;
 }
        static void Main( string[] args )
        {
            string cmdSource = null;
            string cmdConfig = null;

            foreach( string arg in args )
            {
                if( arg == "/autoclose" || arg == "--autoclose" )
                    AutoClose = true;

                else if( arg.StartsWith( "/source:" ) || arg.StartsWith( "--source:" ) )
                    cmdSource = arg.Substring( (arg.StartsWith( "/source:" ) ? 8 : 9) );

                else if( arg.StartsWith( "/config:" ) || arg.StartsWith( "--config:" ) )
                    cmdConfig = arg.Substring( (arg.StartsWith( "/config:" ) ? 8 : 9) );
            }

            FOUpdaterClient updater = new FOUpdaterClient( cmdConfig );

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault( false );

            WindowUpdater = new frmMain( cmdSource );
            WindowUpdater.Text += " v" + FOUpdaterClient.VersionString;

            if( updater.FOnlineCfg == null && cmdSource == null )
            {
                MessageBox.Show(
                    "Cannot find FOnline configuration file in current directory:\n" +
                    Path.GetDirectoryName( Application.ExecutablePath ) + "\n",
                    "FOUpdater",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error
                );

                Environment.Exit( 0 );
            }

            Application.Run( WindowUpdater );

            /*
            if( Installer && File.Exists( ".\\FOConfig.exe" ) )
            {
                DialogResult result = MessageBox.Show(
                    "To finish installation process, you have to\n" +
                    "pleple\n" +
                    "\n" +
                    "Do you wish to run configuration tool?",
                    "Updater",
                    MessageBoxButtons.YesNo,
                    MessageBoxIcon.Information
                );

                if( result == DialogResult.No )
                    Environment.Exit( 0 );
                else
                    Process.Start( ".\\FOConfig.exe" );
            }
            */
        }
 public static void Main(string[] args)
 {
     Application.Init ();
     frmMain win = new frmMain ();
     win.Show ();
     Application.Run ();
 }
Exemple #15
0
 public Game(frmMain owner, Mode GameMode)
 {
     this.endOfGame = false;
     this.NewCards = 5;
     this.GameMode = GameMode;
     this.MStructures = Class.Structure.CreateStructureList(this);
 }
Exemple #16
0
        public static QueueTask GenerateFullQuery(frmMain mainWindow)
        {
            // Create the CLI Query
            string query = string.Empty;
            query += SourceQuery(mainWindow, mainWindow.drop_mode.SelectedIndex, 0, null);
            query += DestinationQuery(mainWindow, QueryEncodeMode.Standard);
            query += GenerateTabbedComponentsQuery(mainWindow, true, QueryPictureSettingsMode.UserInterfaceSettings, 0, 0);

            // Create the Queue Task and setup the EncodeTask model object.
            Preset preset = mainWindow.treeView_presets.SelectedNode.Tag as Preset;
            bool isCustom = true;
            if (preset != null && preset.IsBuildIn)
            {
                isCustom = false;
            }

            EncodeTask task = CreateEncodeTaskObject(mainWindow);
            QueueTask queueTask = new QueueTask(query)
            {
                Source = task.Source,
                Destination = task.Destination,
                Title = mainWindow.GetTitle(),
                CustomQuery = (mainWindow.rtf_query.Text != string.Empty) || isCustom,
                Task = task,
                Query = query,
            };

            return queueTask;
        }
        public EntityChoicesParser(frmMain frm, GameState game_state)
        {
            this.frm_main = frm;
            this.game_state = game_state;

            this.enumerator = this.Process().GetEnumerator();
        }
 private void frmSearchStudents_FormClosing( object sender, FormClosingEventArgs e )
 {
     if ( ! this._openFicha )
     {
         frmMain main = new frmMain( this._data );
         main.Show();
     }
 }
 private void frmInitialMessage_FormClosing( object sender, FormClosingEventArgs e )
 {
     if ( ! this._isNext )
     {
         frmMain main = new frmMain( this._data );
         main.Show();
     }
 }
 //Hiennv  26/11/2014
 public frmTsk_CheckInForRoomBooking(frmMain afrmMain, int IDBookingR,DateTime CheckoutPlan)
 {
     InitializeComponent();
     this.afrmMain = afrmMain;
     this.IDBookingR = IDBookingR;
     this.CheckoutPlan = CheckoutPlan;
     this.aCheckInEN = this.InitData(this.IDBookingR);
 }
 private void frmFindAlumno_FormClosing( object sender, FormClosingEventArgs e )
 {
     if( ! this._closeInProcesses )
     {
         frmMain main = new frmMain( this._data );
         main.Show();
     }
 }
Exemple #22
0
        public static string GenerateQueryForPreset(frmMain mainWindow, QueryPictureSettingsMode mode, bool filters, int width, int height)
        {
            string query = string.Empty;

            query += GenerateTabbedComponentsQuery(mainWindow, filters, mode, width, height);

            return query;
        }
Exemple #23
0
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            frmMain myForm = new frmMain(args);

            if (args.Length == 0)
                Application.Run(myForm);
        }
Exemple #24
0
        public VideoController(frmMain mainForm)
        {
            this.mainForm = mainForm;

            cameraImageHelper = new CameraImage();

            running = true;
            ThreadPool.QueueUserWorkItem(new WaitCallback(DisplayVideoFrames));
        }
 //Hiennv
 public frmTsk_Payment_Step1(frmMain afrmMain, int IDBookingR, int CustomerType, DateTime CheckInPlan, DateTime CheckOutPlan)
 {
     InitializeComponent();
     this.afrmMain = afrmMain;
     this.IDBookingR = IDBookingR;
     this.CustomerType = CustomerType;
     this.CheckInPlan = CheckInPlan;
     this.CheckOutPlan = CheckOutPlan;
 }
        public VideoFrameInteractionController(frmMain mainForm, VideoRenderingController videoRenderingController)
        {
            m_VideoRenderingController = videoRenderingController;

            m_MainForm = mainForm;
            m_MainForm.picVideoFrame.MouseDown +=picVideoFrame_MouseClick;

            TrackingContext.Current.Reset();
        }
Exemple #27
0
        private void btnLogin_Click(object sender, RoutedEventArgs e)
        {
            if (txtUserID.Text.Trim().Length == 0)
            {
                MessageBox.Show("Please enter your user id", "Invalid Input", MessageBoxButton.OK,
                    MessageBoxImage.Exclamation);
                return;
            }

            if (txtPassword.Password.Trim().Length == 0)
            {
                MessageBox.Show("Please enter your password!", "Invalid Input", MessageBoxButton.OK,
                    MessageBoxImage.Exclamation);
                return;
            }

            if (String.Compare(txtSvAddr.Text.Trim(), ConfigHelper.GetEndpointAddress(), true) != 0)
            {
                ConfigHelper.SaveEndpointAddress(txtSvAddr.Text.Trim());
            }

            AdminHelper client = new AdminHelper();
            try
            {
                Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
                KeyValueConfigurationCollection settings = config.AppSettings.Settings;

                settings["timeout"].Value = client.GetClientTimeOut().ToString();

                config.Save(ConfigurationSaveMode.Modified);
                //relaod the section you modified
                ConfigurationManager.RefreshSection(config.AppSettings.SectionInformation.Name);

                //User u = client.Authenticate(txtUserID.Text.Trim(), txtPassword.Password);
                Credentials c = new Credentials();
                c.UserID = txtUserID.Text.Trim();
                c.Password = Helper.KeyGen.Encrypt(txtPassword.Password);

                User u = client.SecureAuthenticate(c);
                var admForm = new frmMain(u, this);
                this.Visibility = Visibility.Collapsed;
                this.txtPassword.Clear();
                this.txtUserID.Clear();
                this.txtUserID.Focus();
                admForm.Show();

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                client.Close();  // Always close the client.
            }
        }
Exemple #28
0
 public void CreateProject(frmMain frm)
 {
     if (frm.UiStatus != UIStatusEnum.EMPTY && frm.UiStatus != UIStatusEnum.CLOSE)
     {
         if (isSave(frm))
         {
             SaveProject(frm);
         }
     }
 }
        public LongOperationsManager(frmMain parentForm, VideoController videoController)
        {
            m_BlockUIForm = new frmLongRunningOperation();
            IntPtr handleHack = m_BlockUIForm.Handle;
            Trace.WriteLine("BlockUI Initialised: " + handleHack.ToInt32());

            m_VideoController = videoController;
            m_MainForm = parentForm;
            m_MainFormHandle = parentForm.Handle;
            m_BlockUIForm.Initialise(m_MainForm);
        }
Exemple #30
0
        public VideoFileView(frmMain mainForm)
        {
            m_MainForm = mainForm;

            m_ExtraWidth = m_MainForm.Width - m_MainForm.pictureBox.Width + 1;
            m_ExtraHeight = m_MainForm.Height - m_MainForm.pictureBox.Height + 1;

            Version tangraVersion = Assembly.GetExecutingAssembly().GetName().Version;
            bool isBeta = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(BetaReleaseAttribute), false).Length == 1;
            m_TangraDisplayVersion = string.Format("v{0}.{1}{2}", tangraVersion.Major, tangraVersion.Minor, isBeta ? " BETA" : "");
        }
        /// <summary>
        /// Charge le formulaire principal.
        /// </summary>
        public void loadMainForm()
        {
            frmMain = new frmMain(this);

            frmMain.ShowDialog();
        }
 private static string FiltersQuery(frmMain mainWindow)
 {
     return(mainWindow.Filters.GetCliQuery);
 }
        /// <summary>
        /// Create the EncodeTask model from the currently selected control options.
        /// </summary>
        /// <param name="frmMain">
        /// The frm main.
        /// </param>
        /// <returns>
        /// An EncodeTask Object
        /// </returns>
        private static EncodeTask CreateEncodeTaskObject(frmMain frmMain)
        {
            EncodeTask task = new EncodeTask();

            // Source, Destination and Output Settings
            task.Destination = frmMain.text_destination.Text;
            string sourcePath = frmMain.selectedTitle != null && File.Exists(frmMain.selectedTitle.SourceName)
                             ? frmMain.selectedTitle.SourceName.Trim()
                             : frmMain.sourcePath;

            if (!string.IsNullOrEmpty(sourcePath) && sourcePath.Trim() != "Select \"Source\" to continue")
            {
                task.Source = sourcePath;
            }

            if (frmMain.drp_dvdtitle.Text != string.Empty)
            {
                string[] titleInfo = frmMain.drp_dvdtitle.Text.Split(' ');
                int      title;
                int.TryParse(titleInfo[0], out title);
                task.Title = title;
            }


            int start, end, angle;

            int.TryParse(frmMain.drop_chapterStart.Text, out start);
            int.TryParse(frmMain.drop_chapterFinish.Text, out end);
            int.TryParse(frmMain.drop_angle.Text, out angle);
            task.StartPoint = start;
            task.EndPoint   = end;
            task.Angle      = angle;

            switch (frmMain.drop_mode.SelectedIndex)
            {
            case 0:     // Chapters
                task.PointToPointMode = PointToPointMode.Chapters;
                break;

            case 1:     // Seconds
                task.PointToPointMode = PointToPointMode.Seconds;
                break;

            case 2:     // Frames
                task.PointToPointMode = PointToPointMode.Frames;
                break;

            default:
                break;
            }

            task.OutputFormat = EnumHelper <OutputFormat> .GetValue(frmMain.drop_format.Text.Replace(" File", string.Empty).Trim());

            task.LargeFile     = frmMain.check_largeFile.Checked;
            task.IPod5GSupport = frmMain.check_largeFile.Checked;
            task.OptimizeMP4   = frmMain.check_optimiseMP4.Checked;

            // Picture Settings
            int width, height;

            int.TryParse(frmMain.PictureSettings.crop_top.Text, out width);
            int.TryParse(frmMain.PictureSettings.crop_top.Text, out height);
            task.Width  = width;
            task.Height = height;
            int top, bottom, left, right;

            int.TryParse(frmMain.PictureSettings.crop_top.Text, out top);
            int.TryParse(frmMain.PictureSettings.crop_top.Text, out bottom);
            int.TryParse(frmMain.PictureSettings.crop_top.Text, out left);
            int.TryParse(frmMain.PictureSettings.crop_top.Text, out right);
            task.Cropping = new Cropping(top, bottom, left, right);

            int modulus, displayWidth, parX, parY;

            int.TryParse(frmMain.PictureSettings.drp_modulus.SelectedItem.ToString(), out modulus);
            int.TryParse(frmMain.PictureSettings.updownDisplayWidth.Text, out displayWidth);
            int.TryParse(frmMain.PictureSettings.updownParWidth.Text, out parX);
            int.TryParse(frmMain.PictureSettings.updownParHeight.Text, out parY);
            switch (frmMain.PictureSettings.drp_anamorphic.SelectedIndex)
            {
            case 0:
                task.Anamorphic = Anamorphic.None;
                task.Modulus    = modulus;
                break;

            case 1:
                task.Anamorphic = Anamorphic.Strict;
                break;

            case 2:
                task.Anamorphic = Anamorphic.Loose;
                task.Modulus    = modulus;
                break;

            case 3:
                task.Anamorphic        = Anamorphic.Custom;
                task.Modulus           = modulus;
                task.DisplayWidth      = displayWidth;
                task.KeepDisplayAspect = frmMain.PictureSettings.check_KeepAR.Checked;
                task.PixelAspectX      = parX;
                task.PixelAspectY      = parY;
                break;
            }

            // Filter Settings
            task.Deblock           = frmMain.Filters.Deblock;
            task.Decomb            = frmMain.Filters.Decomb;
            task.CustomDecomb      = frmMain.Filters.CustomDecombValue;
            task.Deinterlace       = frmMain.Filters.Deinterlace;
            task.CustomDeinterlace = frmMain.Filters.CustomDeInterlaceValue;
            task.Deblock           = frmMain.Filters.Deblock;
            task.Denoise           = frmMain.Filters.Denoise;
            task.CustomDenoise     = frmMain.Filters.CustomDenoiseValue;
            task.Detelecine        = frmMain.Filters.Detelecine;
            task.CustomDetelecine  = frmMain.Filters.CustomDeTelecineValue;
            task.Grayscale         = frmMain.Filters.GrayScale;

            // Video Settings
            task.VideoEncoder = EnumHelper <VideoEncoder> .GetValue(frmMain.drp_videoEncoder.Text);

            int videoBitrate;

            int.TryParse(frmMain.text_bitrate.Text, out videoBitrate);
            task.VideoBitrate        = videoBitrate;
            task.VideoEncodeRateType = frmMain.radio_cq.Checked
                                           ? VideoEncodeRateType.ConstantQuality
                                           : VideoEncodeRateType.AverageBitrate;
            task.TwoPass        = frmMain.check_2PassEncode.Checked;
            task.TurboFirstPass = frmMain.check_turbo.Checked;
            double framerate;

            double.TryParse(frmMain.drp_videoFramerate.Text, out framerate);
            task.Framerate     = framerate;
            task.FramerateMode = frmMain.drp_videoFramerate.SelectedIndex == 0
                                     ? (frmMain.radio_constantFramerate.Checked ? FramerateMode.CFR : FramerateMode.VFR)
                                     : (frmMain.radio_constantFramerate.Checked ? FramerateMode.CFR : FramerateMode.PFR);

            if (frmMain.radio_cq.Checked)
            {
                double cqStep = UserSettingService.GetUserSetting <double>(ASUserSettingConstants.X264Step);
                switch (frmMain.drp_videoEncoder.Text)
                {
                case "MPEG-4 (FFmpeg)":
                case "MPEG-2 (FFmpeg)":
                    task.Quality = 31 - (frmMain.slider_videoQuality.Value - 1);
                    break;

                case "H.264 (x264)":
                    double value = 51 - (frmMain.slider_videoQuality.Value * cqStep);
                    task.Quality = Math.Round(value, 2);
                    break;

                case "VP3 (Theora)":
                    task.Quality = frmMain.slider_videoQuality.Value;
                    break;
                }
            }

            // Audio
            task.AudioTracks = new List <AudioTrack>(frmMain.AudioSettings.AudioTracks);

            // Subtitles
            task.SubtitleTracks = new List <SubtitleTrack>(frmMain.Subtitles.SubtitlesList);

            // Chapters
            task.IncludeChapterMarkers = frmMain.Check_ChapterMarkers.Checked;
            task.ChapterNames          = new List <string>();
            foreach (DataGridViewRow row in frmMain.data_chpt.Rows)
            {
                task.ChapterNames.Add(row.Cells[1].Value.ToString());
            }

            // Advanced Options
            task.AdvancedEncoderOptions = X264Query(frmMain).Replace("-x", string.Empty).Trim();

            // Extra Settings
            task.Verbosity        = UserSettingService.GetUserSetting <int>(ASUserSettingConstants.Verbosity);
            task.DisableLibDvdNav = UserSettingService.GetUserSetting <bool>(ASUserSettingConstants.DisableLibDvdNav);

            return(task);
        }
Exemple #34
0
        private void frmSettings_FormClosed(object sender, FormClosedEventArgs e)
        {
            frmMain n = new frmMain();

            n.Refresh();
        }
Exemple #35
0
        public METAboltInstance(bool firstInstance, string[] args)
        {
            SetExceptionReporter();
            Application.ThreadException += new ThreadExceptionHandler().ApplicationThreadException;

            Application.ApplicationExit += new EventHandler(Application_ApplicationExit);

            this.firstInstance = firstInstance;

            //LoadXMLFile(appdir + "\\MuteList.xml");
            LoadGiverItems(appdir + "\\METAgiverItems.xml");

            MakeTPTable();
            CreateLogDir();
            CreateNotesDir();
            CreateSpellingDir();

            client = new GridClient();

            //at this point we have been given: metabolt.exe [firstname] [lastname] [password]
            //so args[0] and args[1] have the necessary name parts
            if (args.Length > 1)
            {
                string full_name = args[0] + "_" + args[1];
                config = new ConfigManager(full_name);
            }
            else
            {
                config = new ConfigManager();
            }

            config.ApplyDefault();

            SetSettings();
            netcom = new SLNetCom(client, this);

            this.rebooted = true;
            startfrombat  = true;

            config.CurrentConfig.FirstName   = args[0].ToString(CultureInfo.CurrentCulture);
            config.CurrentConfig.LastName    = args[1].ToString(CultureInfo.CurrentCulture);
            config.CurrentConfig.PasswordMD5 = args[2].ToString(CultureInfo.CurrentCulture);

            InitializeConfig();

            imageCache = new ImageCache();
            state      = new StateManager(this);

            mainForm = new frmMain(this);
            mainForm.InitializeControls();
            tabsConsole = mainForm.TabConsole;

            if (config.CurrentConfig.AIon)
            {
                //myBot = new AIMLbot.Bot();
                InitAI();
            }

            //InitAI();

            RandomPwd();

            METAbolt_Version = Properties.Resources.METAboltVersion.ToString(CultureInfo.CurrentCulture);
            //mutelist = LoadXMLFile("MuteList.xml");
            //mutelist.PrimaryKey = new DataColumn[] { mutelist.Columns["uuid"] };
        }
Exemple #36
0
        /// <summary>
        /// Function which generates the filename and path automatically based on
        /// the Source Name, DVD title and DVD Chapters
        /// </summary>
        /// <param name="mainWindow">
        /// The main Window.
        /// </param>
        /// <returns>
        /// The Generated FileName
        /// </returns>
        public static string AutoName(frmMain mainWindow)
        {
            string autoNamePath = string.Empty;

            if (mainWindow.drp_dvdtitle.Text != "Automatic")
            {
                // Get the Source Name and remove any invalid characters
                string sourceName = Path.GetInvalidFileNameChars().Aggregate(Path.GetFileNameWithoutExtension(mainWindow.SourceName), (current, character) => current.Replace(character.ToString(), string.Empty));

                // Remove Underscores
                if (UserSettingService.GetUserSetting <bool>(UserSettingConstants.AutoNameRemoveUnderscore))
                {
                    sourceName = sourceName.Replace("_", " ");
                }

                // Switch to "Title Case"
                if (UserSettingService.GetUserSetting <bool>(UserSettingConstants.AutoNameTitleCase))
                {
                    sourceName = sourceName.ToTitleCase();
                }

                // Get the Selected Title Number
                string[] titlesplit = mainWindow.drp_dvdtitle.Text.Split(' ');
                string   dvdTitle   = titlesplit[0].Replace("Automatic", string.Empty);

                // Get the Chapter Start and Chapter End Numbers
                string chapterStart       = mainWindow.drop_chapterStart.Text.Replace("Auto", string.Empty);
                string chapterFinish      = mainWindow.drop_chapterFinish.Text.Replace("Auto", string.Empty);
                string combinedChapterTag = chapterStart;
                if (chapterFinish != chapterStart && chapterFinish != string.Empty)
                {
                    combinedChapterTag = chapterStart + "-" + chapterFinish;
                }

                /*
                 * File Name
                 */
                string destinationFilename;
                if (UserSettingService.GetUserSetting <string>(UserSettingConstants.AutoNameFormat) != string.Empty)
                {
                    destinationFilename = UserSettingService.GetUserSetting <string>(UserSettingConstants.AutoNameFormat);
                    destinationFilename = destinationFilename.Replace("{source}", sourceName)
                                          .Replace("{title}", dvdTitle)
                                          .Replace("{chapters}", combinedChapterTag)
                                          .Replace("{date}", DateTime.Now.Date.ToShortDateString().Replace('/', '-'));
                }
                else
                {
                    destinationFilename = sourceName + "_T" + dvdTitle + "_C" + combinedChapterTag;
                }

                /*
                 * File Extension
                 */
                if (mainWindow.drop_format.SelectedIndex == 0)
                {
                    switch (UserSettingService.GetUserSetting <int>(UserSettingConstants.UseM4v))
                    {
                    case 0:     // Automatic
                        destinationFilename += mainWindow.Check_ChapterMarkers.Checked ||
                                               mainWindow.AudioSettings.RequiresM4V() || mainWindow.Subtitles.RequiresM4V()
                                               ? ".m4v"
                                               : ".mp4";
                        break;

                    case 1:     // Always MP4
                        destinationFilename += ".mp4";
                        break;

                    case 2:     // Always M4V
                        destinationFilename += ".m4v";
                        break;
                    }
                }
                else if (mainWindow.drop_format.SelectedIndex == 1)
                {
                    destinationFilename += ".mkv";
                }

                /*
                 * File Destination Path
                 */

                // If there is an auto name path, use it...
                if (UserSettingService.GetUserSetting <string>(UserSettingConstants.AutoNamePath).Trim().StartsWith("{source_path}") && !string.IsNullOrEmpty(mainWindow.sourcePath))
                {
                    string savedPath     = UserSettingService.GetUserSetting <string>(UserSettingConstants.AutoNamePath).Trim().Replace("{source_path}\\", string.Empty).Replace("{source_path}", string.Empty);
                    string requestedPath = Path.Combine(Path.GetDirectoryName(mainWindow.sourcePath), savedPath);

                    autoNamePath = Path.Combine(requestedPath, destinationFilename);
                    if (autoNamePath == mainWindow.sourcePath)
                    {
                        // Append out_ to files that already exist or is the source file
                        autoNamePath = Path.Combine(Path.GetDirectoryName(mainWindow.sourcePath), "output_" + destinationFilename);
                    }
                }
                else if (UserSettingService.GetUserSetting <string>(UserSettingConstants.AutoNamePath).Contains("{source_folder_name}") && !string.IsNullOrEmpty(mainWindow.sourcePath))
                {
                    // Second Case: We have a Path, with "{source_folder}" in it, therefore we need to replace it with the folder name from the source.
                    string path = Path.GetDirectoryName(mainWindow.sourcePath);
                    if (!string.IsNullOrEmpty(path))
                    {
                        string[] filesArray   = path.Split(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar);
                        string   sourceFolder = filesArray[filesArray.Length - 1];

                        autoNamePath = Path.Combine(UserSettingService.GetUserSetting <string>(UserSettingConstants.AutoNamePath).Replace("{source_folder_name}", sourceFolder), destinationFilename);
                    }
                }
                else if (!mainWindow.text_destination.Text.Contains(Path.DirectorySeparatorChar.ToString()))
                {
                    // Third case: If the destination box doesn't already contain a path, make one.
                    if (UserSettingService.GetUserSetting <string>(UserSettingConstants.AutoNamePath).Trim() != string.Empty &&
                        UserSettingService.GetUserSetting <string>(UserSettingConstants.AutoNamePath).Trim() != "Click 'Browse' to set the default location")
                    {
                        autoNamePath = Path.Combine(UserSettingService.GetUserSetting <string>(UserSettingConstants.AutoNamePath), destinationFilename);
                    }
                    else // ...otherwise, output to the source directory
                    {
                        autoNamePath = null;
                    }
                }
                else // Otherwise, use the path that is already there.
                {
                    // Use the path and change the file extension to match the previous destination
                    autoNamePath = Path.Combine(Path.GetDirectoryName(mainWindow.text_destination.Text), destinationFilename);
                }
            }

            return(autoNamePath);
        }
Exemple #37
0
 public static void HandleUserStatus(Client client, Core.Packets.ClientPackets.UserStatus packet, frmMain mainForm)
 {
     new Thread(new ThreadStart(() =>
     {
         foreach (ListViewItem lvi in mainForm.lstClients.Items)
         {
             Client c = (Client)lvi.Tag;
             if (client == c)
             {
                 mainForm.Invoke((MethodInvoker) delegate
                 {
                     lvi.SubItems[4].Text = packet.Message;
                 });
                 break;
             }
         }
     })).Start();
 }
Exemple #38
0
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            System.Threading.Thread.CurrentThread.CurrentCulture   = System.Globalization.CultureInfo.InvariantCulture;
            System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.InvariantCulture;
            frmMainMenu      = new frmMain();
            frmTemplateEdit  = new frmTemplateEditor();
            frmSetMines      = new frmMines();
            frmSetTowns      = new frmTowns();
            frmObjectsSelect = new frmObjectsPick();
            frmSplash fSplash = new frmSplash();

            frmGuards = new frmPickGuard();
            //Application.Run(frmMainMenu);

            //MessageBox.Show(args[0]);
            if (args.Length > 0)
            {
                if (args[0] == "/?" || args.Length < 5)
                {
                    //IntPtr ptr = GetForegroundWindow();
                    //int u;
                    //GetWindowThreadProcessId(ptr, out u);
                    //Process process = Process.GetProcessById(u);
                    //AttachConsole(process.Id);

                    System.Console.WriteLine("Homm5RMG Тип_генерации PL1=Раса_игрока_1[(Exc(исключаемые расы через запятую))]");
                    System.Console.WriteLine("                       PL2=Раса_игрока_2[(Exc(исключаемые расы через запятую))]");
                    System.Console.WriteLine("                      [PL3=Раса_игрока_3[(Exc(исключаемые расы через запятую))]]");
                    System.Console.WriteLine("                      [PL4=Раса_игрока_4[(Exc(исключаемые расы через запятую))]]");
                    System.Console.WriteLine("         Template=Полное_имя_файла_шаблона | DirTemplate = Полное_имя_каталога_шаблона");
                    System.Console.WriteLine("         Path=Папка_сохранения_карты");
                    System.Console.WriteLine("         [Dwelling=Standart|Random|Extented]");
                    System.Console.WriteLine("         [Syze=Размер]");
                    System.Console.WriteLine("         [Name=Имя_для_карты]");
                    System.Console.WriteLine("         [HaosWeek=1 | 0]");
                    System.Console.WriteLine("         [Diff=1 | 0]");
                    System.Console.WriteLine("Тип генерации: 1 = 1 vs 1");
                    System.Console.WriteLine("               2 = 1 vs 1 vs 1");
                    System.Console.WriteLine("               3 = 1 vs 1 vs 1 vs 1");
                    System.Console.WriteLine("               4 = 1 + 1 vs 1 + 1(парная)");
                    System.Console.WriteLine("Раса_игрока_X: 0 - random");
                    System.Console.WriteLine("               1 - Haven");
                    System.Console.WriteLine("               2 - Sylvan");
                    System.Console.WriteLine("               3 - dungeon");
                    System.Console.WriteLine("               4 - inferno");
                    System.Console.WriteLine("               5 - fortress");
                    System.Console.WriteLine("               6 - stronghold");
                    System.Console.WriteLine("               7 - Academy");
                    System.Console.WriteLine("               8 - Necro");
                    System.Console.WriteLine("Exc(исключаемые расы через запятую):Только для Расы Random можно указать исключаемые расы(1-8)");
                    System.Console.WriteLine("Template = путь с шаблоном");
                    System.Console.WriteLine("DirTemplate = путь с папкой шаблонов");
                    System.Console.WriteLine("Размер: Medium");
                    System.Console.WriteLine("        Small");
                    System.Console.WriteLine("        Tiny");
                    System.Console.WriteLine("        Impossible");
                    System.Console.WriteLine("        Huge         default");
                    System.Console.WriteLine("        ExtraLarge");
                    System.Console.WriteLine("        Large");
                    System.Console.WriteLine("Dwelling по умолчанию Random");
                    System.Console.WriteLine("Name - по умолчанию имя карты генерируется");
                    System.Console.WriteLine("HaosWeek по умолчанию - 0=нет");
                    System.Console.WriteLine("Diff Differnt Faction, по умолчанию - 1=да");
                    System.Console.WriteLine("");
                    System.Console.WriteLine("Примеры: Homm5RMG 1 PL1=1 PL2=7 Template=c:\\hmm\\irmg\\hugetemplate\\mask.irt Path=c:\\hmm\\maps Name=moz_vs_dwp1");
                    System.Console.WriteLine("         Homm5RMG 1 PL1=0 PL2=0 DirTemplate=c:\\hmm\\irmg\\hugetemplate Path=c:\\hmm\\maps Name=moz_vs_dwp2");
                    System.Console.WriteLine("         Homm5RMG 1 PL1=0 PL2=0 DirTemplate=c:\\hmm\\irmg\\hugetemplate Path=c:\\hmm\\maps Name=moz_vs_dwp2 Diff=0");
                    System.Console.WriteLine("         Homm5RMG 1 PL1=0(Exc(6, 8)) PL2=0(Exc(3, 8)) DirTemplate=c:\\hmm\\irmg\\hugetemplate Path=c:\\hmm\\maps Name=moz_vs_dwp3");
                    System.Console.WriteLine("         Homm5RMG 1 PL1=1 PL2=0(Exc(3, 8)) DirTemplate=c:\\hmm\\irmg\\hugetemplate Path=c:\\hmm\\maps");
                    return;
                }
                // переменные для разбора строки параметров
                string tmpstr1 = "", tmpstr2 = "", tmpstr3 = "0", tmpstr4 = "0",
                       tmpstr5 = "", tmpstr6 = "", tmpstr7 = "", tmpstr8 = "",
                       tmpstr9 = "Huge", tmpstr10 = "Random", tmpstr11 = "0";
                string[] list1, list2, list3, list4;                                                               //списки Exc в командной строке
                int[]    exc1 = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 }, exc2 = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 }, // преобразованые исключения рас для генерации
                exc3 = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 }, exc4 = new int[] { 0, 0, 0, 0, 0, 0, 0, 0 };
                int  delta = 0;
                bool set1 = false, set2 = true, set3 = true, set4 = false;

                if (args[0] == "4" || args[0] == "3")
                {
                    tmpstr4 = args[4].Split('=')[0];
                    tmpstr3 = args[3].Split('=')[0];
                    delta   = 2;
                }
                if (args[0] == "2")
                {
                    tmpstr3 = args[3].Split('=')[0];
                    delta   = 1;
                }
                tmpstr1 = args[1].Split('=')[0];
                tmpstr2 = args[2].Split('=')[0];
                if ((args[0] != "1") & (args[0] != "2") & (args[0] != "3") & (args[0] != "4"))
                {
                    System.Console.WriteLine("Неверный вызов, используйте /? для получения справки.");
                    return;
                }
                if (string.Compare(tmpstr1, "PL1") == 0)
                {
                    tmpstr1 = args[1].Split('=')[1];
                    if (tmpstr1.IndexOf("Exc(") >= 0)
                    {
                        list1 = tmpstr1.Substring(tmpstr1.IndexOf("Exc(") + 4).Replace(")", "").Split(',');
                        for (int i = 0; i < list1.Length; i++)
                        {
                            exc1[Convert.ToInt32(list1[i]) - 1] = 1;
                        }
                        tmpstr1 = tmpstr1.Split('(')[0];
                        if (tmpstr1 != "0")
                        {
                            System.Console.WriteLine("Неверный вызов, используйте /? для получения справки."); return;
                        }
                    }
                }
                else
                {
                    System.Console.WriteLine("Неверный вызов, используйте /? для получения справки.");
                    return;
                }
                if (string.Compare(tmpstr2, "PL2") == 0)
                {
                    tmpstr2 = args[2].Split('=')[1];
                    if (tmpstr2.IndexOf("Exc(") >= 0)
                    {
                        list2 = tmpstr2.Substring(tmpstr2.IndexOf("Exc(") + 4).Replace(")", "").Split(',');
                        for (int i = 0; i < list2.Length; i++)
                        {
                            exc2[Convert.ToInt32(list2[i]) - 1] = 1;
                        }
                        tmpstr2 = tmpstr2.Split('(')[0];
                        if (tmpstr2 != "0")
                        {
                            System.Console.WriteLine("Неверный вызов, используйте /? для получения справки."); return;
                        }
                    }
                }
                if (string.Compare(tmpstr3, "PL3") == 0)
                {
                    tmpstr3 = args[3].Split('=')[1];
                    if (tmpstr3.IndexOf("Exc(") >= 0)
                    {
                        list3 = tmpstr3.Substring(tmpstr3.IndexOf("Exc(") + 4).Replace(")", "").Split(',');
                        for (int i = 0; i < list3.Length; i++)
                        {
                            exc3[Convert.ToInt32(list3[i]) - 1] = 1;
                        }
                        tmpstr3 = tmpstr3.Split('(')[0];
                        if (tmpstr3 != "0")
                        {
                            System.Console.WriteLine("Неверный вызов, используйте /? для получения справки."); return;
                        }
                    }
                }
                if (string.Compare(tmpstr4, "PL4") == 0)
                {
                    tmpstr4 = args[4].Split('=')[1];
                    if (tmpstr4.IndexOf("Exc(") >= 0)
                    {
                        list4 = tmpstr4.Substring(tmpstr3.IndexOf("Exc(") + 4).Replace(")", "").Split(',');
                        for (int i = 0; i < list4.Length; i++)
                        {
                            exc4[Convert.ToInt32(list4[i]) - 1] = 1;
                        }
                        tmpstr4 = tmpstr4.Split('(')[0];
                        if (tmpstr4 != "0")
                        {
                            System.Console.WriteLine("Неверный вызов, используйте /? для получения справки."); return;
                        }
                    }
                }
                switch (args[3 + delta].Split('=')[0])
                {
                case "Template":
                    tmpstr5 = args[3 + delta].Split('=')[1];
                    set1    = false;
                    break;

                case "DirTemplate":
                    tmpstr5 = args[3 + delta].Split('=')[1];
                    set1    = true;
                    break;

                default:
                    System.Console.WriteLine("Неверный вызов, используйте /? для получения справки.");
                    return;
                }
                if (string.Compare(args[4 + delta].Split('=')[0], "Path") == 0)
                {
                    tmpstr7 = args[4 + delta].Split('=')[1];
                }
                else
                {
                    System.Console.WriteLine("Неверный вызов, используйте /? для получения справки.");
                    return;
                }

                // перебираем оставщиеся необязательные параметры командной строки
                for (int i = 0; i < args.Length - delta - 5; i++)
                {
                    switch (args[5 + delta + i].Split('=')[0])
                    {
                    case "Dwelling":
                        tmpstr10 = args[5 + delta + i].Split('=')[1];
                        break;

                    case "Syze":
                        tmpstr9 = args[5 + delta + i].Split('=')[1];
                        break;

                    case "Name":
                        tmpstr6 = args[5 + delta + i].Split('=')[1];
                        set2    = false;
                        break;

                    case "HaosWeek":
                        set4 = Convert.ToInt32(args[5 + delta + i].Split('=')[1]) == 1;
                        break;

                    case "Diff":
                        set3 = Convert.ToInt32(args[5 + delta + i].Split('=')[1]) != 1;
                        break;

                    case "RandomSeed":
                        tmpstr11 = args[5 + delta + i].Split('=')[1];
                        break;

                    default:
                        System.Console.WriteLine("Неверный вызов, используйте /? для получения справки.");
                        return;
                    }
                }
                // запуск генерации без графики
                try
                {
                    frmMainMenu.Console_DoWork(Convert.ToInt32(args[0]),
                                               Convert.ToInt32(tmpstr1), exc1, Convert.ToInt32(tmpstr2), exc2,
                                               Convert.ToInt32(tmpstr3), exc3, Convert.ToInt32(tmpstr4), exc4,
                                               set1, tmpstr5, set2, tmpstr6, tmpstr7, set3, set4, tmpstr9, tmpstr10, tmpstr11);
                }
                catch (Exception ex)
                {
                    System.Console.WriteLine(ex.Message);
                    System.Console.WriteLine("Неверный вызов, используйте /? для получения справки.");
                }
            }
            if (args.Length == 0)
            {
                FreeConsole();
                Application.Run(fSplash);
            }
        }
 public void Initialize(frmMain frmMainWindow)
 {
     this.btnTextChatModerationRemoveSoldier.ImageList = frmMainWindow.iglIcons;
     this.btnTextChatModerationRemoveSoldier.ImageKey  = "cross.png";
 }
Exemple #40
0
        private void bunifuImageButton4_Click(object sender, EventArgs e)
        {
            frmMain f = new frmMain();

            f.ShowDialog();
        }
        public void TestSetup()
        {
            frmMain main = new frmMain();

            main.tmrStart_Tick(null, null);
        }
 public KeysValuesPresenter(frmMain window)
 {
     this.Window = window;
     StartListners();
 }
Exemple #43
0
        public static void HandleInitialize(Client client, Core.Packets.ClientPackets.Initialize packet, frmMain mainForm)
        {
            if (client.EndPoint.Address.ToString() == "255.255.255.255")
            {
                return;
            }

            mainForm.listenServer.ConnectedClients++;
            mainForm.listenServer.AllTimeConnectedClients++;
            mainForm.updateWindowTitle(mainForm.listenServer.ConnectedClients, mainForm.lstClients.SelectedItems.Count);

            new Thread(new ThreadStart(() =>
            {
                try
                {
                    client.Value.Version         = packet.Version;
                    client.Value.OperatingSystem = packet.OperatingSystem;
                    client.Value.AccountType     = packet.AccountType;
                    client.Value.Country         = packet.Country;
                    client.Value.CountryCode     = packet.CountryCode;
                    client.Value.Region          = packet.Region;
                    client.Value.City            = packet.City;

                    string country = string.Format("{0} [{1}]", client.Value.Country, client.Value.CountryCode);

                    // this " " leaves some space between the flag-icon and the IP
                    ListViewItem lvi = new ListViewItem(new string[] { " " + client.EndPoint.Address.ToString(), client.EndPoint.Port.ToString(), client.Value.Version, "Connected", "Active", country, client.Value.OperatingSystem, client.Value.AccountType });
                    lvi.Tag          = client;
                    lvi.ImageIndex   = packet.ImageIndex;

                    mainForm.Invoke((MethodInvoker) delegate
                    {
                        mainForm.lstClients.Items.Add(lvi);
                    });

                    if (XMLSettings.ShowPopup)
                    {
                        ShowPopup(client, mainForm);
                    }

                    client.Value.isAuthenticated = true;
                }
                catch
                { }
            })).Start();
        }
 public frmShowPassword(string strPassword, frmMain main)
 {
     InitializeComponent();
     pwd        = strPassword;
     parentMain = main;
 }
Exemple #45
0
 private static void ShowPopup(Client c, frmMain mainForm)
 {
     mainForm.nIcon.ShowBalloonTip(30, string.Format("Client connected from {0}!", c.Value.Country), string.Format("IP Address: {0}\nOperating System: {1}", c.EndPoint.Address.ToString(), c.Value.OperatingSystem), ToolTipIcon.Info);
 }
Exemple #46
0
        // Token: 0x06000105 RID: 261 RVA: 0x000182DC File Offset: 0x000164DC
        private void btnLogin_Click(object sender, EventArgs e)
        {
            string text  = this.txtUser.Text;
            string text2 = this.txtPassword.Text;
            string text3 = Path.Combine(CMConstant.strFolderPath, "Data\\Account.bin");
            string path  = Path.Combine(CMConstant.strFolderPath, "ConfigFile\\ConfigLogin.json");
            string text4 = Path.Combine(CMConstant.strFolderPath, "Data\\RememberAccount.bin");
            bool   flag  = !string.IsNullOrEmpty(CMConstant.strFolderPath);

            if (flag)
            {
                bool flag2 = File.Exists(text3);
                if (flag2)
                {
                    this.lstAccount = this.funcCommon.ReadFromBinaryFile <List <AddNewAccount> >(text3);
                    foreach (AddNewAccount addNewAccount in this.lstAccount)
                    {
                        bool flag3 = text.Equals(this.funcCommon.Base64Decode(addNewAccount.strUserName)) && text2.Equals(this.funcCommon.Base64Decode(addNewAccount.strPassWord));
                        if (flag3)
                        {
                            this.saveConfigLogin.bRemember = this.chkRemember.Checked;
                            this.saveConfigLogin.bAutoLog  = this.chkAutoLogin.Checked;
                            string contents = JsonConvert.SerializeObject(this.saveConfigLogin, Formatting.Indented);
                            File.WriteAllText(path, contents);
                            bool flag4 = this.chkRemember.Checked || this.chkAutoLogin.Checked;
                            if (flag4)
                            {
                                bool flag5 = File.Exists(text4);
                                if (flag5)
                                {
                                    File.Delete(text4);
                                }
                                List <AddNewAccount> list = new List <AddNewAccount>();
                                list.Add(new AddNewAccount
                                {
                                    strUserName = this.funcCommon.Base64Encode(text),
                                    strPassWord = this.funcCommon.Base64Encode(text2)
                                });
                                this.funcCommon.WriteToBinaryFile <List <AddNewAccount> >(text4, list, true);
                            }
                            this.InitText();
                            base.Hide();
                            foreach (object obj in Application.OpenForms)
                            {
                                Form form  = (Form)obj;
                                bool flag6 = form is frmMain;
                                if (flag6)
                                {
                                    form.Show();
                                    return;
                                }
                            }
                            frmMain frmMain = new frmMain();
                            frmMain.Show();
                            return;
                        }
                    }
                    this.funcCommon.Msg("Đăng nhập thất bại.", "Lỗi");
                }
                else
                {
                    this.funcCommon.Msg("Không tìm thấy tập tin ", "Lỗi");
                }
            }
            else
            {
                this.funcCommon.Msg("Thư mục rỗng.", "Lỗi");
            }
        }
 public AurhorizationForm(Guid tenantID, frmMain parentForm)
 {
     _parentForm = parentForm;
     _tenantID   = tenantID;
     InitializeComponent();
 }
Exemple #48
0
        private static string AudioSettingsQuery(frmMain mainWindow)
        {
            string query = string.Empty;

            DataGridView  audioTracks = mainWindow.AudioSettings.GetAudioPanel();
            List <string> tracks      = new List <string>();
            List <string> codecs      = new List <string>();
            List <string> mixdowns    = new List <string>();
            List <string> samplerates = new List <string>();
            List <string> bitrates    = new List <string>();
            List <string> drcs        = new List <string>();

            // No Audio
            if (audioTracks.Rows.Count == 0)
            {
                query += " -a none ";
            }

            // Gather information about each audio track and store them in the declared lists.
            foreach (DataGridViewRow row in audioTracks.Rows)
            {
                // Audio Track (-a)
                if (row.Cells[1].Value.ToString() == "Automatic")
                {
                    tracks.Add("1");
                }
                else if (row.Cells[1].Value.ToString() != "None")
                {
                    string[] tempSub = row.Cells[1].Value.ToString().Split(' ');
                    tracks.Add(tempSub[0]);
                }

                // Audio Codec (-E)
                if (row.Cells[2].Value.ToString() != String.Empty)
                {
                    codecs.Add(GetAudioEncoder(row.Cells[2].Value.ToString()));
                }

                // Audio Mixdown (-6)
                if (row.Cells[3].Value.ToString() != String.Empty)
                {
                    mixdowns.Add(GetMixDown(row.Cells[3].Value.ToString()));
                }

                // Sample Rate (-R)
                if (row.Cells[4].Value.ToString() != String.Empty)
                {
                    samplerates.Add(row.Cells[4].Value.ToString());
                }

                // Audio Bitrate (-B)
                if (row.Cells[5].Value.ToString() != String.Empty)
                {
                    bitrates.Add(row.Cells[5].Value.ToString().Replace("Auto", "auto"));
                }

                // DRC (-D)
                if (row.Cells[6].Value.ToString() != String.Empty)
                {
                    drcs.Add(row.Cells[6].Value.ToString());
                }
            }

            // Audio Track (-a)
            string audioItems = string.Empty;
            bool   firstLoop  = true;

            foreach (string item in tracks)
            {
                if (firstLoop)
                {
                    audioItems = item;
                    firstLoop  = false;
                }
                else
                {
                    audioItems += "," + item;
                }
            }
            if (audioItems.Trim() != String.Empty)
            {
                query += " -a " + audioItems;
            }
            firstLoop  = true;
            audioItems = string.Empty; // Reset for another pass.

            // Audio Codec (-E)
            foreach (string item in codecs)
            {
                if (firstLoop)
                {
                    audioItems = item;
                    firstLoop  = false;
                }
                else
                {
                    audioItems += "," + item;
                }
            }
            if (audioItems.Trim() != String.Empty)
            {
                query += " -E " + audioItems;
            }
            firstLoop  = true;
            audioItems = string.Empty; // Reset for another pass.

            // Audio Mixdown (-6)
            foreach (string item in mixdowns)
            {
                if (firstLoop)
                {
                    audioItems = item;
                    firstLoop  = false;
                }
                else
                {
                    audioItems += "," + item;
                }
            }
            if (audioItems.Trim() != String.Empty)
            {
                query += " -6 " + audioItems;
            }
            firstLoop  = true;
            audioItems = string.Empty; // Reset for another pass.

            // Sample Rate (-R)
            foreach (string item in samplerates)
            {
                if (firstLoop)
                {
                    audioItems = item;
                    firstLoop  = false;
                }
                else
                {
                    audioItems += "," + item;
                }
            }
            if (audioItems.Trim() != String.Empty)
            {
                query += " -R " + audioItems;
            }
            firstLoop  = true;
            audioItems = string.Empty; // Reset for another pass.

            // Audio Bitrate (-B)
            foreach (string item in bitrates)
            {
                if (firstLoop)
                {
                    audioItems = item;
                    firstLoop  = false;
                }
                else
                {
                    audioItems += "," + item;
                }
            }
            if (audioItems.Trim() != String.Empty)
            {
                query += " -B " + audioItems;
            }
            firstLoop  = true;
            audioItems = string.Empty; // Reset for another pass.

            // DRC (-D)
            foreach (var itm in drcs)
            {
                string item = itm.ToString(new CultureInfo("en-US"));
                if (firstLoop)
                {
                    audioItems = item;
                    firstLoop  = false;
                }
                else
                {
                    audioItems += "," + item;
                }
            }
            if (audioItems.Trim() != String.Empty)
            {
                query += " -D " + audioItems;
            }

            return(query);
        }
Exemple #49
0
 public LayoutSettingsLoader(frmMain MainForm)
 {
     _MainForm = MainForm;
 }
        private static string VideoSettingsQuery(frmMain mainWindow)
        {
            string query = string.Empty;

            switch (mainWindow.drp_videoEncoder.Text)
            {
            case "MPEG-4 (FFmpeg)":
                query += " -e ffmpeg";
                break;

            case "MPEG-2 (FFmpeg)":
                query += " -e ffmpeg2";
                break;

            case "H.264 (x264)":
                query += " -e x264";
                break;

            case "VP3 (Theora)":
                query += " -e theora";
                break;

            default:
                query += " -e x264";
                break;
            }

            // Video Settings
            if (mainWindow.radio_avgBitrate.Checked)
            {
                query += " -b " + mainWindow.text_bitrate.Text;
            }

            // Video Quality Setting
            if (mainWindow.radio_cq.Checked)
            {
                double cqStep = UserSettingService.GetUserSetting <double>(ASUserSettingConstants.X264Step);
                double value;
                switch (mainWindow.drp_videoEncoder.Text)
                {
                case "MPEG-4 (FFmpeg)":
                case "MPEG-2 (FFmpeg)":
                    value  = 31 - (mainWindow.slider_videoQuality.Value - 1);
                    query += " -q " + value.ToString(new CultureInfo("en-US"));
                    break;

                case "H.264 (x264)":
                    CultureInfo culture = CultureInfo.CreateSpecificCulture("en-US");
                    value  = 51 - (mainWindow.slider_videoQuality.Value * cqStep);
                    value  = Math.Round(value, 2);
                    query += " -q " + value.ToString(culture);
                    break;

                case "VP3 (Theora)":
                    value  = mainWindow.slider_videoQuality.Value;
                    query += " -q " + value.ToString(new CultureInfo("en-US"));
                    break;
                }
            }

            if (mainWindow.check_2PassEncode.Checked)
            {
                query += " -2 ";
            }

            if (mainWindow.check_turbo.Checked)
            {
                query += " -T ";
            }

            if (mainWindow.drp_videoFramerate.Text != "Same as source")
            {
                query += " -r " + mainWindow.drp_videoFramerate.Text;
            }

            if (mainWindow.drp_videoFramerate.SelectedIndex == 0)
            {
                // If we use Same as Source, we can either output CFR or VFR
                query += mainWindow.radio_constantFramerate.Checked ? " --cfr " : " --vfr ";
            }
            else
            {
                // We have a hard framerate set, so we can either be Constant or peak (VFR) framerate
                query += mainWindow.radio_constantFramerate.Checked ? " --cfr " : " --pfr ";
            }

            return(query);
        }
 public ReplaceWindow(frmMain parentForm)
     : this()
 {
     this.parentForm = parentForm;
 }
        static void Main(string[] argv)
        {
            // Windows Vista or later
            if (Environment.OSVersion.Version.Major >= 6)
            {
                SetProcessDPIAware();
            }

            Guid guid = new Guid(appGuid);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // Check if the start up directory writable
            GlobalSetting.IsStartUpDirWritable = GlobalSetting.CheckStartUpDirWritable();

            // Enable Portable mode as default if possible
            GlobalSetting.IsPortableMode = GlobalSetting.IsStartUpDirWritable;

            // Save App version
            GlobalSetting.SetConfig("AppVersion", Application.ProductVersion.ToString());

            #region Check First-launch Configs
            var firstLaunchVersion = 0;

            int.TryParse(GlobalSetting.GetConfig("FirstLaunchVersion", "0"), out firstLaunchVersion);

            if (firstLaunchVersion < GlobalSetting.FIRST_LAUNCH_VERSION)
            {
                Process p = new Process();
                p.StartInfo.FileName  = Path.Combine(GlobalSetting.StartUpDir, "igcmd.exe");
                p.StartInfo.Arguments = "firstlaunch";

                try
                {
                    p.Start();
                }
                catch { }

                Application.Exit();
                return;
            }
            #endregion


            #region Auto update
            string lastUpdateConfig = GlobalSetting.GetConfig("AutoUpdate", "7/26/1991 12:13:08 AM");

            if (lastUpdateConfig != "0")
            {
                DateTime lastUpdate = DateTime.Now;

                if (DateTime.TryParseExact(lastUpdateConfig, "M/d/yyyy HH:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.None, out lastUpdate))
                {
                    //Check for update every 3 days
                    if (DateTime.Now.Subtract(lastUpdate).TotalDays > 3)
                    {
                        RunCheckForUpdate();
                    }
                }
                else
                {
                    RunCheckForUpdate();
                }
            }


            void RunCheckForUpdate()
            {
                Process p = new Process();

                p.StartInfo.FileName  = GlobalSetting.StartUpDir + "igcmd.exe";
                p.StartInfo.Arguments = "igautoupdate";
                p.Start();

                //save last update
                GlobalSetting.SetConfig("AutoUpdate", DateTime.Now.ToString("M/d/yyyy HH:mm:ss"));
            }

            #endregion


            #region Multi instances
            //get current config
            GlobalSetting.IsAllowMultiInstances = bool.Parse(GlobalSetting.GetConfig("IsAllowMultiInstances", "true"));

            //check if allows multi instances
            if (GlobalSetting.IsAllowMultiInstances)
            {
                Application.Run(formMain = new frmMain());
            }
            else
            {
                //single instance is required
                using (SingleInstance singleInstance = new SingleInstance(guid))
                {
                    if (singleInstance.IsFirstInstance)
                    {
                        singleInstance.ArgumentsReceived += SingleInstance_ArgumentsReceived;
                        singleInstance.ListenForArgumentsFromSuccessiveInstances();

                        Application.Run(formMain = new frmMain());
                    }
                    else
                    {
                        singleInstance.PassArgumentsToFirstInstance(Environment.GetCommandLineArgs());
                    }
                }
            } //end check multi instances
            #endregion
        }
Exemple #53
0
        private void btnPUse_Click(object sender, EventArgs e)
        {
            s   = Sell.Load();
            con = DBcontroller.Instance();
            con.Open();
            using (var cmd = new SqlCommand("SearchMember", con))
            {
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@phone", tboxPhone.Text);
                cmd.Parameters.AddWithValue("@pwd", tboxPass.Text);
                var sdr = cmd.ExecuteReader();
                if (sdr.HasRows)
                {
                    while (sdr.Read())
                    {
                        if (sdr[0].ToString() == "0")
                        {
                            MessageBox.Show("정보 불일치");
                            con.Close();
                            return;
                        }
                        else
                        {
                            s.ClientID  = sdr["memberNum"].ToString();
                            selectflage = true;
                        }
                    }
                }
            }
            con.Close();
            con.Open();
            if (selectflage)
            {
                using (var cmd = new SqlCommand("UpdatePoint", con))
                {
                    int s = -1 * int.Parse(tboxInputPoint.Text);

                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@phone", tboxPhone.Text);
                    cmd.Parameters.AddWithValue("@point", s);
                    cmd.ExecuteNonQuery();
                }
            }
            con.Close();
            if (tboxInputPoint.Text != "" && int.Parse(tboxUPoint.Text) >= int.Parse(tboxInputPoint.Text))
            {
                s.Pointmoney = decimal.Parse(tboxInputPoint.Text);
                frmMain fm = (frmMain)Owner;
                fm.T2.Text  = "포인트 할인이 적용되었습니다.\r\n";
                fm.T2.Text += "할인전 보유 포인트 : " + tboxUPoint.Text + "\r\n";
                fm.T2.Text += "사용 포인트 : " + tboxInputPoint.Text + "\r\n";
                fm.T2.Text += "할인후 보유 포인트 : " + (int.Parse(tboxUPoint.Text) - int.Parse(tboxInputPoint.Text)) + "\r\n";
                fm.T1.Text  = (int.Parse(fm.T1.Text) - int.Parse(tboxInputPoint.Text)).ToString();
                fm.T5.Text  = (int.Parse(fm.T4.Text) + int.Parse(fm.T1.Text)).ToString();
                s.Phone     = tboxPhone.Text;
                this.Dispose();
            }
            else
            {
                tboxInputPoint.Focus();
                tboxInputPoint.Text = "";
                MessageBox.Show("보유 포인트 부족");
            }
            con.Close();
            MessageBox.Show(tboxInputPoint.Text);
        }
        private static string SourceQuery(frmMain mainWindow, int mode, int duration, string preview)
        {
            string query      = string.Empty;
            string sourcePath = string.Empty;

            sourcePath = mainWindow.selectedTitle != null && File.Exists(mainWindow.selectedTitle.SourceName)
                             ? mainWindow.selectedTitle.SourceName.Trim()
                             : mainWindow.sourcePath;

            if (!string.IsNullOrEmpty(mainWindow.sourcePath) && mainWindow.sourcePath.Trim() != "Select \"Source\" to continue")
            {
                if (mainWindow.sourcePath.EndsWith("\\"))
                {
                    query = " -i " + sourcePath;
                }
                else
                {
                    query = " -i " + '"' + sourcePath + '"';
                }
            }

            if (mainWindow.drp_dvdtitle.Text != string.Empty)
            {
                string[] titleInfo = mainWindow.drp_dvdtitle.Text.Split(' ');
                query += " -t " + titleInfo[0];
            }

            if (!UserSettingService.GetUserSetting <bool>(ASUserSettingConstants.DisableLibDvdNav) && mainWindow.drop_angle.Items.Count != 0)
            {
                query += " --angle " + mainWindow.drop_angle.SelectedItem;
            }

            // Decide what part of the video we want to encode.
            switch (mode)
            {
            case 0:     // Chapters
                if (mainWindow.drop_chapterFinish.Text == mainWindow.drop_chapterStart.Text &&
                    mainWindow.drop_chapterStart.Text != string.Empty)
                {
                    query += string.Format(" -c {0}", mainWindow.drop_chapterStart.Text);
                }
                else if (mainWindow.drop_chapterStart.Text != string.Empty &&
                         mainWindow.drop_chapterFinish.Text != string.Empty)
                {
                    query += string.Format(" -c {0}-{1}", mainWindow.drop_chapterStart.Text,
                                           mainWindow.drop_chapterFinish.Text);
                }
                break;

            case 1:     // Seconds
                int start, end;
                int.TryParse(mainWindow.drop_chapterStart.Text, out start);
                int.TryParse(mainWindow.drop_chapterFinish.Text, out end);
                int calculatedDuration = end - start;

                query += string.Format(" --start-at duration:{0} --stop-at duration:{1}", mainWindow.drop_chapterStart.Text, calculatedDuration);
                break;

            case 2:     // Frames
                int.TryParse(mainWindow.drop_chapterStart.Text, out start);
                int.TryParse(mainWindow.drop_chapterFinish.Text, out end);
                calculatedDuration = end - start;

                query += string.Format(" --start-at frame:{0} --stop-at frame:{1}", mainWindow.drop_chapterStart.Text, calculatedDuration);
                break;

            case 3:     // Preview
                query += " --previews " + UserSettingService.GetUserSetting <int>(UserSettingConstants.PreviewScanCount) + " ";
                query += " --start-at-preview " + preview;
                query += " --stop-at duration:" + duration + " ";
                break;

            default:
                break;
            }

            return(query);
        }
    //=========================== Program Start ============================
    public static void Main()
    {
        frmMain main = new frmMain();

        Application.Run(main);
    }
        private static string AudioSettingsQuery(frmMain mainWindow)
        {
            // Queries for each option
            string tracks      = string.Empty;
            string encoders    = string.Empty;
            string mixdowns    = string.Empty;
            string samplerates = string.Empty;
            string bitrates    = string.Empty;
            string drvValues   = string.Empty;
            string gainValues  = string.Empty;
            string trackNames  = string.Empty;

            // If we have no audio tracks, set the query to none
            if (mainWindow.AudioSettings.AudioTracks.ToList().Count == 0)
            {
                return(" -a none");
            }

            // Generate the sub queries
            foreach (AudioTrack audioTrack in mainWindow.AudioSettings.AudioTracks)
            {
                // Audio Track (-a)
                string track = audioTrack.Track.HasValue ? audioTrack.Track.ToString() : "1"; // Default to "1"
                tracks += string.IsNullOrEmpty(tracks) ? track : string.Format(",{0}", track);

                // Audio Encoder  (-E)
                encoders += string.IsNullOrEmpty(encoders)
                              ? Converters.GetCliAudioEncoder(audioTrack.Encoder)
                              : string.Format(",{0}", Converters.GetCliAudioEncoder(audioTrack.Encoder));

                // Audio Mixdowns (-6)
                mixdowns += string.IsNullOrEmpty(mixdowns)
                              ? Converters.GetCliMixDown(audioTrack.MixDown)
                              : string.Format(",{0}", Converters.GetCliMixDown(audioTrack.MixDown));

                // Audio Samplerates (-R)
                string rate = audioTrack.SampleRate == 0 ? "Auto" : audioTrack.SampleRate.ToString(); // Default to "Auto"
                samplerates += string.IsNullOrEmpty(samplerates) ? rate : string.Format(",{0}", rate);

                // Audio Bitrates (-B)
                bitrates += string.IsNullOrEmpty(bitrates)
                                ? audioTrack.Bitrate.ToString(Culture)
                                : string.Format(",{0}", audioTrack.Bitrate);

                // Audio DRC Values
                drvValues += string.IsNullOrEmpty(drvValues) ? audioTrack.DRC.ToString(Culture) : string.Format(",{0}", audioTrack.DRC.ToString(Culture));

                // Audio Gain Control
                gainValues += string.IsNullOrEmpty(gainValues) ? audioTrack.Gain.ToString(Culture) : string.Format(",{0}", audioTrack.Gain.ToString(Culture));

                trackNames += string.IsNullOrEmpty(trackNames)
                                ? string.IsNullOrEmpty(audioTrack.TrackName) ? "\"\"" : string.Format("\"{0}\"", audioTrack.TrackName.Trim())
                                : string.IsNullOrEmpty(audioTrack.TrackName) ? ",\"\"" : string.Format(",\"{0}\"", audioTrack.TrackName.Trim());
            }

            string audioQuery = string.Format(
                " -a {0} -E {1} -B {2} -6 {3} -R {4} -D {5} --gain={6}",
                tracks,
                encoders,
                bitrates,
                mixdowns,
                samplerates,
                drvValues,
                gainValues);

            if (!string.IsNullOrEmpty(trackNames.Trim()) && !string.IsNullOrEmpty(trackNames.Replace("\"", string.Empty).Replace(",", string.Empty).Trim()))
            {
                audioQuery += string.Format(" --aname={0}", trackNames);
            }

            return(audioQuery);
        }
 public void Logout(frmMain f)
 {
     f.Visible = false;
 }
Exemple #58
0
        public ctlScanner(frmMain oMain, ctlData oData)
        {
            InitializeComponent();
            m_frmMain = oMain;
            m_ctlData = oData;

            oScript = new Alert {
                License = "XRT93NQR79ABTW788XR48"
            };
            Symbols  = new List <string>();
            DataBars = new List <DataManager.BarData>();

            //Setup the results grid
            grdResults.RowTemplate.Height = 28;

            grdResults.ShowCellToolTips = false;
            grdResults.GridColor        = Color.FromArgb(50, 50, 50);
            grdResults.RowsDefaultCellStyle.SelectionBackColor = Color.Black;
            grdResults.RowsDefaultCellStyle.SelectionForeColor = Color.Yellow;

            grdResults.BackgroundColor            = Color.Black;
            grdResults.ForeColor                  = Color.White;
            grdResults.DefaultCellStyle.BackColor = Color.Black;
            grdResults.DefaultCellStyle.ForeColor = Color.White;

            grdResults.RowTemplate.Height = 30;

            DataGridViewTextBoxColumn tradeTime = new DataGridViewTextBoxColumn();
            {
                tradeTime.HeaderText = "Trade Time";
                tradeTime.Name       = "Trade Time";
                tradeTime.ReadOnly   = true;
                grdResults.Columns.Add(tradeTime);
            }

            DataGridViewTextBoxColumn symbolCol = new DataGridViewTextBoxColumn();

            {
                symbolCol.HeaderText = "Symbol";
                symbolCol.Name       = "Symbol";
                symbolCol.ReadOnly   = true;
            }
            grdResults.Columns.Add(symbolCol);

            DataGridViewTextBoxColumn lastCol = new DataGridViewTextBoxColumn();

            {
                lastCol.HeaderText = "Last";
                lastCol.Name       = "Last";
                lastCol.ReadOnly   = true;
                lastCol.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
            }
            grdResults.Columns.Add(lastCol);

            DataGridViewBarGraphColumn volumeCol = new DataGridViewBarGraphColumn();

            {
                volumeCol.HeaderText = "Volume";
                volumeCol.Name       = "Volume";
                volumeCol.ReadOnly   = true;
                volumeCol.SortMode   = DataGridViewColumnSortMode.Automatic;
                volumeCol.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
            }
            grdResults.Columns.Add(volumeCol);

            DataGridViewTextBoxScannerColorColumn alertTime = new DataGridViewTextBoxScannerColorColumn();
            {
                alertTime.HeaderText = "Alert Time";
                alertTime.Name       = "Alert Time";
                alertTime.ReadOnly   = true;
                grdResults.Columns.Add(alertTime);
            }

            DataGridViewButtonColumn tradeCol = new DataGridViewButtonColumn();

            {
                tradeCol.HeaderText  = "Trade";
                tradeCol.Name        = "Trade";
                tradeCol.Text        = "Trade";
                tradeCol.ToolTipText = "Enter Order";
                tradeCol.DefaultCellStyle.NullValue  = "Trade";
                tradeCol.UseColumnTextForButtonValue = true;
            }
            grdResults.Columns.Add(tradeCol);

            DataGridViewButtonColumn chartCol = new DataGridViewButtonColumn();

            {
                chartCol.HeaderText = "Chart";
                chartCol.Name       = "Chart";
                chartCol.Text       = "Chart";
                chartCol.UseColumnTextForButtonValue = true;
            }
            grdResults.Columns.Add(chartCol);

            DataGridViewButtonColumn settingsCol = new DataGridViewButtonColumn();
            {
                settingsCol.HeaderText  = "Settings";
                settingsCol.Name        = "Settings";
                settingsCol.Text        = "Settings";
                settingsCol.ToolTipText = "Edit Settings";
                settingsCol.DefaultCellStyle.NullValue  = "Settings";
                settingsCol.UseColumnTextForButtonValue = true;
                grdResults.Columns.Add(settingsCol);
            }

            DataGridViewImageButtonColumn lockCol = new DataGridViewImageButtonColumn();
            {
                lockCol.HeaderText = "Lock Script";
                lockCol.Name       = "Locked";
                grdResults.Columns.Add(lockCol);
            }

            DataGridViewImageButtonColumn startCol = new DataGridViewImageButtonColumn();

            {
                startCol.HeaderText  = "Pause";
                startCol.Name        = "Start";
                startCol.ToolTipText = "Start Scan";
                grdResults.Columns.Add(startCol);
            }

            UpdateStyle(m_frmMain.m_Style);
        }
Exemple #59
0
        static void Main(string[] args)
        {
            Program.m_Args = args;

            bool dotNETCheck = checkNetVersion("3.5");

            if (PRoConApplication.IsProcessOpen() == false && dotNETCheck == true)
            {
                if (Directory.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Updates")) == true)
                {
                    AutoUpdater.m_strArgs = args;
                    AutoUpdater.BeginUpdateProcess(null);
                }
                else
                {
                    //PRoConApplication paProcon = null;

                    try {
                        bool blBasicConsole = false;
                        bool blGspUpdater   = false;

                        int iValue;
                        if (args != null && args.Length >= 2)
                        {
                            for (int i = 0; i < args.Length; i = i + 2)
                            {
                                if (String.Compare("-console", args[i], true) == 0 && int.TryParse(args[i + 1], out iValue) == true && iValue == 1)
                                {
                                    blBasicConsole = true;
                                }
                                if (String.Compare("-gspupdater", args[i], true) == 0 && int.TryParse(args[i + 1], out iValue) == true && iValue == 1)
                                {
                                    blGspUpdater = true;
                                }
                                if (String.Compare("-use_core", args[i], true) == 0 && int.TryParse(args[i + 1], out iValue) == true && iValue > 0)
                                {
                                    System.Diagnostics.Process.GetCurrentProcess().ProcessorAffinity = (System.IntPtr)iValue;
                                }
                            }
                        }

                        //Thread.Sleep(5000);
                        Application.EnableVisualStyles();
                        Application.SetCompatibleTextRenderingDefault(false);

                        if (blGspUpdater == true)
                        {
                            Application.Run(new GspUpdater());
                        }
                        else
                        {
                            if (blBasicConsole == true)
                            {
                                BasicConsole basicWindow = new BasicConsole();
                                basicWindow.WindowLoaded += new BasicConsole.WindowLoadedHandler(procon_WindowLoaded);

                                Application.Run(basicWindow);
                            }
                            else
                            {
                                frmMain mainWindow = new frmMain(args);
                                mainWindow.WindowLoaded += new frmMain.WindowLoadedHandler(procon_WindowLoaded);
                                Application.Run(mainWindow);
                            }
                        }
                    }
                    catch (Exception e) {
                        FrostbiteConnection.LogError("Application error", String.Empty, e);
                        MessageBox.Show("PRoCon ran into a critical error, but hopefully it logged that error in DEBUG.txt.  Please post/pm/email this to phogue at www.phogue.net.");
                    }
                    finally {
                        if (Program.m_application != null)
                        {
                            Program.m_application.Shutdown();
                        }
                    }
                }
            }
            else
            {
                // Possible prevention of a cpu consumption bug I can see at the time of writing.
                // TCAdmin: Start procon.exe
                // procon.exe has an update to install
                // procon.exe loads proconupdater.exe
                // procon.exe unloads
                // proconupdater.exe begins update
                // TCAdmin detects procon.exe shutdown - attempts to reload
                Thread.Sleep(50);
            }
        }
        private static string PictureSettingsQuery(frmMain mainWindow, QueryPictureSettingsMode mode, int width, int height)
        {
            string query = string.Empty;

            if (mode == QueryPictureSettingsMode.UserInterfaceSettings)
            {
                if (mainWindow.PictureSettings.text_width.Value != 0)
                {
                    if (mainWindow.PictureSettings.drp_anamorphic.SelectedIndex != 1) // Prevent usage for strict anamorphic
                    {
                        query += " -w " + mainWindow.PictureSettings.text_width.Text;
                    }
                }

                if (mainWindow.PictureSettings.text_height.Value != 0 &&
                    mainWindow.PictureSettings.text_height.Text != string.Empty)
                {
                    if (mainWindow.PictureSettings.drp_anamorphic.SelectedIndex == 0 ||
                        mainWindow.PictureSettings.drp_anamorphic.SelectedIndex == 3) // Prevent usage for strict anamorphic
                    {
                        query += " -l " + mainWindow.PictureSettings.text_height.Text;
                    }
                }
            }
            else if (mode == QueryPictureSettingsMode.Custom) // For Add Preset Only.
            {
                query += " -X " + width;
                query += " -Y " + height;
            }
            else if (mode == QueryPictureSettingsMode.SourceMaximum) // For Add Preset Only.
            {
                if (mainWindow.PictureSettings.text_width.Value != 0)
                {
                    if (mainWindow.PictureSettings.drp_anamorphic.SelectedIndex != 1) // Prevent usage for strict anamorphic
                    {
                        query += " -X " + mainWindow.PictureSettings.text_width.Text;
                    }
                }

                if (mainWindow.PictureSettings.text_height.Value != 0 &&
                    mainWindow.PictureSettings.text_height.Text != string.Empty)
                {
                    if (mainWindow.PictureSettings.drp_anamorphic.SelectedIndex == 0 ||
                        mainWindow.PictureSettings.drp_anamorphic.SelectedIndex == 3) // Prevent usage for strict anamorphic
                    {
                        query += " -Y " + mainWindow.PictureSettings.text_height.Text;
                    }
                }
            }

            string cropTop    = mainWindow.PictureSettings.crop_top.Text;
            string cropBottom = mainWindow.PictureSettings.crop_bottom.Text;
            string cropLeft   = mainWindow.PictureSettings.crop_left.Text;
            string cropRight  = mainWindow.PictureSettings.crop_right.Text;

            if (mainWindow.PictureSettings.check_customCrop.Checked && mode != QueryPictureSettingsMode.None)
            {
                if (mainWindow.PictureSettings.crop_top.Text == string.Empty)
                {
                    cropTop = "0";
                }
                if (mainWindow.PictureSettings.crop_bottom.Text == string.Empty)
                {
                    cropBottom = "0";
                }
                if (mainWindow.PictureSettings.crop_left.Text == string.Empty)
                {
                    cropLeft = "0";
                }
                if (mainWindow.PictureSettings.crop_right.Text == string.Empty)
                {
                    cropRight = "0";
                }

                query += " --crop " + cropTop + ":" + cropBottom + ":" + cropLeft + ":" + cropRight;
            }

            switch (mainWindow.PictureSettings.drp_anamorphic.SelectedIndex)
            {
            case 0:
                if (mainWindow.PictureSettings.drp_modulus.SelectedIndex != 0)
                {
                    query += " --modulus " + mainWindow.PictureSettings.drp_modulus.SelectedItem;
                }
                break;

            case 1:
                query += " --strict-anamorphic ";
                break;

            case 2:
                query += " --loose-anamorphic ";
                if (mainWindow.PictureSettings.drp_modulus.SelectedIndex != 0)
                {
                    query += " --modulus " + mainWindow.PictureSettings.drp_modulus.SelectedItem;
                }
                break;

            case 3:
                query += " --custom-anamorphic ";

                if (mainWindow.PictureSettings.drp_modulus.SelectedIndex != 0)
                {
                    query += " --modulus " + mainWindow.PictureSettings.drp_modulus.SelectedItem;
                }

                if (mainWindow.PictureSettings.check_KeepAR.Checked)
                {
                    query += " --display-width " + mainWindow.PictureSettings.updownDisplayWidth.Text + " ";
                }

                if (mainWindow.PictureSettings.check_KeepAR.Checked)
                {
                    query += " --keep-display-aspect ";
                }

                if (!mainWindow.PictureSettings.check_KeepAR.Checked)
                {
                    if (mainWindow.PictureSettings.updownParWidth.Text != string.Empty &&
                        mainWindow.PictureSettings.updownParHeight.Text != string.Empty)
                    {
                        query += " --pixel-aspect " + mainWindow.PictureSettings.updownParWidth.Text + ":" +
                                 mainWindow.PictureSettings.updownParHeight.Text + " ";
                    }
                }
                break;
            }

            return(query);
        }