using System;
using System.Collections;
namespace Csharp_SysInfo
{
class MainClass
{
public static void Main (string[] args)
{
printSysInfo ();
}
/*
* reference:
* https://msdn.microsoft.com/en-us/library/system.environment.aspx
*/
private static void printSysInfo ()
{
String str;
String nl = Environment.NewLine;
//
Console.WriteLine ();
Console.WriteLine ("-- Environment members --");
// Invoke this sample with an arbitrary set of command line arguments.
Console.WriteLine ("CommandLine: {0}", Environment.CommandLine);
String[] arguments = Environment.GetCommandLineArgs ();
Console.WriteLine ("GetCommandLineArgs: {0}", String.Join (", ", arguments));
// <-- Keep this information secure! -->
Console.WriteLine ("CurrentDirectory: {0}", Environment.CurrentDirectory);
Console.WriteLine ("ExitCode: {0}", Environment.ExitCode);
Console.WriteLine ("HasShutdownStarted: {0}", Environment.HasShutdownStarted);
// <-- Keep this information secure! -->
Console.WriteLine ("MachineName: {0}", Environment.MachineName);
Console.WriteLine ("NewLine: {0} first line{0} second line{0} third line",
Environment.NewLine);
Console.WriteLine ("OSVersion: {0}", Environment.OSVersion.ToString ());
Console.WriteLine ("StackTrace: '{0}'", Environment.StackTrace);
// <-- Keep this information secure! -->
Console.WriteLine ("SystemDirectory: {0}", Environment.SystemDirectory);
Console.WriteLine ("TickCount: {0}", Environment.TickCount);
// <-- Keep this information secure! -->
Console.WriteLine ("UserDomainName: {0}", Environment.UserDomainName);
Console.WriteLine ("UserInteractive: {0}", Environment.UserInteractive);
// <-- Keep this information secure! -->
Console.WriteLine ("UserName: {0}", Environment.UserName);
Console.WriteLine ("Version: {0}", Environment.Version.ToString ());
Console.WriteLine ("WorkingSet: {0}", Environment.WorkingSet);
// No example for Exit(exitCode) because doing so would terminate this example.
// <-- Keep this information secure! -->
String query = "My system drive is %SystemDrive% and my system root is %SystemRoot%";
str = Environment.ExpandEnvironmentVariables (query);
Console.WriteLine ("ExpandEnvironmentVariables: {0} {1}", nl, str);
Console.WriteLine ("GetEnvironmentVariable: {0} My temporary directory is {1}.", nl,
Environment.GetEnvironmentVariable ("TEMP"));
Console.WriteLine ("GetEnvironmentVariables: ");
IDictionary environmentVariables = Environment.GetEnvironmentVariables ();
foreach (DictionaryEntry de in environmentVariables) {
Console.WriteLine (" {0} = {1}", de.Key, de.Value);
}
Console.WriteLine ("GetFolderPath: {0}",
Environment.GetFolderPath (Environment.SpecialFolder.System));
String[] drives = Environment.GetLogicalDrives ();
Console.WriteLine ("GetLogicalDrives: {0}", String.Join (", ", drives));
}
}
}
Showing posts with label monodevelop. Show all posts
Showing posts with label monodevelop. Show all posts
Saturday, April 11, 2015
mono/C# on Raspberry Pi, get system info
Example to get system info with mono/C# run on Raspberry Pi, using System.Environment class.
Solve MonoDevelop error: cannot execute "...". File name hase not been set.
After you Install Mono/MonoDevelop on Raspberry Pi/Raspbian or Install latest version of Mono and MonoDevelop on Raspberry Pi/Raspbian, try to run your first "Hello World" in MonoDevelop, but report error of cannot execute "...". File name hase not been set.
To solve it, close MonoDevelop.
Install xterm in LXTerminal
$ sudo apt-get install xterm
Restart MonoDevelop, problem solved.
To solve it, close MonoDevelop.
Install xterm in LXTerminal
$ sudo apt-get install xterm
Restart MonoDevelop, problem solved.
Saturday, April 4, 2015
Install latest version of Mono and MonoDevelop on Raspberry Pi/Raspbian
My previous post show Install Mono/MonoDevelop on Raspberry Pi/Raspbian using the default package repository. The installed version will be mono 3.2.8 and monodevelop 3.0.3.2. Alternatively, we can update the package repository on the system to install with latest release: mono 3.12.1 and monodevelop 5.7.0 currently.
The page http://www.monodevelop.com/download/linux/ and http://www.mono-project.com/docs/getting-started/install/linux/#debian-ubuntu-and-derivatives provide instructions to install MonoDevelop and Mono on Linux, include Debian. We can follow the steps to install on Raspberry Pi/Raspbian.
My steps is summrized here:
The videos show how to, on Raspberry Pi 2/Raspbian:
Here how it run remotely via ssh:
and via xrdp on Raspberry Pi and remmina on Ubuntu Linux:
Related:
- Solve MonoDevelop error: cannot execute "...". File name hase not been set.
The page http://www.monodevelop.com/download/linux/ and http://www.mono-project.com/docs/getting-started/install/linux/#debian-ubuntu-and-derivatives provide instructions to install MonoDevelop and Mono on Linux, include Debian. We can follow the steps to install on Raspberry Pi/Raspbian.
My steps is summrized here:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list
echo "deb http://download.mono-project.com/repo/debian wheezy-apache24-compat main" | sudo tee -a /etc/apt/sources.list.d/mono-xamarin.list
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install mono-devel
sudo apt-get install mono-complete
sudo apt-get install referenceassemblies-pcl
sudo apt-get install monodevelop
sudo apt-get install monodevelop-nunit
sudo apt-get install monodevelop-versioncontrol
sudo apt-get install monodevelop-database
The videos show how to, on Raspberry Pi 2/Raspbian:
Here how it run remotely via ssh:
and via xrdp on Raspberry Pi and remmina on Ubuntu Linux:
Related:
- Solve MonoDevelop error: cannot execute "...". File name hase not been set.
Thursday, April 2, 2015
Create Gtk# application using C#/MonoDevelop on Raspberry Pi
This video show creating Gtk# GUI application of Hello World on Raspberry Pi 2 using C#/MonoDevelop.
Related:
- Install Mono/MonoDevelop on Raspberry Pi/Raspbian
What is Gtk#?
Gtk# is a Graphical User Interface Toolkit for mono and .Net. The project binds the gtk+ toolkit and assorted GNOME libraries, enabling fully native graphical Gnome application development using the Mono and .Net development frameworks.
~ reference: http://www.mono-project.com/docs/gui/gtksharp/
Related:
- Install Mono/MonoDevelop on Raspberry Pi/Raspbian
What is Gtk#?
Gtk# is a Graphical User Interface Toolkit for mono and .Net. The project binds the gtk+ toolkit and assorted GNOME libraries, enabling fully native graphical Gnome application development using the Mono and .Net development frameworks.
~ reference: http://www.mono-project.com/docs/gui/gtksharp/
Install Mono/MonoDevelop on Raspberry Pi/Raspbian
![]() |
| MonoDevelop run on Raspberry Pi 2/Raspbian |
Mono, sponsored by Xamarin, is an open source implementation of Microsoft's .NET Framework based on the ECMA standards for C# and the Common Language Runtime.
MonoDevelop enables developers to quickly write desktop and web applications on Linux, Windows and Mac OS X.
Always run this commands to update your apt before installation:
$ sudo apt-get update
$ sudo apt-get upgrade
To install Mono/MonoDevelop on Raspberry Pi running Raspbian:
$ sudo apt-get install mono-complete
$ sudo apt-get install monodevelop
This video show how to install on Raspberry Pi 2 running Raspbian version 2015-02-16.
The current installed version is mono-complete 3.2.8 and monodevelop 3.0.3.2.
Once installed, run it with Menu > Programming > MonoDevelop
THis video show a "Hello World" of C# console program build using MonoDevelop running on Raspberry Pi 2:
Next:
- Create Gtk# application using C#/MonoDevelop on Raspberry Pi 2
Related:
- Solve MonoDevelop error: cannot execute "...". File name hase not been set.
Updated: Install latest version of Mono and MonoDevelop on Raspberry Pi/Raspbian
Subscribe to:
Comments (Atom)








