public void ConvertNoHeaderEntries() { var testPo = new Po(); testPo.Add(new PoEntry { Original = "original" }); testPo.Add(new PoEntry { Original = "totranslate", Translated = "translated" }); string text = @" msgid ""original"" msgstr """" msgid ""totranslate"" msgstr ""translated"" "; text = text.Replace("\r\n", "\n"); var newPo = ConvertStringToPo(text); CompareText(ConvertFormat.To <BinaryFormat>(testPo), text); Assert.IsNull(newPo.Header); Assert.AreEqual(2, newPo.Entries.Count); }
public void Collection() { ISession s = OpenSession(); ITransaction t = s.BeginTransaction(); Multi multi1 = new Multi(); multi1.ExtraProp = "extra1"; Multi multi2 = new Multi(); multi2.ExtraProp = "extra2"; Po po = new Po(); multi1.Po = po; multi2.Po = po; po.Set = new HashSet <Multi> { multi1, multi2 }; po.List = new ArrayList(); po.List.Add(new SubMulti()); object id = s.Save(po); Assert.IsNotNull(id); t.Commit(); s.Close(); s = OpenSession(); t = s.BeginTransaction(); po = (Po)s.Load(typeof(Po), id); Assert.AreEqual(2, po.Set.Count); Assert.AreEqual(1, po.List.Count); s.Delete(po); Assert.AreEqual(0, s.CreateQuery("from s in class Top").List().Count); t.Commit(); s.Close(); }
public virtual ElfData[] GenerateCustomMapping(byte[] elfArray, Po po, int encoding, int memDiff, bool containsFixedEntries, string dictionaryPath, bool customDictionary = false) { // Pass all arguments and generate the mapping. var mapping = new GenerateMapping(elfArray, po, Encoding.GetEncoding(encoding), memDiff, containsFixedEntries, dictionaryPath, customDictionary); return(mapping.Search().ToArray()); }
static void Main(string[] args) { int val = 12; //var result = val switch //{ // 1 => "Case 1", // _ => "Invalid" //}; Points points = new Points(0, 12); Console.WriteLine(PositionShap(points)); Console.ReadKey(); Console.WriteLine("_________________________"); Po po = new Po(); po.X = 23; po.Y = 45; Console.WriteLine(po.DisplayPosition()); Console.ReadKey(); string firstName = "Tayyab"; string lastName = " hatti"; Console.WriteLine(GetName(firstName, lastName));
public void ParseExtendedHeaderEntriesd() { string text = @" msgid """" msgstr """" ""Project-Id-Version: myId\n"" ""Report-Msgid-Bugs-To: yo\n"" ""Language: SC\n"" ""X-Generator: libgame"" "; text = text.Replace("\r\n", "\n"); Po testPo = null; Assert.DoesNotThrow(() => testPo = ConvertStringToPo(text)); Assert.That(testPo?.Header?.Extensions["Generator"], Is.EqualTo("libgame")); text = "msgid \"\"\nmsgstr \"\"\n\"X: libgame\""; Assert.Throws <FormatException>( () => ConvertStringToPo(text), "Unknown header: Unknown: X"); text = "msgid \"\"\nmsgstr \"\"\n\"X-: libgame\""; Assert.Throws <FormatException>( () => ConvertStringToPo(text), "Unknown header: Unknown: X-"); }
public void ExportPO() { Po poExport = new Po { Header = new PoHeader("Black Rock Shooter The Game", "TraduSquare.es", "es") { LanguageTeam = "TraduSquare", } }; for (int i = 0; i < this.Text.Count; i++) { string sentence = this.Text[i]; if (string.IsNullOrEmpty(sentence)) { sentence = "<!empty>"; } poExport.Add(new PoEntry(this.RemoveButtons(sentence)) { Context = i.ToString() }); } poExport.ConvertTo <BinaryFormat>().Stream.WriteTo(this.FileName + ".po"); }
public async Task AddPoAsync(Po po) { var entity = await this._entityTrackerRepository.GetEntityAsync(po.CompanyId, po.PoDate, BusinessConstants.ENTITY_TRACKER_PO); po.PoNo = entity.EntityNo; await this._poRepository.AddPoAsync(po); }
public NodeContainerFormat Convert(BinaryFormat source) { var container = new NodeContainerFormat(); var po = new Po { Header = new PoHeader("Jump Ultimate Stars", "TranScene", "es") { LanguageTeam = "TranScene", } }; var reader = new DataReader(source.Stream) { DefaultEncoding = Encoding.GetEncoding("shift_jis"), }; JusData.reader = reader; reader.Stream.Position = 0x00; BinaryFormat poBin; var mangaIndex = MangaIndex.getInstance(); int numQuestions = reader.ReadInt32(); string currentManga = mangaIndex.getMangaName(0xFF); int mangaCount = 0; for (int i = 0; i < numQuestions; i++) { var q = JquizData.readData(); if (q.manga != currentManga) { poBin = ConvertFormat.With <Po2Binary>(po) as BinaryFormat; container.Root.Add(new Node($"jquiz-{mangaCount}-{currentManga}.po", poBin)); po = new Po { Header = new PoHeader("Jump Ultimate Stars", "TranScene", "es") { LanguageTeam = "TranScene", } }; mangaCount++; currentManga = q.manga; } po.Add(new PoEntry(q.question) { Context = $"{i} - Question", ExtractedComments = $"{q.photo}-{q.mangaCode}-{q.unknown}-{q.num}" }); for (int j = 0; j < q.answers.Length; j++) { po.Add(new PoEntry(q.answers[j]) { Context = $"{i} - Answer {j}" }); } } poBin = ConvertFormat.With <Po2Binary>(po) as BinaryFormat; container.Root.Add(new Node($"jquiz-{mangaCount}-{currentManga}.po", poBin)); return(container); }
public void ConvertBasicHeaderNoEntries() { var po = new Po(new PoHeader("myId", "yo", "es") { CreationDate = "today" }); string text = @"msgid """" msgstr """" ""Project-Id-Version: myId\n"" ""Report-Msgid-Bugs-To: yo\n"" ""POT-Creation-Date: today\n"" ""PO-Revision-Date: \n"" ""Last-Translator: \n"" ""Language-Team: \n"" ""Language: es\n"" ""MIME-Version: 1.0\n"" ""Content-Type: text/plain; charset=UTF-8\n"" ""Content-Transfer-Encoding: 8bit\n"" "; text = text.Replace("\r\n", "\n"); var newPo = ConvertStringToPo(text); CompareText(ConvertFormat.To <BinaryFormat>(po), text); Assert.AreEqual(po.Header.ProjectIdVersion, newPo.Header.ProjectIdVersion); Assert.AreEqual(po.Header.ReportMsgidBugsTo, newPo.Header.ReportMsgidBugsTo); Assert.AreEqual(po.Header.CreationDate, newPo.Header.CreationDate); Assert.AreEqual(po.Header.Language, newPo.Header.Language); Assert.IsEmpty(newPo.Header.LastTranslator); Assert.IsEmpty(newPo.Entries); }
public static void POExport(Po POHeader, string source, string target, int i) { POHeader.Add(new PoEntry(source) { Translated = target, Context = i.ToString() }); }
private void InitializeForm(Po po) { if (po == null) { return; } CoverObjectUtility.SetAutoBindingData(this.tableLayoutPanel3, po); if (po.Quotation != null) { CoverObjectUtility.SetAutoBindingData(this.tableLayoutPanel3, po.Quotation); } if (m_Comapny != null) { CoverObjectUtility.SetAutoBindingData(this.tableLayoutPanel3, m_Comapny); if (m_Comapny.MainDeputy != null) { CoverObjectUtility.SetAutoBindingData(this.tableLayoutPanel3, m_Comapny.MainDeputy); } if (m_Comapny.CompanyId > 0) { using (IUnitOfWork uow = new UnitOfWork()) { m_Po.PoCode = uow.PoRepository.GetPOCode(m_Comapny.CompanyId, DateTime.Today); uow.Commit(); } txtPoCode.Text = m_Po.PoCode; } } }
private static Po GetOldData(int id, string OldDB) { string q = "USE " + OldDB + "; "; q += "SELECT * FROM " + PO.PO_TBL + " WHERE " + PO.PO_ID + " = '" + id + "'; "; using (IDataReader redr = new DAL().Listreader(q)) { while (redr.Read() == true) { Po obj = new Po { Po_no = redr[PO.PO_NO].ToString(), Po_date = redr[PO.PO_DATE].ToString(), Delivery_date = redr[PO.DELIVERY_DATE].ToString(), Notes = redr[PO.NOTES].ToString(), Active_id = redr[PO.ACTIVE_ID].ToString(), User_id = "1" }; return(obj); } return(null); } }
public Po Convert(BinaryFormat source) { if (source == null) { throw new ArgumentNullException(nameof(source)); } DataReader reader = new DataReader(source.Stream) { DefaultEncoding = Encoding.GetEncoding("utf-16"), }; Po po = new Po { Header = new PoHeader( "AttackFridayMonster Translation", "*****@*****.**", "es-ES"), }; while (!source.Stream.EndOfStream) { uint id = reader.ReadUInt32(); // Japanese version has 0x38 bytes of text and 0x74 of unknown string text = reader.ReadString(0x50).Replace("\0", string.Empty); source.Stream.Seek(0x6C, SeekMode.Current); // Unknown po.Add(new PoEntry(text) { Context = "id:" + id }); } return(po); }
public static void TranslatePOwithAnotherPO(string BasePO, string TargetPo) { Po BPo = null, TPo = null; using (DataStream name = DataStreamFactory.FromFile(BasePO, FileOpenMode.Read)) using (BinaryFormat binaryname = new BinaryFormat(name)) { BPo = (Po)ConvertFormat.With <Po2Binary>(binaryname); } using (DataStream name = DataStreamFactory.FromFile(TargetPo, FileOpenMode.Read)) using (BinaryFormat binaryname = new BinaryFormat(name)) { TPo = (Po)ConvertFormat.With <Po2Binary>(binaryname); } foreach (PoEntry entryBPo in BPo.Entries) { foreach (PoEntry entryTPo in TPo.Entries) { if (entryBPo.Original == entryTPo.Original && (entryBPo.Translated != null && entryBPo.Translated != "")) { entryTPo.Translated = entryBPo.Translated; if (entryBPo.TranslatorComment != string.Empty && entryBPo.TranslatorComment != null && entryBPo.TranslatorComment.Trim() != "") { entryTPo.TranslatorComment = entryBPo.TranslatorComment; } } } } ConvertFormat.To <BinaryFormat>(TPo).Stream.WriteTo(TargetPo); }
public void ImportPO(string poFileName) { DataStream inputPO = new DataStream(poFileName, FileOpenMode.Read); BinaryFormat binaryFile = new BinaryFormat(inputPO); Po newPO = binaryFile.ConvertTo <Po>(); variables.textoOriginal = new string[newPO.Entries.Count]; variables.textoTraducido = new string[newPO.Entries.Count]; variables.contexto = new string[newPO.Entries.Count]; inputPO.Dispose(); int contador = 0; listBox1.Items.Clear(); Array.Clear(variables.textoOriginal, 0, variables.textoOriginal.Length); Array.Clear(variables.textoTraducido, 0, variables.textoTraducido.Length); Array.Clear(variables.contexto, 0, variables.contexto.Length); foreach (var entry in newPO.Entries) { listBox1.Items.Add(entry.Context); variables.textoOriginal[contador] = entry.Original; variables.contexto[contador] = entry.Context; if (entry.Translated == "") { variables.textoTraducido[contador] = "<!empty>"; } variables.textoTraducido[contador] = entry.Translated; contador++; } listBox1.SelectedIndex = 0; }
public void ExportPO() { Po poExport = new Po { Header = new PoHeader("Jump Ultimate Stars", "TranScene", "es") { LanguageTeam = "TranScene", } }; int i = 0; foreach (KeyValuePair <string, int> entry in this.Text) { string sentence = entry.Key; if (string.IsNullOrEmpty(sentence)) { sentence = "<!empty>"; } poExport.Add(new PoEntry(sentence) { Context = i.ToString() }); } poExport.ConvertTo <BinaryFormat>().Stream.WriteTo(this.FileName + ".po"); }
public static void XML2PO(string file) { Po POHeader = new Po { Header = new PoHeader("Shin Megami Tensei IV", "*****@*****.**", "es") { LanguageTeam = "TraduSquare (SMTIVesp)", } }; XElement XML = XElement.Load(file); int count = 0; foreach (XElement entry in XML.Descendants("entry")) { string target; string source = entry.Element("source").Value; if (string.IsNullOrEmpty(source)) { source = "<empty>"; } target = entry.Element("target").Value; if (string.IsNullOrEmpty(target)) { target = ""; } POExport(POHeader, source.Replace("{F801}", "\n"), target.Replace("{F801}", "\n"), count); count++; } POWrite(POHeader, file.Replace(".xml", "")); }
public async Task AddPoAsync(Po po) { using (SqlConnection connection = new SqlConnection(ConnectionSettings.ConnectionString)) { connection.Open(); SqlCommand command = connection.CreateCommand(); SqlTransaction transaction; // Start a local transaction. transaction = connection.BeginTransaction(IsolationLevel.ReadUncommitted, "SampleTransaction"); //1. Get SupplierInvoicePoDetails po transaction detail List <SupplierInvoicePoDetails> supplierInvoicePoDetailsList = new List <SupplierInvoicePoDetails>(); SqlConnection conn = new SqlConnection(ConnectionSettings.ConnectionString); // Must assign both transaction object and connection // to Command object for a pending local transaction command.Connection = connection; command.Transaction = transaction; string sql = string.Empty; try { sql = string.Format($"INSERT INTO [dbo].[PoMaster] ([CompanyId] ,[SupplierId] ,[PoNo] ,[PoDate] ,[EmailIds] ,[Remarks] ,[IsClosed] ,[IsAcknowledged] ,[PaymentTerms] ,[DeliveryTerms],[DueDate],[AccessId] ) VALUES ('{po.CompanyId}' ,'{po.SupplierId}' ,'{po.PoNo}' ,'{po.PoDate}' ,'{po.EmailIds}' ,'{po.Remarks}' ,'{po.IsClosed}' ,'{po.IsAcknowledged}' ,'{po.PaymentTerms}' ,'{po.DeliveryTerms}' ,'{po.DueDate}', '{po.AccessId}')"); sql = sql + " Select Scope_Identity()"; command.CommandText = sql; var poId = command.ExecuteScalar(); //var poId = _sqlHelper.ExecuteScalar(ConnectionSettings.ConnectionString, sql, CommandType.Text); foreach (PoDetail poDetail in po.poDetails) { sql = string.Format($"INSERT INTO [dbo].[PoDetails] ([PoId] ,[PartId] ,[ReferenceNo] ,[Qty] ,[UnitPrice] ,[DueDate] ,[Note] ,[AckQty] ,[InTransitQty] ,[ReceivedQty] ,[IsClosed],[SrNo],[IsForceClosed] ) VALUES ('{poId}' ,'{poDetail.PartId}' ,'{poDetail.ReferenceNo}' ,'{poDetail.Qty}' ,'{poDetail.UnitPrice}' ,'{poDetail.DueDate}' ,'{poDetail.Note}' ,'{poDetail.Qty}' ,'{poDetail.InTransitQty}' ,'{poDetail.ReceivedQty}' ,'{poDetail.IsClosed}','{poDetail.SrNo}','{false}')"); command.CommandText = sql; await command.ExecuteNonQueryAsync(); } foreach (PoTerm poTerm in po.poTerms) { sql = string.Format($"INSERT INTO [dbo].[PoTerms] ([PoId] ,[SequenceNo] ,[Term]) VALUES ('{poId}' ,'{poTerm.SequenceNo}' ,'{poTerm.Term.Replace("'", "''")}')"); command.CommandText = sql; await command.ExecuteNonQueryAsync(); } await this.entityTrackerRepository.AddEntityAsync(po.CompanyId, po.PoDate, BusinessConstants.ENTITY_TRACKER_PO, command.Connection, command.Transaction, command); transaction.Commit(); } catch (Exception ex) { transaction.Rollback(); throw ex; } } }
public Task <string> OnSalesOrderNotApprovedRequestAsync(Po po) { var onSalesOrderNotApprovedFunction = new OnSalesOrderNotApprovedFunction(); onSalesOrderNotApprovedFunction.Po = po; return(ContractHandler.SendRequestAsync(onSalesOrderNotApprovedFunction)); }
public Task <TransactionReceipt> SetPoRequestAndWaitForReceiptAsync(Po po, CancellationTokenSource cancellationToken = null) { var setPoFunction = new SetPoFunction(); setPoFunction.Po = po; return(ContractHandler.SendRequestAndWaitForReceiptAsync(setPoFunction, cancellationToken)); }
private void BindToListView(Po po, IList <QuotationDetail> lstQuotationDetail) { m_Po = po; m_Planning.PlanningCode = m_Po.PoCode.Replace("PO", "PL"); txtPOCode.Text = m_Po.PoCode; txtPlanningCode.Text = m_Planning.PlanningCode; AddProductToListView(lstQuotationDetail); }
public Task <string> SetPoRequestAsync(Po po) { var setPoFunction = new SetPoFunction(); setPoFunction.Po = po; return(ContractHandler.SendRequestAsync(setPoFunction)); }
public Task <string> EmitEventForNewPoRequestAsync(Po po) { var emitEventForNewPoFunction = new EmitEventForNewPoFunction(); emitEventForNewPoFunction.Po = po; return(ContractHandler.SendRequestAsync(emitEventForNewPoFunction)); }
private static void InsertData(Po obj, string newDB) { if (CheckData(obj, newDB) == false) { CPo.Insert(obj, new DAL()); } ; }
public override void Copy() { if (m_PoOrigin == null) { return; } m_CopyPO = new Po(m_PoOrigin); }
public Task <string> OnCreatePurchaseOrderRequestedRequestAsync(Po po) { var onCreatePurchaseOrderRequestedFunction = new OnCreatePurchaseOrderRequestedFunction(); onCreatePurchaseOrderRequestedFunction.Po = po; return(ContractHandler.SendRequestAsync(onCreatePurchaseOrderRequestedFunction)); }
public Task <string> OnPurchaseRefundFailedRequestAsync(Po po) { var onPurchaseRefundFailedFunction = new OnPurchaseRefundFailedFunction(); onPurchaseRefundFailedFunction.Po = po; return(ContractHandler.SendRequestAsync(onPurchaseRefundFailedFunction)); }
public void FinalSpacesAreIgnored() { string text = "msgid \"test\"\n \n \n"; Po newPo = ConvertStringToPo(text); Assert.AreEqual(1, newPo.Entries.Count); Assert.AreEqual("test", newPo.Entries[0].Original); }
public Task <string> OnSalesOrderInvoiceFaultRequestAsync(Po po) { var onSalesOrderInvoiceFaultFunction = new OnSalesOrderInvoiceFaultFunction(); onSalesOrderInvoiceFaultFunction.Po = po; return(ContractHandler.SendRequestAsync(onSalesOrderInvoiceFaultFunction)); }
public Task <string> OnPurchaseUpdatedWithSalesOrderRequestAsync(Po po) { var onPurchaseUpdatedWithSalesOrderFunction = new OnPurchaseUpdatedWithSalesOrderFunction(); onPurchaseUpdatedWithSalesOrderFunction.Po = po; return(ContractHandler.SendRequestAsync(onPurchaseUpdatedWithSalesOrderFunction)); }