//============================================================ // <T>加载配置信息。</T> // // @param xconfig 配置信息 //============================================================ public void LoadOrignConfig(FXmlNode xconfig) { _nodes.Clear(); _displays.Clear(); // 读取所有信息 foreach (FXmlNode xnode in xconfig.Nodes) { if (xnode.IsName("Node")) { FDrSceneNode sceneNode = new FDrSceneNode(); sceneNode.Parent = this; sceneNode.Scene = _scene; sceneNode.LoadOrignConfig(xnode); _nodes.Push(sceneNode); } } // 获得所有显示对象 foreach (FDrSceneNode node in _nodes) { node.FilterDisplays(_displays); } foreach (FDrSceneDisplay display in _displays) { display.UpdateMatrix(); } }
//============================================================ // <T>加载配置信息。</T> // // @param xconfig 配置信息 //============================================================ public void LoadOrignConfig(FXmlNode xconfig) { _displays.Clear(); // 读取节点集合 foreach (FXmlNode xnode in xconfig.Nodes) { if (xnode.IsName("Matrix")) { // 读取矩阵 _modelMatrix.LoadSingleConfig(xnode); } else if (xnode.IsName("Display")) { // 读取显示信息 FDrSceneDisplay display = new FDrSceneDisplay(); display.Parent = this; display.Scene = _scene; display.LoadOrignConfig(xnode); _displays.Push(display); } } // 计算显示集合 foreach (FDrSceneDisplay display in _displays) { display.UpdateMatrix(); } }
//============================================================ // <T>加载配置信息。</T> // // @param xconfig 配置信息 //============================================================ public void LoadOrignConfig(FXmlNode xconfig) { // 获得属性 _source = xconfig.Get("src"); _template = RContent3dManager.TemplateConsole.Find(_source); if (null == _template) { RMoCore.TrackConsole.Write(this, "LoadOrignConfig", "Template is not exists. (scene={0}, template={1})", _scene.Name, _source); } // 获得节点集合 foreach (FXmlNode xnode in xconfig.Nodes) { // 加载矩阵 if (xnode.IsName("Matrix")) { _modelMatrix.LoadSingleConfig(xnode); } // 加载动画集合 if (xnode.IsName("Movies")) { foreach (FXmlNode xmovie in xnode.Nodes) { if (xmovie.IsName("Movie")) { FDrSceneMovie movie = new FDrSceneMovie(); movie.LoadOrignConfig(xmovie); _movies.Push(movie); } } } // 加载材质集合 if (xnode.IsName("Materials")) { foreach (FXmlNode xmaterial in xnode.Nodes) { if (xmaterial.IsName("Material")) { FDrSceneMaterial material = new FDrSceneMaterial(); material.Scene = _scene; material.LoadOrignConfig(xmaterial); _materials.Push(material); } } } // 加载渲染集合 if (xnode.IsName("Renderables")) { foreach (FXmlNode xrenderable in xnode.Nodes) { if (xrenderable.IsName("Renderables")) { FDrSceneRenderable renderable = new FDrSceneRenderable(); renderable.LoadOrignConfig(xrenderable); _renderables.Push(renderable); } } } } }
//============================================================ public FDxDevice3D CreateDevice(int width, int height) { FDxDevice3D device = new FDxDevice3D(); device.Adapter = this; device.Setup(width, height); _devices.Push(device); return(device); }
//============================================================ public FApplicationInfo CreateInfo() { FApplicationInfo info = new FApplicationInfo(); info.Name = "Application_" + _infos.Count; _infos.Push(info); _activeInfo = info; return(info); }
//============================================================ // <T>扫描工作路径,获得对象列表。</T> //============================================================ public override void Scan() { base.Scan(); // 检查文件集合 FStrings fileNames = RDirectory.ListFiles(_directory); foreach (string fileName in fileNames) { if (fileName.EndsWith(".xml")) { string name = RFile.GetFileName(fileName); name = name.Substring(0, name.Length - 4); if (name.StartsWith("import.") || name.StartsWith("temp.")) { continue; } FDrScene scene = new FDrScene(); scene.Name = _name; scene.Label = _label; scene.TechniqueName = name; scene.Directory = _directory; scene.DirectoryExprot = _directoryExprot; scene.Scan(); _scenes.Push(scene); } } // 设置目录 _exportFileName = _directoryExprot + "\\sc_" + Code + ".swf"; // 加载设置文件 if (RFile.Exists(_configFileName)) { //LoadConfig(new FXmlDocument(_directory + "\\config.xml").Root); } }
//============================================================ public void CreateFream(FRsResourceFrame fream, int index) { Button button = new Button(); button.Width = 10; button.Height = 20; button.Tag = fream; int freamDelay = fream.Delay; int cellIndex = 1500 / fream.Delay; button.MouseDown += new MouseEventHandler(button_MouseDown); button.MouseMove += new MouseEventHandler(button_MouseMove); button.MouseUp += new MouseEventHandler(button_MouseUp); button.MouseWheel += new MouseEventHandler(button_MouseWheel); int x = index * cellIndex * 15 + labTimeAxis.Left; Point p = new Point(x, 0); button.Location = p; if (!_isFirst) { _button = button; _isFirst = true; } Controls.Add(button); _controls.Push(button); }
//============================================================ public void LoadResource(FDxRsTemplate resource) { //............................................................ // 加载材质列表 int materialCount = resource.Materials.Count; for (int n = 0; n < materialCount; n++) { // 创建几何体 FDxRsTemplateMaterial rsMaterial = resource.Materials[n]; FDxSpatialMaterial material = new FDxSpatialMaterial(); material.Device = _device; material.LoadResource(rsMaterial); // 增加渲染对象 _materials.Set(material.Name, material); } //............................................................ // 加载渲染列表 int renderableCount = resource.Renderables.Count; for (int n = 0; n < renderableCount; n++) { // 创建几何体 FDxRsTemplateRenderable rsRenderable = resource.Renderables[n]; FDxGeometry geometry = RDxCore.GeometryConsole.Create(_device, rsRenderable.ModelCode, rsRenderable.GeometryName); geometry.Display = this; geometry.LoadRenderable(rsRenderable); _geometries.Push(geometry); // 设置材质 FDxSpatialMaterial material = _materials.Get(rsRenderable.MaterialCode); geometry.ModelMaterial = material; // 增加渲染对象 _renderables.Push(geometry); } }
//============================================================ // <T>加载文件夹信息,取得地址。</T> // <P>加载文件下文件信息,取得文件地址。</P> // // @param directory 文件路径。 //============================================================ public void LoadDirectory(string directory) { // 加载给定路径下面的文件夹. FStrings paths = RDirectory.ListDirectories(directory); int count = paths.Count; for (int n = 0; n < count; n++) { // 检查文件夹 string path = paths[n]; if (path.Contains(".svn")) { continue; } // 取得文件夹类型名称。 string name = path.Substring(path.LastIndexOf("\\") + 1); string id = name.Substring(0, name.IndexOf('-')); string label = name.Substring(name.IndexOf('-') + 1).Trim(); // 文件夹的全路径地址。 FDsMap map = new FDsMap(); map.Resource.Directory = path; map.Resource.Tid = RInt.Parse(id); map.Resource.Name = name; map.Resource.Label = label; map.Resource.LoadDirectory(); _maps.Push(map.Resource); } }
public static FProcessInfo[] Fetch() { IntPtr hSnap = RKernel32.CreateToolhelp32Snapshot(ETh32cs.SnapProcess, 0); if (!RApi.IsValidHandle(hSnap)) { return(null); } FObjects <FProcessInfo> process = new FObjects <FProcessInfo>(); SProcessEntry32 pe32 = new SProcessEntry32(); pe32.dwSize = (uint)Marshal.SizeOf(pe32); bool next = RKernel32.Process32First(hSnap, ref pe32); while (next) { FProcessInfo info = new FProcessInfo(); info.Id = pe32.th32ProcessID; info.Threads = (int)pe32.cntThreads; info.FileName = pe32.szExeFile; process.Push(info); next = RKernel32.Process32Next(hSnap, ref pe32); } RKernel32.CloseHandle(hSnap); return(process.ToArray()); }
public static SModuleEntry32[] ListModule(IntPtr hModule) { FObjects <SModuleEntry32> mes = new FObjects <SModuleEntry32>(); Nullable <SImageNtHeaders> ntHeaders = GetNtHeaders(hModule); SImageDataDirectory idd = ntHeaders.Value.OptionalHeader.DataDirectory[(int)EImageDirectoryEntry.Import]; if (idd.VirtualAddress == 0) { return(mes.ToArray()); } // Import uint maddress = (uint)hModule.ToInt32(); IntPtr pIdHeader = (IntPtr)(maddress + idd.VirtualAddress); int idSize = Marshal.SizeOf(typeof(SImageImportDescriptor)); while (true) { SImageImportDescriptor impDesc = (SImageImportDescriptor)Marshal.PtrToStructure(pIdHeader, typeof(SImageImportDescriptor)); if (impDesc.Name == 0) { break; } IntPtr namePtr = (IntPtr)(maddress + impDesc.Name); SModuleEntry32 me = new SModuleEntry32(); me.modBaseAddr = impDesc.FirstThunk; me.szModule = Marshal.PtrToStringAnsi(namePtr, 260); mes.Push(me); pIdHeader = (IntPtr)(pIdHeader.ToInt32() + idSize); } return(mes.ToArray()); }
//============================================================ // <T>加载设置节点。</T> // // @param xconfig 配置节点 //============================================================ public void LoadConfig(FXmlNode xconfig) { // 加载属性 _name = xconfig.Get("name"); if (xconfig.Contains("color")) { _color = Color.FromArgb(RInt.ParseHex(xconfig.Get("color"))); } _font = xconfig.Get("font", null); _size = xconfig.GetInteger("size", 0); _align = xconfig.Get("align", null); // 加载效果器集合 foreach (FXmlNode xnode in xconfig.Nodes) { if (xnode.IsName("Property")) { FTplStyleProperty property = new FTplStyleProperty(); property.LoadConfig(xnode); _properties.Push(property); } else if (xnode.IsName("Filter")) { string typeName = xnode.Get("type_name"); FTplFilter filter = CreateFilter(typeName); filter.LoadConfig(xnode); _filters.Push(filter); } } }
//============================================================ public void Unserialize(IInput input) { _name = input.ReadString(); //............................................................ // 读取材质列表 int materialCount = input.ReadInt16(); for (int n = 0; n < materialCount; n++) { FDxRsTemplateMaterial material = new FDxRsTemplateMaterial(); material.Template = this; material.Unserialize(input); _materials.Set(material.Code, material); } //............................................................ // 读取材质列表 int renderableCount = input.ReadInt16(); for (int n = 0; n < renderableCount; n++) { FDxRsTemplateRenderable renderable = new FDxRsTemplateRenderable(); renderable.Template = this; renderable.Unserialize(input); //_logger.Debug(this, "LoadFile", "Load renderable. (loop={0}/{1}, model={2}({3}, material={4})", // n, renderableCount, renderable.ModelCode, renderable.GeometryName, renderable.MaterialCode); _renderables.Push(renderable); } }
//============================================================ public void Unserialize(IInput input) { // 存储属性 _code = input.ReadString(); _effectName = input.ReadString(); // 存储设置 _optionDouble = input.ReadUint8(); _optionAlpha = input.ReadUint8(); _optionSymmetry = input.ReadUint8(); _optionShadow = input.ReadUint8(); _optionTransmittance = input.ReadUint8(); // 存储属性 _ambientColor.Unserialize(input); _diffuseColor.Unserialize(input); _specularColor.Unserialize(input); _emissiveColor.Unserialize(input); // 存储贴图 int count = input.ReadUint8(); for (int n = 0; n < count; n++) { FDxRsTemplateTexture texture = new FDxRsTemplateTexture(); texture.Unserialize(input); _textures.Push(texture); } }
//============================================================ // <T>加载设置信息。</T> // // @param xconfig 设置节点 //============================================================ public override void LoadConfig(FXmlNode xconfig) { foreach (FXmlNode xnode in xconfig.Nodes) { if (xnode.IsName("Property")) { string name = xnode.Get("name"); // 创建资源文件夹 switch (name) { case "resource_directory": FRsResourceFolder folder = new FRsResourceFolder(); folder.Directory = RMoCommon.ParseEnvironment(xnode.Text); _folders.Push(folder); break; case "export_directory": _exportDirectory = RMoCommon.ParseEnvironment(xnode.Text); break; case "merge_directory": _mergeDirectory = RMoCommon.ParseEnvironment(xnode.Text); break; } } } }
//============================================================ // <T>加载配置文件。</T> //============================================================ public void LoadConfig(FXmlNode config) { // 加载基本设置 _tid = config.GetInteger("tid", _tid); _name = config.Get("name", _name); _label = config.Get("label", _label); if (config.Contains("size")) { _size.Parse(config.Get("size")); } if (config.Contains("birth_location")) { _birthLocation.Parse(config.Get("birth_location")); } // 加载层 _layerListNode = config.Find("Layers"); if (null == _layerListNode) { return; } foreach (FXmlNode layerNode in _layerListNode.Nodes) { FDsMapLayer layer = new FDsMapLayer(); layer.Resource.LoadConfig(layerNode); _layers.Push(layer.Resource); } // 加载出生点 _birthListNode = config.Find("Births"); if (null == _birthListNode) { return; } foreach (FXmlNode birthNode in _birthListNode.Nodes) { FDsMapBirth birth = new FDsMapBirth(); birth.Resource.LoadConfig(birthNode); _births.Push(birth.Resource); } }
//============================================================ public void Unserialize(IInput input) { _name = input.ReadString(); //............................................................ // 读取材质列表 int bitmapCount = input.ReadInt16(); for (int n = 0; n < bitmapCount; n++) { FDxRsTextureBitmap bitmap = new FDxRsTextureBitmap(); bitmap.Unserialize(input); _bitmaps.Push(bitmap); } //............................................................ // 读取材质列表 int count = input.ReadUint8(); for (int n = 0; n < count; n++) { // 读取数据 int packTypeCd = input.ReadUint8(); FDxRsTextureBitmapPack pack = null; if (EDxTexture.Environment == packTypeCd) { pack = new FDxRsTextureCubePack(); } else { pack = new FDxRsTextureBitmapPack(); } pack.Unserialize(input); _packs.SetExtend(packTypeCd, pack); } }
//============================================================ // <T>增加帧。</T> // // @param frame 帧 //============================================================ public void PushFrame(FRsResourceFrame frame) { frame.Animation = _animation; frame.Clip = this; frame.Index = _frames.Count; _frames.Push(frame); }
public static FSpeedTest TestStart() { FSpeedTest test = new FSpeedTest(); _tests.Push(test); return(test); }
public FShellFolder[] ListFolder() { IntPtr ptr = IntPtr.Zero; if (_face.EnumObjects(_handle, EShcontf.Folders | EShcontf.IncludeHidden, out ptr) == RWinShell.S_OK) { IntPtr pidlSub; int celtFetched; FObjects <FShellFolder> folders = new FObjects <FShellFolder>(); IEnumIDList list = (IEnumIDList)Marshal.GetObjectForIUnknown(ptr); while (list.Next(1, out pidlSub, out celtFetched) == RWinShell.S_OK) { if (celtFetched != RWinShell.S_FALSE) { break; } FShellFolder folder = new FShellFolder(); folder.Parent = this; folder.SetHandle(pidlSub); folder.RefreshInfo(); folders.Push(folder); } return(folders.ToArray()); } return(null); }
//============================================================ // <T>增加一个子目录。</T> // // @param folder 子目录 //============================================================ public void PushFolder(FCfgFolder folder) { if (folder != null) { folder.Parent = this; Folders.Push(folder); } }
//============================================================ // <T>增加网络端口。</T> //============================================================ public void SocketPush(FSocket socket) { FApplicationInfo info = RScoutManager.InfoConsole.CreateInfo(); FNetDataThread socketThread = new FNetDataThread(); socketThread._service = this; socketThread._applicationInfo = info; socketThread.Socket = socket; socketThread.Start(); _socketThreads.Push(socketThread); }
//============================================================ // <T>获取层级目录集合。</T> // // @return 目录集合 //============================================================ public FObjects <FCfgFolder> FetchFolderStack(bool constainsSelf = true) { FObjects <FCfgFolder> stack = new FObjects <FCfgFolder>(); FCfgFolder find = this; while (find != null) { if (constainsSelf) { stack.Push(find); } else if (find != this) { stack.Push(find); } find = find.Parent; } stack.Reverse(); return(stack); }
//============================================================ // <T>获得指定时间的帧对象。</T> //============================================================ public FFrameInfo SyncFrame(long tick) { long findTick = tick / 1000000; int count = _frames.Count; if (count > 0) { FFrameInfo find = _frames.Get(count - 1); if (find.Tick == findTick) { return(find); } } FFrameInfo info = new FFrameInfo(); info.Index = _frames.Count; info.Tick = findTick; _frames.Push(info); return(info); }
//============================================================ // <T>从输入流中反序列化数据。</T> // // @param input 输入流 // @return 处理结果 //============================================================ public EResult Unserialize(IDataInput input) { int count = input.ReadInt32(); for (int n = 0; n < count; n++) { FLoggerInfo loggerInfo = new FLoggerInfo(); loggerInfo.Unserialize(input); _loggers.Push(loggerInfo); } return(EResult.Success); }
//============================================================ public FDxSpatial Create(FDxDevice3D device, string code) { // 获得资源定义 FDxRsTemplate resource = RDxCore.TemplateResourceConsole.Get(code); // 加载资源 FDxSpatial spatial = RDxCore.Factory.Create <FDxSpatial>(EDxObject.ModelSpatial); spatial.Device = device; spatial.LoadResource(resource); _spatials.Push(spatial); return(spatial); }
//============================================================ // <T>加载配置信息。</T> // // @param xconfig 配置信息 //============================================================ public void LoadConfig(FXmlNode xconfig) { foreach (FXmlNode xnode in xconfig.Nodes) { if (xnode.IsName("Movie")) { FDrTemplateAnimationMovie movie = new FDrTemplateAnimationMovie(); movie.LoadConfig(xnode); _movies.Push(movie); } } }
//============================================================ // <T>加载配置文件。</T> //============================================================ public void LoadConfig(FXmlNode config) { if (config.Contains("cell_count")) { _cellCount.Parse(config.Get("cell_count")); } if (config.Contains("cell_size")) { _cellSize.Parse(config.Get("cell_size")); } if (config.Contains("type_cd")) { _typeCd = REnum.ToValue <EMapLayerType>(config.Get("type_cd")); } if (config.Contains("scroll_cd")) { _scrollCd = REnum.ToValue <EMapLayerScroll>(config.Get("scroll_cd")); } if (config.Contains("wrap_cd")) { _wrapCd = REnum.ToValue <EMapLayerWrap>(config.Get("wrap_cd")); } if (config.Contains("scroll_speed")) { _scrollSpeed = config.GetFloat("scroll_speed"); } _tileNode = config.Find("Tiles"); if (null == _tileNode) { return; } // 创建所有格子 for (int m = 0; m < _cellCount.Height; m++) { for (int n = 0; n < _cellCount.Width; n++) { FMbMapCell cell = new FMbMapCell(); cell.Index = new SIntPoint2(n, m); _mapCell.Push(cell); } } // 加载格子资源图片编号 foreach (FXmlNode cellNode in _tileNode.Nodes) { FDsMapCell cell = new FDsMapCell(); cell.Resource.LoadConfig(cellNode); SIntPoint2 cellIndex = cell.Resource.Index; FMbMapCell c = FingCellByIndex(cellIndex.X, cellIndex.Y); c.ResourceId = cell.Resource.ResourceId; } }
//============================================================ // <T>设置渲染过程。</T> //============================================================ public override void Setup() { base.Setup(); SIntSize size = new SIntSize(2048, 2048); FObjects <FDxBufferedTexture> textures = new FObjects <FDxBufferedTexture>(); // 创建深度检测区 _depthTexture.Device = _device; _depthTexture.Create(size.Width, size.Height); // 创建渲染目标纹理区 (标识) _textureFlags.Device = _device; _textureFlags.NativeFormat = Format.R32G32B32A32_SInt; _textureFlags.Create(size.Width, size.Height); textures.Push(_textureFlags); // 创建渲染目标纹理区 (颜色,透明度) _textureColor.Device = _device; _textureColor.NativeFormat = Format.R8G8B8A8_UNorm; _textureColor.Create(size.Width, size.Height); textures.Push(_textureColor); // 建立纹理列表 _targets = textures.ToArray(); }
//============================================================ // <T>加载配置文件。</T> //============================================================ public void LoadConfig(FXmlNode config) { if (config.Contains("location")) { _location.Parse(config.Get("location")); } foreach (FXmlNode node in config.Nodes) { FDsMapBirthEnemy birthEnemy = new FDsMapBirthEnemy(); birthEnemy.Resource.LoadConfig(node); _birthEnemys.Push(birthEnemy.Resource); } }