static void Main(string[] args) { Console.WriteLine("NetworkMessageBuilder run"); string outputDir = "./"; if (args.Length > 0) { outputDir = args[0]; } string includeFile = null; if (args.Length > 1) { includeFile = args[1]; } Console.WriteLine(outputDir); Console.WriteLine(includeFile); AppDomain.CurrentDomain.Load("NetworkMessage"); SchemaBox.Parse(); var groupWriter = new GroupWriter(); groupWriter.GenerateCode(outputDir, includeFile); var groupHandlerWriter = new GroupHandlerWriter(); groupHandlerWriter.GenerateCode(outputDir, includeFile); }
private static void WriteGroupHistory(List <Commit> history) { var groupWriter = new GroupWriter("history-grouped.html"); var items = CommitsToHistoryItem.Transform(history); groupWriter.Write(items); }
public GroupApiController( GroupReader groupReader, GroupWriter groupWriter, IUserContext userContext) : base(userContext) { _groupReader = groupReader; _groupWriter = groupWriter; }
public CMoveResponse(CMoveRequest req, Status status) { this.CommandField = (ushort)C.C_MOVE_RP; this.AffectedSOPClassUID = req.AffectedSOPClassUID; this.MessageIDBeingRespondedTo = req.MessageID; this.DataSetType = (ushort)257; this.Status = (ushort)status; this.GroupLength = (uint)GroupWriter.WriteGroupBytes(new DICOMObject(this.Elements.Skip <IDICOMElement>(1).Take <IDICOMElement>(6).ToList <IDICOMElement>()), new DICOMIOSettings(), "0000").Length; }
public CStoreResponse(CStoreRequest req, Status status) { AffectedSOPClassUID = req.AffectedSOPClassUID; CommandField = (ushort)C.C_STORE_RP; MessageIDBeingResponsedTo = req.MessageID; DataSetType = _dataSet; AffectedSOPInstanceUID = req.AffectedSOPInstanceUID; Status = (ushort)status; GroupLength = (uint)GroupWriter.WriteGroupBytes(new DICOMObject(Elements.Skip(1).Take(6).ToList()), new DICOMWriteSettings(), "0000").Length; }
public CCancel(AbstractDIMSERequest req) { this.AffectedSOPClassUID = req.AffectedSOPClassUID; this.MessageIDBeingResponsedTo = req.MessageID; this.DataSetType = 257; // No data this.CommandField = (ushort)C.C_CANCEL; GroupLength = (uint)GroupWriter.WriteGroupBytes(new DICOMObject(Elements.Skip(1).Take(5).ToList()), new DICOMWriteSettings { TransferSyntax = TransferSyntax.IMPLICIT_VR_LITTLE_ENDIAN }, "0000").Length; }
/// <summary> /// Used to generate a new Echo Response from an Echo Request /// </summary> /// <param name="req">the request that is being responded to</param> /// <param name="status">the status of the echo</param> /// <param name="presContext">the presentation context with which to write the data</param> public CEchoResponse(CEchoRequest req, Status status) { AffectedSOPClassUID = req.AffectedSOPClassUID; CommandField = (ushort)C.C_ECHO_RP; MessageIDBeingRespondedTo = req.MessageID; DataSetType = _dataSet; Status = (ushort)status; GroupLength = (uint)GroupWriter.WriteGroupBytes(new DICOMObject(Elements.Skip(1).Take(5).ToList()), new DICOMWriteSettings { TransferSyntax = TransferSyntax.IMPLICIT_VR_LITTLE_ENDIAN }, "0000").Length; }
public override void WriteToFile(string fileName, IIdentifiedResult identifiedResult) { CheckFormat(identifiedResult); var groups = GetValidGroups(identifiedResult); int totalSpectraCount = (from g in groups select g[0].Peptides.Count).Sum(); Progress.SetRange(0, totalSpectraCount); using (StreamWriter sw = new StreamWriter(fileName)) { sw.WriteLine(ProteinFormat.Headers); WritePeptideHeader(sw); foreach (IIdentifiedProteinGroup mpg in groups) { GroupWriter.WriteToStream(sw, mpg); var spectra = GetValidSpectra(mpg.GetSortedPeptides()); foreach (var p in spectra) { WritePeptide(sw, p); } Progress.Increment(mpg[0].Peptides.Count); } } using (StreamWriter sw = new StreamWriter(fileName + ".summary")) { WriteSummary(sw, identifiedResult); } if (identifiedResult.Count > 0 && identifiedResult[0][0].Sequence != null) { string fastaFilename = fileName + ".fasta"; WriteFastaFile(fastaFilename, identifiedResult); } }
public void OnRequestRecieved(CFindRequest req, Association asc) { asc.Logger.LogInformation("<-- DIMSE" + req.GetLogString()); req.LogData(asc); asc.LastActive = DateTime.Now; asc.IdleClock.Restart(); asc.State = NetworkState.TRANSPORT_CONNECTION_OPEN; var resp = new CFindResponse(req, Status.SUCCESS); dms.RaiseDIMSERequestReceived(req, asc); var results = RetrieveResults(req); if (results != null) { foreach (var result in results) { resp.Data = new DICOMObject(result.Elements); resp.Status = (ushort)Status.PENDING; resp.GroupLength = (uint)GroupWriter.WriteGroupBytes(new DICOMObject(resp.Elements.Skip(1).ToList()), new DICOMIOSettings(), "0000").Length; PDataMessenger.Send(resp, asc, asc.PresentationContexts.First(p => p.Id == req.DataPresentationContextId)); } //Finish resp.Status = results.Any() ? (ushort)Status.SUCCESS : (ushort)Status.FAILURE_UNABLE_TO_FIND; resp.Data = null; resp.GroupLength = (uint)GroupWriter.WriteGroupBytes(new DICOMObject(resp.Elements.Skip(1).ToList()), new DICOMIOSettings(), "0000").Length; PDataMessenger.Send(resp, asc); } else { resp.Status = (ushort)Status.FAILURE; resp.Data = null; resp.GroupLength = (uint)GroupWriter.WriteGroupBytes(new DICOMObject(resp.Elements.Skip(1).ToList()), new DICOMIOSettings(), "0000").Length; PDataMessenger.Send(resp, asc); } }
public void SetGroupLength() { var bytes = GroupWriter.WriteGroupBytes(new DICOMObject(Elements), DICOMIOSettings.Default(), "0000"); GroupLength = (uint)bytes.Length; }
public GroupController(GroupWriter groupWriter) { _groupWriter = groupWriter; }
public override void WriteToFile(string fileName, IIdentifiedResult identifiedResult) { CheckFormat(identifiedResult); List <IIdentifiedSpectrum> allSpectra = identifiedResult.GetSpectra(); for (int i = 0; i < allSpectra.Count; i++) { allSpectra[i].Id = i.ToString(); } string linkFilename = GetLinkFileName(fileName); HashSet <IIdentifiedSpectrum> spectra = new HashSet <IIdentifiedSpectrum>(); using (var linkWriter = new StreamWriter(linkFilename)) { linkWriter.WriteLine("PeptideId\tGroupId"); using (var sw = new StreamWriter(fileName)) { sw.WriteLine(ProteinFormat.GetHeader()); var groups = GetValidGroups(identifiedResult); foreach (IIdentifiedProteinGroup mpg in groups) { GroupWriter.WriteToStream(sw, mpg); var validSpectra = GetValidSpectra(mpg.GetSortedPeptides()); foreach (var spectrum in validSpectra) { linkWriter.WriteLine(spectrum.Id + "\t" + mpg.Index); } spectra.UnionWith(validSpectra); } } } var finalSpectra = from s in spectra orderby s.Id select s; string peptideFile = GetPeptideFileName(fileName); if (!PeptideFormat.GetHeader().Contains("Id\t")) { PeptideFormat = new PeptideLineFormat("Id\t" + PeptideFormat.GetHeader()); } using (var sw = new StreamWriter(peptideFile)) { WritePeptideHeader(sw); foreach (IIdentifiedSpectrum mph in finalSpectra) { WritePeptide(sw, mph); } } if (identifiedResult.Count > 0 && identifiedResult[0][0].Sequence != null) { string fastaFilename = fileName + ".fasta"; WriteFastaFile(fastaFilename, identifiedResult); } }