Example #1
0
	// Constructor.
	public File(FileTable table, int number, OpenMode mode)
			{
				this.table = table;
				this.number = number;
				this.mode = mode;
				this.nextRecord = -1;
			}
Example #2
0
        static void Main(string[] args)
        {
            FileTable fileHandles = new FileTable(1024);

            Thread portMapper = new Thread(new ThreadStart(new portmapper().Run));
            Thread mountD = new Thread(new ThreadStart(new mountd().Run));
            Thread nfsD = new Thread(new ThreadStart(new nfsd().Run));

            portMapper.Start();
            mountD.Start();
            nfsD.Start();

            nfsD.Join();
            mountD.Join();
            portMapper.Join();
        }
Example #3
0
        private static Packet DemoPicture()
        {
            var uri = new Uri("blackfin.png", UriKind.Relative);
            var image = new BitmapImage(uri);

            var text = new TextFile('A') {{"<picture B/>", DisplayMode.Rotate}};
            var pic = new PictureFile('B', image, ColorFormat.Monochrome);

            var files = new FileTable {
                text, pic,
            };

            var packet = new Packet();
            packet.SetMemory(files);
            packet.Add(new WriteTextCommand(text));
            packet.Add(new WritePictureCommand(pic));
            return packet;
        }
Example #4
0
 public virtual void VisitFileTable(FileTable table)
 {
 }
 public byte[] GetFileBuckets()
 {
     return(MemoryMarshal.Cast <int, byte>(FileTable.GetBucketData()).ToArray());
 }
        static CommandListToolTipContent()
        {
            Style style = FileTable.GetStyle("Resources\\CommandListToolTipContent.xaml");

            FrameworkElement.StyleProperty.OverrideMetadata(typeof(CommandListToolTipContent), (PropertyMetadata) new FrameworkPropertyMetadata((object)style));
        }
Example #7
0
	// Close all files in a particular assembly's file table.
	public static void CloseAll(Assembly assembly)
			{
				lock(typeof(File))
				{
					// Find the assembly's file table.
					FileTable table = fileTables;
					while(table != null)
					{
						if(table.assembly == assembly)
						{
							int number = 0;
							File file;
							while(number < MaxFiles)
							{
								// Close all open files in this table.
								file = table.table[number];
								if(file != null)
								{
									file.Close();
								}
								++number;
							}
						}
						table = table.next;
					}
				}
			}
Example #8
0
 public void RefreshBoundingBoxesAndEpisodeInfo(FileTable fileTable, int fileIndex)
 {
     this.RefreshEpisodeInfo(fileTable, fileIndex);
     this.RefreshBoundingBoxes(true);
 }
Example #9
0
		public FileTable(Assembly assembly, FileTable next)
				{
					this.assembly = assembly;
					this.table = new File [MaxFiles];
					this.next = next;
				}
Example #10
0
	// Allocate a new file entry.
	public static File AllocateFile
				(int number, OpenMode mode, Assembly assembly)
			{
				if(number < 1 || number > MaxFiles)
				{
					Utils.ThrowException(52);	// IOException
				}
				lock(typeof(File))
				{
					// Find the assembly's file table.
					FileTable table = fileTables;
					File file;
					while(table != null)
					{
						if(table.assembly == assembly)
						{
							file = table.table[number - 1];
							if(file != null)
							{
								Utils.ThrowException(52);	// IOException
							}
							else
							{
								file = new File(table, number, mode);
								table.table[number - 1] = file;
								return file;
							}
						}
						table = table.next;
					}
					table = new FileTable(assembly, fileTables);
					fileTables = table;
					file = new File(table, number, mode);
					table.table[number - 1] = file;
					return file;
				}
			}
        public void Visit(FileTable table)
        {
            var descriptor = new TableDescriptor(typeof(FileTable <>));
            var fileTable  = new CodeTypeDeclaration(table.Variable)
            {
                TypeAttributes = TypeAttributes.NestedPrivate
            };

            fileTable.BaseTypes.Add(new CodeTypeReference("IRowWriter"));
            fileTable.BaseTypes.Add(new CodeTypeReference("IRowReader"));

            //field
            var fileTableCodeDomType = new CodeTypeReference("FileTable", new CodeTypeReference(table.Variable));

            Scope.Current.Type.Type.Members.Add(
                new CodeMemberField(fileTableCodeDomType, table.Variable)
            {
                Attributes = MemberAttributes.Public | MemberAttributes.Final
            });

            var locationArg = VisitChild(table.Location);

            //constructor
            Scope.Current.Type.Constructor.Statements.Add(new CodeAssignStatement(
                                                              new CodeSnippetExpression(table.Variable),
                                                              new CodeObjectCreateExpression(
                                                                  new CodeTypeReference("FileTable", new CodeTypeReference(table.Variable)))));

            BuildIRowWriterImplementation(fileTable, table.Args);
            BuildIRowReaderImplementation(fileTable, table.Args);

            foreach (var arg in table.Args)
            {
                var domArg = VisitChild(arg);
                fileTable.Members.AddRange(domArg.ParentMemberDefinitions);
                descriptor.Variables.Add(new VariableTypePair {
                    Variable = arg.Variable, Primitive = TablePrimitive.FromString(arg.Type)
                });
            }

            _mainType.Type.Members.Add(fileTable);

            if (Scope.Current.IsCurrentScopeRegistered(table.Variable))
            {
                Errors.Add(new VariableAlreadyExists(new Semantic.LineInfo(table.Line.Line, table.Line.CharacterPosition), table.Variable));
            }

            Scope.Current.RegisterTable(table.Variable, descriptor, fileTableCodeDomType);

            //Init Code
            CodeMemberMethod method = new CodeMemberMethod();

            method.Name       = "Init_" + fileTable.Name;
            method.Attributes = MemberAttributes.Private;

            _mainType.Type.Members.Add(method);
            var assignment = new CodeAssignStatement(new CodeVariableReferenceExpression("_" + Scope.Current.ScopeIdentifier + "." + table.Variable + ".Location"), locationArg.CodeExpression);

            method.Statements.Add(assignment);

            assignment = new CodeAssignStatement(new CodeVariableReferenceExpression("_" + Scope.Current.ScopeIdentifier + "." + table.Variable + ".FieldTerminator"), new CodePrimitiveExpression(table.FieldTerminator));
            method.Statements.Add(assignment);

            assignment = new CodeAssignStatement(new CodeVariableReferenceExpression("_" + Scope.Current.ScopeIdentifier + "." + table.Variable + ".RowTerminator"), new CodePrimitiveExpression(table.RowTerminator));
            method.Statements.Add(assignment);

            method.Statements.Add(new CodeMethodInvokeExpression(new CodeVariableReferenceExpression("_" + Scope.Current.ScopeIdentifier + "." + table.Variable), "Load"));

            var methodcall = new CodeMethodInvokeExpression(
                new CodeMethodReferenceExpression(null, method.Name));

            _codeStack.Peek().ParentStatements.Add(methodcall);
            _codeStack.Peek().CodeExpression = methodcall;
        }
 /// <summary>
 /// 新しい FileTable オブジェクトを作成します。
 /// </summary>
 /// <param name="filetableid">filetableid の初期値。</param>
 /// <param name="guid">guid の初期値。</param>
 /// <param name="name">name の初期値。</param>
 /// <param name="ext">ext の初期値。</param>
 /// <param name="comment">comment の初期値。</param>
 /// <param name="creationtime">creationtime の初期値。</param>
 /// <param name="lastwritetime">lastwritetime の初期値。</param>
 /// <param name="size">size の初期値。</param>
 public static FileTable CreateFileTable(long filetableid, string guid, string name, string ext, string comment, global::System.DateTime creationtime, global::System.DateTime lastwritetime, long size)
 {
     FileTable fileTable = new FileTable();
     fileTable.filetableid = filetableid;
     fileTable.guid = guid;
     fileTable.name = name;
     fileTable.ext = ext;
     fileTable.comment = comment;
     fileTable.creationtime = creationtime;
     fileTable.lastwritetime = lastwritetime;
     fileTable.size = size;
     return fileTable;
 }
Example #13
0
        public bool FileExists(string path)
        {
            path = PathTools.Normalize(path);

            return(FileTable.TryOpenFile(path, out RomFileInfo _));
        }
Example #14
0
        public bool DirectoryExists(string path)
        {
            path = PathTools.Normalize(path);

            return(FileTable.TryOpenDirectory(path, out FindPosition _));
        }
Example #15
0
 public FileTable(Assembly assembly, FileTable next)
 {
     this.assembly = assembly;
     this.table    = new File [MaxFiles];
     this.next     = next;
 }
Example #16
0
        public FileContentResult DownloadFile(Guid Id)
        {
            FileTable fileTable = _DocumentService.GetFile(Id);

            return(File(fileTable.Data, fileTable.ContentType, fileTable.FileName));
        }
Example #17
0
        public JsonResult AjaxUpload(HttpPostedFileBase filelist, Guid documentFileId)
        {
            var statuses = new List <ViewDataUploadFilesResult>();

            System.IO.FileStream inFile;
            byte[] binaryData;
            string contentType;

            if (filelist != null && !string.IsNullOrEmpty(filelist.FileName) && documentFileId != Guid.Empty)
            {
                BinaryReader binaryReader = new BinaryReader(filelist.InputStream);
                byte[]       data         = binaryReader.ReadBytes(filelist.ContentLength);

                var thumbnail = new byte[] {  };
                contentType = filelist.ContentType.ToString().ToUpper();
                thumbnail   = GetThumbnail(data, contentType);

                // here you can save your file to the database...
                FileTable doc = new FileTable();
                doc.DocumentFileId = documentFileId;
                doc.FileName       = filelist.FileName;
                doc.ContentType    = contentType;
                doc.ContentLength  = filelist.ContentLength;
                doc.Data           = data;
                doc.Thumbnail      = thumbnail;

                Guid Id = _DocumentService.SaveFile(doc);

                if (thumbnail.Length == 0)
                {
                    inFile = new System.IO.FileStream(Server.MapPath("~/Content/FileUpload/content-types/64/Text.png"),
                                                      System.IO.FileMode.Open,
                                                      System.IO.FileAccess.Read);
                    binaryData = new Byte[inFile.Length];
                    long bytesRead = inFile.Read(binaryData, 0,
                                                 (int)inFile.Length);
                    inFile.Close();
                    thumbnail = binaryData;
                }

                statuses.Add(new ViewDataUploadFilesResult()
                {
                    name         = doc.FileName,
                    size         = doc.ContentLength,
                    url          = @"/Document/DownloadFile/" + Id.ToString(),
                    deleteUrl    = @"/Document/DeleteFile/" + Id.ToString(),
                    thumbnailUrl = @"data:image/png;base64," + Convert.ToBase64String(thumbnail),
                    deleteType   = "DELETE"
                });
            }

            var uploadedFiles = new
            {
                files = statuses.ToArray()
            };

            JsonResult result = Json(uploadedFiles);

            result.ContentType = "text/plain";
            return(result);
        }
Example #18
0
        /// <summary>
        /// create xls with table
        /// using NPOI
        /// </summary>
        /// <param name="svgDoc"></param>
        /// <param name="stream"></param>
        /// <param name="table"></param>
        public static void CreateExcelWithTableStreamBySvg(SvgDocument svgDoc, Stream stream, FileTable table)
        {
            using (stream)
            {
                IWorkbook        workbook  = new HSSFWorkbook();
                ISheet           sheet     = workbook.CreateSheet("Sheet1");
                IDrawing         patriarch = sheet.CreateDrawingPatriarch();
                HSSFClientAnchor anchor;
                IPicture         pic;

                ICellStyle head_style = createHeadCellStyle(workbook);
                ICellStyle cell_style = createCellBorderStyle(workbook);
                IRow       head_row   = null;
                head_row = sheet.CreateRow(0);
                ICell blank = head_row.CreateCell(0);
                blank.CellStyle = head_style;

                for (int i = 0; i < table.series.Count; i++)
                {
                    ICell head_cell = head_row.CreateCell(i + 1);
                    head_cell.SetCellValue(table.series[i]);
                    head_cell.CellStyle = head_style;
                }
                // create vertical yAxis
                int _ycount = 1;
                foreach (string key in table.xAxis.Keys)
                {
                    IRow  y_row = sheet.CreateRow(_ycount);
                    ICell cell  = y_row.CreateCell(0);
                    cell.SetCellValue(table.xAxis[key]);
                    cell.CellStyle = head_style;
                    for (int i = 0; i < table.series.Count; i++)
                    {
                        ICell value_cell = y_row.CreateCell(i + 1);
                        value_cell.SetCellValue(table.rows[i][key]);
                        value_cell.CellStyle = cell_style;
                    }
                    _ycount++;
                }
                using (MemoryStream ms = new MemoryStream())
                {
                    using (System.Drawing.Bitmap image = svgDoc.Draw())
                    {
                        image.Save(ms, ImageFormat.Bmp);
                        ms.Seek(0, SeekOrigin.Begin);
                        int index = workbook.AddPicture(ms.ToArray(), PictureType.JPEG);
                        anchor = new HSSFClientAnchor(0, 0, 0, 0, table.series.Count + 2, 0, 100, 100);
                        pic    = patriarch.CreatePicture(anchor, index);
                        pic.Resize();
                    }
                }
                workbook.Write(stream);
            }
        }
Example #19
0
 public PrgState(IMyDict <string, int> dict, IMyStack <IStatement> stack, IMyList <int> outList, FileTable <int, FileData> fileTable)
 {
     this.dict      = dict;
     this.stack     = stack;
     this.outList   = outList;
     this.fileTable = fileTable;
 }
Example #20
0
	}; // class FileTable

	// Get a particular file for the specified assembly.
	public static File GetFile(int number, Assembly assembly)
			{
				if(number < 1 || number > MaxFiles)
				{
					Utils.ThrowException(52);	// IOException
				}
				lock(typeof(File))
				{
					// Find the assembly's file table.
					FileTable table = fileTables;
					while(table != null)
					{
						if(table.assembly == assembly)
						{
							File file = table.table[number - 1];
							if(file != null)
							{
								return file;
							}
							else
							{
								Utils.ThrowException(52);	// IOException
							}
						}
						table = table.next;
					}
				}
				Utils.ThrowException(52);	// IOException
				return null;
			}
Example #21
0
 private void FileTableExport_Click(object sender, RoutedEventArgs e)
 {
     FileTable.ExportExcel("select * from DataIn", Str, "归档信息表格.xlsx");
 }
Example #22
0
	// Find a free file number.
	public static int FindFreeFile(Assembly assembly)
			{
				lock(typeof(File))
				{
					// Find the assembly's file table.
					FileTable table = fileTables;
					while(table != null)
					{
						if(table.assembly == assembly)
						{
							int number = 0;
							while(number < MaxFiles &&
								  table.table[number] != null)
							{
								++number;
							}
							if(number < MaxFiles)
							{
								return number + 1;
							}
							else
							{
								Utils.ThrowException(67);	// IOException
							}
						}
						table = table.next;
					}

					// No file table yet, so assume that file number 1 is free.
					return 1;
				}
			}
 public void TrimFreeEntries()
 {
     DirectoryTable.TrimFreeEntries();
     FileTable.TrimFreeEntries();
 }
Example #24
0
        /// <summary>
        /// Depending on the direction, get - as an increment - the following.
        /// - if going forward, the number of files that we need to increment to get to the beginning of the next episode
        /// - if going backwards, the number of files that we need to decrement to get to
        /// - a) the beginning of the current episode if we are not already on the 1st image or
        /// - b) the previous episode if we are on the first image of the current episode.
        /// </summary>
        public static bool GetIncrementToNextEpisode(FileTable files, int index, DirectionEnum direction, out int increment)
        {
            increment = 1;
            if (files == null)
            {
                return(false);
            }
            DateTime date1;
            DateTime date2;
            ImageRow file;
            int      fileCount = files.RowCount;

            // Default in case there is only one file in this episode

            int first   = index;
            int last    = index;
            int current = index;

            // Note that numberOfFiles should never return zero if the provided index is valid
            if (files == null)
            {
                return(false);
            }

            file  = files[index];
            date1 = file.DateTime;

            // We want the next Episode in the forward direction
            if (direction == DirectionEnum.Next)
            {
                // go forwards in the filetable until we find the last file in the episode, or we fail
                // as we have gone forwards maxSearch times
                int maxSearch = Util.GlobalReferences.TimelapseState.EpisodeMaxRangeToSearch;
                while (current < fileCount && maxSearch != 0)
                {
                    file  = files[current];
                    date2 = file.DateTime;
                    TimeSpan difference     = date2 - date1;
                    bool     aboveThreshold = difference.Duration() > Episodes.TimeThreshold;
                    if (aboveThreshold)
                    {
                        break;
                    }
                    date1 = date2;
                    last  = current;
                    current++;
                    maxSearch--;
                }
                increment = last - first + 1;
                return(!(maxSearch == 0));
            }

            // What is left is direction == DirectionEnum.Previous
            // If we are on the first image in the episode, we want the previous Episode in the backwards direction
            // Otherwise we want the first image in the episode (maybe??)
            int minSearch = Util.GlobalReferences.TimelapseState.EpisodeMaxRangeToSearch;

            current = index - 1;
            // Go backwards in the filetable until we find the first file in the episode, or we fail
            // as we have gone back minSearch times
            bool onFirstTwoImages = true;

            while (current >= 0 && minSearch != 0)
            {
                file  = files[current];
                date2 = file.DateTime;
                TimeSpan difference     = date1 - date2;
                bool     aboveThreshold = difference.Duration() > Episodes.TimeThreshold;
                if (aboveThreshold && onFirstTwoImages == false)
                {
                    break;
                }
                onFirstTwoImages = false;
                first            = current;
                date1            = date2;
                current--;
                minSearch--;
            }
            increment = last - first + 1;
            if (increment > 1)
            {
                increment--;
            }
            return(!(minSearch == 0));
        }
Example #25
0
        /// <summary>
        /// Given an index into the filetable, get the episode (defined by the first and last index) that the indexed file belongs to
        /// </summary>
        private static bool EpisodeGetAroundIndex(FileTable files, int index, int maxRangeToSearch, out int first, out int count)
        {
            DateTime date1;
            DateTime date2;
            ImageRow file;
            int      fileCount = files.RowCount;

            // Default in case there is only one file in this episode
            first = index;
            int last = index;

            count = 1;

            // Note that numberOfFiles should never return zero if the provided index is valid
            if (files == null)
            {
                return(false);
            }

            file  = files[index];
            date1 = file.DateTime;

            int current   = index - 1;
            int minSearch = maxRangeToSearch;
            int maxSearch = maxRangeToSearch;

            // Go backwards in the filetable until we find the first file in the episode, or we fail
            // as we have gone back minSearch times
            while (current >= 0 && minSearch != 0)
            {
                file  = files[current];
                date2 = file.DateTime;
                TimeSpan difference     = date1 - date2;
                bool     aboveThreshold = difference.Duration() > Episodes.TimeThreshold;
                if (aboveThreshold)
                {
                    break;
                }
                first = current;
                date1 = date2;
                current--;
                minSearch--;
            }

            // Now go forwards in the filetable until we find the last file in the episode, or we fail
            // as we have gone forwards maxSearch times
            current = index + 1;
            file    = files[index];
            date1   = file.DateTime;
            while (current < fileCount && maxSearch != 0)
            {
                file  = files[current];
                date2 = file.DateTime;
                TimeSpan difference     = date2 - date1;
                bool     aboveThreshold = difference.Duration() > Episodes.TimeThreshold;
                if (aboveThreshold)
                {
                    break;
                }
                date1 = date2;
                last  = current;
                current++;
                maxSearch--;
            }
            count = last - first + 1;
            return(!(minSearch == 0 || maxSearch == 0));
        }
Example #26
0
 internal Exporter(string fileName, string type, int width, string[] svgs, string tableString) : this(fileName, type, width, svgs)
 {
     this.Table = Json.Parse <FileTable>(tableString);
 }
Example #27
0
 /// <summary>
 /// Return the episodes for a given range within the file table
 /// </summary>
 /// <param name="fileTable"></param>
 /// <param name="fileTableIndex"></param>
 public static void EpisodeGetEpisodesInRange(FileTable fileTable, int fileTableIndex)
 {
     EpisodeGetEpisodesInRange(fileTable, fileTableIndex, Util.GlobalReferences.TimelapseState.EpisodeMaxRangeToSearch);
 }
 public byte[] GetFileEntries()
 {
     return(FileTable.GetEntryData().ToArray());
 }
Example #29
0
 /// <summary>
 /// スキーマの FileTable にはコメントがありません。
 /// </summary>
 public void AddToFileTable(FileTable fileTable)
 {
     base.AddObject("FileTable", fileTable);
 }
Example #30
0
 /// <summary>
 /// Construct a CachingBuilder.
 /// </summary>
 public CachingBuilder(FileTable table, NameTable.Builder pathTableBuilder) : base(table)
 {
     PathTableBuilder = pathTableBuilder;
 }
Example #31
0
 public override object GetImage(Size desiredSize)
 {
     return((object)FileTable.GetImageSource("Resources\\Icons\\Categories\\pane_camera_24x24_off.png"));
 }
Example #32
0
        public void Read(ReaderContext ctxt)
        {
            var reader = ctxt.GetTablesReader();

            var actualReserved0 = reader.ReadUInt32();
            if (actualReserved0 != reserved0)
                throw new PEException("invalid MetadataTable header");
            var actualMajorVersion = reader.ReadByte();
            if (actualMajorVersion != majorVersion)
                throw new PEException("invalid MetadataTable header");
            var actualMinorVersion = reader.ReadByte();
            if (actualMinorVersion != minorVersion)
                throw new PEException("invalid MetadataTable header");
            var heapSizes = reader.ReadByte();
            IsStringStreamBig = (heapSizes & 0x01) != 0;
            IsGuidStreamBig = (heapSizes & 0x02) != 0;
            IsBlobStreamBig = (heapSizes & 0x04) != 0;
            Reserved1 = reader.ReadByte();

            var valid = new IntSet64(reader.ReadUInt64());
            var sorted = new IntSet64(reader.ReadUInt64());

            for (var i = 0; i < 64; i++)
            {
                var numRows = 0;
                if (valid[i])
                    numRows = (int)reader.ReadUInt32();

                switch ((TableTag)i)
                {
                case TableTag.Module:
                    ModuleTable = new ModuleTable(numRows);
                    break;
                case TableTag.Assembly:
                    AssemblyTable = new AssemblyTable(numRows);
                    break;
                case TableTag.AssemblyOS:
                    AssemblyOSTable = new AssemblyOSTable(numRows);
                    break;
                case TableTag.AssemblyProcessor:
                    AssemblyProcessorTable = new AssemblyProcessorTable(numRows);
                    break;
                case TableTag.AssemblyRef:
                    AssemblyRefTable = new AssemblyRefTable(numRows);
                    break;
                case TableTag.AssemblyRefOS:
                    AssemblyRefOSTable = new AssemblyRefOSTable(numRows);
                    break;
                case TableTag.AssemblyRefProcessor:
                    AssemblyRefProcessorTable = new AssemblyRefProcessorTable(numRows);
                    break;
                case TableTag.ClassLayout:
                    ClassLayoutTable = new ClassLayoutTable(numRows);
                    break;
                case TableTag.Constant:
                    ConstantTable = new ConstantTable(numRows);
                    break;
                case TableTag.CustomAttribute:
                    CustomAttributeTable = new CustomAttributeTable(numRows);
                    break;
                case TableTag.DeclSecurity:
                    DeclSecurityTable = new DeclSecurityTable(numRows);
                    break;
                case TableTag.EventMap:
                    EventMapTable = new EventMapTable(numRows);
                    break;
                case TableTag.Event:
                    EventTable = new EventTable(numRows);
                    break;
                case TableTag.ExportedType:
                    ExportedTypeTable = new ExportedTypeTable(numRows);
                    break;
                case TableTag.Field:
                    FieldTable = new FieldTable(numRows);
                    break;
                case TableTag.FieldLayout:
                    FieldLayoutTable = new FieldLayoutTable(numRows);
                    break;
                case TableTag.FieldMarshal:
                    FieldMarshalTable = new FieldMarshalTable(numRows);
                    break;
                case TableTag.FieldRVA:
                    FieldRVATable = new FieldRVATable(numRows);
                    break;
                case TableTag.File:
                    FileTable = new FileTable(numRows);
                    break;
                case TableTag.GenericParam:
                    GenericParamTable = new GenericParamTable(numRows);
                    break;
                case TableTag.GenericParamConstraint:
                    GenericParamConstraintTable = new GenericParamConstraintTable(numRows);
                    break;
                case TableTag.ImplMap:
                    ImplMapTable = new ImplMapTable(numRows);
                    break;
                case TableTag.InterfaceImpl:
                    InterfaceImplTable = new InterfaceImplTable(numRows);
                    break;
                case TableTag.ManifestResource:
                    ManifestResourceTable = new ManifestResourceTable(numRows);
                    break;
                case TableTag.MemberRef:
                    MemberRefTable = new MemberRefTable(numRows);
                    break;
                case TableTag.MethodDef:
                    MethodDefTable = new MethodDefTable(numRows);
                    break;
                case TableTag.MethodImpl:
                    MethodImplTable = new MethodImplTable(numRows);
                    break;
                case TableTag.MethodSemantics:
                    MethodSemanticsTable = new MethodSemanticsTable(numRows);
                    break;
                case TableTag.MethodSpec:
                    MethodSpecTable = new MethodSpecTable(numRows);
                    break;
                case TableTag.ModuleRef:
                    ModuleRefTable = new ModuleRefTable(numRows);
                    break;
                case TableTag.NestedClass:
                    NestedClassTable = new NestedClassTable(numRows);
                    break;
                case TableTag.Param:
                    ParamTable = new ParamTable(numRows);
                    break;
                case TableTag.Property:
                    PropertyTable = new PropertyTable(numRows);
                    break;
                case TableTag.PropertyMap:
                    PropertyMapTable = new PropertyMapTable(numRows);
                    break;
                case TableTag.StandAloneSig:
                    StandAloneSigTable = new StandAloneSigTable(numRows);
                    break;
                case TableTag.TypeDef:
                    TypeDefTable = new TypeDefTable(numRows);
                    break;
                case TableTag.TypeRef:
                    TypeRefTable = new TypeRefTable(numRows);
                    break;
                case TableTag.TypeSpec:
                    TypeSpecTable = new TypeSpecTable(numRows);
                    break;
                default:
                    // Ignore
                    break;
                }
            }

            DetermineIndexCodingSizes();

            for (var i = 0; i < 64; i++)
            {
                if (valid[i])
                {
                    switch ((TableTag)i)
                    {
                    case TableTag.Module:
                        ModuleTable.Read(ctxt, reader);
                        break;
                    case TableTag.Assembly:
                        AssemblyTable.Read(ctxt, reader);
                        break;
                    case TableTag.AssemblyOS:
                        AssemblyOSTable.Read(ctxt, reader);
                        break;
                    case TableTag.AssemblyProcessor:
                        AssemblyProcessorTable.Read(ctxt, reader);
                        break;
                    case TableTag.AssemblyRef:
                        AssemblyRefTable.Read(ctxt, reader);
                        break;
                    case TableTag.AssemblyRefOS:
                        AssemblyRefOSTable.Read(ctxt, reader);
                        break;
                    case TableTag.AssemblyRefProcessor:
                        AssemblyRefProcessorTable.Read(ctxt, reader);
                        break;
                    case TableTag.ClassLayout:
                        ClassLayoutTable.Read(ctxt, reader);
                        break;
                    case TableTag.Constant:
                        ConstantTable.Read(ctxt, reader);
                        break;
                    case TableTag.CustomAttribute:
                        CustomAttributeTable.Read(ctxt, reader);
                        break;
                    case TableTag.DeclSecurity:
                        DeclSecurityTable.Read(ctxt, reader);
                        break;
                    case TableTag.EventMap:
                        EventMapTable.Read(ctxt, reader);
                        break;
                    case TableTag.Event:
                        EventTable.Read(ctxt, reader);
                        break;
                    case TableTag.ExportedType:
                        ExportedTypeTable.Read(ctxt, reader);
                        break;
                    case TableTag.Field:
                        FieldTable.Read(ctxt, reader);
                        break;
                    case TableTag.FieldLayout:
                        FieldLayoutTable.Read(ctxt, reader);
                        break;
                    case TableTag.FieldMarshal:
                        FieldMarshalTable.Read(ctxt, reader);
                        break;
                    case TableTag.FieldRVA:
                        FieldRVATable.Read(ctxt, reader);
                        break;
                    case TableTag.File:
                        FileTable.Read(ctxt, reader);
                        break;
                    case TableTag.GenericParam:
                        GenericParamTable.Read(ctxt, reader);
                        break;
                    case TableTag.GenericParamConstraint:
                        GenericParamConstraintTable.Read(ctxt, reader);
                        break;
                    case TableTag.ImplMap:
                        ImplMapTable.Read(ctxt, reader);
                        break;
                    case TableTag.InterfaceImpl:
                        InterfaceImplTable.Read(ctxt, reader);
                        break;
                    case TableTag.ManifestResource:
                        ManifestResourceTable.Read(ctxt, reader);
                        break;
                    case TableTag.MemberRef:
                        MemberRefTable.Read(ctxt, reader);
                        break;
                    case TableTag.MethodDef:
                        MethodDefTable.Read(ctxt, reader);
                        break;
                    case TableTag.MethodImpl:
                        MethodImplTable.Read(ctxt, reader);
                        break;
                    case TableTag.MethodSemantics:
                        MethodSemanticsTable.Read(ctxt, reader);
                        break;
                    case TableTag.MethodSpec:
                        MethodSpecTable.Read(ctxt, reader);
                        break;
                    case TableTag.ModuleRef:
                        ModuleRefTable.Read(ctxt, reader);
                        break;
                    case TableTag.NestedClass:
                        NestedClassTable.Read(ctxt, reader);
                        break;
                    case TableTag.Param:
                        ParamTable.Read(ctxt, reader);
                        break;
                    case TableTag.Property:
                        PropertyTable.Read(ctxt, reader);
                        break;
                    case TableTag.PropertyMap:
                        PropertyMapTable.Read(ctxt, reader);
                        break;
                    case TableTag.StandAloneSig:
                        StandAloneSigTable.Read(ctxt, reader);
                        break;
                    case TableTag.TypeDef:
                        TypeDefTable.Read(ctxt, reader);
                        break;
                    case TableTag.TypeRef:
                        TypeRefTable.Read(ctxt, reader);
                        break;
                    case TableTag.TypeSpec:
                        TypeSpecTable.Read(ctxt, reader);
                        break;
                    default:
                        throw new PEException("unexpected table tag in MetadataTable body");
                    }
                }
            }

            ModuleTable.ResolveIndexes(ctxt);
            TypeRefTable.ResolveIndexes(ctxt);
            TypeDefTable.ResolveIndexes(ctxt);
            FieldTable.ResolveIndexes(ctxt);
            MethodDefTable.ResolveIndexes(ctxt);
            ParamTable.ResolveIndexes(ctxt);
            InterfaceImplTable.ResolveIndexes(ctxt);
            MemberRefTable.ResolveIndexes(ctxt);
            ConstantTable.ResolveIndexes(ctxt);
            CustomAttributeTable.ResolveIndexes(ctxt);
            FieldMarshalTable.ResolveIndexes(ctxt);
            DeclSecurityTable.ResolveIndexes(ctxt);
            ClassLayoutTable.ResolveIndexes(ctxt);
            FieldLayoutTable.ResolveIndexes(ctxt);
            StandAloneSigTable.ResolveIndexes(ctxt);
            EventMapTable.ResolveIndexes(ctxt);
            EventTable.ResolveIndexes(ctxt);
            PropertyMapTable.ResolveIndexes(ctxt);
            PropertyTable.ResolveIndexes(ctxt);
            MethodSemanticsTable.ResolveIndexes(ctxt);
            MethodImplTable.ResolveIndexes(ctxt);
            ModuleRefTable.ResolveIndexes(ctxt);
            TypeSpecTable.ResolveIndexes(ctxt);
            ImplMapTable.ResolveIndexes(ctxt);
            FieldRVATable.ResolveIndexes(ctxt);
            AssemblyTable.ResolveIndexes(ctxt);
            AssemblyProcessorTable.ResolveIndexes(ctxt);
            AssemblyOSTable.ResolveIndexes(ctxt);
            AssemblyRefTable.ResolveIndexes(ctxt);
            AssemblyRefProcessorTable.ResolveIndexes(ctxt);
            AssemblyRefOSTable.ResolveIndexes(ctxt);
            FileTable.ResolveIndexes(ctxt);
            ExportedTypeTable.ResolveIndexes(ctxt);
            ManifestResourceTable.ResolveIndexes(ctxt);
            NestedClassTable.ResolveIndexes(ctxt);
            GenericParamTable.ResolveIndexes(ctxt);
            MethodSpecTable.ResolveIndexes(ctxt);
            GenericParamConstraintTable.ResolveIndexes(ctxt);
        }
Example #33
0
 public virtual object GetImage(Size desiredSize)
 {
     return((object)FileTable.GetImageSource("Resources\\Icons\\Categories\\pane_layout_24x24_off.png"));
 }
 public virtual void VisitFileTable(FileTable table)
 {
 }
 public override object GetHighlightedImage(Size size)
 {
     return((object)FileTable.GetImageSource("Resources\\Icons\\Categories\\pane_transform_24x24_on.png"));
 }
 /// <summary>
 /// スキーマの FileTable にはコメントがありません。
 /// </summary>
 public void AddToFileTable(FileTable fileTable)
 {
     base.AddObject("FileTable", fileTable);
 }
Example #37
0
        /// <summary>
        /// create xlsx with table
        /// using EPPlus
        /// </summary>
        /// <param name="svgDoc"></param>
        /// <param name="stream"></param>
        /// <param name="table"></param>
        public static void CreateExcelXWithTableStreamBySvg(SvgDocument svgDoc, Stream stream, FileTable table)
        {
            using (stream)
            {
                ExcelPackage   package = new ExcelPackage();
                ExcelWorksheet sheet   = package.Workbook.Worksheets.Add("Sheet1");
                ExcelPicture   picture;

                setHeadCellStyle(sheet.Cells[1, 1]);
                for (int i = 0; i < table.series.Count; i++)
                {
                    sheet.Cells[1, i + 2].Value = table.series[i];
                    setHeadCellStyle(sheet.Cells[1, i + 2]);
                }

                int _ycount = 2;
                foreach (string key in table.xAxis.Keys)
                {
                    sheet.Cells[_ycount, 1].Value = table.xAxis[key];
                    setHeadCellStyle(sheet.Cells[_ycount, 1]);
                    for (int i = 0; i < table.series.Count; i++)
                    {
                        sheet.Cells[_ycount, i + 2].Value = table.rows[i][key];
                        setCellBorderStyle(sheet.Cells[_ycount, i + 2]);
                    }
                    _ycount++;
                }

                using (System.Drawing.Bitmap image = svgDoc.Draw())
                {
                    picture = sheet.Drawings.AddPicture("0", image);
                    picture.SetPosition(0, 0, table.series.Count + 2, 0);
                    picture.SetSize(100);
                }
                package.SaveAs(stream);
            }
        }