Example #1
0
        public void loadData()
        {
            if (File.Exists(getDataFile()) == false)
            {
                Utils.WriteLog("no data file");
                return;
            }

            try
            {
                string[] lines = File.ReadAllLines(getDataFile(), Encoding.UTF8);
                int      c     = 0;

                // items >

                {
                    serverInfos.Clear();

                    foreach (string line in StringTools.decodeLines(lines[c++]))
                    {
                        ServerInfo si = new ServerInfo();
                        FieldsSerializer.deserialize(si, StringTools.decodeLines(line));
                        serverInfos.Add(si);
                    }
                }

                relayPortNo            = int.Parse(lines[c++]);
                quality                = int.Parse(lines[c++]);
                mainWin_l              = int.Parse(lines[c++]);
                mainWin_t              = int.Parse(lines[c++]);
                mainWin_w              = int.Parse(lines[c++]);
                mainWin_h              = int.Parse(lines[c++]);
                mouseActiveOutOfScreen = StringTools.toFlag(lines[c++]);

                // conDlgServerInfo
                {
                    string line = lines[c++];

                    if (line != "")
                    {
                        lastConServerInfo = new ServerInfo();
                        FieldsSerializer.deserialize(lastConServerInfo, StringTools.decodeLines(line));
                    }
                    else
                    {
                        lastConServerInfo = null;
                    }
                }

                // < items
            }
            catch (Exception e)
            {
                Utils.WriteLog(e);
            }
        }
Example #2
0
 private void btnTestFieldsSerializer_Click(object sender, EventArgs e)
 {
     try
     {
         Ground.ServerInfo si    = new Ground.ServerInfo();
         string[]          lines = FieldsSerializer.serialize(si);
         FieldsSerializer.deserialize(si, lines);
     }
     catch (Exception ex)
     {
         FailedOperation.caught(ex);
     }
 }
Example #3
0
        // < items

        public void loadData()
        {
            if (File.Exists(getDataFile()) == false)
            {
                Utils.WriteLog("no data file");
                return;
            }

            try
            {
                string[] lines = File.ReadAllLines(getDataFile(), Encoding.UTF8);
                int      c     = 0;

                // items >

                portNo = IntTools.toInt(lines[c++]);

                {
                    string line = lines[c++];

                    if (line != "")
                    {
                        key = new KeyData();
                        FieldsSerializer.deserialize(key, StringTools.decodeLines(line));
                    }
                    else
                    {
                        key = null;
                    }
                }

                passphrase    = lines[c++];
                forwardPortNo = int.Parse(lines[c++]);

                // < items
            }
            catch (Exception e)
            {
                Utils.WriteLog(e);
            }
        }
Example #4
0
 private Ground.ServerInfo siSheetGetRow(int rowidx)
 {
     Ground.ServerInfo si = new Ground.ServerInfo();
     FieldsSerializer.deserialize(si, StringTools.decodeLines(siSheet.Rows[rowidx].Cells[siSheet.ColumnCount - 1].Value.ToString()));
     return(si);
 }