mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2024-12-24 00:05:38 +00:00
store the .cs files as resources also
svn path=/trunk/gtk-sharp/; revision=32944
This commit is contained in:
parent
780218b349
commit
8ba7c8305b
|
@ -8,6 +8,7 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Collections;
|
||||
using System.Reflection;
|
||||
|
||||
using Gdk;
|
||||
using Gtk;
|
||||
|
@ -57,25 +58,34 @@ namespace GtkDemo
|
|||
|
||||
private void LoadFile (string filename)
|
||||
{
|
||||
if (File.Exists (filename))
|
||||
Stream file = Assembly.GetExecutingAssembly ().GetManifestResourceStream (filename);
|
||||
if (file != null)
|
||||
{
|
||||
Stream file = File.OpenRead (filename);
|
||||
StreamReader sr = new StreamReader (file);
|
||||
string s = sr.ReadToEnd ();
|
||||
sr.Close ();
|
||||
file.Close ();
|
||||
|
||||
infoBuffer.Text = filename;
|
||||
sourceBuffer.Text = s;
|
||||
|
||||
Fontify ();
|
||||
LoadStream (file, filename);
|
||||
}
|
||||
else if (File.Exists (filename))
|
||||
{
|
||||
file = File.OpenRead (filename);
|
||||
LoadStream (file, filename);
|
||||
}
|
||||
else
|
||||
{
|
||||
infoBuffer.Text = String.Format ("{0} was not found.", filename);
|
||||
sourceBuffer.Text = String.Empty;
|
||||
Fontify ();
|
||||
}
|
||||
|
||||
Fontify ();
|
||||
}
|
||||
|
||||
private void LoadStream (Stream file, string filename)
|
||||
{
|
||||
StreamReader sr = new StreamReader (file);
|
||||
string s = sr.ReadToEnd ();
|
||||
sr.Close ();
|
||||
file.Close ();
|
||||
|
||||
infoBuffer.Text = filename;
|
||||
sourceBuffer.Text = s;
|
||||
}
|
||||
|
||||
private void Fontify ()
|
||||
|
|
|
@ -97,13 +97,13 @@ namespace GtkDemo
|
|||
textView.AddChildAtAnchor (scale, scaleAnchor);
|
||||
scale.ShowAll ();
|
||||
|
||||
Gtk.Image image = new Gtk.Image ("images/floppybuddy.gif");
|
||||
Gtk.Image image = new Gtk.Image (Gdk.Pixbuf.LoadFromResource ("floppybuddy.gif"));
|
||||
textView.AddChildAtAnchor (image, animationAnchor);
|
||||
image.ShowAll ();
|
||||
|
||||
Entry entry = new Entry ();
|
||||
textView.AddChildAtAnchor (entry, entryAnchor);
|
||||
image.ShowAll ();
|
||||
entry.ShowAll ();
|
||||
}
|
||||
|
||||
private void CreateTags (TextBuffer buffer)
|
||||
|
|
|
@ -41,7 +41,8 @@ images = \
|
|||
/resource:$(srcdir)/images/floppybuddy.gif,floppybuddy.gif
|
||||
|
||||
build_sources = $(addprefix $(srcdir)/, $(sources))
|
||||
resources = $(addprefix /resource:, $(sources))
|
||||
|
||||
GtkDemo.exe: $(build_sources) $(assemblies)
|
||||
$(CSC) /debug /out:GtkDemo.exe $(build_sources) $(references) $(images)
|
||||
$(CSC) /debug /out:GtkDemo.exe $(build_sources) $(references) $(images) $(resources)
|
||||
|
||||
|
|
Loading…
Reference in a new issue