Beispiel #1
0
        public void SaveEntry(Entry entry)
        {
            VerifyProgramDirectoriesExist();
            Config currentConfig = LoadConfig();

            try
            {
                using (var stringWriter = new Utf8StringWriter())
                {
                    stringWriter.WriteLine("[connection]");
                    if (currentConfig.UsingRealVnc == true && entry.Port != "5900")
                    {
                        stringWriter.WriteLine("host=" + entry.Host + ":" + entry.Port);
                    }
                    else
                    {
                        stringWriter.WriteLine("host=" + entry.Host);
                    }
                    stringWriter.WriteLine("port=" + entry.Port);
                    stringWriter.WriteLine("password="******"[options]");
                    stringWriter.WriteLine("username="******"scaling=" + entry.Scaling);
                    stringWriter.WriteLine("fullscreen=" + entry.FullScreen);
                    stringWriter.WriteLine("fitwindow=" + entry.FitWindow);
                    stringWriter.WriteLine("scale_den=" + entry.ScaleDen);
                    stringWriter.WriteLine("scale_num=" + entry.ScaleNum);
                    string vncText = stringWriter.ToString(); // Text to save in .vnc file
                    File.WriteAllText(vncEntriesPath + entry.Name + @".vnc", vncText);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception: SaveEntry() failed.", e.ToString());
            }
        }