public bool PrepareXML(string timeInUse = null) { List <string> dataPointsInUse; if (timeInUse != null) { dataPointsInUse = new List <string> { timeInUse }; dataPointsInUse = GetDataPointsInUse(dataPointsInUse, "xmlElement", "xmlXPath"); } else { dataPointsInUse = GetDataPointsInUse("xmlElement", "xmlXPath"); } if (dataPointsInUse.Count == 0) { return(true); } XmlProcessor xmlProcessor = new XmlProcessor(); try { dataRecords = xmlProcessor.GetRecords(dataFile, dataRestURL, repeatingElement, dataSourceFileOrURL, dataPointsInUse, xmlToString, node); } catch (Exception ex) { sourceLogger.Error(ex, "Error retrieving XML data "); return(false); } return(true); }
public override IData performe(Dictionary <string, string> parameters, string token) { _instance.CommandPath = getCommandPath(parameters, token); XmlDocument doc = getXmlDocument(); XmlNodeList nList = XmlProcessor.getNodes(doc, XmlConstants.STATUS_TAG); string st = string.Empty; bool isFriend = false; foreach (XmlNode node in nList) { try { st = XmlProcessor.getInnerText(node, XmlConstants.FRIENDS_STATUS_TAG); if (st.Equals("3") || st.Equals("2") || st.Equals("1")) { isFriend = true; break; } } catch { isFriend = true; break; } } return(new AreFriends(isFriend)); }
private void OnDeserialize() { movieDatabase = XmlProcessor.Deserialize <MovieDatabase>(txtXml.text); UpdateLog(); btnSerialize.interactable = movieDatabase != null; }
private OrganAnimation readAnimationNode(XmlProcessor xml) { string node; OrganAnimation anim = new OrganAnimation(); XmlAttribute attribute = xml.getNextAttribute(); while (attribute.name != "") { switch (attribute.name) { case "name": anim.name = attribute.value; break; } attribute = xml.getNextAttribute(); } node = xml.getNextNode(); while (node != "/AnimationNode") { switch (node) { case "TagNode": anim.tags.Add(readTagNode(xml)); break; } node = xml.getNextNode(); } return(anim); }
private void ReadXMLFile_Click(object sender, RoutedEventArgs e) { try { RootObject rootObject = new RootObject(); rootObject = XmlProcessor.GetXmlRootObject(@"" + XmlSelector.GetSelectedXmlPath()); //rootObject = XmlProcessor.GetXmlRootObject(@"C:\Projects\BeerPack.xml"); SetUpBitmapDimensions(int.Parse(rootObject.OriginalDocumentWidth), int.Parse(rootObject.OriginalDocumentHeight)); AttachedPanelsItem rootAttached = new AttachedPanelsItem() { PanelName = rootObject.Panels.PanelsItem.PanelName, PanelWidth = rootObject.Panels.PanelsItem.PanelWidth, PanelHeight = rootObject.Panels.PanelsItem.PanelHeight, AttachedPanelsItems = rootObject.Panels.PanelsItem.AttachedPanelsItems }; CreateCustomPanelList(rootAttached, null); customPanelsAfterTransformation = PanelTransformation.RotatePanels(customPanels); customPanelsAfterXYCoordinates = PanelCoordinateCalculation.ChangeReferencePointOfRoot(customPanels, rootObject); UserMessage.Content = "File info: Xml file was successfully read!"; CreatePreview.IsEnabled = true; SavePreview.IsEnabled = true; } catch (Exception ex) { UserMessage.Content = "File error: " + ex.Message + "!"; } }
public async void LoadCmdlets(Object helpPath, Boolean importCBH) { ClosableTabItem previousTab = _mwvm.SelectedTab; UIElement previousElement = ((Grid)previousTab.Content).Children[0]; String cmd = Utils.GetCommandTypes(); if (String.IsNullOrEmpty(cmd)) { Utils.MsgBox("Error", Strings.E_EmptyCmds, MessageBoxButton.OK, MessageBoxImage.Error); return; } UIManager.ShowBusy(previousTab, Strings.InfoCmdletsLoading); try { IEnumerable <CmdletObject> data = await PowerShellProcessor.EnumCmdlets(_mwvm.SelectedModule, cmd, importCBH); _mwvm.SelectedModule.Cmdlets.Clear(); foreach (CmdletObject item in data) { _mwvm.SelectedModule.Cmdlets.Add(item); } if (helpPath != null) { _mwvm.SelectedModule.ImportedFromHelp = true; XmlProcessor.ImportFromXml((String)helpPath, _mwvm.SelectedModule); } previousTab.Module = _mwvm.SelectedModule; _mwvm.SelectedModule = null; UIManager.ShowEditor(previousTab); } catch (Exception e) { Utils.MsgBox("Error while loading cmdlets", e.Message, MessageBoxButton.OK, MessageBoxImage.Error); _mwvm.SelectedTab.ErrorInfo = e.Message; UIManager.RestoreControl(previousTab, previousElement); } }
private Vector3 readOffsetNode(XmlProcessor xml) { float x = 0f; float y = 0f; float z = 0f; XmlAttribute attribute = xml.getNextAttribute(); while (attribute.name != "") { switch (attribute.name) { case "x": x = float.Parse(attribute.value) / 128; break; case "y": y = float.Parse(attribute.value) / 128; break; case "z": z = float.Parse(attribute.value) / 128; break; } attribute = xml.getNextAttribute(); } return(new Vector3(x, y, z)); }
public static void Main() { var xmlProcessor = new XmlProcessor(); xmlProcessor.ImportData(); xmlProcessor.ExportData(); }
private void RegisterOrgans() { XmlProcessor xml = new XmlProcessor("Text/OrganList"); string node; while (!xml.IsDone()) { node = xml.getNextNode(); switch (node) { case "OrganSegmentNode": readOrganSegmentNode(xml); break; case "OrganLimbNode": readOrganLimbNode(xml); break; case "OrganAppendageNode": readOrganAppendageNode(xml); break; default: break; } } }
private void ReadSpeciesNode(XmlProcessor xml) { string node; Species species = new Species(); XmlAttribute attribute = xml.getNextAttribute(); while (attribute.name != "") { switch (attribute.name) { case "name": species.name = attribute.value; break; case "prototypeID": species.id = int.Parse(attribute.value); break; } attribute = xml.getNextAttribute(); } node = xml.getNextNode(); while (node != "/SpeciesTemplateNode") { switch (node) { case "SegmentNode": species.physiology.segments.Add(ReadSegmentNode(xml)); break; } node = xml.getNextNode(); } speciesList.Add(species); }
public override object Create(object parent, object configContext, XmlNode section) { var processor = new XmlProcessor(); var result = processor.Process(section); return(base.Create(parent, configContext, result)); }
public void Test_Embedded2() { var resource = Xml.Embedded("hasResourceIncludes.xml"); var interpreter = new XmlInterpreter(resource); var kernel = new DefaultKernel(); var resourceSubSystem = kernel.GetSubSystem(SubSystemConstants.ResourceKey) as IResourceSubSystem; var processor = new XmlProcessor(null, resourceSubSystem); var element = processor.Process(resource); }
private void OnLoadAsset() { movieDatabase = XmlProcessor.Deserialize <MovieDatabase>(xmlAsset.text); UpdateLog(); txtXml.text = xmlAsset.text; btnSerialize.interactable = movieDatabase != null; btnDeserialize.interactable = !string.IsNullOrWhiteSpace(txtXml.text); }
async void GenerateOutput(Object obj) { CmdletObject cmd = Tab.EditorContext.CurrentCmdlet; ModuleObject module = Tab.Module; if (cmd == null) { return; } BusyControlVisible = Visibility.Visible; RtbVisible = Visibility.Collapsed; WebBrowserVisible = Visibility.Collapsed; if (HtmlChecked) { HtmlText = await HtmlProcessor.GenerateHtmlView(cmd, module); HtmlText = String.Format(Properties.Resources.HtmlTemplate, cmd.Name, HtmlText, cmd.ExtraHeader, cmd.ExtraFooter); BusyControlVisible = Visibility.Collapsed; RtbVisible = Visibility.Collapsed; WebBrowserVisible = Visibility.Visible; return; } IEnumerable <XmlToken> data = new List <XmlToken>(); if (XmlChecked) { if (module.UpgradeRequired) { Utils.MsgBox("Warning", "The module is offline and requires upgrade. Upgrade the project to allow XML view.", MessageBoxButton.OK, MessageBoxImage.Warning); BusyControlVisible = Visibility.Collapsed; return; } List <CmdletObject> cmdlets = new List <CmdletObject> { cmd }; StringBuilder SB = new StringBuilder(); await XmlProcessor.XmlGenerateHelp(SB, cmdlets, null, module.IsOffline); data = XmlTokenizer.LoopTokenize(SB.ToString()); } else if (HtmlSourceChecked) { data = await HtmlProcessor.GenerateHtmlSourceHelp(cmd, module); } Paragraph para = new Paragraph(); para.Inlines.AddRange(ColorizeSource(data)); Document = new FlowDocument(); Document.Blocks.Add(para); BusyControlVisible = Visibility.Collapsed; WebBrowserVisible = Visibility.Collapsed; RtbVisible = Visibility.Visible; }
private void RegisterDefaultSpecies() { XmlProcessor xml = new XmlProcessor("Text/SpeciesList"); while (!xml.IsDone()) { xml.getNextNode(); ReadSpeciesNode(xml); } }
/// <summary> /// Constructs a new Communication by specifying the Configuration /// </summary> /// <param name="configuration"></param> public CoreCommunicator(IConfiguration configuration) { LocalConfiguration = configuration; Logger = LocalConfiguration.LoggerFactory.Create(LocalConfiguration); XmlProcessor = new XmlProcessor(LocalConfiguration); LocalInstrumentCode = Instrumentation.Core; Logger.Log("communicator initialized with custom configuration"); }
public void TestDeserialize() { XmlProcessor processor = new XmlProcessor(); PurchaseOrder po = processor.Deserialize <PurchaseOrder>(_purchaseOrderXml); po.Should().NotBeNull(); po.ItemsOrders.Should().NotBeEmpty().And.HaveCount(3); po.OrderNumber.Should().Be("12345"); }
private void OnSerialize() { xmlBuilder.Clear(); XmlProcessor.Serialize(movieDatabase, xmlOptions, xmlBuilder); btnDeserialize.interactable = (xmlBuilder.Length > 0); UpdateLog(); txtXml.text = xmlBuilder.ToString(); }
public void TestSerialize() { XmlProcessor processor = new XmlProcessor(); string poXml = processor.Serialize(_purchaseOrder); poXml.Should().NotBeEmpty(); Debug.Write(poXml); // Yes, this is pretty low bar for a passing unit test, but comparing XML is beyond the scope of this project }
public void TestDeserialize() { XmlProcessor processor = new XmlProcessor(); Invoice invoiceXml = processor.Deserialize <Invoice>(_invoiceXml); invoiceXml.Should().NotBeNull(); invoiceXml.ItemsOrders.Should().NotBeEmpty().And.HaveCount(3); invoiceXml.InvoiceNumber.Should().Be("12345"); }
private void readOrganLimbNode(XmlProcessor xml) { string node; CreatureLimb limb = new CreatureLimb(); //Get Attributes limb.name = "default"; limb.limbType = "none"; limb.animationControllerName = "none"; XmlAttribute attribute = xml.getNextAttribute(); while (attribute.name != "") { switch (attribute.name) { case "name": limb.name = attribute.value; break; case "limbType": limb.limbType = attribute.value; break; case "animationControllerName": limb.animationControllerName = attribute.value; break; } attribute = xml.getNextAttribute(); } //Get Subnodes node = xml.getNextNode(); while (node != "/OrganLimbNode") { switch (node) { case "OffsetNode": limb.appendageOffsets.Add(readOffsetNode(xml)); break; case "AnimationNode": limb.animations.Add(readAnimationNode(xml)); break; case "ActionNode": limb.combatActions.Add(readActionNode(xml)); break; } node = xml.getNextNode(); } limb.prototypeIndex = limbPrototypes.Count; limbPrototypes.Add(limb); }
public EvidenteRepository(IWebServiceConsultationRepository webServiceConsultationRepository) { _webServiceConsultationRepository = webServiceConsultationRepository; _webSettingsConsultationSettingsBuilder = new WebSettingsConsultationSettingsBuilder(); _xmlProcessor = new XmlProcessor(); var username = ConfigurationManager.AppSettings["EvidenteUsername"]; var password = ConfigurationManager.AppSettings["EvidentePassword"]; this.SetNetworkCredentials(username, password); RequestEncoding = Encoding.UTF8; }
public override IData performe(Dictionary <string, string> parameters, string token) { _instance.CommandPath = getCommandPath(parameters, token); XmlDocument doc = getXmlDocument(); User user = new User(); user.Id = XmlProcessor.getInnerText(doc, XmlConstants.ID_TAG); return(user); }
public void Test_Embedded3() { var resource = Xml.Embedded("hasResourceIncludes.xml"); var interpreter = new XmlInterpreter(resource); var kernel = new DefaultKernel(); var resourceSubSystem = kernel.GetSubSystem(SubSystemConstants.ResourceKey) as IResourceSubSystem; var processor = new XmlProcessor(null, resourceSubSystem); var assemRes = resource as AssemblyResource; Assert.IsNotNull(assemRes); var stream = assemRes.CreateStream(); }
protected override object[] doService(object[] param) { if ((param != null) && (param.Length >= 1)) { Fpxx fp = param[0] as Fpxx; if (fp != null) { XmlDocument document = new XmlProcessor().CreateDKFPXml(fp); return(new object[] { document }); } } return(null); }
/// <summary> /// Indexes the files. /// </summary> /// <param name="servers">The servers.</param> /// <returns></returns> public bool CreateIndexFiles(ProductType productType) { string ImpersonatedUser = ConfigurationManager.AppSettings.Get("User"); string ImpersonatedUserPassword = ConfigurationManager.AppSettings.Get("Password"); string ImpersonatedUserDomain = ConfigurationManager.AppSettings.Get("Domain"); using (UserImpersonation user = new UserImpersonation(ImpersonatedUser, ImpersonatedUserDomain, ImpersonatedUserPassword)) { if (user.ImpersonateValidUser()) { XmlProcessor processor = new XmlProcessor(); Product product = processor.ReadProduct(productType); if (product.LastIndexedDate.HasValue && DateTime.Compare(product.LastIndexedDate.Value, DateTime.Today) == 0) { return(true); } DateTime startDate = product.LastIndexedDate ?? product.IndexStartDate; DateTime endDate = DateTime.Today.AddDays(-1); string targetDirectory = ConfigurationManager.AppSettings.Get("DecompressedFolder"); string indexLocation = ConfigurationManager.AppSettings.Get("IndexFolder") + productType.ToString(); ClearLogDecompress(targetDirectory); DeleteEarlierIndexes(product, processor); while (startDate <= endDate) { foreach (string file in processor.CopyFiles(startDate.ToShortDateString(), productType)) { string fileName; FileInfo fi = new DirectoryInfo(targetDirectory).GetFiles("*.zip").FirstOrDefault(); fileName = fi != null?processor.DecompressFile(fi) : string.Empty; if (!string.IsNullOrEmpty(fileName)) { LuceneIndexer li = new LuceneIndexer(); HashSet <string> set = processor.ReadFile(product, fileName); li.IndexFile(indexLocation, fileName, startDate.ToShortDateString(), set); } } startDate = startDate.AddDays(1); this.UpdateProductDate(product, startDate, "LastIndexedDate"); } } } return(true); }
private CreatureAppendage ReadAppendageNode(XmlProcessor xml) { string node; CreatureAppendage appendage; string name = "default"; int id = 0; int hitpoints = 0; float x = 0f; float y = 0f; float z = 0f; XmlAttribute attribute = xml.getNextAttribute(); while (attribute.name != "") { switch (attribute.name) { case "name": name = attribute.value; break; case "prototypeID": id = int.Parse(attribute.value); break; case "hitpoints": hitpoints = int.Parse(attribute.value); break; case "x": x = float.Parse(attribute.value) / 128f; break; case "y": y = float.Parse(attribute.value) / 128f; break; case "z": z = float.Parse(attribute.value) / 128f; break; } attribute = xml.getNextAttribute(); } appendage = OrganPrototypes.Instance.LoadAppendage(id); appendage.hitpoints = hitpoints; return(appendage); }
private void readOrganSegmentNode(XmlProcessor xml) { string node; CreatureBodySegment segment = new CreatureBodySegment(); //Get Attributes segment.name = "default"; segment.segmentType = "none"; segment.animationControllerName = "none"; XmlAttribute attribute = xml.getNextAttribute(); while (attribute.name != "") { switch (attribute.name) { case "name": segment.name = attribute.value; break; case "segmentType": segment.segmentType = attribute.value; break; case "animationControllerName": segment.animationControllerName = attribute.value; break; } attribute = xml.getNextAttribute(); } //Get Subnodes node = xml.getNextNode(); while (node != "/OrganSegmentNode") { switch (node) { case "OffsetNode": segment.segmentOffsets.Add(readOffsetNode(xml)); break; case "AnimationNode": segment.animations.Add(readAnimationNode(xml)); break; } node = xml.getNextNode(); } segment.prototypeIndex = segmentPrototypes.Count; segmentPrototypes.Add(segment); }
private CombatAction readActionNode(XmlProcessor xml) { CombatAction act = new CombatAction(); XmlAttribute attribute = xml.getNextAttribute(); while (attribute.name != "") { switch (attribute.name) { case "name": act.name = attribute.value; break; case "range": act.range = float.Parse(attribute.value); break; case "damage": act.damage = int.Parse(attribute.value); break; case "windupDuration": act.windupDuration = float.Parse(attribute.value); break; case "attackDuration": act.attackDuration = float.Parse(attribute.value); break; case "cooldownDuration": act.cooldownDuration = float.Parse(attribute.value); break; case "windupAnimation": act.windupAnimation = attribute.value; break; case "attackAnimation": act.attackAnimation = attribute.value; break; case "backswingAnimation": act.backswingAnimation = attribute.value; break; } attribute = xml.getNextAttribute(); } return(act); }
static void Main(string[] args) { #if DEBUG fromFile_ = @"C:\gource\gdata\cvs2pl.xml"; toFile_ = fromFile_ + @".scrubbed"; #else //TODO: Command line options #endif XmlNode doc = XmlManager.XmlProcessor.ReadFromXml <XmlNode>(fromFile_, new XmlScrubHandler()); FileStream fs = File.Create(toFile_, 1000); StreamWriter sw = new StreamWriter(fs); string XML = XmlProcessor.XmlDeclaration + XmlProcessor.ToXml(doc, false); sw.Write(XML); sw.Close(); }
private static void ApplyTemplate(string contentFolder, string siteFolder, FileInfo fi) { if (Verbose) Console.WriteLine("Processing "+ fi.Extension + " " + fi.Name); if (fi.Extension == ".html") { HtmlProcessor processor = new HtmlProcessor(); processor.Consume(contentFolder, siteFolder, fi.Name, fi.Extension); FileUtils.WriteFile(processor.SiteFile, processor.Template, processor.Content); SearchProcessor.TagSearchFile(processor.Content, contentFolder, siteFolder, fi); } else if (fi.Extension == ".xml") { string title = BijouUtils.ParsePageTitle(siteFolder+"/bogus.xxx"); XmlProcessor processor = new XmlProcessor(); processor.XslArgs = XmlProcessor.BuildXsltArgumentList(title); processor.Consume(contentFolder, siteFolder, fi.Name, fi.Extension); FileUtils.WriteFile(processor.SiteFile, processor.Content); } else if (fi.Extension == ".csv") { CsvProcessor processor = new CsvProcessor(); processor.Consume(contentFolder, siteFolder, fi.Name, fi.Extension); FileUtils.WriteFile(processor.SiteFile, processor.Template, processor.Content); } else if (fi.Extension == ".md") { MdProcessor processor = new MdProcessor(); processor.Consume(contentFolder, siteFolder, fi.Name, fi.Extension); FileUtils.WriteFile(processor.SiteFile, processor.Template, processor.Content); } else if (fi.Extension == ".rss") { RssProcessor processor = new RssProcessor(); processor.Consume(contentFolder, siteFolder, fi.Name, fi.Extension); FileUtils.WriteFile(processor.SiteFile, processor.Template, processor.Content); FileUtils.HtmlClone(contentFolder, siteFolder, fi.Name, fi.Extension, processor.Clone); } else if (fi.Extension == ".ics") { IcsProcessor processor = new IcsProcessor(); processor.Consume(contentFolder, siteFolder, fi.Name, fi.Extension); FileUtils.WriteFile(processor.SiteFile, processor.Template, processor.Content); FileUtils.HtmlClone(contentFolder, siteFolder, fi.Name, fi.Extension, processor.Clone); } }