コード例 #1
0
        private void LoadAgentList()
        {
            if(agentList == null)
            {
                FileInfo fileInfo = new FileInfo(FilePath);
                var bytes = fileInfo.ReadBinary();
                agentList = FormatterMg.XMLDerObjectFromBytes(typeof( ObservableCollection<Agent>), bytes) as  ObservableCollection<Agent>;
            }


        }
コード例 #2
0
ファイル: FileDBTest.cs プロジェクト: cotopboy/nxdaigou_git
        public void TestMethod2()
        {
           

            FileInfo fileInfo = new FileInfo(@"T:\test.dat");

            var bytes = fileInfo.ReadBinary();

            FileDB db =  bytes.ToObject<FileDB>();

            List<domain.Order> list = db.OrderList;
        }
コード例 #3
0
ファイル: FileDB.cs プロジェクト: cotopboy/nxdaigou_git
        public FileDB LoadFileDB()
        {
            if (db == null)
            {
                FileInfo fileInfo = new FileInfo(this.fileDbPath);

                var bytes = fileInfo.ReadBinary();

                db = FormatterMg.XMLDerObjectFromBytes(typeof(FileDB), bytes) as FileDB;
            }

            return db;
        }
コード例 #4
0
 /// <summary>
 /// Adds a file to the zip file
 /// </summary>
 /// <param name="File">File to add</param>
 /// <param name="FileInfo">File information</param>
 /// <param name="Package">Package to add the file to</param>
 protected virtual void AddFile(string File, FileInfo FileInfo, Package Package)
 {
     File.ThrowIfNullOrEmpty("File");
     if (!FileInfo.Exists)
         throw new ArgumentException("FileInfo does not exist");
     Uri UriPath = PackUriHelper.CreatePartUri(new Uri(File, UriKind.Relative));
     PackagePart PackagePart = Package.CreatePart(UriPath, System.Net.Mime.MediaTypeNames.Text.Xml, CompressionOption.Maximum);
     byte[] Data = FileInfo.ReadBinary();
     PackagePart.GetStream().Write(Data, 0, Data.Count());
     Package.CreateRelationship(PackagePart.Uri, TargetMode.Internal, "http://schemas.microsoft.com/opc/2006/sample/document");
 }