mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2025-06-06 06:28:15 +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;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
using Gdk;
|
using Gdk;
|
||||||
using Gtk;
|
using Gtk;
|
||||||
|
@ -57,25 +58,34 @@ namespace GtkDemo
|
||||||
|
|
||||||
private void LoadFile (string filename)
|
private void LoadFile (string filename)
|
||||||
{
|
{
|
||||||
if (File.Exists (filename))
|
Stream file = Assembly.GetExecutingAssembly ().GetManifestResourceStream (filename);
|
||||||
|
if (file != null)
|
||||||
{
|
{
|
||||||
Stream file = File.OpenRead (filename);
|
LoadStream (file, filename);
|
||||||
StreamReader sr = new StreamReader (file);
|
}
|
||||||
string s = sr.ReadToEnd ();
|
else if (File.Exists (filename))
|
||||||
sr.Close ();
|
{
|
||||||
file.Close ();
|
file = File.OpenRead (filename);
|
||||||
|
LoadStream (file, filename);
|
||||||
infoBuffer.Text = filename;
|
|
||||||
sourceBuffer.Text = s;
|
|
||||||
|
|
||||||
Fontify ();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
infoBuffer.Text = String.Format ("{0} was not found.", filename);
|
infoBuffer.Text = String.Format ("{0} was not found.", filename);
|
||||||
sourceBuffer.Text = String.Empty;
|
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 ()
|
private void Fontify ()
|
||||||
|
|
|
@ -97,13 +97,13 @@ namespace GtkDemo
|
||||||
textView.AddChildAtAnchor (scale, scaleAnchor);
|
textView.AddChildAtAnchor (scale, scaleAnchor);
|
||||||
scale.ShowAll ();
|
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);
|
textView.AddChildAtAnchor (image, animationAnchor);
|
||||||
image.ShowAll ();
|
image.ShowAll ();
|
||||||
|
|
||||||
Entry entry = new Entry ();
|
Entry entry = new Entry ();
|
||||||
textView.AddChildAtAnchor (entry, entryAnchor);
|
textView.AddChildAtAnchor (entry, entryAnchor);
|
||||||
image.ShowAll ();
|
entry.ShowAll ();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CreateTags (TextBuffer buffer)
|
private void CreateTags (TextBuffer buffer)
|
||||||
|
|
|
@ -41,7 +41,8 @@ images = \
|
||||||
/resource:$(srcdir)/images/floppybuddy.gif,floppybuddy.gif
|
/resource:$(srcdir)/images/floppybuddy.gif,floppybuddy.gif
|
||||||
|
|
||||||
build_sources = $(addprefix $(srcdir)/, $(sources))
|
build_sources = $(addprefix $(srcdir)/, $(sources))
|
||||||
|
resources = $(addprefix /resource:, $(sources))
|
||||||
|
|
||||||
GtkDemo.exe: $(build_sources) $(assemblies)
|
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