Hi,
I am currently building an application in C# using mono and .NET. I
want to get a MIME type for a specific file, which is why I want to
detect the OS on which the application is running. On Windows, I would
look up the registry, on Linux/OSX/etc. I would look in
/etc/mime-types (or where the mime types are located). How would I
detect the OS ?
I have tried the following:
OperatingSystem os = Environment.OSV ersion;
Version vs = os.Version;
This gives me: "5.1.2600" on Linux :-)
Maybe it is better to build a MIME database on my own instead of
relying on the OS ?
Regards,
Christoffer 5 3518
I don't have a lot of details on the underlying implementation of Mono (just
because I haven't downloaded all the source).
However, I have a feeling that for "interoperabili ty reasons", they fool
your code into believing you are running under windows. I can see where that
might come in handy, deceitful as it may be :-)
Perhaps you can try to use the DllImport tag to write a p/invoke function
call to a Windows dll (like perhaps one of the registry API functions). Wrap
this up in a Try-Catch, and if the function fails (because the DLL doesn't
exist), then you are not in Windows. The only catch may be if the system is
using Wine or some windows emulator on Linux.
-Rob Teixeira [MVP]
"Christoffe r Soerensen" <sa********@hot mail.com> wrote in message
news:ac******** *************** ***@posting.goo gle.com... Hi,
I am currently building an application in C# using mono and .NET. I want to get a MIME type for a specific file, which is why I want to detect the OS on which the application is running. On Windows, I would look up the registry, on Linux/OSX/etc. I would look in /etc/mime-types (or where the mime types are located). How would I detect the OS ?
I have tried the following:
OperatingSystem os = Environment.OSV ersion; Version vs = os.Version;
This gives me: "5.1.2600" on Linux :-)
Maybe it is better to build a MIME database on my own instead of relying on the OS ?
Regards,
Christoffer
OperatingSystem os = Environment.OSV ersion;
MessageBox.Show ("OS:" + os.Platform + "\nVer:" + os.Version +
"\nToString :" + os.ToString()); sa********@hotm ail.com (Christoffer Soerensen) wrote in
news:ac******** *************** ***@posting.goo gle.com: Hi,
I am currently building an application in C# using mono and .NET. I want to get a MIME type for a specific file, which is why I want to detect the OS on which the application is running. On Windows, I would look up the registry, on Linux/OSX/etc. I would look in /etc/mime-types (or where the mime types are located). How would I detect the OS ?
I have tried the following:
OperatingSystem os = Environment.OSV ersion; Version vs = os.Version;
This gives me: "5.1.2600" on Linux :-)
Maybe it is better to build a MIME database on my own instead of relying on the OS ?
Regards,
Christoffer
> > This gives me: "5.1.2600" on Linux :-)
You are having this problem because Mono is simulating a Windows XP
environment.
"chris" <so**@one.com > wrote in message
news:OI******** ******@TK2MSFTN GP09.phx.gbl... OperatingSystem os = Environment.OSV ersion; MessageBox.Show ("OS:" + os.Platform + "\nVer:" + os.Version + "\nToString :" + os.ToString());
sa********@hotm ail.com (Christoffer Soerensen) wrote in news:ac******** *************** ***@posting.goo gle.com:
Hi,
I am currently building an application in C# using mono and .NET. I want to get a MIME type for a specific file, which is why I want to detect the OS on which the application is running. On Windows, I would look up the registry, on Linux/OSX/etc. I would look in /etc/mime-types (or where the mime types are located). How would I detect the OS ?
I have tried the following:
OperatingSystem os = Environment.OSV ersion; Version vs = os.Version; Maybe it is better to build a MIME database on my own instead of relying on the OS ?
Regards,
Christoffer
thats the version number...and is the same as what i get on xp pro so it
doesnt look good, but what does the platform property return?
im omw to install the runtime on my mandrake box tonight...
"Nick" <ne**@zigamorph .com> wrote in news:uE#QvluzDH A.2240
@TK2MSFTNGP10.p hx.gbl: > This gives me: "5.1.2600" on Linux :-) You are having this problem because Mono is simulating a Windows XP environment.
"chris" <so**@one.com > wrote in message news:OI******** ******@TK2MSFTN GP09.phx.gbl... OperatingSystem os = Environment.OSV ersion; MessageBox.Show ("OS:" + os.Platform + "\nVer:" + os.Version + "\nToString :" + os.ToString());
sa********@hotm ail.com (Christoffer Soerensen) wrote in news:ac******** *************** ***@posting.goo gle.com:
> Hi, > > I am currently building an application in C# using mono and .NET. I > want to get a MIME type for a specific file, which is why I want to > detect the OS on which the application is running. On Windows, I
would > look up the registry, on Linux/OSX/etc. I would look in > /etc/mime-types (or where the mime types are located). How would I > detect the OS ? > > I have tried the following: > > OperatingSystem os = Environment.OSV ersion; > Version vs = os.Version; > > > Maybe it is better to build a MIME database on my own instead of > relying on the OS ? > > Regards, > > Christoffer
chris <so**@one.com > wrote in message news:<OI******* *******@TK2MSFT NGP09.phx.gbl>. .. OperatingSystem os = Environment.OSV ersion; MessageBox.Show ("OS:" + os.Platform + "\nVer:" + os.Version + "\nToString :" + os.ToString());
Thank you!
Output from my C# program using Mono:
"Version: 5.1.2600.0
Platform: 128
ToString: Unix 5.1.2600.0"
I haven't tried using MS .NET but probably the ToString string is
"Windows 5.1.2600.0" on XP.
Thanks for all suggestions.
Christoffer This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Lethargy |
last post by:
http://www.linuxjournal.com/article.php?sid=7554
The question for the Free Software community to ruminate is this: Is
supporting Mono supporting our own desktop downfall? A statement
attributed to Steve Ballmer at a party a few years ago would support
this possibility. To paraphrase, when asked about Mono, he shrugged it
off with a statement alluding to the fact if Mono got too popular,
that's what lawyers are for. Mind you this is...
|
by: Everything Jute ! |
last post by:
Programmers everyday are making a tragic error by not learning mono.
Mono is te standard .net implementation for Windos and Linux.
Learning mono is the key to writing fast, OOP, cross platform applications.
Mono virtualized the OS in the most efficient way possible -- making
Linux programming a dream, instead of a chore.
Go mono !
|
by: Tony Baker |
last post by:
In order for my company to go ahead and use .Net and C# (over java), I
need to know how to install and run a C# ASP.Net application not only
on Windows, but on Linux.
I'm a Windows developer, currently writing a c# ASP.Net application.
The last time I used Linux (or whatever you want to call it) was back
at Uni 5 years ago.
What I want to do, is to see if I can get my ASP.Net project working
on Linux using mono (www.mono-project.com) -...
|
by: John Bailo |
last post by:
http://www.onlamp.com/pub/wlg/7468
"Mono Live was released on May 24, 2005. Although there are several Live
Linux CDs with Mono, they are all based on Knoppix and use KDE as the
default Linux desktop. This distribution is based on the Ubuntu Live Linux
CD. In many ways, the outstanding experience available from the Mono Live
CD is made possible from Ubuntu. Since Ubuntu features GNOME as the default
desktop, it only follows that due to...
|
by: anonymous |
last post by:
So, I was able to compile my Csharp program using Mono
(http://www.go-mono.com/). It seems to still rely on .NET
though. Is there a way to compile it so it will run
independent of .NET?
| |
by: Sanghyeon Seo |
last post by:
I took some time to write this HOWTO:
http://sparcs.kaist.ac.kr/~tinuviel/fepy/howto/simplehttpserver-ironpython-mono-howto.html
IronPython seems to get much less interest than it deserves. This
howto shows how to setup IronPython to use with Mono on Linux and how
to rebuild IronPython from source. It also discusses various patches
to current problems. It also shows that IronPython can run
SimpleHTTPServer today, not a trivial...
|
by: Vincent Courcelle |
last post by:
Hello,
Does someone experimented running ASP.NET 2 under Mono ? What about
performances and compatibility ? I would like to run my application
under windows but I can't (because of my hoster).
It would be so great if the .NET framework were open sourced (as
membership provider has recently been), it would be a real attack to
Java (and C# is far better than Java language it think...) and his cross
platform compatibility.
|
by: Twig |
last post by:
Hi,
Can I use strictly for C# development without missing anything from MS?
Twig
|
by: flagos |
last post by:
Hi to all!
Any of you know if it's possible to use the Cairo graphics library in
a WIN32 c# application? I know there is a binding made for Mono but my
app will run on win32 so obviously I wont need Mono.
Any help will be appreciated. Thanks!
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |