[Mono-docs-list] Monodoc HelpSource refactor patch

2004-08-28 Thread Peter Williams
Hi all,

The attached patch refactors the HelpSource class a bit. It adds a new
parent class called HelpStore, which deals with the I/O tasks of the
class. Then the HelpSource implementation adds the tree loading and
saving. The patch doesn't change any functionality, but it adds
encapsulation of the IO routines and helps reduce the size of
provider.cs, which I think is too long at the moment.

Comments?

Peter

-- 
Peter Williams  [EMAIL PROTECTED]

[Ninjas] are cool; and by cool, I mean totally sweet.
  -- REAL Ultimate Power
Index: ChangeLog
===
RCS file: /cvs/public/monodoc/browser/ChangeLog,v
retrieving revision 1.137
diff -u -r1.137 ChangeLog
--- ChangeLog	25 Aug 2004 16:08:56 -	1.137
+++ ChangeLog	28 Aug 2004 18:21:32 -
@@ -1,3 +1,16 @@
+2004-08-28  Peter Williams  [EMAIL PROTECTED]
+
+	* HelpStore.cs (HelpStore): Break out the IO routines of HelpSource into
+	a new class, to better separate the IO and Help dimensions of
+	the class. 
+	
+	* provider.cs (HelpSource): Refactor to be a subclass of
+	HelpStore.
+	(Tree): Change to work with a generic Stream, not
+	filename/FileStream, to accomodate the split.
+	
+	* Makefile.am: Add HelpStore.cs into the build.
+	
 2004-08-25  Peter Williams  [EMAIL PROTECTED]
 
 	* provider.cs: Allow a .source file to add nodes to the tree
Index: provider.cs
===
RCS file: /cvs/public/monodoc/browser/provider.cs,v
retrieving revision 1.65
diff -u -r1.65 provider.cs
--- provider.cs	25 Aug 2004 16:08:56 -	1.65
+++ provider.cs	28 Aug 2004 18:21:32 -
@@ -19,7 +19,6 @@
 using System.Configuration;
 using System.Xml;
 using System.Xml.XPath;
-using ICSharpCode.SharpZipLib.Zip;
 
 /// summary
 ///This tree is populated by the documentation providers, or populated
@@ -35,21 +34,17 @@
 	/// /summary
 	public readonly HelpSource HelpSource;
 	
-	internal FileStream InputStream;
+	internal Stream InputStream;
 	internal BinaryReader InputReader;
 
 	/// summary
 	///   Load from file constructor
 	/// /summary
-	public Tree (HelpSource hs, string filename) : base (null, null)
+	public Tree (HelpSource hs, Stream input) : base (null, null)
 	{
 		Encoding utf8 = new UTF8Encoding (false, true);
 
-		if (!File.Exists (filename)){
-			throw new FileNotFoundException ();
-		}
-		
-		InputStream = File.OpenRead (filename);
+		InputStream = input;
 		InputReader = new BinaryReader (InputStream, utf8);
 		byte [] sig = InputReader.ReadBytes (4);
 		
@@ -81,21 +76,20 @@
 	/// summary
 	///Saves the tree into the specified file using the help file format.
 	/// /summary
-	public void Save (string file)
+	public void Save (Stream output)
 	{
 		Encoding utf8 = new UTF8Encoding (false, true);
-		using (FileStream output = File.OpenWrite (file)){
-			// Skip over the pointer to the first node.
-			output.Position = 8;
+
+		// Skip over the pointer to the first node.
+		output.Position = 8;
 			
-			using (BinaryWriter writer = new BinaryWriter (output, utf8)){
-// Recursively dump
-Dump (output, writer);
-
-output.Position = 0;
-writer.Write (new byte [] { (byte) 'M', (byte) 'o', (byte) 'H', (byte) 'P' });
-writer.Write (position);
-			}
+		using (BinaryWriter writer = new BinaryWriter (output, utf8)){
+			// Recursively dump
+			Dump (output, writer);
+			
+			output.Position = 0;
+			writer.Write (new byte [] { (byte) 'M', (byte) 'o', (byte) 'H', (byte) 'P' });
+			writer.Write (position);
 		}
 	}
 
@@ -287,7 +281,7 @@
 return ret;
 	}
 
-	internal void Dump (FileStream output, BinaryWriter writer)
+	internal void Dump (Stream output, BinaryWriter writer)
 	{
 		if (nodes != null){
 			foreach (Node child in nodes){
@@ -360,42 +354,27 @@
 // The HelpSource class keeps track of the archived data, and its
 // tree
 //
-public class HelpSource {
+public class HelpSource : HelpStore {
 	static int id;
 
 	//
 	// The unique ID for this HelpSource.
 	//
 	int source_id;
-	DateTime zipFileWriteTime;
 	string name;
 
-	public HelpSource (string base_filename, bool create)
+	public HelpSource (string base_filename, bool create) : base (base_filename, create)
 	{
 		this.name = Path.GetFileName (base_filename);
-		tree_filename = base_filename + .tree;
-		zip_filename = base_filename + .zip;
 
 		if (create)
-			SetupForOutput ();
+			Tree = new Tree (this, , );
 		else 
-			Tree = new Tree (this, tree_filename);
+			Tree = new Tree (this, GetTreeStream ());
 
 		source_id = id++;
-		try {
-			FileInfo fi = new FileInfo (zip_filename);
-			zipFileWriteTime = fi.LastWriteTime;
-		} catch {
-			zipFileWriteTime = DateTime.Now;
-		}
 	}
 
-	public DateTime ZipFileWriteTime {
-		get {
-			return zipFileWriteTime;
-		}
-	}
-	
 	public int SourceID {
 		get {
 			return source_id;
@@ -408,66 +387,30 @@
 		}
 	}
 	
-	ZipFile zip_file;
-	
-	/// summary
-	///   

[Mono-list] popt

2004-08-28 Thread Rob Brown-Bayliss

On Fri, 2004-08-27 at 15:36, Marcus wrote: 
 I'm not sure if Mono.GetOptions is compiled by default. If you're building 
 from source, you can do a make in Mono.GetOptions directory. The resulting 
 assembly to be installed is Mono.GetOptions.dll.



I do have the Mo.GetOptions.dll installed. I get all the mono stuff via
Yum (using fedora) so any other ideas as to why this is failing?
--
Rob Brown-Bayliss

___
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list


[Mono-list] Simple Drag Drop Questions

2004-08-28 Thread Andreas Sliwka
Greetings,
  first I have to explain that after lurking on this list for nearly a
year the developers notebook persuaded me to actually code something
in c#. I must admit that it is very addicting. I haven't had that much
fun in hacking in weeks :-) Although monodevelop stops responding to
events after I click on certain links in the class documentation ...

  Now let me describe the tiny problem that I've got: I followed the
labs in the notebook and combined drag  drop and building interfaces
with glade from the GTK# sections. The following code snippet works, I
can drop file uris from nautilus on the filelist, but I get a strange
error (warning?) message.

Here my code (shortened):

use everything.needed.in.System.and.Glade.and.such;
public class MyProgram {
  public MyProgram (string [] args) {
Program program = new Program (MyProgram, 0.0, 
  Modules.UI, args);
Glade.XML gxml = new Glade.XML (null, gustav.glade, 
  gustav, null);
gxml.Autoconnect(this);
Gtk.TreeView filelist = (Gtk.TreeView) gxml.GetWidget(filelist);
Gtk.Drag.DestSet(filelist, DestDefaults.All, 
  filelist_drop_types,Gdk.DragAction.Copy);
filelist.DragDataReceived += filelist_drop;
program.Run();
  }

  private void filelist_drop(object o, DragDataReceivedArgs args) {
bool success = false;
// do some things
success = true;
Gtk.Drag.Finish (args.Context, success, false, args.Time);
  }
}   

... and I receive the following error message:

(MyProgram:5822): Gtk-WARNING **: You must override the default
'drag_data_received' handler on GtkTreeView when using models that don't
support the GtkTreeDragDest interface and enabling drag-and-drop. [...]

Why is that? Do I have to do funky things? I thought that I copied all
relevant parts from the examples ... 

System is Debian unstable with mono* 1.0.1-1. monodevelop is 0.5-2.

best regards,

mfg

___
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list


[Mono-list] Mono assembly load error under .NET 1.1 Windows

2004-08-28 Thread Scott
Hello fellow Monoers,
Should it be possible to compile simple assemblies under Mono 1.0.1 on  
Linux
and use them successfully under Microsoft's .NET 1.1 Framework on  
Windows?

I'm getting an assembly load error on an ASP.NET page:
The format of the file 'Xxxx.Web' is invalid.
I didn't expect that.  This suggests that there is something wrong with  
the encoding
of the assembly itself, rather than an error in my code, doesn't it?

I've compiled against Mono's implementation of System.Web and  
System.Data,
but it's nothing complex. The assembly compiled and loaded fine when I  
used
SharpDevelop on XP with .NET 1.1, but not with when compiled with  
MonoDevelop on
Linux under Mono 1.0.1 deployed to Windows Server 2003 .NET 1.1, and I  
haven't
change a line of code.

Maybe I'm doing something stupid here?  - This is quite often the case  
:o)

Has any one else seen this, or maybe it's not meant to be possible yet?
Here's the ASP.NET output:
8  
 
-

Parser Error
Description: An error occurred during the parsing of a resource  
required to service this request. Please review the following specific  
parse error details and modify your source file appropriately.

Parser Error Message: The format of the file Xxxx.Web' is invalid.
Source Error:
Line 1:  %@ Page Language=C# ContentType=text/html  
ResponseEncoding=iso-8859-1 EnableViewState=false %
Line 2:  %@ Register TagPrefix=xxx Namespace=Xxxx.Web  
Assembly=Xxxx.Web%
Line 3:  %@ Import Namespace=System.Data %
Line 4:  %@ Import namespace=ByteFX.Data.MySqlClient %

Source File:  D:\customer\\www..co.uk\www\menu.aspx    Line:  2
Assembly Load Trace: The following information can be helpful to  
determine why the assembly 'Xxxx.Web' could not be loaded.

=== Pre-bind state information ===
LOG: DisplayName = Xxxx.Web
 (Partial)
LOG: Appbase = file:///D:/customer//www..co.uk/www
LOG: Initial PrivatePath = bin
Calling assembly : (Unknown).
===
LOG: Policy not being applied to reference at this time (private,  
custom, partial, or location-based assembly bind).
LOG: Post-policy reference: Xxxx.Web
LOG: Attempting download of new URL  
file:///C:/WINDOWS/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET  
Files/root/68c8f421/a2dce656/Xxxx.Web.DLL.
LOG: Attempting download of new URL  
file:///C:/WINDOWS/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET  
Files/root/68c8f421/a2dce656/Simbiotic.Web/Xxxx.Web.DLL.
LOG: Attempting download of new URL  
file:///D:/customer/j/www..co.uk/www/bin/Xxxx.Web.DLL.

Version Information: Microsoft .NET Framework Version:1.1.4322.573;  
ASP.NET Version:1.1.4322.573

8  
 
-

I humbly await your comments...
-- Scott
___
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list


Re: [Mono-list] Setting up mod_mono/Apache2

2004-08-28 Thread Simon Ask Ulsnes
Thanks for the help, I'll see if it works.
Gonzalo Paniagua Javier wrote:
If instead of ranting you provide more details on how you configure
apache, you might even get some help.
 

Yeah, but that's really hard if you have no idea what's wrong and what 
details are missing or relevant because the logs are empty and the docs 
(those I could find in /usr/share/doc/xsp-1.0/) are vague at best.
By the way, I use mod_mono in a fairly standard Apache2 Gentoo-style 
setup. It is configured exactly according to the docs.

And I would like to note that I don't mean to sound negative - I'm 
extremely grateful for the very impressive work the Mono team et al has 
done. It's simply amazing that it works so flawlessly, which is why I 
get really frustrated when it doesn't... ;-)

- Simon
___
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list


[Mono-list] Separate Files

2004-08-28 Thread Eric Damron
I just started using mono, C# and monodevelop so forgive the beginner 
question.

If I have a class with a particular nasty function, is there a way to 
put the source for that one function into a separate file to make the 
code more manageable?

Thanks
___
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list


Re: [Mono-list] Separate Files

2004-08-28 Thread Marcus
With the original C# standard, no, you can't, but C# 2.0 supports dividing the 
class into several files at including the keyword partial in the class 
declarations.


On Saturday 28 August 2004 9:16 pm, Eric Damron wrote:
 I just started using mono, C# and monodevelop so forgive the beginner
 question.

 If I have a class with a particular nasty function, is there a way to
 put the source for that one function into a separate file to make the
 code more manageable?
___
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list


Re: [Mono-list] Separate Files

2004-08-28 Thread Cory Nelson
You are able to split classes into multiple files with C# 2.0 but not
anything prior.  I'm not sure how well Mono's C# 2.0 support is but it
can't hurt to try.

On Sat, 28 Aug 2004 19:16:20 -0700, Eric Damron [EMAIL PROTECTED] wrote:
 I just started using mono, C# and monodevelop so forgive the beginner
 question.
 
 If I have a class with a particular nasty function, is there a way to
 put the source for that one function into a separate file to make the
 code more manageable?
 
 Thanks
 ___
 Mono-list maillist  -  [EMAIL PROTECTED]
 http://lists.ximian.com/mailman/listinfo/mono-list
 


-- 
Cory Nelson
http://www.int64.org
___
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list


Re: [Mono-list] Beginner C# Book

2004-08-28 Thread Michael J. Ryan
anyone still here? quiet lately..
setting up an FC2 box tonight, and tomorrow to play with the 1.01, been
a while... going to do a presentation for the dot-net usergroup in my
area in january, for Non-Microsoft .Net .. focussing on alternatives
to MS based services, would love to get suggestions and feedback.
--
Michael J. Ryan - tracker1(at)theroughnecks(dot)com - www.theroughnecks.net
icq: 4935386  -  AIM/AOL: azTracker1  -  Y!: azTracker1  -  MSN/Win: (email)
___
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list


Re: [Mono-list] Beginner C# Book

2004-08-28 Thread Adam Tauno Williams
 anyone still here? quiet lately..
 setting up an FC2 box tonight, and tomorrow to play with the 1.01, been
 a while... going to do a presentation for the dot-net usergroup in my
 area in january, for Non-Microsoft .Net .. focussing on alternatives
 to MS based services, would love to get suggestions and feedback.

I did such a presentation not too long ago...
ftp://www.kalamazoolinux.org/pub/pdf/mono.pdf

___
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list