[Mono-list] GETTING THE MS .NET DOC TO WORK ON LINUX
Nick
nick@chemlab.org
12 Aug 2002 22:32:44 -0400
--=-S5o2UgmrUZA9/amUAerp
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
PHP is defunct on my Debian box due to glibc package problems, so I
wrote a C# version of convert.php. Here it is for anyone who might be
having the same problem. (Note, this sucked up close to 300M of RAM when
I ran it.) Also, the hrefs in the htm files refer to filenames of all
lower-case characters, while the actual filenames are not all
lower-case. I've attached a Perl script to convert all files in the
current directory to lower case.
Johannes, thanks for taking the time to figure all of this out. :-)
Nick
On Mon, 2002-08-12 at 12:46, Guenther Roith wrote:
> Hi!
>
>
> > Hello!
> >
> > > GETTING THE MS .NET DOC TO WORK ON LINUX
> > > ========================================
> >
> > Thanks for the precise instructions! This is pretty good!
> >
> >
> > > 5. Change to it and type
> > >
> > > "C:\program files\Microsoft Help 2.0 SDK\hxcomp.exe" -u C:\program
> > > files\Microsoft.N
> > > ET\FrameworkSDK\Docs\1031\cpref.HxS
> > >
> > > at the command line. Your path may be a bit different.
> > >
> > > This can take some time.
> >
> >
> > Ok, I have arrived this far, but now I am running into trouble in the
> > next step:
> >
> > > 6. You will have some files in it and a sub-directory called "html" as
> well
> > > as "Scripts".
> > > Copy the file dtue.css in "Scripts" one dir level higher, that it is one
> dir
> > > above "html".
> >
> > I can not find a Scripts directory, or a dtue.css file. In fact, I can
> > not find any .css files in there.
>
> if the html dir is in lets say
>
> c:\something\html
>
> the Scripts dir is in
> c:\something\Scripts
>
> then.
>
>
> If you really don't have it, I've attached the file.
>
> copy it to c:\something\ if html would be c:\something\html
>
>
> >
> > Miguel
> >
> ----
>
--=-S5o2UgmrUZA9/amUAerp
Content-Disposition: attachment; filename=c2l.pl
Content-Transfer-Encoding: quoted-printable
Content-Type: text/x-perl; name=c2l.pl; charset=ISO-8859-1
#!/usr/bin/perl
use File::Copy;
for (<*>)
{
/^\.(|.)$/ and next;
my $lc =3D $_;
$lc =3D~ tr/A-Z/a-z/;
=20
move($_, $lc);
}
--=-S5o2UgmrUZA9/amUAerp
Content-Disposition: attachment; filename=convert.cs
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; name=convert.cs; charset=ISO-8859-1
using System;
using System.IO;
using System.Text;
public class TagConverter {
private static string OldString =3D "<SCRIPT SRC=3D\"ms-help:/../commoner/=
scripts/dtuelink.js\"></SCRIPT>";
private static string NewString =3D "<link REL=3DSTYLESHEET type=3DTEXT/CS=
S href=3D../style.css>";
public static void Main(string[] args) {
if (args.Length !=3D 1) {
Console.WriteLine("Usage: convert.exe <directory>");
return;
}
else if (!Directory.Exists(args[0])) {
Console.WriteLine("Error: No such directory: {0}", args[0]);
return;
}
Convert(args[0]);
}
public static void Convert(string dir) {
string[] filenames =3D Directory.GetFiles(dir);
foreach (string filename in filenames) {
if (!filename.EndsWith(".htm"))
continue;
Console.WriteLine("Converting: " + filename);
string contents =3D ReadFile(filename);
contents =3D ReplaceTags(contents);
WriteFile(filename, contents);
}
}
public static string ReadFile(string filename) {
FileStream file =3D File.Open(filename, FileMode.Open, FileAccess.Read);
StreamReader reader =3D new StreamReader(file);
StringBuilder builder =3D new StringBuilder();
for (string line=3Dreader.ReadLine(); line !=3D null; line=3Dreader.ReadL=
ine()) {
builder.Append(line);
builder.Append("\n");
}
file.Close();
return builder.ToString();
}
public static string ReplaceTags(string contents) {
return contents.Replace(OldString, NewString);
}
public static void WriteFile(string filename, string contents) {
FileStream file =3D File.Open(filename, FileMode.Truncate, FileAccess.Rea=
dWrite);
StreamWriter writer =3D new StreamWriter(file);
writer.Write(contents);
file.Close();
}
}
--=-S5o2UgmrUZA9/amUAerp--