public MainForm() { _merger = new Merger(); _merger.StateChanged += MergerStateChanged; InitializeComponent(); }
public void MergeDouble() { var candidate = "Test {{a}}"; var expected = "Test 1.2"; var m = new Merger(); m.AddProperty("a", 1.2); Assert.AreEqual(expected, m.Merge(candidate)); }
public void SimpleMerge() { var candidate = "Test {{a}}"; var expected = "Test B"; var m = new Merger(); m.AddProperty("a", "B"); Assert.AreEqual(expected, m.Merge(candidate)); }
public void MergeDate() { var candidate = "Test {{a}}"; var expected = "Test 09/10/2015 12:34:00"; var value = new DateTime(2015, 10, 9, 12, 34, 0); var m = new Merger(); m.AddProperty("a", value); Assert.AreEqual(expected, m.Merge(candidate)); }
public void MergeDateFormatted() { var candidate = "Test {{a:d MMM yyyy}}"; var expected = "Test 9 Oct 2015"; var value = new DateTime(2015, 10, 9, 12, 34, 0); var m = new Merger(); m.AddProperty("a", value); Assert.AreEqual(expected, m.Merge(candidate)); }
private void sendMessageButton_Click(object sender, EventArgs e) { try { //Let us create a data source in this case Hastable that would //used to demonstrate the merging // Take the form variables collection as the data source. Hashtable dataSource = new Hashtable(); dataSource.Add("FIRSTNAME", _tbFirstName.Text); dataSource.Add("LASTNAME", _tbLastName.Text); dataSource.Add("EMAIL", _tbEmail.Text); dataSource.Add("ORDER_ID", _tbOrderId.Text); dataSource.Add("CUSTOMER_ID", "1"); dataSource.Add("PRODUCTS_TEXT", (string)_comboProduct.SelectedItem); // We create the templater object. ActiveUp.Net.Mail.Templater templater = new Templater(@"MailTemplate_for_datasource.xml"); // We instanciante the Merger object by passing the templater data. Merger merger = new Merger(); // We merge our DataSource and send the mail. merger.MergeMessage(templater.Message, dataSource, false); this.AddLogEntry("Sending template message."); string smtp = string.Empty; if (_cbUseSmtpFromTemplate.Checked) { smtp = templater.SmtpServers[0].Host; } else { smtp = smtpServerAddressTextbox.Text; } templater.Message.Send(smtp); this.AddLogEntry("Message sent successfully."); } catch (SmtpException ex) { this.AddLogEntry(string.Format("Smtp Error: {0}", ex.Message)); } catch (Exception ex) { this.AddLogEntry(string.Format("Failed: {0}", ex.Message)); } }
private void startMerging() { Program.debug("Starting to merge databases:"); Merger merger = new Merger(); Thread newThread = new Thread(new ThreadStart(merger.start)); newThread.Start(); newThread.Join(); anyButtonClicked = false; }
public void Merge_Types_with_Ignore_Policy() { var obj1 = new { Property1 = "values1", Property2 = "values1" }; var obj2 = new { Property1 = "values2", Property4 = "values4" }; var result = Merger.Ignore(() => obj1.Property1) .Ignore(() => obj2.Property4) .Merge(obj1, obj2); Assert.AreEqual(2, result.GetType().GetProperties().Length); Assert.AreEqual("values2", result.GetType().GetProperty("Property1").GetValue(result)); Assert.IsNotNull(result.GetType().GetProperty("Property2")); }
public void TwoPassMerge() { var candidate = "Test {{A}}"; var expected = "Test C"; var d = new Dictionary <string, object>(); d.Add("A", "{{B}}"); d.Add("B", "C"); // Test the other constructor var m = new Merger(d); Assert.AreEqual(expected, m.Merge(m.Merge(candidate))); }
public void Product() { dynamic parsed = GetUUT("Product"); dynamic merged = Merger.Merge(parsed.Amazon, parsed.WalMart); Assert.That(merged.Price == 129); Assert.That(merged.Rating.Comments.Length == 3); // only float values should be in the rating var stars = (merged.Rating.Stars as object[]).Select(Convert.ToDouble).ToList(); Assert.IsNotNull(stars); Assert.That(stars.Sum(d => d) == 12.5); }
/// <summary> /// Initializes a new instance of the MainViewModel class. /// </summary> public MainViewModel(Merger merger, FileManager fileManager) { Guard.ArgumentNotNull(merger, "merger"); Guard.ArgumentNotNull(fileManager, "fileManager"); _merger = merger; _fileManager = fileManager; LoadOriginalFileCommand = new RelayCommand(LoadOriginalFile); LoadFirstFileCommand = new RelayCommand(LoadFirstFile); LoadSecondFileCommand = new RelayCommand(LoadSecondFile); SaveResultFileCommand = new RelayCommand(SaveResultFile, () => Items.Any()); Items = new ObservableCollection<ItemViewModel>(); }
public void Test_Class_with_Built_in_Types() { var obj1 = new { Property1 = "value1", Property2 = "2" }; var obj2 = new AllBuiltInTypes { ByteType = byte.MaxValue, SByteType = sbyte.MaxValue, Int32Type = int.MaxValue, UInt32Type = uint.MaxValue, Int16Type = short.MaxValue, UInt16Type = ushort.MaxValue, Int64Type = long.MaxValue, UInt64Type = ulong.MaxValue, SingleType = float.MaxValue, DoubleType = double.MaxValue, DecimalType = 300.5m, BooleanType = false, CharType = '\x0058', ObjectType = new { Test = 1 }, StringType = "foo", DateTimeType = DateTime.Now, EnumType = TestEnum.Val1 }; var result1 = Merger.Merge(obj1, obj2); Assert.AreEqual(19, result1.GetType().GetProperties().Length); Assert.AreEqual(obj1.Property1, result1.GetType().GetProperty("Property1").GetValue(result1)); Assert.AreEqual(obj1.Property2, result1.GetType().GetProperty("Property2").GetValue(result1)); Assert.AreEqual(obj2.ByteType, result1.GetType().GetProperty("ByteType").GetValue(result1)); Assert.AreEqual(obj2.SByteType, result1.GetType().GetProperty("SByteType").GetValue(result1)); Assert.AreEqual(obj2.Int32Type, result1.GetType().GetProperty("Int32Type").GetValue(result1)); Assert.AreEqual(obj2.UInt32Type, result1.GetType().GetProperty("UInt32Type").GetValue(result1)); Assert.AreEqual(obj2.Int16Type, result1.GetType().GetProperty("Int16Type").GetValue(result1)); Assert.AreEqual(obj2.UInt16Type, result1.GetType().GetProperty("UInt16Type").GetValue(result1)); Assert.AreEqual(obj2.Int64Type, result1.GetType().GetProperty("Int64Type").GetValue(result1)); Assert.AreEqual(obj2.UInt64Type, result1.GetType().GetProperty("UInt64Type").GetValue(result1)); Assert.AreEqual(obj2.SingleType, result1.GetType().GetProperty("SingleType").GetValue(result1)); Assert.AreEqual(obj2.DoubleType, result1.GetType().GetProperty("DoubleType").GetValue(result1)); Assert.AreEqual(obj2.DecimalType, result1.GetType().GetProperty("DecimalType").GetValue(result1)); Assert.AreEqual(obj2.BooleanType, result1.GetType().GetProperty("BooleanType").GetValue(result1)); Assert.AreEqual(obj2.CharType, result1.GetType().GetProperty("CharType").GetValue(result1)); Assert.AreEqual(obj2.ObjectType, result1.GetType().GetProperty("ObjectType").GetValue(result1)); Assert.AreEqual(obj2.SingleType, result1.GetType().GetProperty("SingleType").GetValue(result1)); Assert.AreEqual(obj2.DateTimeType, result1.GetType().GetProperty("DateTimeType").GetValue(result1)); Assert.AreEqual(TestEnum.Val1, result1.GetType().GetProperty("EnumType").GetValue(result1)); }
public void Test_Multiple_Type_Creation_from_Same_Anonymous_Types_Sources() { var obj1 = new { Property1 = "value1", Property2 = "2" }; var obj2 = new { Property1 = "value2", Property3 = "3" }; var result1 = Merger.Merge(obj1, obj2); Assert.AreEqual(3, result1.GetType().GetProperties().Length); Assert.AreEqual("value1", result1.GetType().GetProperty("Property1").GetValue(result1)); var result2 = Merger.Ignore(() => obj1.Property2) .Merge(obj1, obj2); Assert.AreEqual(2, result2.GetType().GetProperties().Length); Assert.AreEqual("3", result2.GetType().GetProperty("Property3").GetValue(result2)); }
//[MenuItem ("Scene/Mergea", false, 2)] public void Merge() { // // if (txlist == null) // return; if (mInstance == null) { mInstance = (Merger)EditorWindow.GetWindow(typeof(Merger)); mInstance.titleContent.text = "merge objs"; mInstance.minSize = new Vector2(700, 500); mInstance.maxSize = new Vector2(5200, 5000); istart = 0; mInstance.Show(); } }
public ActionResult PerformMerge() { string uploadedFile = TempData["UploadedFile"] as string; string fileType = TempData["FileType"] as string; if (string.IsNullOrEmpty(uploadedFile)) { ViewData["MergeStatus"] = "Please choose a file to merge"; return(View("MistakenlyResolved")); } Merger.PerformMerge(uploadedFile, fileType); ViewData["MergeStatus"] = "Merge Complete"; return(View("MistakenlyResolved")); }
public void TestCase3() { var src = new[] { "line1", "line2", "line3" }; var ver1 = new[] { "line1", "line2", "line3", "line4" }; var ver2 = new[] { "line1", "line2", "line3", "line5", "line6" }; var merger = new Merger(src, ver1, ver2); var result = merger.Merge(); Assert.AreEqual("line1", result[0]); Assert.AreEqual("line2", result[1]); Assert.AreEqual("line3", result[2]); Assert.AreEqual("line4", result[3]); Assert.AreEqual("line5", result[4]); Assert.AreEqual("line6", result[5]); }
/// <summary> /// Injects the protection runtime methods and calls the 'InitializeByteGuard' method upon module launch. /// </summary> /// <param name="fileLocation">The file location of the file to protect.</param> private static ModuleDefMD InitializeProtection(string fileLocation) { ModuleDefMD targetModule = ModuleDefMD.Load(fileLocation); ModuleDefMD protectionModule = ModuleDefMD.Load("ByteGuard.Protections.dll"); targetModule = (ModuleDefMD)Merger.Merge(targetModule, protectionModule, "ByteGuard.Protections.Online.Runtime", false); TypeDef byteguardCore = targetModule.Find("ByteGuard.Protections.Online.Runtime.ByteGuardCore", true); MethodDef cctor = targetModule.GlobalType.FindOrCreateStaticConstructor(); MethodDef initializeByteguard = byteguardCore.FindMethod("InitializeByteGuard"); cctor.Body.Instructions.Insert(0, Instruction.Create(OpCodes.Call, initializeByteguard)); return(targetModule); }
public static void Run() { string filePath = Constants.SAMPLE_DOCX; string filePathOut = Path.Combine(Constants.GetOutputDirectoryPath(), Constants.SAMPLE_NAME + Path.GetExtension(filePath)); ExtractOptions extractOptions = new ExtractOptions(new int[] { 1, 4 }); // Resultant document will contain pages 1 and 4 using (Merger merger = new Merger(filePath)) { merger.ExtractPages(extractOptions); merger.Save(filePathOut); } Console.WriteLine("Source document was extractmed successfully."); Console.WriteLine($"Check output {filePathOut}."); }
protected void Awake() { rigidbody = GetComponent <Rigidbody2D>(); gravitation = GetComponent <Gravitation>(); gameController = GameObject.Find("GameController").GetComponent <GameController>(); merger = GetComponentInChildren <Merger>(); particleCollider = GetComponent <Collider2D>(); mergeCollider = merger.GetComponent <Collider2D>(); emitter = GetComponent <Emitter>(); mainRenderer = GetComponent <SpriteRenderer>(); auraRenderer = transform.Find("Aura").GetComponent <SpriteRenderer>(); detailsRenderer = transform.Find("Details").GetComponent <SpriteRenderer>(); hue = GetComponent <Hue>(); animator = GetComponent <Animator>(); disappear = GetComponent <Disappear>(); }
public void MergeEmptyConfigObject() { var n = new ConfigObject(); var c = Config.ApplyJson(@"{ ""Sample"": ""Foobar"" }", new ConfigObject()); // merge left dynamic merged = Merger.Merge(c, n); Assert.IsInstanceOfType(typeof(ConfigObject), merged); Assert.That(merged.Sample == "Foobar"); // merge right merged = Merger.Merge(n, c); Assert.IsInstanceOfType(typeof(ConfigObject), merged); Assert.That(merged.Sample == "Foobar"); }
public static void Run() { string filePath = Constants.SAMPLE_DOCX; string filePathOut = Path.Combine(Constants.GetOutputDirectoryPath(), Constants.SAMPLE_NAME + Path.GetExtension(filePath)); OrientationOptions orientationOptions = new OrientationOptions(OrientationMode.Landscape, new int[] { 3, 4 }); using (Merger merger = new Merger(filePath)) { merger.ChangeOrientation(orientationOptions); merger.Save(filePathOut); } Console.WriteLine("Source document changed orientation successfully."); Console.WriteLine($"Check output {filePathOut}."); }
public static void Run() { string filePath = Constants.SAMPLE_DOCX_PROTECTED; string filePathOut = Path.Combine(Constants.GetOutputDirectoryPath(), Constants.SAMPLE_NAME + Path.GetExtension(filePath)); LoadOptions loadOptions = new LoadOptions(Constants.SAMPLE_PASSWORD); using (Merger merger = new Merger(filePath, loadOptions)) { merger.RemovePassword(); merger.Save(filePathOut); } Console.WriteLine("Source document password was removed successfully."); Console.WriteLine($"Check output {filePathOut}."); }
public static void Run() { string filePath = Constants.SAMPLE_VSDX; string filePathOut = Path.Combine(Constants.GetOutputDirectoryPath(), Constants.SAMPLE_NAME + Path.GetExtension(filePath)); RemoveOptions removeOptions = new RemoveOptions(new int[] { 3, 5 }); using (Merger merger = new Merger(filePath)) { merger.RemovePages(removeOptions); merger.Save(filePathOut); } Console.WriteLine("Source document pages was removed successfully."); Console.WriteLine($"Check output {filePathOut}."); }
public static void Run() { string filePath = Constants.SAMPLE_PPTX; string filePathOut = Path.Combine(Constants.GetOutputDirectoryPath(), Constants.SAMPLE_NAME + Path.GetExtension(filePath)); AddPasswordOptions addOptions = new AddPasswordOptions(Constants.SAMPLE_PASSWORD); using (Merger merger = new Merger(filePath)) { merger.AddPassword(addOptions); merger.Save(filePathOut); } Console.WriteLine("Source document password was added successfully."); Console.WriteLine($"Check output {filePathOut}."); }
/// <summary> /// If one of the objects is a NullExceptionPreventer, the other object is returned unchanged but /// as a ConfigObject /// </summary> public void MergeNullExceptionPreventer() { var n = new NullExceptionPreventer(); var c = Config.ApplyJson(@"{ ""Sample"": ""Foobar"" }", new ConfigObject()); dynamic merged; // merge left merged = Merger.Merge(c, n); Assert.IsInstanceOf <ConfigObject>(merged); Assert.That(merged.Sample == "Foobar"); // merge right merged = Merger.Merge(n, c); Assert.IsInstanceOf <ConfigObject>(merged); Assert.That(merged.Sample == "Foobar"); }
public static void Run() { string filePath = Constants.SAMPLE_PDF; string filePathOut = Path.Combine(Constants.GetOutputDirectoryPath(), Constants.SAMPLE_NAME + Path.GetExtension(filePath)); using (Merger merger = new Merger(filePath)) { merger.Join(Constants.SAMPLE_DOCX); merger.Join(Constants.SAMPLE_XLSX); merger.Join(Constants.SAMPLE_PPTX); merger.Save(filePathOut); } Console.WriteLine("Source documents was merged successfully."); Console.WriteLine($"Check output {filePathOut}."); }
public static void Run() { string filePath = Constants.SAMPLE_PDF_2; string filePathOut = Path.Combine(Constants.GetOutputDirectoryPath(), Constants.SAMPLE_NAME + Path.GetExtension(filePath)); RotateOptions rotateOptions = new RotateOptions(RotateMode.Rotate180, new int[] { 1 }); using (Merger merger = new Merger(filePath)) { merger.RotatePages(rotateOptions); merger.Save(filePathOut); } Console.WriteLine("Source document was rotated successfully."); Console.WriteLine($"Check output {filePathOut}."); }
public void TestCase6() { var src = new[] { "line1", "line2" }; var ver1 = new[] { "line1", " line3", "line2", "line4 " }; var ver2 = new[] { "line1", "line3 ", "line2", " line4" }; var merger = new Merger(src, ver1, ver2); var result = merger.Merge(); Console.WriteLine(string.Join("\n", result)); Assert.AreEqual("line1", result[0]); Assert.AreEqual(" line3", result[1]); Assert.AreEqual("line2", result[2]); Assert.AreEqual("line4 ", result[3]); }
public void MergeListDuplicateTest() { int[] first = { 1 }; int[] second = { 1, 3, 3 }; int[] ret = Merger.MergeLists(first, second); Assert.Equal(4, ret.Length); Assert.Equal(1, ret[0]); Assert.Equal(1, ret[1]); Assert.Equal(3, ret[2]); Assert.Equal(3, ret[3]); }
private static void testWithCSV() { string assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); if (assemblyFolder == null) { return; } string kmlPath = Path.Combine(assemblyFolder, "testWithCSV.kml"); string kmlInputPath = Path.Combine(assemblyFolder, "Areas.kml"); string excelPBCsv = Path.Combine(assemblyFolder, "Peakbagger Scraper.csv"); string excelDBCsv = Path.Combine(assemblyFolder, "Sierra Guidebook.csv"); List <Region> regions = Merger.CollateLocationsAndRegions(kmlInputPath, excelDB, excelScraper, excelDBCsv, excelPBCsv); Kml.WriteToKml(kmlPath, regions); }
public void MergeWith_merges_stored_values() { var inputHistory = new InputHistory <int>(0, Merger <int> .FromDelegate((a, b) => a + b)); inputHistory.Append(1); inputHistory.Append(2); inputHistory.Append(3); inputHistory.Append(4); inputHistory.Append(5); inputHistory.Append(6); inputHistory.MergeWith(2, new ArraySlice <int>(new[] { 5, 5, 5, 5 })); Assert.That(inputHistory.Select(i => i.Input).ToArray(), Is.EqualTo(new[] { 0, 1, 7, 8, 9, 10, 6 })); AssertHistoryMaintainsOrder(inputHistory); }
public void TestChooseCorporation() { // Setup tiles and corporations Corporation american = new Corporation(ECorporation.American); american.addHandler(this); Corporation sackson = new Corporation(ECorporation.Sackson); sackson.addHandler(this); Corporation[] corporations = { american, sackson }; // Form American var tiles = new List <Tile>(); Tile a1 = new Tile("1A"); Tile a2 = new Tile("2A"); tiles.Add(a1); tiles.Add(a2); american.formCorporation(tiles); // dependency on formCorporation // Form Sackson tiles = new List <Tile>(); Tile b3 = new Tile("3B"); Tile c3 = new Tile("3C"); tiles.Add(b3); tiles.Add(c3); sackson.formCorporation(tiles); // Connector Tile connector = new Tile("3A"); List <Tile> adjacentTiles = new List <Tile>(); // Adjacent Tiles adjacentTiles.Add(a2); adjacentTiles.Add(b3); // Start Merger Merger merger = new Merger(connector, adjacentTiles); corpEvent = merger; merger.setHandler(this); merger.resolveIntersection(corporations); // Check that it chose American (see handleChooseCorp) Assert.IsTrue(american.Active); Assert.IsFalse(sackson.Active); }
public void Product() { dynamic parsed = GetUUT("Product"); dynamic merged = Merger.Merge(parsed.Amazon, parsed.WalMart); Assert.That(merged.Price == 129); Assert.That(merged.Rating.Comments.Length == 3); // only float values should be in the rating var stars = merged.Rating.Stars as ICollection <double>; Assert.IsNotNull(stars); // ReSharper disable CompareOfFloatsByEqualityOperator Assert.That(stars.Sum(d => d) == 12.5); // ReSharper restore CompareOfFloatsByEqualityOperator }
public static void Run() { string filePath = Constants.SAMPLE_PDF_2; string embeddedFilePath = Constants.SAMPLE_PPTX; string filePathOut = Path.Combine(Constants.GetOutputDirectoryPath(), Constants.SAMPLE_NAME + Path.GetExtension(filePath)); PdfAttachmentOptions olePdfOptions = new PdfAttachmentOptions(embeddedFilePath); using (Merger merger = new Merger(filePath)) { merger.ImportDocument(olePdfOptions); merger.Save(filePathOut); } Console.WriteLine("Embedded object was added to the source document successfully."); Console.WriteLine($"Check output {filePathOut}."); }
public void merge() { try { OnMergingProgress(null, 0, mergeSourceFilepaths.Count()); // start the clock var ilr = new pwiz.CLI.util.IterationListenerRegistry(); ilr.addListener(new IterationListenerProxy { merger = this }, 1); Merger.Merge(mergeTargetFilepath, mergeSourceFilepaths.ToList(), 8, ilr); } catch (Exception e) { OnMergingProgress(e, 1, 1); } }
public static void Run() { string filePath = Constants.SAMPLE_XLSX; string filePathOut = Path.Combine(Constants.GetOutputDirectoryPath(), Constants.SAMPLE_NAME + Path.GetExtension(filePath)); int pageNumber = 6; int newPageNumber = 1; MoveOptions moveOptions = new MoveOptions(pageNumber, newPageNumber); using (Merger merger = new Merger(filePath)) { merger.MovePage(moveOptions); merger.Save(filePathOut); } Console.WriteLine("Source document page was moved successfully."); Console.WriteLine($"Check output {filePathOut}."); }
public void MergeEmptyExpandoObject() { // Merge a ExpandoObject with an empty Expando // should return a ConfigObject dynamic e = new ExpandoObject(); e.Foo = "Bar"; e.X = 1; dynamic merged = Merger.Merge(e, new ExpandoObject()); Assert.IsInstanceOfType(typeof(ConfigObject), merged); Assert.IsInstanceOfType(typeof(int), merged.X); Assert.IsInstanceOfType(typeof(string), merged.Foo); Assert.AreEqual("Bar", merged.Foo); Assert.AreEqual(1, merged.X); }
public static void Run() { string filePath = Constants.SAMPLE_PPTX; string filePathOut = Path.Combine(Constants.GetOutputDirectoryPath(), Constants.SAMPLE_NAME + Path.GetExtension(filePath)); int pageNumber1 = 3; int pageNumber2 = 6; SwapOptions swapOptions = new SwapOptions(pageNumber2, pageNumber1); using (Merger merger = new Merger(filePath)) { merger.SwapPages(swapOptions); merger.Save(filePathOut); } Console.WriteLine("Source document was swapped successfully."); Console.WriteLine($"Check output {filePathOut}."); }
private void RestoreSettings(String filename) { XDocument doc = XDocument.Load(filename); this.Text = String.Format("{0} - [{1}]", Application.ProductName, Path.GetFileName(filename)); //1) Restore Switches. ChkCopyAttributes.Checked = Boolean.Parse(doc.Root.Element("CopyAttributes").Attribute("Enabled").Value); ChkUnionDuplicates.Checked = Boolean.Parse(doc.Root.Element("UnionDuplicates").Attribute("Enabled").Value); CboDebug.SelectedIndex = Int32.Parse(doc.Root.Element("Debug").Attribute("Enabled").Value); if (doc.Root.Element("Internalize") != null) { ChkInternalize.Checked = Boolean.Parse(doc.Root.Element("Internalize").Attribute("Enabled").Value); } if (doc.Root.Element("MergeXml") != null) { ChkMergeXml.Checked = Boolean.Parse(doc.Root.Element("MergeXml").Attribute("Enabled").Value); } //2) Restore Signing. ChkSignKeyFile.Checked = Boolean.Parse(doc.Root.Element("Sign").Attribute("Enabled").Value); ChkDelayedSign.Checked = Boolean.Parse(doc.Root.Element("Sign").Attribute("Delay").Value); TxtKeyFile.Text = doc.Root.Element("Sign").Value; //3) Restore Logging. ChkGenerateLog.Checked = Boolean.Parse(doc.Root.Element("Log").Attribute("Enabled").Value); TxtLogFile.Text = doc.Root.Element("Log").Value; //4) Restore Assemblies. ListAssembly.Items.Clear(); List<String> files = new List<String>(); foreach (XElement assembly in doc.Root.Element("Assemblies").Elements("Assembly")) { files.Add(assembly.Value); } ProcessFiles(files.ToArray()); Primary = doc.Root.Element("Assemblies").Element("Primary").Value; LblPrimaryAssembly.Text = Path.GetFileName(Primary); //5) Restore Output. TxtOutputAssembly.Text = doc.Root.Element("OutputAssembly").Value; //6) Restore Framework. String framework = doc.Root.Element("Framework").Value; foreach (Object o in CboTargetFramework.Items) { if (((DotNet)o).name.Equals(framework)) { CboTargetFramework.SelectedItem = o; break; } } //7) Restore Engine if (doc.Root.Element("Engine") != null) { Engine = (Merger)Enum.Parse(typeof(Merger), doc.Root.Element("Engine").Attribute("Name").Value); LocateEngine(Engine); radioButton1.Checked = Engine == Merger.ILMerge; radioButton2.Checked = Engine == Merger.ILRepack; } }
private FileData GetResultFileData(string[] originalData, string[] firstData, string[] secondData, out Merger merger) { var lcsCalculator = _lcsCalculatorMock.Object; merger = new Merger { OriginalFile = GetFileData(originalData), FirstFile = GetFileData(firstData), SecondFile = GetFileData(secondData) }; merger.SetLineNumbers(merger.OriginalFile); lcsCalculator.SetLongestCommonSubsequence(merger.OriginalFile.Lines.ToArray(), merger.FirstFile.Lines.ToArray()); lcsCalculator.SetLongestCommonSubsequence(merger.OriginalFile.Lines.ToArray(), merger.SecondFile.Lines.ToArray()); merger.SetOffset(); merger.SetOriginalLinesDeleted(); return merger.Compare(merger.FirstFile, merger.SecondFile); }
private void sendMessageButton_Click(object sender, EventArgs e) { if (_lvDataItems.Items.Count > 0) { // We prepare the data. // We will create a offline datatable to demonstrate , this can veru well // be fetched from database. DataSet dsOrderData = new DataSet(); #region Create Data //Create a datatable DataTable tb = new DataTable("ORDERS"); tb.Columns.Add("FIRSTNAME"); tb.Columns.Add("LASTNAME"); tb.Columns.Add("EMAIL"); tb.Columns.Add("ORDER_ID"); tb.Columns.Add("CUSTOMER_ID"); tb.Columns.Add("PRODUCT"); tb.Columns.Add("QUANTITY"); //Create Sample set of data for (int i = 0; i < _lvDataItems.Items.Count; i++) { Utils.ListRowItem lri = (Utils.ListRowItem)_lvDataItems.Items[i].Tag; DataRow dr = tb.NewRow(); dr["FIRSTNAME"] = lri.FirstName; dr["LASTNAME"] = lri.LastName; dr["EMAIL"] = lri.Email; dr["ORDER_ID"] = lri.OrderId; dr["CUSTOMER_ID"] = i; dr["PRODUCT"] = lri.Product; dr["QUANTITY"] = lri.Quantity; tb.Rows.Add(dr); } #endregion this.AddLogEntry("Creating templater."); // We create the templater object. ActiveUp.Net.Mail.Templater templater = new ActiveUp.Net.Mail.Templater("mailFormat_working_with_list.xml"); // We instanciante the Merger object by passing the templater data. Merger merger = new Merger(templater); // We merge the message templates. merger.MergeListTemplate("PRODUCTS_TEXT", dsOrderData.Tables["ORDERS"]); merger.MergeListTemplate("PRODUCTS_HTML", dsOrderData.Tables["ORDERS"]); // We merge our message with the data. merger.MergeMessage(dsOrderData.Tables["ORDERS"]); this.AddLogEntry("Sending template message."); try { // We send the mail merger.Message.Send(smtpServerAddressTextbox.Text); this.AddLogEntry("Message sent successfully."); } catch (SmtpException ex) { this.AddLogEntry(string.Format("Smtp Error: {0}", ex.Message)); } catch (Exception ex) { this.AddLogEntry(string.Format("Failed: {0}", ex.Message)); } } else { this.AddLogEntry("No datas defined."); } }
private void leftClickBehaviour(object sender, MouseEventArgs e) { //You cannot click outside of the mapbox if (((e.X + menuImages.Images[0].Width < mapBox.Width) && (e.Y + menuImages.Images[0].Height < mapBox.Height)) || typeC == (int)EnumTypes.Pipe) { if (ct.OverlappingComp(e.Location, menuImages) != -1 && typeC <= (int)EnumTypes.Merger) { MessageBox.Show("There cannot be an overlapping of components!"); } else { Component c1 = null; // Creating a Component object in order to use the heritage (subcomponents) switch (typeC) // Switching between type of Component in order to place the different images depending on the clicked button { case (int)EnumTypes.Sink: // Creating the new object (Sick in this case) - The (int)EnumTypes.Sink uses the enum created so you don't need to remember which number is it each type. c1 = new Sink(id, e.Location, 20, (int)EnumTypes.Sink); break; case (int)EnumTypes.Pump: c1 = new Pump(id, e.Location, (int)EnumTypes.Pump); break; case (int)EnumTypes.Merger: c1 = new Merger(id, e.Location, (int)EnumTypes.Merger); break; case (int)EnumTypes.Regulable: c1 = new Regulable(id, e.Location, 1, 50, (int)EnumTypes.Regulable); break; case (int)EnumTypes.Normal: c1 = new Normal(id, e.Location, 0, (int)EnumTypes.Normal); break; case (int)EnumTypes.Pipe: if (idStart == -1) { int resulStart = ct.pointOverlappingComp(e.Location, menuImages); if (resulStart != -1) { if (ct.isComponentConnectionAvailable(resulStart, e.Location, menuImages) == -1) { idStart = resulStart; typeOfConnectionStart = ct.whatKindOfCoennectionIs(idStart, e.Location, menuImages); } else { MessageBox.Show(ct.isComponentConnectionAvailable(resulStart, e.Location, menuImages).ToString()); cleanValues(); } } else { MessageBox.Show("You should click ontop of a component"); cleanValues(); } } else { int resulEnd = ct.pointOverlappingComp(e.Location, menuImages); if (resulEnd != -1 && (idStart != resulEnd)) { if (ct.isComponentConnectionAvailable(resulEnd, e.Location, menuImages) == -1) { idEnd = resulEnd; typeOfConnectionEnd = ct.whatKindOfCoennectionIs(idEnd, e.Location, menuImages); pipeFlowForm = new AskFlow((int)EnumTypes.Pipe); if (pipeFlowForm.ShowDialog(this) == DialogResult.OK) { pipeFlow = (int)pipeFlowForm.GetFlow.Value; if (pipesCoordAux == null) { p = new Pipe(idStart, idEnd, typeOfConnectionStart, typeOfConnectionEnd, pipeId, pipeFlow); } else { p = new Pipe(idStart, idEnd, typeOfConnectionStart, typeOfConnectionEnd, pipesCoordAux, pipeId, pipeFlow); } if (!ct.pipeOverlappingComponent(p, menuImages)) { //makeConnectionInaccessible ct.invalidateConnection(idStart, typeOfConnectionStart, pipeId); ct.invalidateConnection(idEnd, typeOfConnectionEnd, pipeId); ct.PipeList.Add(p); pipeId++; // Inserting the flow into the different components currentFlow = ct.FlowOut(idStart, typeOfConnectionStart, pipeId); //MessageBox.Show(currentFlow.ToString()); if (currentFlow >= p.MaxFlow) { p.CurrentFlow = p.MaxFlow; } else { p.CurrentFlow = currentFlow; } ct.FlowIn(idEnd, typeOfConnectionEnd, pipeId, p.CurrentFlow); // End cleanValues(); } else { MessageBox.Show("This pipe is overlapping a component"); cleanValues(); } } else { MessageBox.Show("Cancelled!"); } pipeFlowForm.Dispose(); } else { MessageBox.Show(ct.isComponentConnectionAvailable(resulEnd, e.Location, menuImages).ToString()); cleanValues(); } } else { if (pipesCoordAux == null) { pipesCoordAux = new List<Point>(); pipesCoordAux.Add(e.Location); } else { pipesCoordAux.Add(e.Location); } } } break; case (int)EnumTypes.Remove: ct.RemoveComp(e.Location, menuImages); break; default: break; } if (c1 != null) { id++; // Increments the id of component ct.CompList.Add(c1); // Adding component to the List in the ComponentTable. } else if (c1 == null && typeC > (int)EnumTypes.Pipe) { // If theres no component created and the typeC is out from the component range if(typeC != (int)EnumTypes.Remove) MessageBox.Show("Error selecting object."); } } Refresh(); } }
private void sendMessageButton_Click(object sender, EventArgs e) { // Prepare the data. //We will create a offline datatable to demonstrate , this can veru well //be fetched from database. this.AddLogEntry("Creating the data."); #region Create Data DataSet dsOrderData = new DataSet(); #region Create Data // We create a datatable DataTable tb = new DataTable("ORDERS"); tb.Columns.Add("FIRSTNAME"); tb.Columns.Add("DATE", typeof(DateTime)); tb.Columns.Add("CODEFORMATEDDATE", typeof(DateTime)); tb.Columns.Add("CODEFORMATEDNUMBER", typeof(float)); // We create sample set of data DataRow dr = tb.NewRow(); dr["FIRSTNAME"] = "John"; dr["DATE"] = DateTime.Now; dr["CODEFORMATEDDATE"] = DateTime.Now; dr["CODEFORMATEDNUMBER"] = 0.58; tb.Rows.Add(dr); dsOrderData.Tables.Add(tb); #endregion #endregion this.AddLogEntry("Creating templater."); try { ActiveUp.Net.Mail.Templater templater = new ActiveUp.Net.Mail.Templater("mailformat_working_with_field_format.xml"); // We instanciante the Merger object by passing the templater data. Merger merger = new Merger(templater); //Either you can specifiy the field format in the XML using <fieldformat> //tags are you can add the field format in the code merger.FieldsFormats.Add("CODEFORMATEDDATE", "{0:dd mmm yy}"); merger.FieldsFormats.Add("CODEFORMATEDNUMBER", "{0:0#.##0}"); // We merge our message with the data. merger.MergeMessage(dsOrderData.Tables[0]); this.AddLogEntry("Sending template message."); //Handle the error in case any merger.Message.Send(smtpServerAddressTextbox.Text); this.AddLogEntry("Message sent successfully."); } catch (SmtpException ex) { this.AddLogEntry(string.Format("Smtp Error: {0}", ex.Message)); } catch (Exception ex) { this.AddLogEntry(string.Format("Failed: {0}", ex.Message)); } }
public void TwoPassMerge() { var candidate = "Test {{A}}"; var expected = "Test C"; var d = new Dictionary<string, object>(); d.Add("A", "{{B}}"); d.Add("B", "C"); // Test the other constructor var m = new Merger(d); Assert.AreEqual(expected, m.Merge(m.Merge(candidate))); }
public void MergeCaseInsensitive() { var candidate = "Test {{A}}"; var expected = "Test B"; var m = new Merger(); m.AddProperty("a", "B"); Assert.AreEqual(expected, m.Merge(candidate)); }
private void LocateIlRepack() { iLMergePath = String.Empty; Debug.Print("[ILRepack]"); if (File.Exists(@".\ILRepack.exe")) { iLMergePath = Path.GetFullPath(@".\ILRepack.exe"); Debug.Print("ILRepack Location Method=Current Directory"); Debug.Print("ILRepack Path={0}", iLMergePath); } else { String path = System.Environment.GetEnvironmentVariable("Path"); String[] folders = path.Split(';'); foreach (String folder in folders) { if (Directory.Exists(folder)) { foreach (String file in Directory.GetFiles(folder, "ILRepack.exe")) { iLMergePath = Path.Combine(folder, file); Debug.Print("ILRepack Location Method=%Path%"); Debug.Print("ILRepack Path={0}", iLMergePath); break; } } else { //! These folders are missing on the FileSyetem. //Debug.Print(folder); } } } if (String.IsNullOrEmpty(iLMergePath)) { Debug.Print("ILRepack not found"); } else { Engine = Merger.ILRepack; radioButton2.Enabled = true; } Debug.Print(String.Empty); }
private void LocateIlMerge() { Debug.Print("[ILMerge]"); iLMergePath = String.Empty; // 1) Default Installation Locations... if (Environment.Is64BitOperatingSystem) { iLMergePath = @Path.Combine( Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), @"Microsoft\ILMerge\ILMerge.exe"); Debug.Print("ILMerge Location Method=Default x86 install location"); Debug.Print("ILMerge Path={0}", iLMergePath); } else { iLMergePath = @Path.Combine( Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), @"Microsoft\ILMerge\ILMerge.exe"); Debug.Print("ILMerge Location Method=Default install location"); Debug.Print("ILMerge Path={0}", iLMergePath); } // 2) Search Path... if (String.IsNullOrEmpty(ilMerge) || !File.Exists(iLMergePath)) { //See http://stackoverflow.com/questions/5578385/assembly-searchpath-via-path-environment String path = System.Environment.GetEnvironmentVariable("Path"); String[] folders = path.Split(';'); foreach (String folder in folders) { if (Directory.Exists(folder)) { foreach (String file in Directory.GetFiles(folder, "ILMerge.exe")) { iLMergePath = Path.Combine(folder, file); Debug.Print("ILMerge Location Method=%Path%"); Debug.Print("ILMerge Path={0}", iLMergePath); break; } } else { //! These folders are missing on the FileSyetem. //Debug.Print(folder); } } } //3) Search Registry... if (String.IsNullOrEmpty(iLMergePath) || !File.Exists(iLMergePath)) { //! HKEY_CURRENT_USER\Software\Microsoft\Installer\Assemblies\C:|Program Files (x86)|Microsoft|ILMerge|ILMerge.exe //! just enumerate //! HKEY_CURRENT_USER\Software\Microsoft\Installer\Assemblies until a key ends in |ILMerge.exe using (RegistryKey AssembliesKey = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Installer\Assemblies", false)) { // If the return value is null, the key doesn't exist if (AssembliesKey != null) { foreach (String KeyName in AssembliesKey.GetSubKeyNames()) { if (KeyName.EndsWith("ILMerge.exe", StringComparison.OrdinalIgnoreCase)) { if (File.Exists(KeyName.Replace('|', '\\'))) { iLMergePath = KeyName.Replace('|', '\\'); Debug.Print("ILMerge Location Method=Registry"); Debug.Print("ILMerge Path={0}", iLMergePath); break; } } } } } } //4) Current Directory... if (File.Exists("ILMerge.exe")) { iLMergePath = Path.GetFullPath("ILMerge.exe"); Debug.Print("ILMerge Location Method=Current Directory"); Debug.Print("ILMerge Path={0}", iLMergePath); } //! TODO Fifth Search Strategy. //! HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-21-822211721-2317658140-2171821640-1000\Components\F995DC6782BCD301ECDB40AF0BEFB501 //! FB8E12458022DA64AB4CCF9364EE3B15=C:\Program Files (x86)\Microsoft\ILMerge\ILMerge.exe if (String.IsNullOrEmpty(iLMergePath) || !File.Exists(iLMergePath)) { Debug.Print("ILMerge Location=Error"); Debug.Print("ILMerge Path={0}", iLMergePath); // MessageBox.Show("IlMerge could not be located, please reinstall!", "ILMergeGui", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { Engine = Merger.ILMerge; radioButton1.Enabled = true; } Debug.Print(String.Empty); }
public void FindTwoProperty() { var candidate = "Test {{A}} {{B}}"; var m = new Merger(); var props = m.GetProperties(candidate); Assert.AreEqual(2, props.Count); Assert.IsTrue(props.ContainsKey("A")); Assert.IsTrue(props.ContainsKey("B")); }
public void FindSinglePropertyDifferentCaseMultipleInstance() { var candidate = "Test {{A}} {{a}}"; var m = new Merger(); var props = m.GetProperties(candidate); Assert.AreEqual(1, props.Count); Assert.IsTrue(props.ContainsKey("a")); }
private void MultiMerge(string value, int iterations) { var merger = new Merger(properties); for (var i = 0; i < iterations; i++) { merger.Merge(value); } }
private void Check(string expected, string value, string message) { var merger = new Merger(properties); var result = merger.Merge(value); Assert.AreEqual(expected, result, message); }
private void LocateEngine(Merger merger) { switch (merger) { case Merger.ILMerge: LocateIlMerge(); break; case Merger.ILRepack: LocateIlRepack(); break; } if (File.Exists(iLMergePath)) { label1.Text = String.Format("{0}: v{1}", Path.GetFileNameWithoutExtension(iLMergePath), AssemblyName.GetAssemblyName(iLMergePath).Version.ToString()); } else { label1.Text = String.Format("{0}: {1}", merger.ToString(), "not found."); } }
private void LocateEngines() { Engine = Merger.None; LocateEngine(Merger.ILRepack); LocateEngine(Merger.ILMerge); switch (Engine) { case Merger.ILMerge: radioButton1.Checked = true; break; case Merger.ILRepack: radioButton2.Checked = true; break; } if (Engine != Merger.None) { LocateEngine(Engine); } if (String.IsNullOrEmpty(iLMergePath) || !File.Exists(iLMergePath)) { MessageBox.Show("IlMerge/Repack could not be located, please reinstall ILMerge/Repack!", "ILMergeGui", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
// 結合ボタン // mergePath(string[]) : 結合するpdfファイルのフルパス // mergeResult(string) : 結合するpdfファイルの名前(出力用) private void MergeButton_Click(object sender, EventArgs e) { // MainListにアイテムが存在するか? if (MainList.Items.Count == 0) { OriginalMessageBox_OK(Properties.Resources.EmptyList, MessageBoxIcon.Warning); return; } var result = new SaveFileDialog(); result.Filter = Properties.Resources.FileFilter; result.Title = Properties.Resources.SaveDialogTitle; if (result.ShowDialog() != DialogResult.OK) { return; } var merger = new Merger(); var configure = new Configure(); System.Collections.Generic.List<string> mergePath = new List<string>(); System.Collections.Generic.List<string> detachedPath = new List<string>(); bool success = true; foreach (ListViewItem item in MainList.Items) { FileProperty obj = item.Tag as FileProperty; if (obj == null) continue; if (obj.OwnerPassword == null) mergePath.Add(obj.Path); else { try { string detached = configure.DetachPassword(obj.Path, obj.OwnerPassword); mergePath.Add(detached); detachedPath.Add(detached); } catch (FileNotFoundException err) { OriginalMessageBox_OK(err.Message, MessageBoxIcon.Error); success = false; break; } } } if (success) { try { merger.Run(mergePath.ToArray(), result.FileName); var listdelete = OriginalMessageBox_YesNo(String.Format(Properties.Resources.MergeDone, mergePath.Count), MessageBoxIcon.Information); MainList.Items.Clear(); if (listdelete == DialogResult.Yes) AddItemToList(result.FileName, null); } catch (Exception err) { OriginalMessageBox_OK(err.Message, MessageBoxIcon.Error); } finally { foreach (string item in detachedPath) File.Delete(item); } } }
private static Grammar BuildGrammar(CilGrammar definition) { var result = new Grammar(); InitContextProvider( result, definition.GlobalContextProvider, result.GlobalContextProvider); var symbolResolver = definition.SymbolResolver; // Define grammar tokens foreach (var cilSymbol in symbolResolver.Definitions) { Symbol symbol; if (cilSymbol.Type == typeof(Exception)) { cilSymbol.Symbol = symbol = (Symbol)result.Symbols[PredefinedTokens.Error]; symbol.Joint.Add( new CilSymbol { Type = typeof(Exception), Symbol = symbol, Categories = SymbolCategory.DoNotDelete | SymbolCategory.DoNotInsert }); } else { symbol = new Symbol(cilSymbol.Name) { Categories = cilSymbol.Categories, Joint = { cilSymbol } }; result.Symbols.Add(symbol); cilSymbol.Symbol = symbol; } } foreach (CilSymbolFeature<Precedence> feature in definition.Precedence) { var symbol = symbolResolver.GetSymbol(feature.SymbolRef); symbol.Precedence = feature.Value; } foreach (CilSymbolFeature<CilContextProvider> feature in definition.LocalContextProviders) { var symbol = symbolResolver.GetSymbol(feature.SymbolRef); if (symbol != null) { InitContextProvider(result, feature.Value, symbol.LocalContextProvider); } } result.Start = symbolResolver.GetSymbol(definition.Start); // Define grammar rules foreach (var cilProduction in definition.Productions) { Symbol outcome = symbolResolver.GetSymbol(cilProduction.Outcome); var pattern = Array.ConvertAll(cilProduction.Pattern, symbolResolver.GetSymbol); // Try to find existing rules whith same token-signature Production production; if (result.Productions.FindOrAdd(outcome, pattern, out production)) { ForeignContextRef contextRef = CreateActionContextRef(cilProduction.Context); production.Actions.Add(new ForeignAction(pattern.Length, contextRef)); } var action = production.Actions[0]; action.Joint.Add(cilProduction); production.ExplicitPrecedence = cilProduction.Precedence; } // Create conditions to allow referencing them from matchers foreach (CilCondition cilCondition in definition.Conditions) { var cond = CreateCondtion(result, cilCondition); result.Conditions.Add(cond); } // Create matchers foreach (CilCondition cilCondition in definition.Conditions) { var condition = ConditionFromType(result, cilCondition.ConditionType); foreach (var cilMatcher in cilCondition.Matchers) { SymbolBase outcome = GetMatcherOutcomeSymbol(result, symbolResolver, cilMatcher.MainOutcome, cilMatcher.AllOutcomes); var matcher = new Matcher( cilMatcher.Pattern, outcome, #if false context: CreateActionContextRef(cilMatcher.Context), #endif nextCondition: ConditionFromType(result, cilMatcher.NextConditionType), disambiguation: cilMatcher.Disambiguation); matcher.Joint.Add(cilMatcher); condition.Matchers.Add(matcher); } } foreach (var cilMerger in definition.Mergers) { var symbol = symbolResolver.GetSymbol(cilMerger.Symbol); var merger = new Merger(symbol) { Joint = { cilMerger } }; result.Mergers.Add(merger); } foreach (var report in definition.Reports) { result.Reports.Add(report); } return result; }
//BackgroundWorker - Merges analyzed data from backgroundWorker1 that has ordered chapter. private void backgroundWorker3_DoWork(object sender, DoWorkEventArgs e) { e.Result = analyzeData; Merger merger = new Merger(backgroundWorker3); progress = 1; processPercent = 0; Analyze.outputGroups.Clear(); foreach (FileObjectCollection fileList in analyzeData.fileLists) { if (backgroundWorker3.CancellationPending) { // Set the e.Cancel flag so that the WorkerCompleted event // knows that the process was cancelled. e.Cancel = true; return; } processPercent = progress.ToPercentage(analyzeData.fileLists.Count); progress++; merger.Merge(fileList, analyzeData, false, processPercent); } if (backgroundWorker3.CancellationPending) { e.Cancel = true; return; } }
private void sendMessageButton_Click(object sender, EventArgs e) { // Let us create a data source in this case Hastable that would // used to demonstrate the merging // Take the form variables collection as the data source. Hashtable dataSource = new Hashtable(); dataSource.Add("FIRSTNAME", "John"); dataSource.Add("LASTNAME", "Richards"); dataSource.Add("MESSAGE", "This is a test mail."); dataSource.Add("VAR1", "This is a variable."); // We create the message object. Message message = new Message(); //We assign the sender email message.From.Email = this.fromEmailTextbox.Text; // We assign the recipient email message.To.Add(this.toEmailTextbox.Text); // We assign the subject message.Subject = this.subjectTextbox.Text; // We create the template. System.Text.StringBuilder messageTemplate = new System.Text.StringBuilder(); messageTemplate.Append("Request posted\n\n"); messageTemplate.Append("Firstname : $FIRSTNAME$\n"); messageTemplate.Append("Lastname : $LASTNAME$\n"); messageTemplate.Append("Message : $MESSAGE$\n"); message.BodyText.Text = messageTemplate.ToString(); Merger merger = new Merger(); // We merge our DataSource merger.MergeMessage(message, dataSource, false); //Handle the error in case any try { // We send the mail message.Send(smtpServerAddressTextbox.Text); this.AddLogEntry("Message sent successfully."); } catch (SmtpException ex) { this.AddLogEntry(string.Format("Smtp Error: {0}", ex.Message)); } catch (Exception ex) { this.AddLogEntry(string.Format("Failed: {0}", ex.Message)); } }