public void Load(StreamReader r) { // Описание сценария состоит из следующих элементов: // Название сценария Title = r.ReadLine(); // Тип резервирования scenarioType = Convert(r.ReadLine()); // Использование архиватора Zip = bool.Parse(r.ReadLine()); // Путь назначения Destination = r.ReadLine(); // Дата последнего запуска string temp = r.ReadLine(); LastTime = DateTime.Parse(temp); // Список источников данных int N; N = int.Parse(r.ReadLine()); Source = new List <string>(); for (int n = 0; n < N; n++) { Source.Add(r.ReadLine()); } // Список расписания N = int.Parse(r.ReadLine()); Shedule = new List <string>(); for (int n = 0; n < N; n++) { Shedule.Add(r.ReadLine()); } }
public void Load(StreamReader r) { //Описание сценария состоит из //Заголовок Title = r.ReadLine(); //Тип scenarioType = Convert(r.ReadLine()); //Упакованность Zip = bool.Parse(r.ReadLine()); //Назначение Destination = r.ReadLine(); //список источников int N; N = int.Parse(r.ReadLine()); Source = new List <string>(); for (int n = 0; n < N; n++) { Source.Add(r.ReadLine()); } //список раписаний N = int.Parse(r.ReadLine()); Shedule = new List <string>(); for (int n = 0; n < N; n++) { Shedule.Add(r.ReadLine()); } }
public void LoadValues() { string strNotes = ""; FIA_Biosum_Manager.ado_data_access oAdo = new ado_data_access(); string strScenarioDBDir = frmMain.g_oFrmMain.frmProject.uc_project1.txtRootDirectory.Text.Trim() + "\\" + ScenarioType + "\\db"; string strScenarioFile = "scenario_" + ScenarioType + "_rule_definitions.mdb"; StringBuilder strScenarioFullPath = new StringBuilder(strScenarioDBDir); strScenarioFullPath.Append("\\"); strScenarioFullPath.Append(strScenarioFile); string strScenarioConn = oAdo.getMDBConnString(strScenarioFullPath.ToString(), "admin", ""); oAdo.OpenConnection(strScenarioConn); if (ScenarioType.Trim().ToUpper() == "OPTIMIZER") { oAdo.m_strSQL = "SELECT notes FROM scenario WHERE TRIM(scenario_id)='" + this.ReferenceOptimizerScenarioForm.uc_scenario1.strScenarioId.Trim() + "'"; } else { oAdo.m_strSQL = "SELECT notes FROM scenario WHERE TRIM(scenario_id)='" + this.ReferenceProcessorScenarioForm.uc_scenario1.strScenarioId.Trim() + "'"; } strNotes = oAdo.getSingleStringValueFromSQLQuery(oAdo.m_OleDbConnection, oAdo.m_strSQL, "scenario"); oAdo.m_OleDbConnection.Close(); while (oAdo.m_OleDbConnection.State != System.Data.ConnectionState.Closed) { oAdo.m_OleDbConnection.Close(); System.Threading.Thread.Sleep(1000); } oAdo = null; this.txtNotes.Text = strNotes; }
public void SaveScenarioNotes() { ado_data_access p_ado = new ado_data_access(); System.Data.OleDb.OleDbConnection oConn = new System.Data.OleDb.OleDbConnection(); string strProjDir = frmMain.g_oFrmMain.frmProject.uc_project1.txtRootDirectory.Text.Trim(); string strScenarioDir = strProjDir + "\\" + ScenarioType + "\\db"; string strFile = "scenario_" + ScenarioType + "_rule_definitions.mdb"; //((frmMain)this.ParentForm.ParentForm).frmProject.uc_project1.m_strProjectFile; StringBuilder strFullPath = new StringBuilder(strScenarioDir); strFullPath.Append("\\"); strFullPath.Append(strFile); string strNotes = this.txtNotes.Text; string strSQL = ""; strNotes = p_ado.FixString(strNotes, "'", "''"); string strConn = p_ado.getMDBConnString(strFullPath.ToString(), "admin", ""); //string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + strFullPath.ToString() + ";User Id=admin;Password=;"; if (ScenarioType.Trim().ToUpper() == "OPTIMIZER") { strSQL = "UPDATE scenario SET notes = '" + strNotes + "' WHERE trim(lcase(scenario_id)) = '" + ((frmOptimizerScenario)this.ParentForm).uc_scenario1.txtScenarioId.Text.Trim().ToLower() + "';"; } else { strSQL = "UPDATE scenario SET notes = '" + strNotes + "' WHERE trim(lcase(scenario_id)) = '" + this.ReferenceProcessorScenarioForm.uc_scenario1.txtScenarioId.Text.Trim().ToLower() + "';"; } p_ado.SqlNonQuery(strConn, strSQL); p_ado = null; }
private void btnCancel_Click(object sender, System.EventArgs e) { if (ScenarioType.Trim().ToUpper() == "OPTIMIZER") { if (((frmOptimizerScenario)this.ParentForm).m_bScenarioOpen == false) { ((frmOptimizerScenario)this.ParentForm).Close(); } else { this.lblTitle.Text = ""; //((frmScenario)this.ParentForm).lblTitle.Text = ""; ((frmOptimizerScenario)this.ParentForm).SetMenu("scenario"); this.Visible = false; //v309((frmScenario)this.ParentForm).Height = ((frmScenario)this.ParentForm).grpboxMenu.Height*2; } } else { if (this.ReferenceProcessorScenarioForm.m_bScenarioOpen == false) { this.ReferenceProcessorScenarioForm.Close(); } else { this.lblTitle.Text = ""; this.Visible = false; } } }
public static RoutingTableViewModel GenerateRoutingTableViewModel(ScenarioType scenarioType) { return(new RoutingTableViewModel { RoutingTableLineViewModels = GenerateRoutingTableLineViewModel(scenarioTypeChosen: scenarioType) }); }
public void LoadValuesSqlite() { string strNotes = ""; SQLite.ADO.DataMgr dataMgr = new SQLite.ADO.DataMgr(); string strScenarioDBDir = frmMain.g_oFrmMain.frmProject.uc_project1.txtRootDirectory.Text.Trim() + "\\" + ScenarioType + "\\db"; string strScenarioFile = "scenario_" + ScenarioType + "_rule_definitions.db"; StringBuilder strScenarioFullPath = new StringBuilder(strScenarioDBDir); strScenarioFullPath.Append("\\"); strScenarioFullPath.Append(strScenarioFile); string strScenarioConn = dataMgr.GetConnectionString(strScenarioFullPath.ToString()); using (System.Data.SQLite.SQLiteConnection con = new System.Data.SQLite.SQLiteConnection(strScenarioConn)) { con.Open(); if (ScenarioType.Trim().ToUpper() == "OPTIMIZER") { dataMgr.m_strSQL = "SELECT notes FROM scenario WHERE TRIM(scenario_id)='" + this.ReferenceOptimizerScenarioForm.uc_scenario1.strScenarioId.Trim() + "'"; } else { dataMgr.m_strSQL = "SELECT notes FROM scenario WHERE TRIM(scenario_id)='" + this.ReferenceProcessorScenarioForm.uc_scenario1.strScenarioId.Trim() + "'"; } strNotes = dataMgr.getSingleStringValueFromSQLQuery(con, dataMgr.m_strSQL, "scenario"); } this.txtNotes.Text = strNotes; }
public static RoutingInfoHeadingViewModel GeneRoutingInfoHeadingViewModel(ScenarioType scenarioType) { return(new RoutingInfoHeadingViewModel { PredefinedScenarioViewModel = GeneratePredefinedScenarioViewModel(scenarioTypeChosen: scenarioType), SoftwareTypeViewModel = GeneraSoftwareTypeViewModel() }); }
/// <summary> /// 画面にセリフを表示 /// </summary> /// <param name="mes"></param> public void msg(string mes) { scenarioType = ScenarioType.TapToNext; ScenarioEngine.Instance.UpdateScenario( type: ScenarioType.TapToNext, messages: new string[] { mes }, data: this ); }
void Start() { currentScenarioType = ScenarioType.FASTFOOD; InitAgentLogicArray(); DetermineCurrentArrays(); currentAgentId = -1; }
public void SaveScenarioNotes() { ado_data_access p_ado = null; SQLite.ADO.DataMgr oDataMgr = null; string strNotes = this.txtNotes.Text; string strProjDir = frmMain.g_oFrmMain.frmProject.uc_project1.txtRootDirectory.Text.Trim(); string strScenarioDir = strProjDir + "\\" + ScenarioType + "\\db"; if ((ReferenceProcessorScenarioForm != null && !ReferenceProcessorScenarioForm.m_bUsingSqlite) || ScenarioType.Trim().ToUpper() == "OPTIMIZER") { p_ado = new ado_data_access(); strNotes = p_ado.FixString(strNotes, "'", "''"); string strSQL = ""; if (ScenarioType.Trim().ToUpper() == "OPTIMIZER") { strSQL = "UPDATE scenario SET notes = '" + strNotes + "' WHERE trim(lcase(scenario_id)) = '" + ((frmOptimizerScenario)this.ParentForm).uc_scenario1.txtScenarioId.Text.Trim().ToLower() + "';"; } else { strSQL = "UPDATE scenario SET notes = '" + strNotes + "' WHERE trim(lcase(scenario_id)) = '" + this.ReferenceProcessorScenarioForm.uc_scenario1.txtScenarioId.Text.Trim().ToLower() + "';"; } System.Data.OleDb.OleDbConnection oConn = new System.Data.OleDb.OleDbConnection(); string strFile = "scenario_" + ScenarioType + "_rule_definitions.mdb"; StringBuilder strFullPath = new StringBuilder(strScenarioDir); strFullPath.Append("\\"); strFullPath.Append(strFile); string strConn = p_ado.getMDBConnString(strFullPath.ToString(), "admin", ""); p_ado.SqlNonQuery(strConn, strSQL); p_ado = null; } else { oDataMgr = new SQLite.ADO.DataMgr(); strNotes = oDataMgr.FixString(strNotes, "'", "''"); //@ToDo: Only support Processor at this time string strSQL = "UPDATE scenario SET notes = '" + strNotes + "' WHERE trim(lower(scenario_id)) = '" + this.ReferenceProcessorScenarioForm.uc_scenario1.txtScenarioId.Text.Trim().ToLower() + "';"; string strFile = "scenario_" + ScenarioType + "_rule_definitions.db"; StringBuilder strFullPath = new StringBuilder(strScenarioDir); strFullPath.Append("\\"); strFullPath.Append(strFile); string strConn = oDataMgr.GetConnectionString(strFullPath.ToString()); using (System.Data.SQLite.SQLiteConnection conn = new System.Data.SQLite.SQLiteConnection(strConn)) { conn.Open(); oDataMgr.SqlNonQuery(conn, strSQL); } oDataMgr = null; } }
private void Init() { _instance = this; scenariosDict = new Dictionary <ScenarioType, GameObject>(); scenariosDict.Add(ScenarioType.SKY, ScenariosFactory.Instance.CreateSky()); scenariosDict.Add(ScenarioType.GROUND, ScenariosFactory.Instance.CreateGround()); scenariosDict.Add(ScenarioType.CAVE, ScenariosFactory.Instance.CreateCave()); _current = ScenarioType.NONE; }
private void btnClose_Click(object sender, System.EventArgs e) { if (ScenarioType.Trim().ToUpper() == "OPTIMIZER") { ((frmOptimizerScenario)this.ParentForm).Close(); } else { this.ReferenceProcessorScenarioForm.Close(); } }
private void uc_scenario_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { if (ScenarioType.Trim().ToUpper() == "OPTIMIZER") { ((frmOptimizerScenario)this.ParentForm).m_bPopup = false; } else { this.ReferenceProcessorScenarioForm.m_bPopup = false; } }
public void SetWorkspaceToScenario(ScenarioType st) { if (st == ScenarioType.PASSPORT) { _workspaceId = workspaceID_passport; } else if (st == ScenarioType.FASTFOOD) { _workspaceId = workspaceID_fastfood; } }
private void txtNotes_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) { if (ScenarioType.Trim().ToUpper() == "OPTIMIZER") { ReferenceOptimizerScenarioForm.m_bSave = true; } else { ReferenceProcessorScenarioForm.m_bSave = true; } }
public List <int> GetRelevantYears(int financialYear, ScenarioType scenarioType) { var result = new List <int>(); int count = scenarioType == ScenarioType.InputData ? -1 : 0; while (count < 6) { result.Add(financialYear + count); count++; } return(result); }
/// <summary> /// Initializes a new instance of the 'ScenarioPresentation' class. /// </summary> /// <param name="form">Form.</param> public ScenarioPresentation(Form form, ScenarioType scenarioType) { mForm = form; if (mForm != null) { // for force KeyPreview = true if ScenarioType is "Service". ScenarioType = scenarioType; // Suscriber key events. Only for suscribers to ExecuteCommand. mForm.KeyDown += new KeyEventHandler(HandleFormKeyDown); } }
/// <summary> /// 選択肢を表示 /// </summary> /// <param name="title"></param> /// <param name="choices"></param> public void choice(string title, params string[] choices) { scenarioType = ScenarioType.Select; var message = new string[choices.Length + 1]; message[0] = title; choices.CopyTo(message, 1); ScenarioEngine.Instance.UpdateScenario( type: ScenarioType.Select, messages: message, data: this ); }
private async Task RunDownloadsAsync(BackgroundDownloader downloader, ScenarioType type) { // Validating the URI is required since it was received from an untrusted source (user input). // The URI is validated by calling Uri.TryCreate() that will return 'false' for strings that are not valid URIs. // Note that when enabling the text box users may provide URIs to machines on the intrAnet that require // the "Home or Work Networking" capability. if (!Uri.TryCreate(serverAddressField.Text.Trim(), UriKind.Absolute, out baseUri)) { rootPage.NotifyUser("Invalid URI.", NotifyType.ErrorMessage); return; } // Use a unique ID for every button click, to help the user associate downloads of the same run // in the logs. runId++; DownloadOperation[] downloads = new DownloadOperation[3]; try { // First we create three download operations: Note that we don't start downloads immediately. It is // important to first create all operations that should participate in the toast/tile update. Once all // operations have been created, we can start them. // If we start a download and create a second one afterwards, there is a race where the first download // may complete before we were able to create the second one. This would result in the toast/tile being // shown before we even create the second download. downloads[0] = await CreateDownload(downloader, 1, String.Format(CultureInfo.InvariantCulture, "{0}.{1}.FastDownload.txt", type, runId)); downloads[1] = await CreateDownload(downloader, 5, String.Format(CultureInfo.InvariantCulture, "{0}.{1}.MediumDownload.txt", type, runId)); downloads[2] = await CreateDownload(downloader, 10, String.Format(CultureInfo.InvariantCulture, "{0}.{1}.SlowDownload.txt", type, runId)); } catch (FileNotFoundException) { // We were unable to create the destination file. return; } // Once all downloads participating in the toast/tile update have been created, start them. Task[] downloadTasks = new Task[downloads.Length]; for (int i = 0; i < downloads.Length; i++) { downloadTasks[i] = DownloadAsync(downloads[i]); } await Task.WhenAll(downloadTasks); }
private void btnOpen_Click(object sender, System.EventArgs e) { //lets see if this scenario is already open try { utils p_oUtils = new utils(); p_oUtils.m_intLevel = 1; if (ScenarioType.Trim().ToUpper() == "OPTIMIZER") { if (p_oUtils.FindWindowLike(frmMain.g_oFrmMain.Handle, "Treatment Optimizer: Optimization Scenario (" + this.txtScenarioId.Text.Trim() + ")", "*", true, false) > 0) { MessageBox.Show("!!Scenario Already Open!!", "Scenario Open", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } } else { if (p_oUtils.FindWindowLike(frmMain.g_oFrmMain.Handle, "Processor: Scenario (" + this.txtScenarioId.Text.Trim() + ")", "*", true, false) > 0) { MessageBox.Show("!!Scenario Already Open!!", "Scenario Open", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } } this.SaveScenarioProperties(); if (this.m_intError == 0) { this.btnOpen.DialogResult = DialogResult.OK; if (ScenarioType.Trim().ToUpper() == "OPTIMIZER") { ((frmOptimizerScenario)this.ParentForm).DialogResult = DialogResult.OK; ((frmOptimizerScenario)this.ParentForm).Close(); } else { this.ReferenceProcessorScenarioForm.DialogResult = DialogResult.OK; this.ReferenceProcessorScenarioForm.Close(); } } } catch (Exception err) { MessageBox.Show("!!Error!! \n" + "Module - uc_scenario:btnOpen_Click \n" + "Err Msg - " + err.Message.ToString().Trim(), "Open Scenario", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation); } }
/// <summary> /// create new scenario event /// </summary> /// <param name="gameObject">GameObject of scenario owner</param> /// <param name="displayName">owner name(無指定だとGameObjectの名前となる)</param> public EventData(GameObject gameObject, string displayName = "") { this.gameObject = gameObject; if (displayName == "") { this.displayName = gameObject.name; } else { this.displayName = displayName; } m_scenarioType = ScenarioType.None; }
public List <List <ScenarioData> > CreateScenarioIndexGroups(ScenarioType type, MapList.MapList maplist, IContainer gameDataPath, TextUtils.GameTextEncoding encoding, EndianUtils.Endianness endian, BitUtils.Bitness bits) { SortedDictionary <int, ScenarioWebsiteName> websiteNames = ScenarioWebsiteName.GenerateWebsiteNames(this.Version); Util.Assert(maplist.MapNames.Count == websiteNames.Count); List <ScenarioData> scenes = new List <ScenarioData>(); List <ScenarioFile.ScenarioFile> scenarioFiles = new List <ScenarioFile.ScenarioFile>(); bool haveSeenEP_030_010 = false; foreach (var d in websiteNames) { var names = maplist.MapNames[d.Key]; if (d.Value.Type != type) { continue; } string episodeID = names.Name3 == "dummy" ? names.Name1 : names.Name3; // the game has this file twice in scenario.dat, so ignore the first instance we encounter, as presumably the game would overwrite the first instance with the second? if (!haveSeenEP_030_010 && episodeID == "EP_030_010") { haveSeenEP_030_010 = true; continue; } int num = d.Key; var metadata = new ScenarioData() { ScenarioDatIndex = num, EpisodeId = episodeID, HumanReadableName = d.Value.Description != null ? d.Value.Description : episodeID }; System.IO.Stream stream = GenerateWebsite.TryGetScenarioFile(gameDataPath, num, Locale, Version); if (stream != null) { var orig = new ScenarioFile.ScenarioFile(stream, encoding, endian, bits); orig.Metadata = metadata; scenarioFiles.Add(orig); scenes.Add(metadata); } } foreach (var s in scenarioFiles.OrderBy(x => x.Metadata.EpisodeId)) { this.ScenarioFiles.Add(s.Metadata.EpisodeId, s); } return(ScenarioData.ProcessScenesToGroups(scenes)); }
private void UpdateScenario(ScenarioType type, string[] messages, EventData data) { if (type == ScenarioType.Select) { OnChoiceStart?.Invoke(data, messages); } else if (!StepScenario) { OnMessageUpdate?.Invoke(data, messages[0], 1f); } else { currentMessages = messages; StartCoroutine("StepMessage", data); } }
static string Convert(ScenarioType s) { string result; switch (s) { case ScenarioType.дифференциальный: result = "Дифференциальный"; break; case ScenarioType.инкрементальный: result = "Инкрементальный"; break; case ScenarioType.зеркальный: result = "Зеркальный"; break; default: result = "Полный"; break; } return(result); }
public void loadvalues_FromProperties() { if (ScenarioType.Trim().ToUpper() == "OPTIMIZER") { FIA_Biosum_Manager.OptimizerScenarioItem oItem = ReferenceOptimizerScenarioForm.m_oOptimizerScenarioItem; this.txtNotes.Text = oItem.Notes.Trim(); } else { if (!String.IsNullOrEmpty(ReferenceProcessorScenarioForm.m_oProcessorScenarioItem.Notes)) { FIA_Biosum_Manager.ProcessorScenarioItem oItem = ReferenceProcessorScenarioForm.m_oProcessorScenarioItem; this.txtNotes.Text = oItem.Notes.Trim(); } } }
private void AddNewReport(DateTime date, GameOverCause gameOverCause, ScenarioType scenarioType, Player winningPlayer, Force winForce, int winScore, Player losingPlayer, Force losingForce, int lossScore, List <Round> rounds) { context.Add(new Report { Date = date, GameOverCause = gameOverCause, Scenario = context.Scenarios.Single(s => s.ScenarioType == scenarioType), WinningPlayer = winningPlayer, WinScore = winScore, WinningForce = winForce, LosingPlayer = losingPlayer, LossScore = lossScore, LosingForce = losingForce, Rounds = rounds }); context.SaveChanges(); }
public DateTime LastTime; // Время последнего запуска static ScenarioType Convert(string s) { ScenarioType result = ScenarioType.полный; if (s == "Зеркальный") { result = ScenarioType.зеркальный; } if (s == "Инкрементальный") { result = ScenarioType.инкрементальный; } if (s == "Дифференциальный") { result = ScenarioType.дифференциальный; } return(result); }
void Start() { Cursor.lockState = CursorLockMode.Confined; Cursor.visible = false; ShowEmpty(); for (int i = 0; i < allSliders.Length; i++) { allSliders[i].sliderName.Add(iconMonitors[i]); allSliders[i].precisionMonitor = precisionMonitors[i]; ScenarioType scenarioT = (ScenarioType)i; foreach (SpriteRenderer s in allSliders[i].sliderName) { s.sprite = icons[i]; } } }
public string Scenario(int id, ScenarioType scenario) { string action = ""; switch (scenario) { case ScenarioType.Disable: action = "deactivate"; break; case ScenarioType.Enable: action = "activate"; break; case ScenarioType.Start: action = "start"; break; case ScenarioType.Stop: action = "stop"; break; } Dictionary <string, object> command = new Dictionary <string, object>() { { "apikey", _api_key }, { "type", "scenario" }, { "action", action }, { "id", id } }; HTTPQuery query = new HTTPQuery(this, command); if (query.Execute()) { return(query.Response); } else { return(""); } }
public PerformanceTestSession(ScenarioType scenarioType, ImplementationType implementationType, int runs) { _scenarioType = scenarioType; _implementationType = implementationType; _runs = runs; _computerSpecifications = ComputerSpecifications.GetSpecificationsForPlatform(); Console.WriteLine("Scenario={0}, Implementation={1}, Runs={2}", scenarioType, implementationType, runs); if (scenarioType == ScenarioType.All) { foreach (var scenarioName in Enum.GetNames(typeof(ScenarioType)).Where(s => s != "All")) { _scenarios.Add(new Scenario(scenarioName, implementationType, runs, _computerSpecifications.NumberOfCores)); } } else { string scenarioName = scenarioType.ToString(); _scenarios.Add(new Scenario(scenarioName, implementationType, runs, _computerSpecifications.NumberOfCores)); } }
public string Scenario(int id, ScenarioType scenario) { string action = ""; switch (scenario) { case ScenarioType.Disable: action = "deactivate"; break; case ScenarioType.Enable: action = "activate"; break; case ScenarioType.Start: action = "start"; break; case ScenarioType.Stop: action = "stop"; break; } Dictionary<string, object> command = new Dictionary<string, object>() { { "apikey", _api_key }, { "type", "scenario" }, { "action", action }, { "id", id } }; HTTPQuery query = new HTTPQuery(this, command); if (query.Execute()) return query.Response; else return ""; }
/// <summary> /// Map to settlement contract ScenarioType /// </summary> /// <returns></returns> private static SettlementServiceContract.ScenarioTypes MapToSettlementServiceContractScenarioTypes( ScenarioType scenarioType) { switch (scenarioType) { case ScenarioType.EviivoPaymentAgent: return SettlementServiceContract.ScenarioTypes.EVIIVO_PAYMENTAGENT; case ScenarioType.EviivoPaymentAgentCustomDeposit: return SettlementServiceContract.ScenarioTypes.EVIIVO_PAYMENTAGENT_CUSTOMDEPOSIT; case ScenarioType.EviivoPaymentAgentFirstNightDeposit: return SettlementServiceContract.ScenarioTypes.EVIIVO_PAYMENTAGENT_FIRSTNIGHTDEPOSIT; case ScenarioType.EviivoPaymentDeposit: return SettlementServiceContract.ScenarioTypes.EVIIVO_PAYMENTAGENT_DEPOSIT; case ScenarioType.OnAccountPaymentAgent: return SettlementServiceContract.ScenarioTypes.ONACCOUNT_PAYMENTAGENT; case ScenarioType.OnAccountPrincipalCommRate: return SettlementServiceContract.ScenarioTypes.ONACCOUNT_PRINCIPAL_COMM_RATE; case ScenarioType.OnAccountPrincipalWholesaleRate: return SettlementServiceContract.ScenarioTypes.ONACCOUNT_PRINCIPAL_WHOLESALE_RATE; case ScenarioType.OneTimeCcEviivoMerchant: return SettlementServiceContract.ScenarioTypes.ONE_TIME_CC_EVIIVO_MERCHANT; case ScenarioType.OneTimeCcProviderMerchant: return SettlementServiceContract.ScenarioTypes.ONE_TIME_CC_PROVIDER_MERCHANT; case ScenarioType.OneTimeCcUnknownMerchant: return SettlementServiceContract.ScenarioTypes.ONE_TIME_CC_UNKNOWN_MERCHANT; case ScenarioType.PaymentOnArrival: return SettlementServiceContract.ScenarioTypes.PAYMENT_ON_ARRIVAL; case ScenarioType.ProviderMerchant: return SettlementServiceContract.ScenarioTypes.PROVIDER_MERCHANT; case ScenarioType.ProviderMerchantCustomDeposit: return SettlementServiceContract.ScenarioTypes.PROVIDER_MERCHANT_CUSTOMDEPOSIT; case ScenarioType.ProviderMerchantDeposit: return SettlementServiceContract.ScenarioTypes.PROVIDER_MERCHANT_DEPOSIT; case ScenarioType.ProviderMerchantFirstNightDeposit: return SettlementServiceContract.ScenarioTypes.PROVIDER_MERCHANT_FIRSTNIGHTDEPOSIT; case ScenarioType.Referral: return SettlementServiceContract.ScenarioTypes.REFERRAL; case ScenarioType.SupplyPartnerPaymentAgent: return SettlementServiceContract.ScenarioTypes.SUPPLYPARTNER_PAYMENTAGENT; case ScenarioType.SupplyPartnerPaymentAgentCustomDeposit: return SettlementServiceContract.ScenarioTypes.SUPPLYPARTNER_PAYMENTAGENT_CUSTOMDEPOSIT; case ScenarioType.SupplyPartnerPaymentAgentDeposit: return SettlementServiceContract.ScenarioTypes.SUPPLYPARTNER_PAYMENTAGENT_DEPOSIT; case ScenarioType.SupplyPartnerPaymentAgentFirstNightDeposit: return SettlementServiceContract.ScenarioTypes.SUPPLYPARTNER_PAYMENTAGENT_FIRSTNIGHTDEPOSIT; case ScenarioType.DistributorDeposit: return SettlementServiceContract.ScenarioTypes.DISTRIBUTOR_DEPOSIT; default: return SettlementServiceContract.ScenarioTypes.EVIIVO_PAYMENTAGENT; } }
private async Task RunDownloadsAsync(BackgroundDownloader downloader, ScenarioType type) { // Use a unique ID for every button click, to help the user associate downloads of the same run // in the logs. runId++; DownloadOperation[] downloads = new DownloadOperation[3]; try { // First we create three download operations: Note that we don't start downloads immediately. It is // important to first create all operations that should participate in the toast/tile update. Once all // operations have been created, we can start them. // If we start a download and create a second one afterwards, there is a race where the first download // may complete before we were able to create the second one. This would result in the toast/tile being // shown before we even create the second download. downloads[0] = await CreateDownload(downloader, 1, String.Format(CultureInfo.InvariantCulture, "{0}.{1}.FastDownload.txt", type, runId)); downloads[1] = await CreateDownload(downloader, 5, String.Format(CultureInfo.InvariantCulture, "{0}.{1}.MediumDownload.txt", type, runId)); downloads[2] = await CreateDownload(downloader, 10, String.Format(CultureInfo.InvariantCulture, "{0}.{1}.SlowDownload.txt", type, runId)); } catch (FileNotFoundException) { // We were unable to create the destination file. return; } // Once all downloads participating in the toast/tile update have been created, start them. Task[] downloadTasks = new Task[downloads.Length]; for (int i = 0; i < downloads.Length; i++) { downloadTasks[i] = DownloadAsync(downloads[i]); } await Task.WhenAll(downloadTasks); }
private List<List<ScenarioData>> CreateScenarioIndexGroups( ScenarioType type, string database, string scenarioDatFolder, string scenarioDatFolderMod = null, bool isUtf8 = false ) { var data = SqliteUtil.SelectArray( "Data Source=" + database, "SELECT filename, shortdesc, desc FROM descriptions ORDER BY desc" ); List<ScenarioData> scenes = new List<ScenarioData>(); foreach ( var d in data ) { string filename = (string)d[0]; string humanReadableName = (string)d[1]; string episodeID = (string)d[2]; int idx = humanReadableName.LastIndexOfAny( new char[] { ']', '}' } ); if ( idx > -1 ) { humanReadableName = humanReadableName.Substring( idx + 1 ); } humanReadableName = humanReadableName.Trim(); if ( filename.StartsWith( "VScenario" ) ) { string group; int dummy; bool isStory; bool isScenario = episodeID.StartsWith( "EP_" ); if ( isScenario ) { group = episodeID.Split( '_' )[1]; isStory = group.Length == 3 && Int32.TryParse( group, out dummy ); } else { group = ""; isStory = false; } bool exportAsScenario = isScenario && ( ( type == ScenarioType.Story && isStory ) || ( type == ScenarioType.Sidequests && !isStory ) ); bool exportAsMap = !isScenario && type == ScenarioType.Maps; if ( exportAsScenario || exportAsMap ) { if ( !ScenarioFiles.ContainsKey( episodeID ) ) { string num = filename.Substring( "VScenario".Length ); try { var orig = new ScenarioFile.ScenarioFile( Path.Combine( scenarioDatFolder, num + ".d" ), isUtf8 ); if ( scenarioDatFolderMod != null ) { var mod = new ScenarioFile.ScenarioFile( Path.Combine( scenarioDatFolderMod, num + ".d" ), isUtf8 ); Util.Assert( orig.EntryList.Count == mod.EntryList.Count ); for ( int i = 0; i < orig.EntryList.Count; ++i ) { orig.EntryList[i].EnName = mod.EntryList[i].JpName; orig.EntryList[i].EnText = mod.EntryList[i].JpText; } } orig.EpisodeID = episodeID; this.ScenarioFiles.Add( episodeID, orig ); scenes.Add( new ScenarioData() { EpisodeId = episodeID, HumanReadableName = humanReadableName, DatabaseName = filename } ); } catch ( FileNotFoundException ) { } } } } } return ScenarioData.ProcessScenesToGroups( scenes ); }
private string ScenarioProcessGroupsToHtml( List<List<ScenarioData>> groups, ScenarioType type, bool phpLinks = false ) { var sb = new StringBuilder(); AddHeader( sb, "Scenario Index (" + type.ToString() + ")" ); sb.AppendLine( "<body>" ); AddMenuBar( sb ); sb.Append( "<div class=\"scenario-index\">" ); sb.Append( "<ul>" ); for ( int i = 0; i < groups.Count; ++i ) { var group = groups[i]; string commonBegin = ScenarioData.FindMostCommonStart( group ); sb.Append( "<li>" ); if ( type == ScenarioType.Maps ) { sb.Append( commonBegin.Split( new char[] { '_', '0' } )[0] ); } else { if ( commonBegin != "" ) { sb.Append( commonBegin ); } else { sb.Append( "Intro" ); } } sb.Append( "<ul>" ); for ( int j = 0; j < group.Count; ++j ) { var scene = group[j]; sb.Append( "<li>" ); sb.Append( "<a href=\"" ); sb.Append( GetUrl( WebsiteSection.Scenario, GameVersion.PS3, phpLinks, extra: scene.EpisodeId ) ); sb.Append( "\">" ); sb.Append( scene.HumanReadableNameWithoutPrefix( commonBegin ) ); sb.Append( "</a>" ); foreach ( var skit in scene.Skits ) { sb.Append( "<ul>" ); sb.Append( "<li>" ); sb.Append( "<a href=\"" ); sb.Append( GetUrl( WebsiteSection.Skit, GameVersion.PS3, phpLinks, extra: skit.RefString ) ); sb.Append( "\">" ); sb.Append( InGameIdDict[skit.StringDicIdName].GetStringHtml( 0, GameVersion.PS3 ) ); sb.Append( " (" ); sb.Append( InGameIdDict[skit.StringDicIdName].GetStringHtml( 1, GameVersion.PS3 ) ); sb.Append( ")" ); sb.Append( "</a>" ); sb.Append( "</li>" ); sb.Append( "</ul>" ); } sb.Append( "</li>" ); } sb.Append( "</ul>" ); sb.Append( "</li>" ); } sb.Append( "</ul>" ); sb.Append( "</div>" ); AddFooter( sb ); sb.AppendLine( "</body></html>" ); return sb.ToString(); }