aboutsummaryrefslogtreecommitdiffstatsci
path: root/src/XCursor.cs
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2015-09-09 12:33:45 +0200
committerjpbruyere <jp.bruyere@hotmail.com>2015-09-09 12:33:45 +0200
commit83a4710020bc9e254241bdce880d20bcbcec0bee (patch)
tree6c3d80154d1e791996de2de11f3fa8398662a7f9 /src/XCursor.cs
parent0c200d4ae4f0f4a7a7c58c3affc7670eb6b2dcff (diff)
use Interface.GetStreamFromPath to handle either file or resource in
every loading places
Diffstat (limited to 'src/XCursor.cs')
-rw-r--r--src/XCursor.cs30
1 files changed, 1 insertions, 29 deletions
diff --git a/src/XCursor.cs b/src/XCursor.cs
index 8120530e..9c42c8da 100644
--- a/src/XCursor.cs
+++ b/src/XCursor.cs
@@ -46,32 +46,7 @@ namespace go
public List<XCursor> Cursors = new List<XCursor>();
- static XCursorFile loadFromRessource (string resId)
- {
- Stream stream = null;
-
- //first, search for ressource in main executable assembly
- stream = System.Reflection.Assembly.GetEntryAssembly().GetManifestResourceStream(resId);
- if (stream == null)//try to find ressource in golib assembly
- stream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(resId);
- if (stream == null) {
- Debug.WriteLine ("Ressource not found: " + resId);
- return null;
- }
- using (MemoryStream ms = new MemoryStream ()) {
- stream.CopyTo (ms);
- ms.Seek (0, SeekOrigin.Begin);
- return loadFromStream (ms);
- }
- }
- static XCursorFile loadFromFile (string path)
- {
- using (Stream s = new FileStream (path,
- FileMode.Open, FileAccess.Read)) {
- return loadFromStream (s);
- }
- }
static XCursorFile loadFromStream(Stream s)
{
List<toc> tocList = new List<toc> ();
@@ -108,10 +83,7 @@ namespace go
public static XCursorFile Load(string path)
{
- if (path.StartsWith ("#"))
- return loadFromRessource (path.Substring(1));
- else
- return loadFromFile (path);
+ return loadFromStream (Interface.GetStreamFromPath (path));
}
static XCursor imageLoad(BinaryReader sr)