Ejemplo n.º 1
0
        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_;
            }
        }
Ejemplo n.º 2
0
        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));
        }
Ejemplo n.º 3
0
 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);
 }
Ejemplo n.º 4
0
 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);
     }
 }
Ejemplo n.º 5
0
        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();
        }
Ejemplo n.º 6
0
 public void _setCreator(IStreamCreator nStreamCreator)
 {
     mStreamCreator = nStreamCreator;
 }
Ejemplo n.º 7
0
 public ResourceEntry(String filename, IStreamCreator data, uint systemFlag, uint graphicsFlag)
     : base(filename, data)
 {
     this.SystemFlag = systemFlag;
     this.GraphicsFlag = graphicsFlag;
 }
Ejemplo n.º 8
0
 public FileEntry(String filename, IStreamCreator data)
     : base(filename)
 {
     this.Data = data;
 }
Ejemplo n.º 9
0
 public RegularFileEntry(String filename, IStreamCreator data, bool compressed)
     : base(filename, data)
 {
     this.Compressed = compressed;
 }
Ejemplo n.º 10
0
 public RegularFileEntry(String filename, IStreamCreator data, bool compressed)
     : base(filename, data)
 {
     this.Compressed = compressed;
 }
Ejemplo n.º 11
0
 public CsvParser()
 {
     StreamCreator = new TextFileStreamCreator();
 }
Ejemplo n.º 12
0
 public ResourceEntry(String filename, IStreamCreator data, uint systemFlag, uint graphicsFlag)
     : base(filename, data)
 {
     this.SystemFlag   = systemFlag;
     this.GraphicsFlag = graphicsFlag;
 }
Ejemplo n.º 13
0
 // todo: validate input (mediatr?)
 public OpenRouteCommand(IStreamCreator streamCreator, ITcxParser parser)
 {
     _streamCreator = streamCreator;
     _parser        = parser;
 }
Ejemplo n.º 14
0
 public FileEntry(String filename, IStreamCreator data)
     : base(filename)
 {
     this.Data = data;
 }