コード例 #1
0
        public string ToString01([PexAssumeUnderTest] ExportFunction target)
        {
            var result = target.ToString();

            return(result);
            // TODO: add assertions to method ExportFunctionTest.ToString01(ExportFunction)
        }
コード例 #2
0
    static void CreateExportPlan(GameObject go,
                                 SampleBase sample,
                                 ExportFunction exportFunc,
                                 ExportContext context,
                                 string pathSuffix = null,
                                 object data = null,
                                 bool insertFirst = true) {
      // This is an exportable object.
      Transform expRoot = context.exportRoot;
      string path = UnityTypeConverter.GetPath(go.transform, expRoot);
      if (!string.IsNullOrEmpty(pathSuffix)) {
        path += pathSuffix;
      }
      if (!context.plans.ContainsKey(go)) {
        context.plans.Add(go, new ExportPlan());
      }

      var exp = new Exporter { exportFunc = exportFunc, sample = sample, path = path, data = data };
      if (insertFirst) {
        context.plans[go].exporters.Insert(0, exp);
      } else {
        context.plans[go].exporters.Add(exp);
      }

      // Include the parent xform hierarchy.
      // Note that the parent hierarchy is memoised, so despite looking expensive, the time
      // complexity is linear.
      Transform xf = go.transform.parent;
      if (xf != context.exportRoot && !context.plans.ContainsKey(xf.gameObject)) {
        // Since all GameObjects have a Transform, export all un-exported parents as transform.
        CreateExportPlan(xf.gameObject, CreateSample<XformSample>(context), XformExporter.ExportXform, context);
        CreateExportPlan(xf.gameObject, CreateSample<XformSample>(context), NativeExporter.ExportObject, context, insertFirst: false);
      }
    }
コード例 #3
0
        protected override ExportFunction[] ParseTarget()
        {
            if (_exportDirectory == null || _exportDirectory.AddressOfFunctions == 0)
            {
                return(null);
            }

            var expFuncs = new ExportFunction[_exportDirectory.NumberOfFunctions];

            var funcOffsetPointer = _exportDirectory.AddressOfFunctions.RVAtoFileMapping(_sectionHeaders);
            var ordOffset         = _exportDirectory.NumberOfNames == 0 ? 0 : _exportDirectory.AddressOfNameOrdinals.RVAtoFileMapping(_sectionHeaders);
            var nameOffsetPointer = _exportDirectory.NumberOfNames == 0 ? 0 : _exportDirectory.AddressOfNames.RVAtoFileMapping(_sectionHeaders);

            //Get addresses
            for (uint i = 0; i < expFuncs.Length; i++)
            {
                var address = Buff.BytesToUInt32(funcOffsetPointer + sizeof(uint) * i);
                expFuncs[i] = new ExportFunction(null, address);
            }

            //Associate names
            for (uint i = 0; i < _exportDirectory.NumberOfNames; i++)
            {
                var namePtr      = Buff.BytesToUInt32(nameOffsetPointer + sizeof(uint) * i);
                var nameAdr      = namePtr.RVAtoFileMapping(_sectionHeaders);
                var name         = Buff.GetCString(nameAdr);
                var ordinalIndex = Buff.GetOrdinal(ordOffset + sizeof(ushort) * i);

                expFuncs[ordinalIndex].Name = name;
            }

            return(expFuncs);
        }
コード例 #4
0
ファイル: ExportFunctionTest.cs プロジェクト: secana/PeNet
 public ExportFunction Constructor(
     string name,
     uint address,
     ushort ordinal
     )
 {
     var target = new ExportFunction(name, address, ordinal);
     return target;
     // TODO: add assertions to method ExportFunctionTest.Constructor(String, UInt32, UInt16)
 }
コード例 #5
0
        public ExportFunction Constructor(
            string name,
            uint address,
            ushort ordinal
            )
        {
            var target = new ExportFunction(name, address, ordinal);

            return(target);
            // TODO: add assertions to method ExportFunctionTest.Constructor(String, UInt32, UInt16)
        }
コード例 #6
0
        public oTabExportFunction(oTabManager parent, ToolStrip toolStrip, Panel panelMain, ToolStrip mainToolStrip,
                                  string tabTitle, oFunction function)
            : base(parent, toolStrip, panelMain, mainToolStrip, tabTitle)
        {
            ExportFunction exportFunction = new ExportFunction(function)
            {
                Dock = DockStyle.Fill
            };

            workingPage.Controls.Add(exportFunction);
        }
コード例 #7
0
        protected override ExportFunction[] ParseTarget()
        {
            if (_exportDirectory == null || _exportDirectory.AddressOfFunctions == 0)
            {
                return(null);
            }

            var expFuncs = new ExportFunction[_exportDirectory.NumberOfFunctions];

            var funcOffsetPointer = _exportDirectory.AddressOfFunctions.RVAtoFileMapping(_sectionHeaders);
            var ordOffset         = _exportDirectory.AddressOfNameOrdinals.RVAtoFileMapping(_sectionHeaders);
            var nameOffsetPointer = _exportDirectory.AddressOfNames.RVAtoFileMapping(_sectionHeaders);

            //Get addresses
            for (uint i = 0; i < expFuncs.Length; i++)
            {
                var ordinal = i + _exportDirectory.Base;
                var address = _buff.BytesToUInt32(funcOffsetPointer + sizeof(uint) * i);
                expFuncs[i] = new ExportFunction(null, address, (ushort)ordinal);
            }

            //Associate names
            for (uint i = 0; i < _exportDirectory.NumberOfNames; i++)
            {
                var namePtr      = _buff.BytesToUInt32(nameOffsetPointer + sizeof(uint) * i);
                var nameAdr      = namePtr.RVAtoFileMapping(_sectionHeaders);
                var name         = _buff.GetCString(nameAdr);
                var ordinalIndex = (uint)_buff.GetOrdinal(ordOffset + sizeof(ushort) * i);

                if (IsForwardedExport(expFuncs[ordinalIndex].Address))
                {
                    var forwardNameAdr = expFuncs[ordinalIndex].Address.RVAtoFileMapping(_sectionHeaders);
                    var forwardName    = _buff.GetCString(forwardNameAdr);

                    expFuncs[ordinalIndex] = new ExportFunction(
                        name,
                        expFuncs[ordinalIndex].Address,
                        expFuncs[ordinalIndex].Ordinal,
                        forwardName);
                }
                else
                {
                    expFuncs[ordinalIndex] = new ExportFunction(
                        name,
                        expFuncs[ordinalIndex].Address,
                        expFuncs[ordinalIndex].Ordinal);
                }
            }

            return(expFuncs);
        }
        public void ToString01606()
        {
            string         s;
            ExportFunction s0 = new ExportFunction((string)null, 0u, (ushort)0);

            s = this.ToString01(s0);
            Assert.AreEqual <string>
                ("ExportFunction\nName                :\t          \nAddress             :\t         0\nOrdinal             :\t         0\n",
                s);
            Assert.IsNotNull((object)s0);
            Assert.AreEqual <string>((string)null, s0.Name);
            Assert.AreEqual <uint>(0u, s0.Address);
            Assert.AreEqual <ushort>((ushort)0, s0.Ordinal);
        }
コード例 #9
0
        void InitExportableObjects(GameObject go)
        {
            SampleBase     sample     = null;
            ExportFunction exportFunc = null;

            if (go.GetComponent <MeshFilter>() != null && go.GetComponent <MeshRenderer>() != null)
            {
                sample     = new MeshSample();
                exportFunc = ExportMesh;
                foreach (var mat in go.GetComponent <MeshRenderer>().materials)
                {
                    if (!m_materialMap.ContainsKey(mat))
                    {
                        string usdPath = "/World/Materials/" + pxr.UsdCs.TfMakeValidIdentifier(mat.name);
                        m_materialMap.Add(mat, usdPath);
                    }
                }
            }
            else if (go.GetComponent <Camera>())
            {
                sample     = new CameraSample();
                exportFunc = ExportCamera;
            }
            else
            {
                return;
            }

            // This is an exportable object.
            string path = Unity.UnityTypeConverter.GetPath(go.transform);

            m_primMap.Add(go, new ExportPlan {
                path = path, sample = sample, exportFunc = exportFunc
            });
            Debug.Log(path + " " + sample.GetType().Name);

            // Include the parent xform hierarchy.
            // Note that the parent hierarchy is memoised, so despite looking expensive, the time
            // complexity is linear.
            Transform xf = go.transform.parent;

            while (xf)
            {
                if (!InitExportableParents(xf.gameObject))
                {
                    break;
                }
                xf = xf.parent;
            }
        }
コード例 #10
0
        internal override IEnumerable <Element> GetElements()
        {
            // ****************************************************************

            List <ExportFunction> functions = new List <ExportFunction>(m_functions.Values);

            functions.Sort();

            ElementCollection content           = new ElementCollection();
            ElementCollection header            = content.ElementCollection();
            ElementCollection functionAddresses = content.ElementCollection();
            ElementCollection functionNames     = content.ElementCollection();
            ElementCollection functionOrdinals  = content.ElementCollection();
            ElementCollection names             = content.ElementCollection();

            header.UInt32(0);                                    // Export flags
            header.UInt32(0);                                    // date
            header.UInt16(0);                                    // major version
            header.UInt16(0);                                    // minor version
            header.RelativeMemoryAddress32(m_moduleNameElement); // module name
            header.UInt32(1);                                    // ordinal base

            header.UInt32((UInt32)functions.Count);              // address table entries
            header.UInt32((UInt32)functions.Count);              // number of name pointers
            header.RelativeMemoryAddress32(functionAddresses);   // function addresses
            header.RelativeMemoryAddress32(functionNames);       // function names
            header.RelativeMemoryAddress32(functionOrdinals);    // function ordinals

            // Module name
            names.Elements.Add(m_moduleNameElement);

            for (int i = 0; i < functions.Count; i++)
            {
                ExportFunction function = functions[i];

                functionAddresses.RelativeMemoryAddress32(function.Function);
                functionNames.RelativeMemoryAddress32(function.NameElement);
                functionOrdinals.UInt16((UInt16)i);

                names.Elements.Add(function.NameElement);
            }

            return(content.Elements);
        }
コード例 #11
0
 private RemoteFunction ExportToRemote(ExportFunction func)
 {
     return(new RemoteFunction(m_Process, BaseAddress + func.RelativeAddress, func.Name));
 }
        public string ExportToExcel(string serverCName, string startDate, string endDate)
        {
            var multipleServer = new List <string>();
            var queryResults   = new Dictionary <string, IOrderedEnumerable <SummarizedDataDto> >();
            var returnList     = new List <ExpandoObject>();

            if (serverCName.Contains(","))
            {
                multipleServer.AddRange(serverCName.Split(','));
            }
            else
            {
                multipleServer.Add(serverCName);
            }

            foreach (var server in multipleServer)
            {
                var serverResults = summarizedDataService.GetQueryResult(server, Convert.ToDateTime(startDate), Convert.ToDateTime(endDate)).OrderBy(s => s.HourCategory);
                queryResults.Add(server, serverResults);
            }

            var rows = new Dictionary <string, List <string> >();

            var ExcelFile = string.Empty;

            var exportProvinceData = new List <List <List <string> > >();
            var exportIspData      = new List <List <List <string> > >();
            var exportHighestData  = new List <List <List <string> > >();
            var exportOver3Data    = new List <List <List <string> > >();
            var exportOver5Data    = new List <List <List <string> > >();
            var exportOver10Data   = new List <List <List <string> > >();
            var exportTestData     = new List <List <List <string> > >();


            foreach (var x in queryResults)
            {
                var provinceData = this.ProvinceIspResult(x.Value);
                var ispData      = this.IspResult(x.Value);
                var highestData  = this.HighestResponseResults(x.Value);
                var over3Data    = this.CountOver3Results(x.Value);
                var over5Data    = this.CountOver5Results(x.Value);
                var over10Data   = this.CountOver10Results(x.Value);
                var totalTest    = this.TotalTest(x.Value);

                exportProvinceData.Add(provinceData);
                exportIspData.Add(ispData);
                exportHighestData.Add(highestData);
                exportOver3Data.Add(over3Data);
                exportOver5Data.Add(over5Data);
                exportOver10Data.Add(over10Data);
                exportTestData.Add(totalTest);
            }
            var exportData = new List <List <List <List <string> > > >
            {
                exportProvinceData,
                exportIspData,
                exportHighestData,
                exportOver3Data,
                exportOver5Data,
                exportOver10Data,
                exportTestData
            };
            ExportFunction _documentExport = new ExportFunction();

            ExcelFile = _documentExport.ExcelExportFunction(serverCName, exportData);

            return(JsonConvert.SerializeObject(new { filedownload = ExcelFile }));
            //return ExcelFile;
        }
コード例 #13
0
 public Export(ExportFunction fce)
     : this(fce.Name, fce.Address)
 {
 }