static bool AssembleFinalEntryPrefix(DialogueEntry entry, CheckResult checkResult, bool isLocalizationTrigger, ref FinalEntry __result) { FinalEntry finalEntry; if (JanusNode.IsJanusNode(entry)) { finalEntry = JanusNode.HandleEntry(entry); } else if (WhiteCheckNode.IsWhiteCheckNode(entry)) { finalEntry = ((checkResult == null) ? CheckNodeUtil.HandleEntry(entry) : CheckNodeUtil.HandleEntry(entry, checkResult)); } else if (RedCheckNode.IsRedCheckNode(entry)) { finalEntry = ((checkResult == null) ? CheckNodeUtil.HandleEntry(entry) : CheckNodeUtil.HandleEntry(entry, checkResult)); } else if (PassiveNode.IsPassiveNode(entry)) { finalEntry = PassiveNode.HandleEntry(entry, true); } else if (CostOptionNode.IsCostOptionNode(entry)) { finalEntry = CostOptionNode.HandleEntry(entry, isLocalizationTrigger); } else if (KimSwitchNode.IsKimSwitchNode(entry)) { string localizedTerm = LocalizationManager.GetLocalizedTerm(LocalizationUtils.GetDialogueEntryLocalizationTerm(entry)); string spokenLine = (localizedTerm == null || localizedTerm.Equals(string.Empty)) ? entry.subtitleText : LocalizationUtils.FormatLocalizedDialogueText(localizedTerm); KimSwitchNode.HandleEntry(entry, isLocalizationTrigger); finalEntry = new FinalEntry(entry, spokenLine, FinalEntry.GetSpeakerName(entry)); } else if (FakeCheckNode.IsFakeCheckNode(entry)) { finalEntry = CheckNodeUtil.HandleEntry(entry); } else if (checkResult != null) { finalEntry = CheckNodeUtil.HandleEntry(entry, checkResult); string localizedTerm2 = LocalizationManager.GetLocalizedTerm(LocalizationUtils.GetDialogueEntryLocalizationTerm(entry)); string spokenLine2 = (localizedTerm2 == null || localizedTerm2.Equals(string.Empty)) ? entry.subtitleText : LocalizationUtils.FormatLocalizedDialogueText(localizedTerm2); finalEntry.spokenLine = spokenLine2; } else { string localizedTerm3 = LocalizationManager.GetLocalizedTerm(LocalizationUtils.GetDialogueEntryLocalizationTerm(entry)); string spokenLine3 = (localizedTerm3 == null || localizedTerm3.Equals(string.Empty)) ? entry.subtitleText : LocalizationUtils.FormatLocalizedDialogueText(localizedTerm3); finalEntry = new FinalEntry(entry, spokenLine3, FinalEntry.GetSpeakerName(entry)); } __result = finalEntry; return(false); }
public static bool InsertFinalEntry(FinalEntry model) { int cashmemoid; using (var conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString)) { using (var cmd = new SqlCommand("sp_InsertFinalEntry", conn)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("busId", model.BusID); cmd.Parameters.AddWithValue("Transipment", model.Transipment); cmd.Parameters.AddWithValue("wayCorrection", model.wayCorrection); cmd.Parameters.AddWithValue("FareRefund", model.FareRefund); cmd.Parameters.AddWithValue("Deficiency", model.Deficiency); cmd.Parameters.AddWithValue("ElectionBill", model.ElectionBill); cmd.Parameters.AddWithValue("FreeSeat", model.FreeSeat); cmd.Parameters.AddWithValue("RoadWarrant", model.RoadWarrant); cmd.Parameters.AddWithValue("Commission", model.Commission); cmd.Parameters.AddWithValue("Owner", model.Owner); cmd.Parameters.AddWithValue("Balance", model.Balance); cmd.Parameters.AddWithValue("Payment", model.Payment); cmd.Parameters.AddWithValue("Advance", model.Advance); cmd.Parameters.AddWithValue("AdvanceStation", model.AdvanceStation); cmd.Parameters.AddWithValue("Toll", model.Toll); cmd.Parameters.AddWithValue("TRoadWarrant", model.TRoadWarrant); cmd.Parameters.AddWithValue("RoadTax", model.RoadTax); cmd.Parameters.AddWithValue("TTC", model.TTC); cmd.Parameters.AddWithValue("PaiseDetain", model.PaiseDetain); cmd.Parameters.AddWithValue("Super", model.Super); cmd.Parameters.AddWithValue("Fine", model.Fine); cmd.Parameters.AddWithValue("PermitFee", model.PermitFee); cmd.Parameters.AddWithValue("Insurance", model.Insurance); cmd.Parameters.AddWithValue("Advance2", model.Advance2); cmd.Parameters.AddWithValue("BuildingFund", model.BuildingFund); cmd.Parameters.AddWithValue("Loss", model.Loss); cmd.Parameters.AddWithValue("Refund2", model.refund2); cmd.Parameters.AddWithValue("RoadWarrantExp", model.RoadWarrantExp); cmd.Parameters.AddWithValue("SupplyMail", model.SupplyMail); cmd.Parameters.AddWithValue("OwnerSecurity", model.OwnerSecurity); cmd.Parameters.AddWithValue("EntreeFees", model.EntreeFees); cmd.Parameters.AddWithValue("VechileTranfer", model.VechileTranfer); cmd.Parameters.AddWithValue("DistBoard", model.DistBoard); conn.Open(); cmd.ExecuteNonQuery(); conn.Close(); } } return(true); }
private void DiscoReaderHandleNewDialogueEntry(LuaWatchItem luaWatchItem, Lua.Result newResult) { try { if (DialogueManager.IsConversationActive && DialogueManager.Instance.ConversationModel.HasValidEntry) { Subtitle dialogueSubtitle = DialogueManager.Instance.currentConversationState.subtitle; if (dialogueSubtitle?.dialogueEntry == null) { return; } FinalEntry finalEntry = ConversationLogger.AssembleFinalEntry(dialogueSubtitle.dialogueEntry); int conversationId = DialogueManager.Instance.ConversationModel.GetConversationID(DialogueManager.Instance.currentConversationState); if (Conversation == null || Conversation.ConversationId != conversationId) { Conversation = new Conversation(conversationId, DialogueManager.Instance.ConversationModel.ActorInfo.Name, DialogueManager.Instance.ConversationModel.ConversantInfo.Name); } Conversation.DialogueEntries.Add(new ReaderDialogueEntry(dialogueSubtitle.speakerInfo.Name, dialogueSubtitle.speakerInfo.IsPlayer, finalEntry.spokenLine, dialogueSubtitle.sequence, UniqueDialogEntry)); } else { Conversation = new Utils.Conversation(); } // Now to handle outputting to the file... XmlSerializer serializerObj = new XmlSerializer(typeof(Conversation)); Stream stream = null; try { stream = new FileStream(@"WriteText.txt", FileMode.Create, FileAccess.Write); serializerObj.Serialize(stream, Conversation); } finally { stream?.Close(); } } catch (Exception e) { ShowDebugMessage("Exception while writing file... " + e.Message, 30); // We never want to throw an exception } }
public void StartSearchCopy(string source, string target, string outputLoc) { CSVReader sourceReader = new CSVReader(); CSVReader targetReader = new CSVReader(); sourceReader.ParseCSV(source, "}"); targetReader.ParseCSV(target, ""); List <List <string> > sourceList = new List <List <string> >(); List <List <string> > targetList = new List <List <string> >(); sourceList = sourceReader.GetArrayStorage(); targetList = targetReader.GetArrayStorage(); //Tidy up Lists List <OrderEntry> orderList = new List <OrderEntry>(); List <FinalEntry> finalList = new List <FinalEntry>(); List <OrderEntry> orderFailToMatchjList = new List <OrderEntry>(); int indexID = 0; foreach (List <string> entry in sourceList) { if (indexID == 0) { indexID = 1; continue; } indexID++; OrderEntry oEntry = new OrderEntry(); oEntry.indexID = indexID; oEntry.orderID = Int32.Parse(entry[0]); oEntry.custID = Int32.Parse(entry[1]); oEntry.shipID = Int32.Parse(entry[3]); oEntry.notes = entry[4]; oEntry.SearchNotes(); orderList.Add(oEntry); } indexID = 0; foreach (List <string> entry in targetList) { if (indexID == 0) { indexID = 1; continue; } indexID++; //TODO:fix these FinalEntry oEntry = new FinalEntry(); oEntry.indexID = indexID; oEntry.APIID = Int64.Parse(entry[0]); oEntry.customerName = entry[4]; oEntry.siteName = entry[5]; finalList.Add(oEntry); } //Start finding matches int[] matchScore = new int[finalList.Count]; int successfulMatchCounter = 0; int processedAmount = 0; foreach (OrderEntry oE in orderList) { foreach (string name in oE.sitenames) { if (!name.Contains("CORIOLIS"))//theres a random scope inside a Service At: field { if (Properties.Settings.Default.UseLevensteins) { //assign scores per name in comments int matchCounter = 0; foreach (FinalEntry fE in finalList) { matchScore[matchCounter] = ComputeDistance(name, fE.siteName); matchCounter++; } //Find lowest scores and assign them as probable matches int bestScore = matchScore.Min(); int counter = 0; foreach (int value in matchScore) { if (value == bestScore) { finalList[counter].proposedSiteIDs.Add(oE.shipID); finalList[counter].proposedeNameMatch.Add(name); finalList[counter].proposedWorkOrder.Add(oE.orderID); } counter++; } } else { int counter = 0; foreach (FinalEntry fE in finalList) { bool match = CanContain(name, fE.siteName); if (match) { finalList[counter].proposedSiteIDs.Add(oE.shipID); finalList[counter].proposedeNameMatch.Add(name); finalList[counter].proposedWorkOrder.Add(oE.orderID); orderList[oE.indexID].matched = true; successfulMatchCounter++; } counter++; } } } } processedAmount++; } //Write Results string filePath = outputLoc + "/Results.csv"; string delimiter = ","; using (FileStream fs = new FileStream(filePath, FileMode.CreateNew, FileAccess.Write)) { if (fs.CanWrite) { string csvInput = ""; csvInput = "Index_ID" + delimiter + "API_ID" + delimiter + "Customer" + delimiter + "Site_Names" + delimiter + "Prop_Ship_ID1" + delimiter + "Prop_Name1" + delimiter + "Prop_Work_Order1" + delimiter + "Match Rate: " + successfulMatchCounter + "/" + processedAmount; fs.Write(Encoding.ASCII.GetBytes(csvInput), 0, ASCIIEncoding.ASCII.GetByteCount(csvInput)); byte[] newline = Encoding.ASCII.GetBytes(Environment.NewLine); fs.Write(newline, 0, newline.Length); foreach (FinalEntry fE in finalList) { csvInput = fE.indexID + delimiter + fE.APIID + delimiter + fE.customerName + delimiter + fE.siteName; fs.Write(Encoding.ASCII.GetBytes(csvInput), 0, ASCIIEncoding.ASCII.GetByteCount(csvInput)); int count = 0; foreach (int siteID in fE.proposedSiteIDs) { csvInput = delimiter + fE.proposedSiteIDs[count] + delimiter + fE.proposedeNameMatch[count] + delimiter + fE.proposedWorkOrder[count]; fs.Write(Encoding.ASCII.GetBytes(csvInput), 0, ASCIIEncoding.ASCII.GetByteCount(csvInput)); count++; } fs.Write(newline, 0, newline.Length); } } fs.Flush(); fs.Close(); } filePath = outputLoc + "/FailedMatches.csv"; using (FileStream fs = new FileStream(filePath, FileMode.CreateNew, FileAccess.Write)) { if (fs.CanWrite) { string csvInput = ""; csvInput = "Index_ID" + delimiter + "Order_ID" + delimiter + "Ship_ID" + delimiter + "Site_Names" + delimiter + "Notes"; fs.Write(Encoding.ASCII.GetBytes(csvInput), 0, ASCIIEncoding.ASCII.GetByteCount(csvInput)); byte[] newline = Encoding.ASCII.GetBytes(Environment.NewLine); fs.Write(newline, 0, newline.Length); foreach (OrderEntry oE in orderList) { if (oE.matched == false) { csvInput = oE.indexID + delimiter + oE.orderID + delimiter + oE.shipID + delimiter + oE.sitenames[0] + delimiter + oE.notes; fs.Write(Encoding.ASCII.GetBytes(csvInput), 0, ASCIIEncoding.ASCII.GetByteCount(csvInput)); fs.Write(newline, 0, newline.Length); } } } fs.Flush(); fs.Close(); } }
public void BALInsertFinalEntry(FinalEntry model) { }