コード例 #1
0
ファイル: Config.cs プロジェクト: CCluv/JiaowuHelper
        public static bool save(ConfigInfo ci)
        {
            try
            {
                Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
                if (config.AppSettings.Settings.AllKeys.Contains("user"))
                    config.AppSettings.Settings["user"].Value = ci.username;
                else
                    config.AppSettings.Settings.Add("user", ci.username);

                if (config.AppSettings.Settings.AllKeys.Contains("url"))
                    config.AppSettings.Settings["url"].Value = ci.url;
                else
                    config.AppSettings.Settings.Add("url", ci.url);

                if (config.AppSettings.Settings.AllKeys.Contains("password"))
                    config.AppSettings.Settings["password"].Value = ci.password;
                else
                    config.AppSettings.Settings.Add("password", ci.password);

                if (config.AppSettings.Settings.AllKeys.Contains("autoLogin"))
                    config.AppSettings.Settings["autoLogin"].Value = ci.autoLogin.ToString();
                else
                    config.AppSettings.Settings.Add("autoLogin", ci.autoLogin.ToString());

                config.Save(ConfigurationSaveMode.Minimal);
                return true;
            }
            catch
            {
                return false;
            }
        }
コード例 #2
0
ファイル: Config.cs プロジェクト: godlzr/dotnet-clara
 public Config()
 {
     defaultConfig = new ConfigInfo
     {
         apiToken = null,
         basePath = "/api",
         host = "clara.io",
         username = null
     };
 }
コード例 #3
0
ファイル: Config.cs プロジェクト: CCluv/JiaowuHelper
 public static ConfigInfo get()
 {
     ConfigInfo ci = new ConfigInfo();
     Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
     if (config.AppSettings.Settings.AllKeys.Contains("user"))
         ci.username = config.AppSettings.Settings["user"].Value;
     if (config.AppSettings.Settings.AllKeys.Contains("url"))
         ci.url = config.AppSettings.Settings["url"].Value;
     if (config.AppSettings.Settings.AllKeys.Contains("password"))
         ci.password = config.AppSettings.Settings["password"].Value;
     if (config.AppSettings.Settings.AllKeys.Contains("autoLogin"))
         ci.autoLogin = Boolean.Parse(config.AppSettings.Settings["autoLogin"].Value);
     return ci;
 }
コード例 #4
0
ファイル: Config.cs プロジェクト: MarkBellCN/QQRobot
 private void dataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex >= 0)
     {
         DataGridViewColumn column = dataGridView.Columns[e.ColumnIndex];
         if (column is DataGridViewButtonColumn && column.Name == "edit")
         {
             ConfigInfo configInfo = ConfigCache.configInfos[e.RowIndex];
             AddConfig  addConfig  = new AddConfig(this, configInfo, e.RowIndex);
             addConfig.Show();
         }
         else if (column is DataGridViewButtonColumn && column.Name == "delete")
         {
             ConfigCache.configInfosBind.RemoveAt(e.RowIndex);
             ConfigCache.saveConfigToFile();
         }
     }
 }
コード例 #5
0
        private AttributeInfo[] CreateConfigAttributeInfos(ConfigInfo configInfo)
        {
            var attributeInfo = new AttributeInfo[]
            {
                new AttributeInfo()
                {
                    Name  = "name",
                    Value = configInfo.PropertyName
                },
                new AttributeInfo()
                {
                    Name  = "value",
                    Value = configInfo.Value
                }
            };

            return(attributeInfo);
        }
コード例 #6
0
 /// <summary>
 /// 页面加载
 /// </summary>
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         string userAgent = Request.Headers["User-Agent"];
         if (userAgent.Contains("MicroMessenger"))
         {
             Response.Redirect("Index.aspx");
         }
         else
         {
             int        terminalType        = Fetch.GetTerminalType(Page.Request);
             ConfigInfo config              = FacadeManage.aideNativeWebFacade.GetConfigInfo(AppConfig.SiteConfigKey.MobilePlatformVersion.ToString());
             string     PlatformDownloadUrl = terminalType == 2 ? config.Field5 : config.Field6;
             Response.Redirect(PlatformDownloadUrl);
         }
     }
 }
コード例 #7
0
        public IActionResult Produtos(TB_Produtos obj)
        {
            ConfigInfo oInfor = Util.ProjectInfo();

            ViewData["Mstr_Layout"] = "_Layout";
            ViewBag.Dados           = null;
            ViewData["Perfil"]      = null;
            try { ViewData["Perfil"] = CurrentUser.Perfil; } catch { ViewData["Perfil"] = "Cliente"; }
            try
            {
                string  jsonSTRINGResult = JsonConvert.SerializeObject(obj);
                JObject jObj             = Util.FormatarObjeto("LISTAR", jsonSTRINGResult);
                jObj          = Util.GetRequest("POST", oInfor.Api_Url_Base + "Produto", "Authorization", oInfor.Api_Key, jObj);
                ViewBag.Dados = jObj["Dados"];
            }
            catch { }
            return(View());
        }
コード例 #8
0
        /// <summary>
        /// 插入配置
        /// </summary>
        public bool InsertConfig(ConfigInfo info)
        {
            if (info.CfgStatus == null)
            {
                info.CfgStatus = "0";
            }
            if (info.CreateTime == null)
            {
                info.CreateTime = Utils.GetNow();
            }
            if (info.ModifyTime == null)
            {
                info.ModifyTime = Utils.GetNow();
            }

            SqlMapper.Instance().Insert("ConfigInfo.InsertConfig", info);
            return(true);
        }
コード例 #9
0
        public IActionResult DownloadFile([FromServices] WtmFileProvider fp, string id, string csName = null)
        {
            var file = fp.GetFile(id, true, ConfigInfo.CreateDC(csName));

            if (file == null)
            {
                return(BadRequest(Localizer["Sys.FileNotFound"]));
            }
            var    ext      = file.FileExt.ToLower();
            var    provider = new FileExtensionContentTypeProvider();
            string contentType;

            if (!provider.TryGetContentType(file.FileName, out contentType))
            {
                contentType = "application/octet-stream";
            }
            return(File(file.DataStream, contentType, file.FileName ?? (Guid.NewGuid().ToString() + ext)));
        }
コード例 #10
0
 public ConsulServiceRouteManager(ConfigInfo configInfo, ISerializer <byte[]> serializer,
                                  ISerializer <string> stringSerializer, IClientWatchManager manager, IServiceRouteFactory serviceRouteFactory,
                                  ILogger <ConsulServiceRouteManager> logger,
                                  IServiceHeartbeatManager serviceHeartbeatManager) : base(stringSerializer)
 {
     _configInfo          = configInfo;
     _serializer          = serializer;
     _stringSerializer    = stringSerializer;
     _serviceRouteFactory = serviceRouteFactory;
     _logger  = logger;
     _manager = manager;
     _serviceHeartbeatManager = serviceHeartbeatManager;
     _consul = new ConsulClient(config =>
     {
         config.Address = new Uri($"http://{configInfo.Host}:{configInfo.Port}");
     }, null, h => { h.UseProxy = false; h.Proxy = null; });
     EnterRoutes().Wait();
 }
コード例 #11
0
 public ConsulServiceCommandManager(ConfigInfo configInfo, ISerializer <byte[]> serializer,
                                    ISerializer <string> stringSerializer, IServiceRouteManager serviceRouteManager, IClientWatchManager manager, IServiceEntryManager serviceEntryManager,
                                    ILogger <ConsulServiceCommandManager> logger, bool enableChildrenMonitor = false) : base(stringSerializer, serviceEntryManager)
 {
     _configInfo          = configInfo;
     _serializer          = serializer;
     _logger              = logger;
     _stringSerializer    = stringSerializer;
     _manager             = manager;
     _serviceRouteManager = serviceRouteManager;
     _logger.LogInformation($"ConsulServiceCommandManager->ConsulClient Connect to http://{configInfo.Host}:{configInfo.Port}"); //20180719
     _consul = new ConsulClient(config =>
     {
         config.Address = new Uri($"http://{configInfo.Host}:{configInfo.Port}");
     }, null, h => { h.UseProxy = false; h.Proxy = null; });
     EnterServiceCommands().Wait();
     _serviceRouteManager.Removed += ServiceRouteManager_Removed;
 }
コード例 #12
0
ファイル: Program.cs プロジェクト: justSteve/DevBetterWeb
    private async Task OnExecuteAsync()
    {
        // ideally I'd like all of this setup of config, services, and logging to happen in the generic host builder above
        var configInfo = new ConfigInfo(Token, ApiLink, ApiKey);
        var logger     = CreateLogger();

        _serviceProvider = SetupDi(configInfo, logger);

        logger.Debug("Logger Enabled"); // I'm never seeing these displayed in the console -Steve
        logger.Debug("DI Setup Done");

        // I'd like this to be the first line of OnExecuteAsync
        var uploaderService = GetUploaderService();

        if (IsUpdateThumbnails)
        {
            if (string.IsNullOrEmpty(VimeoId))
            {
                logger.Information("The Vimeo ID is Required");
            }
            else
            {
                await uploaderService.UpdateAnimatedThumbnailsAsync(VimeoId);
            }
        }
        else if (IsDeleteVideo)
        {
            if (string.IsNullOrEmpty(VimeoId))
            {
                logger.Information("The Vimeo ID is Required");
            }
            else
            {
                await uploaderService.DeleteVimeoVideoAsync(VimeoId);
            }
        }
        else
        {
            await uploaderService.SyncAsync(FolderPath);
        }

        Console.WriteLine("Done, press any key to close");
        Console.ReadKey();
    }
コード例 #13
0
ファイル: ConfigService.cs プロジェクト: fighting71/QQRobot
        /// <summary>
        /// 添加配置
        /// </summary>
        /// <param name="input"></param>
        /// <param name="msg"></param>
        public void AddInfo(string input, out string msg)
        {
            var info = input.Split('|');

            if (info.Length == 3)
            {
                if (!string.IsNullOrWhiteSpace(info[0]))
                {
                    var config = new ConfigInfo()
                    {
                        Key         = info[0].Trim(),
                        Value       = info[1],
                        Description = info[2],
                        Enable      = true
                    };

                    var old = PikachuDataContext.ConfigInfos.FirstOrDefault(u =>
                                                                            u.Enable && u.Key.Equals(config.Key, StringComparison.CurrentCultureIgnoreCase));

                    if (old != null)
                    {
                        old.Value      = config.Value;
                        old.UpdateTime = DateTime.Now;
                    }
                    else
                    {
                        config.UpdateTime = DateTime.Now;
                        PikachuDataContext.ConfigInfos.Add(config);
                    }

                    PikachuDataContext.SaveChanges();

                    msg = "   添加成功!";
                }
                else
                {
                    msg = "   配置key不能为空!";
                }
            }
            else
            {
                msg = "   输入格式有误!";
            }
        }
コード例 #14
0
    protected void bt_jieSuan_Click(object sender, EventArgs e)
    {
        DateTime dateTime = DateTime.Parse(this.lb_lastJieSuanDate.Text);
        DateTime addDate  = default(DateTime);
        int      num      = int.Parse(this.hf_lastJieSuanId.Value) + 1;

        if (DateTime.TryParse(this.newJieSuanDate.Text, out addDate))
        {
            this.db.RunNonQurey(string.Concat(new object[]
            {
                "insert into JieSuanDate(JieSuanId,AddDate)values(",
                num,
                ",'",
                DateTime.Parse(this.newJieSuanDate.Text),
                "')"
            }));
            ConfigInfo      configInfo      = ConfigInfo.Read(1);
            MySqlDataReader mySqlDataReader = this.db.RunProcGetReader(string.Concat(new string[]
            {
                "select userId, username,sum(duipengjiang) as duipengjiang,sum(jintie) as jintie,sum(allJiangjin) as allJiangjin from JiangJin where addDate>'",
                dateTime.ToString(),
                "' And addDate<='",
                addDate.ToString(),
                "' group by username,userId"
            }));
            while (mySqlDataReader.Read())
            {
                double      fenHong     = Math.Round(double.Parse(mySqlDataReader["allJiangJin"].ToString()) * (double)configInfo.FenHong * 0.01, 2);
                double      kouShui     = Math.Round(double.Parse(mySqlDataReader["allJiangJin"].ToString()) * configInfo.KouShui * 0.01, 2);
                double      num2        = Math.Round(this.GetShiJiang(mySqlDataReader["allJiangJin"].ToString(), mySqlDataReader["userId"].ToString()), 2);
                JieSuanInfo jieSuanInfo = new JieSuanInfo(0, int.Parse(mySqlDataReader["userId"].ToString()), mySqlDataReader["username"].ToString(), double.Parse(mySqlDataReader["duipengjiang"].ToString()), double.Parse(mySqlDataReader["jintie"].ToString()), double.Parse(mySqlDataReader["allJiangJin"].ToString()), fenHong, kouShui, num2, addDate, num);
                jieSuanInfo.Insert();
                MemberInfo memberInfo = MemberInfo.Read(int.Parse(mySqlDataReader["userId"].ToString()));
                memberInfo.JiangJin += num2;
                memberInfo.Update();
            }
            mySqlDataReader.Close();
            this.db.Dispose();
            this.BindData();
            return;
        }
        this.Page.ClientScript.RegisterStartupScript(base.GetType(), "wrong", "alert('日期格式错误,请检查日期格式!');", true);
        this.BindData();
    }
コード例 #15
0
ファイル: PublicHelper.cs プロジェクト: howfar9595/BuildCode
        public static string CreateTable2(List <Table> List, ConfigInfo Config)
        {
            List <string> strCreateTable   = new List <string>();
            List <string> strCreateComment = new List <string>();

            List = List.Where(t => t.IsDataColumn == true).ToList(); //过滤非数据库字段

            if (CPQuery.From($"SELECT  COUNT(1) FROM dbo.SysObjects WHERE ID = object_id(N'[{Config.TableName.Trim()}]') ").ExecuteScalar <int>() > 0)
            {
                return(Config.TableName + "已存在!");
            }

            strCreateTable.Add($"CREATE TABLE [dbo].[{Config.TableName.Trim()}](");
            strCreateTable.Add($"[ID] uniqueidentifier Not Null ,");
            strCreateComment.Add($"EXEC sp_addextendedproperty N'MS_Description', N'{Config.TableComment}', 'SCHEMA', N'dbo', 'TABLE', N'{Config.TableName}', NULL, NULL; ");
            strCreateComment.Add($"EXEC sp_addextendedproperty N'MS_Description', N'主键', 'SCHEMA', N'dbo', 'TABLE', N'{Config.TableName}', 'COLUMN', N'ID'; ");

            foreach (var item in List)
            {
                string length = item.TypeName.Contains("varchar") ? $"({item.MaxLength.ToString()})" : "";
                strCreateTable.Add(string.Format($"[{item.ColumnName.Trim()}] {item.TypeName}{{0}} {{1}} {{2}},",
                                                 length,
                                                 item.NotNUll ? "Not Null" : "Null",
                                                 item.DefaultValue?.Length > 0 ? $"'{item.DefaultValue}'" : ""
                                                 ));
                strCreateComment.Add($"EXEC sp_addextendedproperty N'MS_Description', N'{item.Comment}', 'SCHEMA', N'dbo', 'TABLE', N'{Config.TableName.Trim()}', 'COLUMN', N'{item.ColumnName.Trim()}'; ");
            }
            strCreateTable.Add(@"[Timestamp] [timestamp] NULL,
[IsDeleted] [bit] NOT NULL DEFAULT 0,
[CreateUser] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL,
[CreateTime] [datetime] NULL,
[UpdateUser] [nvarchar] (50) COLLATE Chinese_PRC_CI_AS NULL,
[UpdateTime] [datetime] NULL,");
            strCreateTable.Add($"PRIMARY KEY ( [ID] ));\r\n");
            strCreateComment.Add($@"EXEC sp_addextendedproperty N'MS_Description', N'时间戳', 'SCHEMA', N'dbo', 'TABLE', N'{Config.TableName}', 'COLUMN', N'Timestamp' 
EXEC sp_addextendedproperty N'MS_Description', N'是否删除', 'SCHEMA', N'dbo', 'TABLE', N'{Config.TableName}', 'COLUMN', N'IsDeleted' 
EXEC sp_addextendedproperty N'MS_Description', N'创建人', 'SCHEMA', N'dbo', 'TABLE', N'{Config.TableName}', 'COLUMN', N'CreateUser' 
EXEC sp_addextendedproperty N'MS_Description', N'创建时间', 'SCHEMA', N'dbo', 'TABLE', N'{Config.TableName}', 'COLUMN', N'CreateTime' 
EXEC sp_addextendedproperty N'MS_Description', N'修改人', 'SCHEMA', N'dbo', 'TABLE', N'{Config.TableName}', 'COLUMN', N'UpdateUser' 
EXEC sp_addextendedproperty N'MS_Description', N'修改时间', 'SCHEMA', N'dbo', 'TABLE', N'{Config.TableName}', 'COLUMN', N'UpdateTime' ");
            CPQuery.From(string.Join("", strCreateTable)).ExecuteNonQuery();
            CPQuery.From(string.Join("", strCreateComment)).ExecuteNonQuery();
            return(string.Join("\r\n", strCreateTable) + string.Join("\r\n", strCreateComment));
        }
コード例 #16
0
        public async Task <JsonResult> ConfigInfoEdit(ConfigInfo configInfo)
        {
            try
            {
                bool isEdit = await _configInfoService.Update(configInfo);

                if (isEdit)
                {
                    return(Json(new { isEdit = true }));
                }

                return(Json(new { isEdit = false, msg = "编辑配置失败!" }));
            }
            catch (Exception ex)
            {
                _logService.Error(string.Format("编辑配置失败!configinfo={0}", configInfo.ToJSON()), ex);
                return(Json(new { isEdit = false, msg = "编辑配置失败!" }));
            }
        }
コード例 #17
0
        /// <summary>
        /// 执行保存已修改数据的方法
        /// </summary>
        private void btnApply_Click(object sender, RoutedEventArgs e)
        {
            ConfigController configController = new ConfigController();
            ConfigInfo       configInfo       = new ConfigInfo();

            //global
            configInfo.StandarOutput  = standaroutput.IsChecked == true ? "true" : "false";
            configInfo.Svnpath        = Svnpath.Text;
            configInfo.Updateinterval = Updateinterval.Text;
            configInfo.ServiceSwitch  = (windowprocess.IsChecked == true) ? "window" : "service";
            //config report
            configInfo.ReportFrom = ReportFrom.Text;
            configInfo.Password   = Password.Text;
            configInfo.SmtpServer = SmtpServer.Text;
            configInfo.ReportTo   = ReportTo.Text;
            var result = configController.SaveConfig(configInfo, "../../../common/res/CIConfig.xml");

            MessageBox.Show(result);
        }
コード例 #18
0
        public void LoadConfig()
        {
            if (!System.IO.File.Exists(Properties.Resource.ConfigFilePath))
            {
                _configInfos = new ConfigInfo {
                    FilePath = Properties.Resource.ConfigFilePath
                };
                InitConfigDefault();
            }
            else
            {
                _configInfos = new ConfigInfo {
                    FilePath = Properties.Resource.ConfigFilePath
                };
                _configInfos = (ConfigInfo)_serializer.DeSerialize(Properties.Resource.ConfigFilePath, typeof(ConfigInfo));
            }

            SaveConfig();
        }
コード例 #19
0
        private void ConfigCloneConfig_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (ConfigListSelect.SelectedIndex == -1)
            {
                return;
            }
            ConfigInfo old  = ConfigList[ConfigListSelect.SelectedIndex];
            ConfigInfo info = new ConfigInfo();

            info.filetype.AddRange(old.filetype);
            info.path.AddRange(old.path);
            info.whitefile.AddRange(old.whitefile);
            info.fileurl = old.fileurl;
            info.name    = old.name + " 克隆";
            ConfigList.Add(info);
            ConfigListSelect.Items.Add(info.name);
            ConfigSelect.Items.Add(info.name);
            ConfigListSelect.SelectedIndex = ConfigListSelect.Items.Count - 1;
        }
コード例 #20
0
 public ConfigCard(ConfigInfo info)
 {
     InitializeComponent();
     this.info        = info;
     name.Text        = info.ConfigName;
     description.Text = info.Description == "" ? "暂无描述" : info.Description;
     if (info.LaunchModule == null)
     {
         errorTag.ToolTip = "一个或多个插件未加载";
     }
     else
     {
         errorTag.Visibility = Visibility.Hidden;
     }
     if (File.Exists(System.IO.Path.Combine(info.rootPath, "preview.png")))
     {
         previewImage.Source = new BitmapImage(new Uri(System.IO.Path.Combine(info.rootPath, "preview.png"), UriKind.Absolute));
     }
 }
コード例 #21
0
        /// <summary>
        /// 查询配置信息
        /// </summary>
        /// <param name="dataPath">节点路径</param>
        /// <param name="xmlConfigPath">查询的xml文件路径</param>
        /// <returns></returns>
        public ConfigInfo ConfigQuery(string dataPath, string xmlConfigPath)
        {
            ConfigInfo configInfo = new ConfigInfo();
            XmlDao     xmlDao     = new XmlDao();

            try
            {
                XmlNodeList xmlNodeList = xmlDao.XmlQuery(dataPath, xmlConfigPath);
                configInfo.Svnpath        = xmlNodeList[0].SelectSingleNode("SvnPath").InnerText;
                configInfo.Updateinterval = xmlNodeList[0].SelectSingleNode("UpdateInterval").InnerText;
                configInfo.StandarOutput  = xmlNodeList[0].SelectSingleNode("StandarOutput").InnerText;
                configInfo.ServiceSwitch  = xmlNodeList[0].SelectSingleNode("ServiceSwitch").InnerText;
                return(configInfo);
            }
            catch (Exception)
            {
                return(configInfo);
            }
        }
コード例 #22
0
        public string GetConflictMessage(DataSourceReversalSetting conflicting)
        {
            if (ConfigInfo.IsForAllTargetTypes())
            {
                return(GetRedundantSettingConflictMessage(conflicting, " by default"));
            }

            var targetType = ConfigInfo.TargetType.GetFriendlyName();

            if (ConfigInfo.IsForAllSourceTypes())
            {
                return(GetRedundantSettingConflictMessage(conflicting, " when mapping to " + targetType));
            }

            var sourceType   = ConfigInfo.SourceType.GetFriendlyName();
            var typeSettings = $" when mapping {sourceType} -> {targetType}";

            return(GetRedundantSettingConflictMessage(conflicting, typeSettings));
        }
コード例 #23
0
        /// <summary>
        /// 执行保存已修改数据的方法
        /// </summary>
        private void InitUserConfig()
        {
            string           dataPath         = "config/preferences";
            ConfigController configController = new ConfigController();
            ConfigInfo       configInfo       = configController.ConfigQuery(dataPath, "../../../common/res/CIConfig.xml");

            Svnpath.Text        = configInfo.Svnpath;
            Updateinterval.Text = configInfo.Updateinterval;
            switch (configInfo.StandarOutput)
            {
            case "true":
                standaroutput.IsChecked = true;
                break;

            case "false":
                standaroutput.IsChecked = false;
                break;

            default:
                standaroutput.IsChecked = false;
                break;
            }
            switch (configInfo.ServiceSwitch)
            {
            case "window":
                windowprocess.IsChecked = true;
                break;

            case "service":
                serviceprocess.IsChecked = true;
                break;

            default:
                windowprocess.IsChecked  = false;
                serviceprocess.IsChecked = false;
                break;
            }
            ReportFrom.Text = configInfo.ReportFrom;
            ReportTo.Text   = configInfo.ReportTo;
            Password.Text   = configInfo.Password;
            SmtpServer.Text = configInfo.SmtpServer;
        }
コード例 #24
0
        private object CreateInstance(ConfigInfo config,
                                      string key)
        {
            Hashtable mapping = config.GetMappingEntries();
            Hashtable dllPath = config.GetOuterDLLPaths();
            string    impl    = (string)mapping[key];
            string    path    = (string)dllPath[key];

            if (impl == null)
            {
                if (Version.DEBUG)
                {
                    System.Console.WriteLine("the method node's field <impl> is null");
                }
                return(null);
            }
            if (path != null)
            {
                IEnv e = (IEnv)DynamicCreator.CreateInstance(impl, path);
                e.SetEnv(_env);
                return(e);
            }

            Type type = null;

            try
            {
                Assembly assembly = this.GetType().Assembly;
                type = assembly.GetType(impl);
            }
            catch (Exception e)
            {
                System.Console.WriteLine(e.Message);
                return(null);
            }

            IEnv env = (IEnv)DynamicCreator.CreateInstance(type);

            env.SetEnv(_env);

            return(env);
        }
コード例 #25
0
        public async Task <ResultData> DeleteDataBaseInfo(List <DataBaseInfo> infos, string type)
        {
            //获取配置文件信息
            ConfigInfo configInfo = _dbContext.Queryable <ConfigInfo>().Where(x => x.ConfigName == "PublicDataAdapters.json" && x.CategoryType == type).First();

            if (configInfo == null)
            {
                return(ResultData.CreateResult("-1", "配置文件不存在", null));
            }

            string localPath = ApiUtils.GetLocalPath(_dbContext, configInfo.Guid, out string errorMessage);

            if (!string.IsNullOrEmpty(errorMessage))
            {
                return(ResultData.CreateResult("-1", errorMessage, null));
            }

            List <PublicDataAdapters> datainfos;

            using (StreamReader reader = new StreamReader(localPath))
            {
                string json = await reader.ReadToEndAsync();

                datainfos = JsonConvert.DeserializeObject <List <PublicDataAdapters> >(json);
            }

            string[] dataAdapterAlias = infos.Select(x => x.AccountSetNumber).ToArray();

            List <PublicDataAdapters> deleteData = datainfos.Where(x => dataAdapterAlias.Contains(x.DataAdapterAlias)).ToList();

            foreach (var item in deleteData)
            {
                datainfos.Remove(item);
            }

            using (StreamWriter writer = new StreamWriter(localPath, false, Encoding.UTF8))
            {
                await writer.WriteAsync(ApiUtils.ConvertJsonString(JsonConvert.SerializeObject(datainfos)));
            }

            return(ResultData.CreateSuccessResult());
        }
コード例 #26
0
ファイル: PageSettings.cs プロジェクト: lulzzz/SS.Payment
        public void Page_Load(object sender, EventArgs e)
        {
            _siteId = Convert.ToInt32(Request.QueryString["siteId"]);

            if (!Main.Instance.AdminApi.IsSiteAuthorized(_siteId))
            {
                HttpContext.Current.Response.Write("<h1>未授权访问</h1>");
                HttpContext.Current.Response.End();
                return;
            }

            _configInfo = Main.Instance.GetConfigInfo(_siteId);

            if (IsPostBack)
            {
                return;
            }

            Utils.SelectListItems(DdlIsForceLogin, _configInfo.IsForceLogin.ToString());
        }
コード例 #27
0
        private static IList <ConfigInfo> GetConfigInfoForS(XmlDocument xml, IList <ConfigInfo> list, string cate)
        {
            var        configInfonodes = xml.SelectNodes("//SmartBoxConfig/*");
            ConfigInfo c = null;

            if (configInfonodes == null)
            {
                throw new ArgumentNullException("没有SmartBoxConfig节点");
            }
            foreach (XmlNode item in configInfonodes)
            {
                c                    = new ConfigInfo();
                c.Key1               = GetNodeValue(item.SelectSingleNode("./key"));
                c.Value1             = GetNodeValue(item.SelectSingleNode("./value"));
                c.PluginCode         = Constants.MianName;
                c.ConfigCategoryCode = cate;
                list.Add(c);
            }
            return(list);
        }
コード例 #28
0
 private static ConfigInfo GetConfigInfo(ConfigInfo config)
 {
     if (AppConfig.Configuration != null)
     {
         var sessionTimeout = config.SessionTimeout.TotalSeconds;
         Double.TryParse(AppConfig.Configuration["SessionTimeout"], out sessionTimeout);
         var conn = AppConfig.Configuration["ConnectionString"];
         config = new ConfigInfo(
             AppConfig.Configuration["ConnectionString"],
             TimeSpan.FromSeconds(sessionTimeout),
             AppConfig.Configuration["RoutePath"] ?? config.RoutePath,
             AppConfig.Configuration["SubscriberPath"] ?? config.SubscriberPath,
             AppConfig.Configuration["CommandPath"] ?? config.CommandPath,
             AppConfig.Configuration["CachePath"] ?? config.CachePath,
             AppConfig.Configuration["ReloadOnChange"] != null ? bool.Parse(AppConfig.Configuration["ReloadOnChange"]) :
             config.ReloadOnChange
             );
     }
     return(config);
 }
コード例 #29
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            PagerSet mobileNotcieList = FacadeManage.aideNativeWebFacade.GetMobileNotcieList(1, 10);

            this.rptData.DataSource = mobileNotcieList.PageSet;
            this.rptData.DataBind();
            if (System.Web.HttpRuntime.Cache["zhuce"] == null)
            {
                ConfigInfo configInfo = FacadeManage.aideNativeWebFacade.GetConfigInfo(AppConfig.SiteConfigKey.SiteConfig.ToString());
                if (configInfo != null)
                {
                    this.zhuce = configInfo.Field3;
                    CacheHelper.AddCache("zhuce", this.zhuce);
                }
            }
            else
            {
                this.zhuce = System.Web.HttpRuntime.Cache["zhuce"].ToString();
            }
        }
コード例 #30
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            this.terminalType = Fetch.GetTerminalType(this.Page.Request);
            ConfigInfo configInfo  = FacadeManage.aideNativeWebFacade.GetConfigInfo(AppConfig.SiteConfigKey.GameAndroidConfig.ToString());
            ConfigInfo configInfo2 = FacadeManage.aideNativeWebFacade.GetConfigInfo(AppConfig.SiteConfigKey.GameIosConfig.ToString());

            if (configInfo.Field1 != "" || configInfo2.Field1 != "")
            {
                if (this.terminalType == 1)
                {
                    this.platformDownloadUrl = configInfo.Field1;
                }
                else
                {
                    this.platformDownloadUrl = configInfo2.Field1;
                }
            }
            this.platformIntro = "";
            this.BindMoblieGame();
        }
コード例 #31
0
ファイル: ConfigsIndexModel.cs プロジェクト: darakeon/dfm
        public ConfigsIndexModel()
        {
            var languageDictionary =
                PlainText.AcceptedLanguages()
                .ToDictionary(l => l, l => translator["Language" + l]);

            LanguageList = SelectListExtension.CreateSelect(languageDictionary);
            TimeZoneList = SelectListExtension.CreateSelect(TZ.All);

            Info = new ConfigInfo
            {
                UseCategories    = current.UseCategories,
                UseAccountsSigns = current.UseAccountsSigns,
                SendMoveEmail    = current.SendMoveEmail,
                MoveCheck        = current.MoveCheck,
                Wizard           = current.Wizard,
                Language         = current.Language,
                TimeZone         = current.TimeZone,
            };
        }
コード例 #32
0
        private void AddLoad()
        {
            for (int i = 0; i < configInfo.PFSConfigInfoNum; i++)
            {
                ConfigInfo config = configInfo.ConfigInfo[i];
                var        client = new PriceFeederMonitorUI(config.Ip, config.Port)
                {
                    Text = config.PFSMonitorName
                };
                //client.Show(Application.Panel);

                ToolStripMenuItem btnMonitor = new ToolStripMenuItem();
                btnMonitor.Text         = config.PFSMonitorName;
                btnMonitor.DisplayStyle = ToolStripItemDisplayStyle.ImageAndText;
                btnMonitor.Image        = Resources.monitor;
                btnMonitor.Click       += new EventHandler(btnMonitor_Click);
                btnMonitor.Tag          = config.Ip + "|" + config.Port + "|" + config.PFSMonitorName;
                Application.MainTool.Items.Insert(i, btnMonitor);
            }
        }
コード例 #33
0
        public static ConfigInfo ConvertToConfigInfo(ConfigTemp model)
        {
            ConfigInfo configInfo = new ConfigInfo();

            Type ToModel   = configInfo.GetType();
            Type FromModel = model.GetType();
            var  fileds    = ToModel.GetProperties();

            foreach (var item in fileds)
            {
                object fromValue = Convert.ChangeType(model.GetType().GetProperty(item.Name).GetValue(model, null), item.PropertyType);

                if (fromValue != null)
                {
                    configInfo.GetType().GetProperty(item.Name).SetValue(configInfo, fromValue, null);
                }
            }

            return(configInfo);
        }
コード例 #34
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="configContext"></param>
        /// <param name="section"></param>
        /// <returns></returns>
        public object Create(object parent, object configContext, System.Xml.XmlNode section)
        {
            ConfigInfo configInfo = new ConfigInfo();
            XmlNode aNode = section.SelectSingleNode("Authorization");
            configInfo.AuthorizationServiceProvider = GetServiceProvider(aNode);

            aNode = section.SelectSingleNode("Authenticate");
            configInfo.AuthenticateServiceProvider = GetServiceProvider(aNode);

            XmlNode propertiesNode = section.SelectSingleNode("Properties");
            if (propertiesNode != null && propertiesNode.ChildNodes != null && propertiesNode.ChildNodes.Count > 0)
            {
                foreach (XmlNode prop in propertiesNode.ChildNodes)
                {
                    if (prop.Attributes["name"] != null && prop.Attributes["value"] != null)
                    {
                        configInfo.AddProperty(prop.Attributes["name"].Value, prop.Attributes["value"].Value);
                    }
                }
            }
            return configInfo;
        }
コード例 #35
0
ファイル: Config.cs プロジェクト: godlzr/dotnet-clara
 // Write the config info to disk.
 public void WriteConfig(ConfigInfo configObj)
 {
     if (home == null)
     {
         Console.WriteLine("Invalid Home Directory!");
         return;
     }
     if(configFilePath == null)
     {
         Console.WriteLine("Invalid Configuration File Path!");
         return;
     }
     string output = JsonConvert.SerializeObject(configObj);
     if (output == null)
     {
         Console.WriteLine("Invalid Configuration!");
         return;
     }
     System.IO.StreamWriter file = new System.IO.StreamWriter(configFilePath);
     file.WriteLine(output);
     file.Close();
 }
コード例 #36
0
 void Awake()
 {
     instance = this;
 }
コード例 #37
0
ファイル: KernelResTree.cs プロジェクト: renyh1013/dp2
        int GetConfigFile(
            LibraryChannel channel,
            string strPath,
            out ConfigInfo info,
            out string strError)
        {
            strError = "";
            info = new ConfigInfo();

            string strOutputFileName = Path.GetTempFileName();
            try
            {
                byte[] baOutputTimestamp = null;
                string strOutputPath = "";
                string strMetadata = "";

                long lRet = channel.GetRes(null,
                strPath,
                strOutputFileName,
                out strMetadata,
                out baOutputTimestamp,
                out strOutputPath,
                out strError);
                if (lRet == -1)
                    return -1;

                info.Timestamp = baOutputTimestamp;
                info.Path = strOutputPath;

                // 观察mime
                // 取metadata
                Hashtable values = StringUtil.ParseMetaDataXml(strMetadata,
                    out strError);
                if (values == null)
                {
                    strError = "ParseMedaDataXml() values == null";
                    return -1;
                }

                string strMime = (string)values["mimetype"];
                if (strMime == null || strMime == "")
                    strMime = "text";

                string strLocalPath = (string)values["localpath"];
                if (strLocalPath == null)
                    strLocalPath = "";

                info.MIME = strMime;
                info.LocalPath = strLocalPath;

                if (IsText(strMime) == true)
                {
                    using (StreamReader sr = new StreamReader(strOutputFileName, Encoding.UTF8))
                    {
                        info.Content = ConvertCrLf(sr.ReadToEnd());
                    }
                }
                else
                {
                    strError = "二进制内容 '" + strMime + "' 无法直接编辑";
                    return -1;
                }

                return 0;
            }
            finally
            {
                if (string.IsNullOrEmpty(strOutputFileName) == false)
                    File.Delete(strOutputFileName);
            }
        }
コード例 #38
0
ファイル: KernelResTree.cs プロジェクト: renyh1013/dp2
        int SaveConfigFile(LibraryChannel channel,
            string strPath,
            ConfigInfo info,
            out string strError)
        {
            strError = "";

            string strTempFileName = Path.GetTempFileName();
            using (Stream sw = new FileStream(strTempFileName,
                FileMode.Create, FileAccess.Write))
            {
                byte[] baContent = StringUtil.GetUtf8Bytes(info.Content, true);

                sw.Write(baContent, 0, baContent.Length);
            }

            try
            {
                // 保存资源
                // return:
                //		-1	error
                //		0	发现上载的文件其实为空,不必保存了
                //		1	已经保存
                int nRet = SaveObjectFile(
                    channel,
                    null,
                    strPath,
                    strTempFileName,
                    info.Timestamp,
                    info.MIME,
                    info.LocalPath,
                    out strError);
                if (nRet == -1)
                    return -1;

                return 0;
            }
            finally
            {
                if (string.IsNullOrEmpty(strTempFileName) == false)
                    File.Delete(strTempFileName);
            }
        }
コード例 #39
0
 public ConfigInfo()
 {
     instance = this;
     Init();
 }
コード例 #40
0
 void Awake()
 {
     config = new ConfigInfo();
 }
コード例 #41
0
        /// <summary>
        /// Helper method to initialize the ConfigInfo object
        /// </summary>
        /// <remarks>
        /// This method gets the process id of the current process.  Then it looks in the appSettings for
        /// the name of the performance counter category.  Finally, it makes sure the category exists.  If
        /// there is no value in the appSettings or the category does not exist, then the PerformanceEnabled
        /// flag will be set to false and a message written to the trace log.  Otherwise PerformanceEnabled
        /// will be marked as true
        /// </remarks>
        /// <returns>A ConfigInfo object</returns>
        private static ConfigInfo InitializeConfigInfo()
        {
            ConfigInfo info = new ConfigInfo();
            info.ProcessId = Process.GetCurrentProcess().Id;

            String enableperformancemonitoring = ConfigurationManager.AppSettings[EnablePerformanceMonitoring];
            if (String.IsNullOrWhiteSpace(enableperformancemonitoring))
            {
                Trace.WriteLine("No appSettings value was found to enable performance monitoring");
                info.PerformanceEnabled = false;
            }
            else
            {
                // There is a category name, so make sure it exists
                info.PerformanceCategoryName = enableperformancemonitoring;
                info.PerformanceEnabled = true;
            }
            return info;
        }
コード例 #42
0
ファイル: PlayerInfo.cs プロジェクト: z530989673/MovieStudio
 public PlayerInfo()
 {
     configInfo = new ConfigInfo();
 }