Go Back   RunUO - Ultima Online Emulation > RunUO > Core Modifications > Other

Other Cant find a category above, use this one! Core mods not listed above go here!

Reply
 
Thread Tools Display Modes
Old 04-11-2008, 06:59 PM   #1 (permalink)
Newbie
 
聲heledir's Avatar
 
Join Date: Jan 2007
Location: Mainz (Germany)
Age: 26
Posts: 17
Send a message via AIM to 聲heledir Send a message via MSN to 聲heledir Send a message via Yahoo to 聲heledir Send a message via Skype™ to 聲heledir
Lightbulb Using .NET 3.5 Features with RunUO

First, before I show you the tricky part there are some questions you should ask yourself:
  • Are you willing to recompile the core? (Remember: You will not get support in case you have some script-problems and using a modified core even though your problem has nothing to do with it!)
  • Are you sure you have installed the Microsoft .NET Framework 3.5 both on your Development-Server and your Productive-Server?
  • Do you know what LINQ is or do you really need other (new) features of C# or VB.NET 3.0?
  • Do you know what a Dictionary-Object is and what it is used for?
  • Are you a geek?

In case you have answered one or more times with "no", leave this thread. Now. Also I do not recommend to do any core-changes you don't understand! I'm neither a teacher nor a debugger: If you have some strange problems with the following changes -> revert them or try to understand what the .NET-Compiler tries to tell you....


Sooo.... you are still with me? Excitingly reading how to use those cool new features like LINQ, anonymous classes, extensions, add-ins, ....?? Here is all the magic:

First: Open ScriptCompiler.cs and search for this line:
Code:
using ( CSharpCodeProvider provider = new CSharpCodeProvider() )
Second: Replace this line with the following:
Code:
var providerOptions = new Dictionary<string, string>();
providerOptions.Add( "CompilerVersion", "v3.5" );
using ( CSharpCodeProvider provider = new CSharpCodeProvider( providerOptions ) )
Repeat those steps for the VBCodeProvider(), too.

Yep, thats all... have fun

--Anheledir
__________________
I work to live. I do not live to work. My clients do not seem capable of grasping this fact.

聲heledir is offline   Reply With Quote
Old 04-12-2008, 08:19 PM   #2 (permalink)
Forum Expert
 
Erica's Avatar
 
Join Date: Jan 2005
Location: Laramie Wyoming
Age: 43
Posts: 1,255
Send a message via ICQ to Erica Send a message via AIM to Erica Send a message via MSN to Erica Send a message via Yahoo to Erica Send a message via Skype™ to Erica
Default

I run a a server RunUO 2.0 RC2 and my computer has 3.5 net and it still runs the server with no core modification. So 3.5 net does work with RunUO 2.0 RC2.
__________________
Erica is online now   Reply With Quote
Old 04-12-2008, 08:44 PM   #3 (permalink)
Master of the Internet
 
Join Date: Mar 2006
Location: Germany
Age: 17
Posts: 14,257
Send a message via AIM to Suil Ban Send a message via MSN to Suil Ban
Default

He means using new .NET 3.5-specific features.
__________________
the runuo community has lost sight
Suil Ban is offline   Reply With Quote
Old 04-12-2008, 08:56 PM   #4 (permalink)
Newbie
 
聲heledir's Avatar
 
Join Date: Jan 2007
Location: Mainz (Germany)
Age: 26
Posts: 17
Send a message via AIM to 聲heledir Send a message via MSN to 聲heledir Send a message via Yahoo to 聲heledir Send a message via Skype™ to 聲heledir
Default

Quote:
Originally Posted by Erica View Post
I run a a server RunUO 2.0 RC2 and my computer has 3.5 net and it still runs the server with no core modification. So 3.5 net does work with RunUO 2.0 RC2.
OK, you have no clue what this patch is doing, do you?

You can obviously run RunUO 2.0 on .NET 3.5 'cause 3.5 doesn't have a new CRL. The .NET Core (CRL) is still on version 2.0. Then .NET 3.0 had a new version of C# and some new namespaces for WPF, WCF and WF, but it's only build around the 2.0 CRL. And now there is .NET 3.5 - and the biggest new feature is LINQ. But: It is using the 2.0 CRL, too.

So... in case you have installed .NET 3.0 or 3.5 you must have .NET 2.0 also. Because of that there is no problem running RunUO with the new Framework. But in case you want to use some of the new features from .NET 3.0 or 3.5, you must tell the internal script-Compiler from RunUO to compile against those new namespaces. And thats exactly what my little patch is doing.

Example 1:
Without this patch and only .NET 2.0 you have to write the following:

Code:
private bool _someProperty;
public bool SomeProperty {
get { return _someProperty; }
set { _someProperty = value; }
}
With this patch and .NET 3.5 you can shorten this to:
Code:
public bool SomeProperty { get; set; }

Example 2:
Without this patch and only .NET 2.0 you have to write the following:

Code:
Cloak c = new Cloak();
c.IsArcane = true;
c.MaxArcaneCharges = 10;
c.CurArcaneCharges = 10;
With this patch and .NET 3.5 you can simply write:
Code:
var c = new Cloak(IsArcane = true, MaxArcaneCharges = 10, CurArcaneCharges = 10);
These are only two small features of the new Framework you cannot use without this patch (RunUO would throw a exception on compile) and there are many more - but this is no place to advertise the new framework or to give lessons in LINQ
__________________
I work to live. I do not live to work. My clients do not seem capable of grasping this fact.

聲heledir is offline   Reply With Quote
Old 04-12-2008, 09:00 PM   #5 (permalink)
Forum Expert
 
Erica's Avatar
 
Join Date: Jan 2005
Location: Laramie Wyoming
Age: 43
Posts: 1,255
Send a message via ICQ to Erica Send a message via AIM to Erica Send a message via MSN to Erica Send a message via Yahoo to Erica Send a message via Skype™ to Erica
Default

Quote:
Originally Posted by 聲heledir View Post
OK, you have no clue what this patch is doing, do you?

You can obviously run RunUO 2.0 on .NET 3.5 'cause 3.5 doesn't have a new CRL. The .NET Core (CRL) is still on version 2.0. Then .NET 3.0 had a new version of C# and some new namespaces for WPF, WCF and WF, but it's only build around the 2.0 CRL. And now there is .NET 3.5 - and the biggest new feature is LINQ. But: It is using the 2.0 CRL, too.

So... in case you have installed .NET 3.0 or 3.5 you must have .NET 2.0 also. Because of that there is no problem running RunUO with the new Framework. But in case you want to use some of the new features from .NET 3.0 or 3.5, you must tell the internal script-Compiler from RunUO to compile against those new namespaces. And thats exactly what my little patch is doing.

Example 1:
Without this patch and only .NET 2.0 you have to write the following:

Code:
private bool _someProperty;
public bool SomeProperty {
get { return _someProperty; }
set { _someProperty = value; }
}
With this patch and .NET 3.5 you can shorten this to:
Code:
public bool SomeProperty { get; set; }

Example 2:
Without this patch and only .NET 2.0 you have to write the following:

Code:
Cloak c = new Cloak();
c.IsArcane = true;
c.MaxArcaneCharges = 10;
c.CurArcaneCharges = 10;
With this patch and .NET 3.5 you can simply write:
Code:
var c = new Cloak(IsArcane = true, MaxArcaneCharges = 10, CurArcaneCharges = 10);
These are only two small features of the new Framework you cannot use without this patch (RunUO would throw a exception on compile) and there are many more - but this is no place to advertise the new framework or to give lessons in LINQ
Ah i see i misunderstood you hehe .
__________________
Erica is online now   Reply With Quote
Old 05-02-2008, 11:37 PM   #6 (permalink)
Newbie
 
ETsCat's Avatar
 
Join Date: Apr 2003
Location: Montana,USA
Age: 58
Posts: 19
Send a message via ICQ to ETsCat Send a message via MSN to ETsCat
Unhappy OK sounds goodBut

Quote:
Originally Posted by 聲heledir View Post
First, before I show you the tricky part there are some questions you should ask yourself:
  • Are you willing to recompile the core? (Remember: You will not get support in case you have some script-problems and using a modified core even though your problem has nothing to do with it!)
  • Are you sure you have installed the Microsoft .NET Framework 3.5 both on your Development-Server and your Productive-Server?
  • Do you know what LINQ is or do you really need other (new) features of C# or VB.NET 3.0?
  • Do you know what a Dictionary-Object is and what it is used for?
  • Are you a geek?

In case you have answered one or more times with "no", leave this thread. Now. Also I do not recommend to do any core-changes you don't understand! I'm neither a teacher nor a debugger: If you have some strange problems with the following changes -> revert them or try to understand what the .NET-Compiler tries to tell you....


Sooo.... you are still with me? Excitingly reading how to use those cool new features like LINQ, anonymous classes, extensions, add-ins, ....?? Here is all the magic:

First: Open ScriptCompiler.cs and search for this line:
Code:
using ( CSharpCodeProvider provider = new CSharpCodeProvider() )
Second: Replace this line with the following:
Code:
var providerOptions = new Dictionary<string, string>();
providerOptions.Add( "CompilerVersion", "v3.5" );
using ( CSharpCodeProvider provider = new CSharpCodeProvider( providerOptions ) )
Repeat those steps for the VBCodeProvider(), too.

Yep, thats all... have fun

--Anheledir
Where In Hades is the "ScriptCompiler.cs " ?
I do a Search but it dont show anything exxcept Not Found.
__________________
Kick a Dog I kick yer Azz, Save a Dog And you have made 2 friends for life!
ETsCat is offline   Reply With Quote
Old 05-03-2008, 11:42 AM   #7 (permalink)
CEO
Forum Expert
 
CEO's Avatar
 
Join Date: Jun 2004
Age: 47
Posts: 775
Default

You must not have the full RunUO 2.0 with server sources or you're looking in the Scripts directory. ScriptCompiler.cs is in the Server directory where the RunUO source is.
__________________
If you PM me and ask me to write scripts for you I will add you to my ignore list.
Please don't add me to your friends list, I have enough friends. Thx
CEO is online now   Reply With Quote
Reply

Bookmarks

Tags
.net 3.5, core, linq


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5