public MetaViewer( ) { InitializeComponent(); hexBox1.ByteCharConverter = new DefaultByteCharConverter( ); _streamDictionary = new Dictionary <GuerillaBlock, Stream>(); foreach (var map in GuerillaCodeDom.GetAllMaps()) { var tagDatums = map.Index.Where(u => u.Class == TagClass.Vrtx); foreach (var tagDatum in tagDatums) { try { ////var guerillaBlock = tagDatum.Identifier.Get<VertexShaderBlock>(); //var stream = new MemoryStream(); //var buffer = guerillaBlock.GeometryClassifications[0].Code; //stream.Write(buffer, 0, buffer.Length); //if (!_streamDictionary.ContainsKey(guerillaBlock.GeometryClassifications[0])) // _streamDictionary.Add(guerillaBlock.GeometryClassifications[0], stream); } catch { continue; } } } toolStripComboBox1.Items.AddRange(_streamDictionary.Select(u => (object)u.Key).ToArray( )); _stream = new MemoryStream(); propertyGrid1.SelectedObject = _converter = new DataTypes( ); hexBox1.ByteProvider = new DynamicFileByteProvider(_stream); toolStripComboBox1.SelectedIndex = 0; }
public VrtxViewer() { InitializeComponent(); hexBox1.ByteCharConverter = new DefaultByteCharConverter(); vertexTags.Columns.Add("Path"); foreach (var map in GuerillaCodeDom.GetAllMaps()) { var tagDatums = map.Index.Where(u => u.Class == TagClass.Vrtx); foreach (var tagDatum in tagDatums) { try { //var guerillaBlock = tagDatum.Identifier.Get<VertexShaderBlock>(); //for (int index = 0; index < guerillaBlock.GeometryClassifications.Length; index++) //{ // var vertexShaderClassificationBlock = guerillaBlock.GeometryClassifications[index]; // if (vertexShaderClassificationBlock.Code.Length <= 0 || // !blockKeys.Add(vertexShaderClassificationBlock)) continue; // var path = map.Index[tagDatum.Identifier].Path; // var stream = new MemoryStream(vertexShaderClassificationBlock.Code); // vertexStreams.Add(vertexShaderClassificationBlock, stream); // vertexTags.Items.Add(new ListViewItem // { // Text = $"{path}: [{index}]", // Tag = vertexShaderClassificationBlock // }); //} } catch { // ignored } } break; } vertexTags.Columns[0].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent); _stream = new MemoryStream(); hexBox1.ByteProvider = new DynamicFileByteProvider(_stream); vertexTags.Items[0].Selected = true; hexBox1.AutoSize = true; splitContainer_tags_hex.Panel2MinSize = hexBox1.RequiredWidth + hexBox1.Padding.Horizontal; splitContainer_tags_hex.FixedPanel = FixedPanel.Panel2; propertyGrid1.SelectedObject = _types; }
public VrtxASMViewer( ) { InitializeComponent( ); vertexTags.Columns.Add("Path"); foreach (var map in GuerillaCodeDom.GetAllMaps( )) { var tagDatums = map.Index.Where(u => u.Class == TagClass.Vrtx); foreach (var tagDatum in tagDatums) { try { //var guerillaBlock = tagDatum.Identifier.Get<VertexShaderBlock>( ); //for ( int index = 0; index < guerillaBlock.GeometryClassifications.Length; index++ ) //{ // var vertexShaderClassificationBlock = guerillaBlock.GeometryClassifications[ index ]; // if ( vertexShaderClassificationBlock.Code.Length <= 0 || // !blockKeys.Add( vertexShaderClassificationBlock ) ) continue; // var path = map.Index[ tagDatum.Identifier ].Path; // var stream = new MemoryStream( vertexShaderClassificationBlock.Code ); // vertexStreams.Add( vertexShaderClassificationBlock, stream ); // vertexTags.Items.Add( new ListViewItem // { // Text = $"{path}: [{index}]", // Tag = vertexShaderClassificationBlock // } ); //} } catch { // ignored } } break; } vertexTags.Columns[0].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent); _stream = new MemoryStream( ); hexBox1.ByteProvider = new DynamicFileByteProvider(_stream); vertexTags.Items[0].Selected = true; }
public Research() { InitializeComponent(); var items = new SortedSet <object>(Comparer <object> .Create((a, b) => { dynamic o1 = a; dynamic o2 = b; return(o1.Type.CompareTo(o2.Type) == 0 ? o1.SourceIndex.CompareTo(o2.SourceIndex) == 0 ? o1.Value0.CompareTo(o2.Value0) == 0 ? o1.Value1.CompareTo(o2.Value1) == 0 ? o1.Value2.CompareTo(o2.Value2) == 0 ? 0 : o1.Value2.CompareTo(o2.Value2) : o1.Value1.CompareTo(o2.Value1) : o1.Value0.CompareTo(o2.Value0) : o1.SourceIndex.CompareTo(o2.SourceIndex) : o1.Type.CompareTo(o2.Type)); })); foreach (var map in GuerillaCodeDom.GetAllMaps()) { var tagDatums = map.Index.Where(u => u.Class == TagClass.Stem); foreach (var tagDatum in tagDatums) { try { ////var guerillaBlock = tagDatum.Identifier.Get<ShaderTemplateBlock>(); //foreach (var definition in guerillaBlock.PostprocessDefinition) //{ // foreach ( var implementation in definition.Implementations ) // { // for ( int index = 0; index < implementation.Bitmaps.Length; index++ ) // { // var remap = definition.Remappings[index]; // items.Add( // new // { // Type = "Bitmap Remappings", // SourceIndex = remap.SourceIndex, // Value0 = remap.fieldskip[0], // Value1 = remap.fieldskip[1], // Value2 = remap.fieldskip[2], // Location = map.Index[tagDatum.Identifier].Path // }); // } // for (int index = 0; index < implementation.PixelConstants.Length; index++) // { // var remap = definition.Remappings[index]; // items.Add( // new // { // Type = "Pixel Constant Remappings", // SourceIndex = remap.SourceIndex, // Value0 = remap.fieldskip[0], // Value1 = remap.fieldskip[1], // Value2 = remap.fieldskip[2], // Location = map.Index[tagDatum.Identifier].Path // }); // } // for (int index = 0; index < implementation.VertexConstants.Length; index++) // { // var remap = definition.Remappings[index]; // items.Add( // new // { // Type = "Vertex Constant Remappings", // SourceIndex = remap.SourceIndex, // Value0 = remap.fieldskip[0], // Value1 = remap.fieldskip[1], // Value2 = remap.fieldskip[2], // Location = map.Index[tagDatum.Identifier].Path // }); // } // } //} } catch { continue; } } } var source = new BindingSource(); source.DataSource = items; dataGridView1.DataSource = source; }