public void _virserialize <__t>(ref Dictionary <ushort, __t> nValue, string nName) where __t : IVirU16 { if (null == nValue) { nValue = new Dictionary <ushort, __t>(); } int size_ = 0; this._serialize(ref size_, null, 0); for (int i = 0; i < size_; i++) { string virstream_ = this.ReadString(); if (null == mStreamCreator) { throw new NoStreamCreatorException(); } __t t_ = (__t)mStreamCreator._virstream(virstream_); if (object.Equals(t_, default(__t))) { throw new VirstreamCreateException(virstream_); } IStreamCreator streamCreator_ = mStreamCreator; t_._serialize(this); mStreamCreator = streamCreator_; ushort key_ = t_._keyU16(); nValue[key_] = t_; } }
public Tuple <IEnumerable <string[]>, int, ImportResult> Split(string path) { var lines = new List <string[]>(); var size = 0; var result = ImportResult.Success; try { if (!IsPlainText && !File.Exists(path)) { return(Tuple.Create(lines.AsEnumerable(), size, ImportResult.FileNotFound)); } IStreamCreator creator = IsPlainText ? (IStreamCreator) new PlainTextMemoryStreamCreator() : new TextFileStreamCreator(); var parser = new CsvParser { Delimiter = Delimiter, StreamCreator = creator, }; lines = parser.Parse(path).ToList(); size = IsPlainText ? Encoding.GetByteCount(path) : (int)(new FileInfo(path)).Length; } catch { result = ImportResult.FileReadError; } return(Tuple.Create(lines.AsEnumerable(), size, result)); }
public ResourceEntry(String filename, IStreamCreator data, uint systemFlag, uint graphicsFlag) : base(filename, data) { this.SystemFlag = systemFlag; this.GraphicsFlag = graphicsFlag; ResourcePlatform = Path.GetExtension(filename)[1]; ResourceType = Path.GetExtension(filename).Substring(2); }
private void dragDrop(object sender, DragEventArgs e) { string[] s = e.Data.GetFormats(); if (s == null) { return; } if (s.Length != 1) { return; } if (s[0].Equals(name)) { object o = e.Data.GetData(s[0]); IStreamCreator cr = o as IStreamCreator; Stream stream = cr.Stream; desktop.LoadFromStream(stream, SerializationInterface.StaticExtensionSerializationInterface.Binder, desktop.Extension, desktop.Extension); afterDrag(stream); } }
public void _virserialize <__t>(ref List <__t> nValue, string nName) where __t : IVirstream { if (null == nValue) { nValue = new List <__t>(); } mXmlNodes.Push(mXmlNode); XmlNode xmlNode_ = mXmlNode.SelectSingleNode(nName); if (null != xmlNode_) { foreach (XmlNode i in xmlNode_.ChildNodes) { mXmlNode = i; XmlAttribute xmlAttribute_ = mXmlNode.Attributes["virstream"]; if (null == xmlAttribute_) { throw new NoAssignVirstreamException(nName); } if (null == mStreamCreator) { throw new NoStreamCreatorException(); } string virstream_ = xmlAttribute_.InnerText; __t t_ = (__t)mStreamCreator._virstream(virstream_); if (object.Equals(t_, default(__t))) { throw new VirstreamCreateException(virstream_); } IStreamCreator streamCreator_ = mStreamCreator; t_._serialize(this); mStreamCreator = streamCreator_; nValue.Add(t_); } } mXmlNode = mXmlNodes.Pop(); }
public void _setCreator(IStreamCreator nStreamCreator) { mStreamCreator = nStreamCreator; }
public ResourceEntry(String filename, IStreamCreator data, uint systemFlag, uint graphicsFlag) : base(filename, data) { this.SystemFlag = systemFlag; this.GraphicsFlag = graphicsFlag; }
public FileEntry(String filename, IStreamCreator data) : base(filename) { this.Data = data; }
public RegularFileEntry(String filename, IStreamCreator data, bool compressed) : base(filename, data) { this.Compressed = compressed; }
public CsvParser() { StreamCreator = new TextFileStreamCreator(); }
// todo: validate input (mediatr?) public OpenRouteCommand(IStreamCreator streamCreator, ITcxParser parser) { _streamCreator = streamCreator; _parser = parser; }