Esempio n. 1
0
        public Settings GetSettings()
        {
            Settings settings = new Settings();

            bool UseDefaultResolution = false;
            bool.TryParse (ConfigurationManager.AppSettings ["AlwaysUseDefaultResolution"], out UseDefaultResolution);

            bool RedirectClipboard = false;
            bool.TryParse (ConfigurationManager.AppSettings ["AlwaysRedirectClipboard"], out RedirectClipboard);

            bool UseAero = false;
            bool.TryParse (ConfigurationManager.AppSettings ["AlwaysUseAero"], out UseAero);

            int ResolutionWidth = 0;
            int.TryParse(ConfigurationManager.AppSettings ["DefaultResolution"].Split('x')[0], out ResolutionWidth);

            int ResolutionHeight = 0;
            int.TryParse(ConfigurationManager.AppSettings ["DefaultResolution"].Split('x')[1], out ResolutionHeight);

            string path = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly ().Location);
            PlatformID CurrentPlatform = Environment.OSVersion.Platform;
            if (CurrentPlatform == PlatformID.MacOSX || CurrentPlatform == PlatformID.Unix) {
                path = path + "/";
            } else {
                path = path + "\\";
            }

            bool AlwaysUseFonts = false;
            bool.TryParse (ConfigurationManager.AppSettings ["AlwaysUseFonts"], out AlwaysUseFonts);

            bool AlwaysUseWindowDrag = false;
            bool.TryParse (ConfigurationManager.AppSettings ["AlwaysUseWindowDrag"], out AlwaysUseWindowDrag);

            bool AlwaysUseMenuAnims = false;
            bool.TryParse (ConfigurationManager.AppSettings ["AlwaysUseMenuAnims"], out AlwaysUseMenuAnims);

            bool AlwaysUseRFX = false;
            bool.TryParse (ConfigurationManager.AppSettings ["AlwaysUseRFX"], out AlwaysUseRFX);

            settings.AlwaysUseRFX = AlwaysUseRFX;
            settings.AlwaysUseWindowDrag = AlwaysUseWindowDrag;
            settings.AlwaysUseMenuAnims = AlwaysUseMenuAnims;
            settings.AlwaysUseFonts = AlwaysUseFonts;
            settings.CurrentPlatform = CurrentPlatform;
            settings.ExecutingPath = path;
            settings.AlwaysUseDefaultResolution = UseDefaultResolution;
            settings.AlwaysUseAero = UseAero;
            settings.ResolutionWidth = ResolutionWidth;
            settings.ResolutionHeight = ResolutionHeight;
            settings.AlwaysRedirectClipboard = RedirectClipboard;

            return settings;
        }
Esempio n. 2
0
        public string BuildArguments(Machine machine, Settings settings)
        {
            string arguments = string.Empty;
            if (settings.AlwaysUseDefaultResolution) {
                arguments += "/w:" + settings.ResolutionWidth + " ";
                arguments += "/h:" + settings.ResolutionHeight + " ";
            }

            if (settings.AlwaysRedirectClipboard) {
                arguments += "+clipboard ";
            } else {
                arguments += "-clipboard ";
            }

            if (settings.AlwaysUseAero) {
                arguments += "+aero ";
            } else {
                arguments += "-aero ";
            }

            if (settings.AlwaysUseFonts) {
                arguments += "+fonts ";
            } else {
                arguments += "-fonts ";
            }

            if (settings.AlwaysUseWindowDrag) {
                arguments += "+window-drag ";
            } else {
                arguments += "-window-draw ";
            }

            if (settings.AlwaysUseMenuAnims) {
                arguments += "+menu-anims ";
            } else {
                arguments += "-menu-anims ";
            }

            if (settings.AlwaysUseRFX) {
                arguments += "/rfx ";
            }

            arguments += "/u:" + machine.Username + " ";
            arguments += "/p:" + machine.Password + " ";
            arguments += "/v:" + machine.MachineName + " ";
            return arguments;
        }
Esempio n. 3
0
 public void LaunchSSH(Machine machine, Settings settings)
 {
     Process.Start("terminator", "-e 'ssh " + machine.Username + "@" + machine.MachineName + "'");
 }
Esempio n. 4
0
 public void LaunchVNC(Machine machine, Settings settings)
 {
     Process.Start("vncviewer", machine.MachineName);
 }
Esempio n. 5
0
 public void LaunchRDP(Machine machine, Settings settings)
 {
     Process freerdp = new Process();
     freerdp.StartInfo.FileName = "xfreerdp";
     freerdp.StartInfo.Arguments = BuildArguments(machine, settings);
     freerdp.StartInfo.RedirectStandardError = true;
     freerdp.StartInfo.RedirectStandardOutput = true;
     freerdp.StartInfo.RedirectStandardInput = true;
     freerdp.StartInfo.UseShellExecute = false;
     freerdp.Start();
 }