/// <summary> /// Loads a resource group from a file. For more information on build mode and load mode, see @ ref resourceManagerModes "Resource Manager Modes". /// </summary> /// <param name="groupPath"> /// Pathname to GROUP text file to load. /// </param> /// <param name="allowNonExist"> /// True only if we wish to permit the non-existence of the GROUP file. Defaults to false. /// </param> /// <returns> /// </returns> public CIwResGroup LoadGroup(string groupPath, bool allowNonExist) { if (allowNonExist && !File.Exists(groupPath)) { return(null); } var gr = new CIwResGroup(this); string originalDir = Directory.GetCurrentDirectory(); try { var file = this.ResolveSourceOrBinaryFilePath(groupPath); Debug.WriteLine(string.Format("Loading {0}", file)); this.groups.Add(gr); // Directory.SetCurrentDirectory(Path.GetDirectoryName(file)); if (file.EndsWith(".bin", StringComparison.InvariantCultureIgnoreCase)) { using (var s = IwSerialise.Open(file, true, this.classRegistry, this)) { gr.Read(s); } } else { throw new NotImplementedException(); } } finally { Directory.SetCurrentDirectory(originalDir); } return(gr); }
/// <summary> /// Destroys a group and all its resources. /// </summary> /// <param name="group"> /// </param> public void DestroyGroup(CIwResGroup group) { this.groups.Remove(group); group.Dispose(); }
/// <summary> /// Loads a resource group from a file. For more information on build mode and load mode, see @ ref resourceManagerModes "Resource Manager Modes". /// </summary> /// <param name="groupPath"> /// Pathname to GROUP text file to load. /// </param> /// <param name="allowNonExist"> /// True only if we wish to permit the non-existence of the GROUP file. Defaults to false. /// </param> /// <returns> /// </returns> public CIwResGroup LoadGroup(string groupPath, bool allowNonExist) { if (allowNonExist && !File.Exists(groupPath)) { return null; } var gr = new CIwResGroup(this); string originalDir = Directory.GetCurrentDirectory(); try { var file = this.ResolveSourceOrBinaryFilePath(groupPath); Debug.WriteLine(string.Format("Loading {0}", file)); this.groups.Add(gr); // Directory.SetCurrentDirectory(Path.GetDirectoryName(file)); if (file.EndsWith(".bin", StringComparison.InvariantCultureIgnoreCase)) { using (var s = IwSerialise.Open(file, true, this.classRegistry, this)) { gr.Read(s); } } else { throw new NotImplementedException(); } } finally { Directory.SetCurrentDirectory(originalDir); } return gr; }
/// <summary> /// Destroys a group and all its resources. /// </summary> /// <param name="group"> /// </param> public void DestroyGroup(CIwResGroup group) { this.groups.Remove(group); group.Dispose(); }
/// <summary> /// The on load. /// </summary> /// <param name="e"> /// The e. /// </param> protected override void OnLoad(EventArgs e) { base.OnLoad(e); this.isLoaded = true; this.timer.Interval = 1000 / 30; this.timer.Tick += (s, a) => { this.glControl.Invalidate(); }; try { this.@group = this.resManager.LoadGroup( @"Z:\MyWork\toe.git\net4\src\Toe.Marmalade.Tests\TestData\data-sw\scalablepipeline\bike.group.bin", false); // @group = this.resManager.LoadGroup(@"Z:\MyWork\toe.git\net4\src\Toe.Marmalade.Tests\TestData\data-gles1\scalablepipeline\bike.group.bin", false); } catch (Exception ex) { Debug.Write(ex.ToString()); throw; } this.ApplyScreenMode(); this.timer.Start(); }