Exemplo n.º 1
0
        public msg Execute(msg m)
        {
            if (m == null || m.Input == null)
            {
                return(m);
            }
            bool hasUpdate = false;

            switch (m.KEY)
            {
            case _API.SETTING_APP_KEY_UPDATE_FOLDER:
                #region
                string fol = (string)m.Input;
                if (!string.IsNullOrEmpty(fol))
                {
                    fol = fol.ToLower().Trim();
                    lock (_lock)
                    {
                        if (_setting.list_folder.IndexOf(fol) == -1)
                        {
                            _setting.list_folder.Add(fol);
                            hasUpdate = true;
                            app.postMessageToService(new msg()
                            {
                                API = _API.FOLDER_ANYLCTIC, Input = fol
                            });
                        }
                    }
                }
                #endregion
                break;

            case _API.SETTING_APP_KEY_UPDATE_NODE_OPENING:
                oNode node = (oNode)m.Input;
                lock (_lock)
                    _setting.node_opening = node.id;
                hasUpdate = true;
                break;

            case _API.SETTING_APP_KEY_UPDATE_SIZE:
                oAppSize app_size = (oAppSize)m.Input;
                lock (_lock)
                {
                    _setting.app_size = app_size;
                    hasUpdate         = true;
                }
                break;
            }

            //if (hasUpdate)
            //{
            //    using (var file = File.Create(file_name))
            //    {
            //        Serializer.Serialize<oSetting>(file, _setting);
            //    }
            //}
            m.Output.Ok   = hasUpdate;
            m.Output.Data = hasUpdate;
            return(m);
        }
Exemplo n.º 2
0
 public oSetting()
 {
     list_folder  = new List <string>();
     list_package = new List <long>();
     list_book    = new List <long>();
     app_size     = new oAppSize();
     node_opening = 0;
 }