Ejemplo n.º 1
0
        /// <summary>
        /// Add
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public NetworkModel Add(NetworkModel obj)
        {
            var c = IniFileHelper.ReadIniInt(_ini, "settings", "count") + 1;

            IniFileHelper.WriteINI(_ini, c.ToString(), "description", obj.Description);
            obj.NetworkID = c;
            return(obj);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Add
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public ServerModel Add(ServerModel obj)
        {
            var c = IniFileHelper.ReadIniInt(_ini, "Settings", "Count") + 1;

            IniFileHelper.WriteINI(_ini, c.ToString(), "Description", obj.Description);
            IniFileHelper.WriteINI(_ini, c.ToString(), "IP", obj.IP);
            IniFileHelper.WriteINI(_ini, c.ToString(), "NetworkID", obj.NetworkID.ToString());
            obj.ServerID = c - 1;
            return(obj);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Window Size
 /// </summary>
 /// <param name="type"></param>
 /// <param name="frm"></param>
 public void WindowSize(WindowSizes type, Form frm, string ini)
 {
     if (!string.IsNullOrEmpty(frm.Name))
     {
         if (type == WindowSizes.Loading)
         {
             frm.Left   = IniFileHelper.ReadIniInt(ini, frm.Name, "Left", frm.Left);
             frm.Top    = IniFileHelper.ReadIniInt(ini, frm.Name, "Top", frm.Top);
             frm.Width  = IniFileHelper.ReadIniInt(ini, frm.Name, "Width", frm.Width);
             frm.Height = IniFileHelper.ReadIniInt(ini, frm.Name, "Height", frm.Height);
         }
         else
         {
             IniFileHelper.WriteIni(ini, frm.Name, "Left", frm.Left.ToString());
             IniFileHelper.WriteIni(ini, frm.Name, "Top", frm.Top.ToString());
             IniFileHelper.WriteIni(ini, frm.Name, "Width", frm.Width.ToString());
             IniFileHelper.WriteIni(ini, frm.Name, "Height", frm.Height.ToString());
         }
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Read All
        /// </summary>
        /// <returns></returns>
        public List <NetworkModel> ReadAll()
        {
            var result = new List <NetworkModel> {
                new NetworkModel()
            };
            var c = IniFileHelper.ReadIniInt(_ini, "Settings", "Count");

            for (var i = 1; i <= c; i++)
            {
                var item = new NetworkModel()
                {
                    Description = IniFileHelper.ReadINI(_ini, i.ToString(), "Description", ""),
                    NetworkID   = i
                };
                if (!string.IsNullOrEmpty(item.Description))
                {
                    result.Add(item);
                }
            }
            return(result);
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Index
 /// </summary>
 /// <returns></returns>
 public int Index()
 {
     return(IniFileHelper.ReadIniInt(_ini, "Settings", "Index"));
 }