protected void btnLoadURLVideo_Click(object sender, EventArgs e) { if (mode == AccessMode.Web || mode == AccessMode.External) { #region In line commands // Used to check for commands (wihtout additional information) if (txtURLSource.Text.ToLower() == "help" || txtURLSource.Text.ToLower() == "bantuan") { Response.Redirect("Help.aspx"); } else if (txtURLSource.Text.ToLower() == "error") { Response.Redirect("Error.aspx?id=100"); } else if (txtURLSource.Text.ToLower() == "setting" || txtURLSource.Text.ToLower() == "settings") { Response.Redirect("Settings.aspx"); } else if (txtURLSource.Text.ToLower() == "player") { Response.Redirect("Player.aspx"); } else if (txtURLSource.Text.ToLower() == "sample1" || txtURLSource.Text.ToLower() == "sample2" || txtURLSource.Text.ToLower() == "sample3" || txtURLSource.Text.ToLower() == "sample4" || txtURLSource.Text.ToLower() == "sample5") { Response.Redirect("Error.aspx?id=2"); } else if (txtURLSource.Text.ToLower() == "checker") { Response.Redirect("Checker.aspx?mode=sample"); } #endregion In line commands #region Validation if (HelperClass.CheckWebsite(txtURLSource.Text)) { Uri uri = new Uri(txtURLSource.Text); Response.Redirect("Error.aspx?id=902&message=" + uri.Host); } #endregion Validation #region (Old) Main Processing //#region Old main processing //#region Service initialization //VideoProcessingService.Service1Client videoProcessor = new VideoProcessingService.Service1Client(); //#endregion Service initialization //#region Main process //string[] receivedVideoInfo = videoProcessor.ProcessVideo2(txtURLSource.Text, true, Session.SessionID, true, 0, (int)settings.resolution, (float)settings.frameRate); //#endregion Main process //#endregion Old main processing //#region Result processor //Stopwatch waitTime = new Stopwatch(); //waitTime.Start(); //if (receivedVideoInfo.Length == 0) //{ // System.Threading.Thread.Sleep(1000); // if (waitTime.ElapsedMilliseconds == 20000) // { // waitTime.Stop(); // Response.Redirect("Error.aspx"); // } //} //videoProcessor.Close(); //if (receivedVideoInfo[0].ToLower().Contains("error")) //{ // Response.Redirect("Error.aspx?id=10a"); //} //else //{ // string queryString = string.Empty; // queryString += "?new=true&"; // queryString += "path=" + receivedVideoInfo[1] + "&"; // queryString += "name=" + receivedVideoInfo[2] + "&"; // queryString += "duration=" + receivedVideoInfo[3] + "&"; // queryString += "framerate=" + receivedVideoInfo[4] + "&"; // queryString += "startframe=" + receivedVideoInfo[5] + "&"; // queryString += "endframe=" + receivedVideoInfo[6] + "&"; // queryString += "videowidth=" + receivedVideoInfo[7]; // Response.Redirect("Player.aspx" + queryString); //} //#endregion Result processor #endregion (Old) Main Processing #region New processing #region Preparation string databaseName = "MediaPlayerDatabase"; string userTableName = "SessionInfo"; string settingsTable = "UserSettings"; Processor mainProcessor = new Processor(); UserInfo userInfo = new UserInfo(); VideoProcessingInformation videoProcessingInformation = new VideoProcessingInformation(); #region System configuration loader SystemConfiguration systemConfiguration = HelperClass.SystemConfigurationLoader(); #endregion System configuration loader #region User information loader // Check for user information in database if (HelperClass.CheckUser(databaseName, userTableName, Session.SessionID, systemConfiguration.DatabaseProcessingConfiguration.DatabaseConectionString)) { userInfo.SessionID = Session.SessionID; try { userInfo.UserID = HelperClass.ReadUserInfo(Session.SessionID).UserID; } catch (Exception err) { Response.Redirect("Error.aspx?id=22&message=" + err.Message); } } else { userInfo.SessionID = Session.SessionID; if (!HelperClass.AddUser(databaseName, userTableName, userInfo.SessionID, systemConfiguration.DatabaseProcessingConfiguration.DatabaseConectionString)) { Response.Redirect("Error.aspx?id=23"); } try { userInfo.UserID = HelperClass.ReadUserInfo(Session.SessionID).UserID; } catch (Exception err) { Response.Redirect("Error.aspx?id=22&message=" + err.Message); } } #endregion User information loader #region Player settings loader VideoPlayerSettings settings = new VideoPlayerSettings(); // Check settings if (HelperClass.CheckSettings(databaseName, userInfo, settingsTable, systemConfiguration.DatabaseProcessingConfiguration.DatabaseConectionString)) { settings = HelperClass.ReadPlayerSettings(Session.SessionID, database, settingsTable, connectionString); } else { if (HelperClass.CreateNewSettings(databaseName, settingsTable, userInfo, systemConfiguration.DatabaseProcessingConfiguration.DatabaseConectionString)) { settings = HelperClass.ReadPlayerSettings(Session.SessionID, database, settingsTable, connectionString); } } #endregion Player settings loader #endregion Preparation; #region Information generation videoProcessingInformation.VideoLocations.VideoLocation = txtURLSource.Text; videoProcessingInformation.VideoLocations.videoSaveLocation = systemConfiguration.ProcessedVideoSaveLocation; videoProcessingInformation.VideoLocations.videoNetworkSaveLocation = systemConfiguration.NetworkProcessedVideoSaveLocation; videoProcessingInformation.VideoSetting.processedVideoResolution = settings.resolution; videoProcessingInformation.VideoSetting.frameRate = settings.frameRate; videoProcessingInformation.VideoSetting.audioProcessing = AudioProcessing.ProcessAudio; userInfo.SessionID = Session.SessionID; #endregion Information generation #region Main process ProcessedVideo processedVideo = mainProcessor.ProcessVideo(videoProcessingInformation, systemConfiguration, userInfo); string queryString = string.Empty; if (processedVideo.result == Result.Success) { queryString += "?new=true&"; queryString += "path=" + processedVideo.networkAccessLocation + "&"; queryString += "name=" + processedVideo.videoName + "&"; queryString += "duration=" + processedVideo.videoDuration + "&"; queryString += "framerate=" + processedVideo.frameRate + "&"; queryString += "startframe=" + processedVideo.startFrame + "&"; queryString += "endframe=" + processedVideo.endFrame + "&"; queryString += "videoresolution=" + processedVideo.videoHeight + "&"; queryString += "pid=" + processedVideo.processID; if (Convert.ToInt32(lstPlayingSpeed.SelectedValue) > 0) { queryString += "&playspeed=" + lstPlayingSpeed.SelectedValue; } if (txtCustomPlayTime.Text != string.Empty) { queryString += "&timeposition=" + txtCustomPlayTime.Text; } Response.Redirect("Player.aspx" + queryString); } else { Response.Redirect("Error.aspx?id=301&message=" + processedVideo.message); } #endregion Main process #endregion New processing } else if (mode == AccessMode.Other) { Server.Transfer("Error.aspx?id=96"); } }