Exemplo n.º 1
0
    public static IEnumerable<CustomGenTask> GetTasks(LuaEnv lua_env, UserConfig user_cfg)
    {
        LuaTable data = lua_env.NewTable();
        var assembly_infos = (from type in user_cfg.ReflectionUse
                              group type by type.Assembly.GetName().Name into assembly_info
                              select new { FullName = assembly_info.Key, Types = assembly_info.ToList()}).ToList();
        data.Set("assembly_infos", assembly_infos);

        yield return new CustomGenTask
        {
            Data = data,
            Output = new StreamWriter(GeneratorConfig.common_path + "/link.xml",
            false, Encoding.UTF8)
        };
    }
Exemplo n.º 2
0
        public Message Create(UserConfig objUI)
        {
            Message msg = null;
            try
            {
                    dbContext.UserConfigs.InsertOnSubmit(objUI);
                    dbContext.SubmitChanges();
                    // Show success message
                    msg = new Message(MessageConstants.I0001, MessageType.Info, objUI.UserAdmin.UserName, "added");

            }
            catch (Exception ex)
            {
                msg = new Message(MessageConstants.E0007, MessageType.Error);
                throw ex;
            }
            return msg;
        }
Exemplo n.º 3
0
        public async Task <bool> SyncEpisodes(UserConfig user, List <Episode> seen, List <Episode> unseen)
        {
            if (!seen.Any() && !unseen.Any())
            {
                return(false);
            }

            var firstEpisode = seen.Any() ? seen.First() : unseen.First();
            var show         = await GetShow(user, firstEpisode.Series);

            if (show == default(ShowSummary))
            {
                return(false);
            }

            var seenIds   = new List <int>();
            var unSeenIds = new List <int>();

            foreach (var ep in seen)
            {
                var episode = show.episodes.FirstOrDefault(e => e.seasonNumber == ep.Season.IndexNumber && e.episodeNumber == ep.IndexNumber);
                if (episode != default(EpisodeSummary))
                {
                    seenIds.Add(episode.id);
                }
            }
            foreach (var ep in unseen)
            {
                var episode = show.episodes.FirstOrDefault(e => e.seasonNumber == ep.Season.IndexNumber && e.episodeNumber == ep.IndexNumber);
                if (episode != default(EpisodeSummary))
                {
                    unSeenIds.Add(episode.id);
                }
            }

            var success = await Execute <bool>(user, "manage.SyncEpisodesDelta", new ManageSyncEpisodesDeltaArgs
            {
                showId       = show.id,
                checkedIds   = seenIds.ToArray(),
                unCheckedIds = unSeenIds.ToArray(),
            });

            return(success);
        }
Exemplo n.º 4
0
        internal static void LoadUserConfig()
        {
            //  Load global user settings into memory
            UserConfig GlobalUserConfig = ModInstance.Helper.Data.ReadJsonFile <UserConfig>(UserConfigFilename);

            if (GlobalUserConfig != null)
            {
                bool RewriteConfig = false;

                //  Update config with settings for managing which bags are sold at shops (Added in v1.2.3)
                if (GlobalUserConfig.CreatedByVersion == null || GlobalUserConfig.CreatedByVersion < new Version(1, 2, 3))
                {
                    RewriteConfig = true;
                }
                //  Update config with settings for managing bag drop rates (Added in v1.4.5)
                if (GlobalUserConfig.CreatedByVersion == null || GlobalUserConfig.CreatedByVersion < new Version(1, 4, 5))
                {
                    GlobalUserConfig.MonsterLootSettings = new MonsterLootSettings();
                    RewriteConfig = true;
                }
                //  Update config file with settings for gamepad controls (Added in v1.4.9)
                if (GlobalUserConfig.CreatedByVersion == null || GlobalUserConfig.CreatedByVersion < new Version(1, 5, 0))
                {
                    GlobalUserConfig.GamepadSettings = new GamepadControls();
                    RewriteConfig = true;
                }

                if (RewriteConfig)
                {
                    GlobalUserConfig.CreatedByVersion = CurrentVersion;
                    ModInstance.Helper.Data.WriteJsonFile(UserConfigFilename, GlobalUserConfig);
                }
            }
            else
            {
                GlobalUserConfig = new UserConfig()
                {
                    CreatedByVersion = CurrentVersion
                };
                ModInstance.Helper.Data.WriteJsonFile(UserConfigFilename, GlobalUserConfig);
            }
            UserConfig = GlobalUserConfig;
            GamepadControls.Current = UserConfig.GamepadSettings;
        }
Exemplo n.º 5
0
        public virtual void ApplyConfig(UserConfig config)
        {
            Trace.Call(config);

            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            var theme = new ThemeSettings(config);

            if (theme.BackgroundColor == null)
            {
                ModifyBase(Gtk.StateType.Normal);
            }
            else
            {
                ModifyBase(Gtk.StateType.Normal, theme.BackgroundColor.Value);
            }
            if (theme.ForegroundColor == null)
            {
                ModifyText(Gtk.StateType.Normal);
            }
            else
            {
                ModifyText(Gtk.StateType.Normal, theme.ForegroundColor.Value);
            }
            ModifyFont(theme.FontDescription);

            Settings.ApplyConfig(config);

            // replace nick completer if needed
            if (Settings.BashStyleCompletion && !(NickCompleter is LongestPrefixNickCompleter))
            {
                NickCompleter = new LongestPrefixNickCompleter();
            }
            else if (!Settings.BashStyleCompletion && !(NickCompleter is TabCycleNickCompleter))
            {
                NickCompleter = new TabCycleNickCompleter();
            }

            // set the completion character
            NickCompleter.CompletionChar = Settings.CompletionCharacter;
        }
Exemplo n.º 6
0
        public InstallationForm(UserConfig cfg, IProject prj)
        {
            if (cfg == null)
            {
                throw new ArgumentNullException("UserConfig cannot be null.");
            }
            config  = cfg;
            project = prj;

            InitializeComponent();
            comboNS.MaxLength = config.nsBuffer;
            numOrdinal.Value  = FIRST_ORDINAL;

            foreach (var ns in cfg.defnamespaces)
            {
                comboNS.Items.Add(ns);
            }
            comboNS.SelectedIndex = 0;
        }
Exemplo n.º 7
0
 public static long CreateReplyComment(User user, long Mid, long MUid, string Content, long replyCid, long replyUid)
 {
     try
     {
         Comment replyComment = GetCommentByID(replyCid);
         if (replyComment == null)
         {
             return(-1);
         }
         Comment comment = new Comment();
         comment.MID      = Mid;
         comment.MUID     = MUid;
         comment.Content  = Content;
         comment.ReferUID = GetAtStr(Content);
         Users.AtCmtTip(comment.ReferUID, user.ID, replyUid);
         if (user.ID != replyUid)
         {
             UserConfig uc = Users.GetUserConfigByID(replyUid);
             if (uc.IsCommentTip == 1)
             {
                 Users.UpdateCfgCommentCount(replyUid);
             }
             else if (uc.IsCommentTip == 2)
             {
                 int relation = Users.GetRelateBetweenUsers(replyUid, user.ID);
                 if (relation == 1 || relation == 2)
                 {
                     Users.UpdateCfgCommentCount(replyUid);
                 }
             }
         }
         comment.ReplyContent = replyComment.Content;
         comment.ReplyUID     = replyUid;
         comment.UID          = user.ID;
         comment.ID           = CreateComment(comment);
         return(comment.ID);
     }
     catch (Exception ex)
     {
         Logs.WriteErrorLog(ex);
         return(-1);
     }
 }
Exemplo n.º 8
0
 private void button_execute_Click(object sender, EventArgs e)
 {
     if (checkRequiredParameters())
     {
         UserConfig userConfig = new UserConfig()
         {
             miningAccountName = textBox_mining_account_name.Text,
             workerGroupName   = textBox_worker_group_name.Text,
             gpuUsage          = textBox_gpu_usage.Text
         };
         JSONHandler j = new JSONHandler();
         j.saveUserConfig(userConfig);
         CMD.runClaymore(
             textBox_mining_account_name.Text
             , textBox_worker_group_name.Text
             , textBox_gpu_usage.Text);
         Application.Exit();
     }
 }
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DgUserConfig_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            UserConfig model = dgUserConfig.SelectedItem as UserConfig;

            if (model == null)
            {
                return;
            }
            if (!CommonHelper.UserControls.ContainsKey("UserConfig"))
            {
                UserConfigModule module = new UserConfigModule(model);
                CommonHelper.MainWindow.brMain.Child = module;
                CommonHelper.UserControls.Add("UserConfig", module);
            }
            else
            {
                CommonHelper.MainWindow.brMain.Child = CommonHelper.UserControls["UserConfig"];
            }
        }
Exemplo n.º 10
0
        private void NextPoint()
        {
            if (CurrentGTIndex == null)
            {
                WorldPosOutput.Text = "设置起始坐标"; return;
            }
            CurrentGTIndex = CurrentGTIndex.Value.GTChunkIndexTranslateOne(CurrentDirection);
            var IsDetected = IsPointDetected(CurrentGTIndex.Value, out var _CurrentDetail);

            DisplayIndexMessage(_CurrentDetail);
            if (IsDetected)
            {
            }
            else
            {
                UserConfig.PointDetected(_CurrentDetail);
            }
            CurrentDetail = new IndexDetail?(_CurrentDetail);
        }
Exemplo n.º 11
0
 public IActionResult Run(
     [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = null)] HttpRequest req,
     ILogger log)
 {
     try
     {
         log.LogInformation("user function processing a request.");
         UserConfig user = _userService.GetUserDetails();
         if (user == null)
         {
             return(new NotFoundObjectResult("Failed to retrieve user name and token from App Configuration"));
         }
         return(new OkObjectResult(user));
     }
     catch
     {
         return(new InternalServerErrorResult());
     }
 }
Exemplo n.º 12
0
        protected virtual IInterServiceInventoryServices StartupCoreComponents()
        {
            Cfg = new UserConfig("USER SERVER", (Path.Combine(Util.configDir(), "UserServer_Config.xml")));

            m_httpServer = new BaseHttpServer(Cfg.HttpPort);

            RegisterInterface <CommandConsole>(m_console);
            RegisterInterface <UserConfig>(Cfg);

            //Should be in modules?
            IInterServiceInventoryServices inventoryService = new OGS1InterServiceInventoryService(Cfg.InventoryUrl);

            // IRegionProfileRouter regionProfileService = new RegionProfileServiceProxy();

            RegisterInterface <IInterServiceInventoryServices>(inventoryService);
            // RegisterInterface<IRegionProfileRouter>(regionProfileService);

            return(inventoryService);
        }
Exemplo n.º 13
0
    /// <summary>
    ///
    /// 执行Sql语句   //test OK
    /// </summary>
    /// <param name="sqlString">sql语句</param>
    /// <returns></returns>
    private DataSet QuerySet(string sqlString, UserConfig config)
    {
        if (config == null)
        {
            config = _config;
        }
        OpenSql(config.DataBaseIP, config.DataBaseName, config.DbUserID, config.DbPassword, config.DbPort);
        Logger.Log("conState=" + mySqlConnection.State + ",sql=" + sqlString);
        if (mySqlConnection.State == ConnectionState.Open)
        {
            DataSet ds = new DataSet();
            var     mySqlDataAdapter = new MySqlDataAdapter(sqlString, mySqlConnection);
            mySqlDataAdapter.Fill(ds);

            return(ds);
        }
        Close();
        return(null);
    }
Exemplo n.º 14
0
        //[ValidateAntiForgeryToken]
        public async Task <ActionResult> Register(RegisterViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = new ApplicationUser {
                    UserName = model.UserName, Email = model.Email, Name = model.Name, FlatNo = model.FlatNo
                };
                var result = await UserManager.CreateAsync(user, model.Password);

                if (result.Succeeded)
                {
                    UserConfig uc = new UserConfig();
                    uc.CreateRoles();
                    uc = null;
                    if (model.UserName == "9860002040")
                    {
                        var roles = await UserManager.AddToRoleAsync(user.Id, "Admin");
                    }
                    else if (model.UserName == "9730251433" || model.UserName == "9545080608")
                    {
                        var roles = await UserManager.AddToRoleAsync(user.Id, "Manager");
                    }
                    else
                    {
                        var roles = await UserManager.AddToRoleAsync(user.Id, "User");
                    }
                    await SignInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false);

                    // For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=320771
                    // Send an email with this link
                    // string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id);
                    // var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme);
                    // await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>");

                    return(RedirectToAction("Index", "Home"));
                }
                AddErrors(result);
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
Exemplo n.º 15
0
 public static void AtMeTip(string atstr, long curUID, int isOri)
 {
     if (!string.IsNullOrEmpty(atstr))
     {
         string[] AtArray = atstr.Split(',');
         for (int i = 0; i < AtArray.Length - 1; i++)
         {
             long uid = Convert.ToInt64(AtArray[i].Replace("a", ""));
             if (curUID != uid)
             {
                 UserConfig uc = Users.GetUserConfigByID(uid);
                 if (uc.IsAtTip == 1.1)
                 {
                     Users.UpdateCfgAtmeCount(uid);
                 }
                 else if (uc.IsAtTip == 1.2)
                 {
                     if (isOri == 1)
                     {
                         Users.UpdateCfgAtmeCount(uid);
                     }
                 }
                 else if (uc.IsAtTip == 2.1)
                 {
                     int relation = GetRelateBetweenUsers(uid, curUID);
                     if (relation == 1 || relation == 2)
                     {
                         Users.UpdateCfgAtmeCount(uid);
                     }
                 }
                 else if (uc.IsAtTip == 2.2)
                 {
                     int relation = GetRelateBetweenUsers(uid, curUID);
                     if ((relation == 1 || relation == 2) && isOri == 1)
                     {
                         Users.UpdateCfgAtmeCount(uid);
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 16
0
    private void OnClickButton()
    {
        string errorCode = "";

        Logger.Log("此时的IP=" + inputServer.text);
        Logger.Log("DBname=" + inputDBName.text);
        UserConfig config = new UserConfig();

        config.DataBaseIP   = inputServer.text;
        config.DataBaseName = inputDBName.text;
        config.DbUserID     = inputUserName.text;
        config.DbPassword   = inputPassword.text;
        config.DbPort       = inputPort.text;
        SqlAccess.instance.UpdateDBClass(out errorCode, config, inputOutput.text, inputClassType.text);
        if (errorCode == "")
        {
            errorCode = "生成成功!";
        }
        setLog(errorCode);
    }
Exemplo n.º 17
0
        /// <summary>
        /// Retorna as configurações de um determinado usuário do sistema
        /// </summary>
        /// <param name="usc_user_id">É o id do usuário</param>
        /// <returns>Lista de configurações do usuário</returns>
        public List <UserConfig> UserConfig(int usc_user_id)
        {
            List <UserConfig> userConfigs = new List <UserConfig>();

            cmd = new NpgsqlCommand(userConfig, conn);
            cmd.Parameters.AddWithValue("@usc_user_id", usc_user_id);

            reader = cmd.ExecuteReader();
            while (reader.Read())
            {
                UserConfig userConfig = new UserConfig();
                userConfig.usc_user_id      = (int)reader["usc_user_id"];
                userConfig.usc_config_name  = reader["usc_config_name"].ToString();
                userConfig.usc_config_value = reader["usc_config_value"].ToString();
                userConfigs.Add(userConfig);
            }
            reader.Close();

            return(userConfigs);
        }
Exemplo n.º 18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            UC = (UserConfig)HttpContext.Current.Session["userconfig"];

            string pathTemplate;

            pathTemplate = Path.Combine(ConfigSettings.DataStoragePath, FilterNoLetters(Request.PathInfo));

            if (Request.PathInfo != null && Request.PathInfo.Length > 0 && File.Exists(pathTemplate))
            {
                Response.ContentType = StaticFunctions.ContentTypeMatch(Request.PathInfo);
                Response.WriteFile(pathTemplate);
            }
            else
            {
                Response.StatusCode        = 404;
                Response.StatusDescription = "File not found, are you trying a hack?";
                Response.End();
            }
        }
Exemplo n.º 19
0
        private void SaveConfig()
        {
            UserConfig.Config.SyncService.RemoteURL = this.textBox1.Text;
            UserConfig.Config.SyncService.UserName  = this.textBox2.Text;
            UserConfig.Config.SyncService.Password  = this.textBox3.Text;

            if (this.textBox8.Text != "")
            {
                UserConfig.Config.Program.IntervalTime = Convert.ToInt32(this.textBox8.Text) * 1000;
            }
            if (this.textBox7.Text != "")
            {
                UserConfig.Config.Program.TimeOut = Convert.ToInt32(this.textBox7.Text) * 1000;
            }
            if (this.textBox6.Text != "")
            {
                UserConfig.Config.Program.RetryTimes = Convert.ToInt32(this.textBox6.Text);
            }
            UserConfig.Save();
        }
        private async Task CheckUpdate()
        {
            UserConfig userConfig = Configuration.getConfigAsYAML();

            var client = new WebClient();

            client.Headers.Add("User-Agent", "request");

            dynamic release_info  = UpdateHelpers.GitReleaseInfo(ADDONS_REPO_URL);
            string  latestVersion = release_info.tag_name;

            if (latestVersion == userConfig.version["addon_list"])
            {
                return;
            }

            string download_link = release_info.assets[0].browser_download_url;

            await Download(download_link, client);
        }
Exemplo n.º 21
0
        public void btnPolyLine_Click(object sender, EventArgs e)
        {
            if (ProgramCore.IsTutorialVisible && UserConfig.ByName("Options")["Tutorials", "LineTool", "1"] == "1")
            {
                frmTutLineTool.ShowDialog(this);
            }

            if (btnPolyLine.Tag.ToString() == "2")
            {
                btnPolyLine.Tag = "1";
                btnLine.Tag     = btnArc.Tag = "2";

                btnPolyLine.Image = Resources.btnPolyLinePressed;
                btnLine.Image     = Resources.btnLineNormal;
                btnArc.Image      = Resources.btnArcNormal;

                ProgramCore.MainForm.ctrlRenderControl.ToolsMode = ToolsMode.HairPolyLine;
            }
            ProgramCore.MainForm.ctrlRenderControl.sliceController.BeginSlice();            //  if was selected - reset.
        }
Exemplo n.º 22
0
        internal List <DriveConfig> ConfigureDrives(UserConfig user)
        {
            var drives = new List <DriveConfig>();

            do
            {
                WriteLine("Press Enter to add a new drive, or Esc to continue.");
                ConsoleKeyInfo key = ReadKey(true);
                if (key.Key == ConsoleKey.Enter)
                {
                    drives.Add(GetDrive(user));
                }
                else if (key.Key == ConsoleKey.Escape)
                {
                    break;
                }
            }while (true);

            return(drives);
        }
Exemplo n.º 23
0
        public L4D2AppHost(string fileName, string args, HostSettings hostSettings)
            : base(fileName, args, hostSettings)
        {
            _cts      = new CancellationTokenSource();
            _scanTask = Task.Run(new Action(Scan));
            if (File.Exists(ConfigFilePath))
            {
                //JsonSerializerSettings settings = new JsonSerializerSettings();
                //settings.ObjectCreationHandling = ObjectCreationHandling.Reuse;
                UserConfig = JsonConvert.DeserializeObject <UserConfig>(File.ReadAllText(ConfigFilePath));
            }
            else
            {
                UserConfig = new UserConfig {
                    StartTime = new CustomDate(DateTime.Now).ToString()
                }
            };

            //RunMissingDayFix();
        }
Exemplo n.º 24
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (HttpContext.Current.Session.IsNewSession)
            {
                HttpContext.Current.Response.Redirect("/login.aspx");
            }
            UC = (UserConfig)HttpContext.Current.Session["UserConfig"];

            if (this.companyId == null)
            {
                this.companyId = ViewState["_CompanyID"].ToString();
            }
            try
            {
                this.isCompany = Convert.ToBoolean(ViewState["_IsCompany"]);
            }
            catch
            {
            }
        }
Exemplo n.º 25
0
        public void GetUrlFromUserConfig_WithFilePath(string searchedUrl, string expected)
        {
            //Assign
            var engine     = new Core.Engine.Engine(null, null, null, null, null, null, null);
            var userConfig = new UserConfig()
            {
                Urls = new Dictionary <string, string>()
                {
                    { "url1", "http://www.url1.com" },
                    { "url2", "http://www.url2.com" },
                    { "url3", "http://www.url3.com" },
                }
            };

            //Act
            var result = engine.GetUrlTupleFromUserConfig(userConfig, searchedUrl);

            //Assert
            result?.Value.Should().Be(expected);
        }
Exemplo n.º 26
0
        public void FillEvents()
        {
            UC = (UserConfig)HttpContext.Current.Session["userconfig"];
            DataSet ds = DatabaseConnection.CreateDataset("select * from Project_events where projectid=" + prjID);

            if (ds.Tables[0].Rows.Count > 0)
            {
                StringBuilder sb = new StringBuilder();
                sb.AppendFormat("<script>FillEvent(0,'{0}','{1}','{2}',{4});{3}", G.ParseJSString(ds.Tables[0].Rows[0]["DESCRIPTION"].ToString()), UC.LTZ.ToLocalTime((DateTime)ds.Tables[0].Rows[0]["EVENTDATE"]).ToShortDateString(), ds.Tables[0].Rows[0]["SECTIONID"].ToString(), System.Environment.NewLine, ds.Tables[0].Rows[0]["ID"].ToString());
                if (ds.Tables[0].Rows.Count > 1)
                {
                    for (int i = 1; i < ds.Tables[0].Rows.Count; i++)
                    {
                        sb.AppendFormat("addEvent();{3}FillEvent({4},'{0}','{1}','{2}',{5});{3}", G.ParseJSString(ds.Tables[0].Rows[i]["DESCRIPTION"].ToString()), UC.LTZ.ToLocalTime((DateTime)ds.Tables[0].Rows[i]["EVENTDATE"]).ToShortDateString(), ds.Tables[0].Rows[i]["SECTIONID"].ToString(), System.Environment.NewLine, i, ds.Tables[0].Rows[i]["ID"].ToString());
                    }
                }
                sb.Append("</script>");
                Page.ClientScript.RegisterStartupScript(this.GetType(), "loadevents", sb.ToString());
            }
        }
Exemplo n.º 27
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            foreach (var sel in imageListView.SelectedItems)
            {
                var path = Path.Combine(sel.FilePath, sel.FileName);
                UserConfig.ByName("Options")["Styles", path] = "0";     // not delete, just hide it.

                /*     var mtlPath = Path.Combine(Path.GetDirectoryName(path), Path.GetFileNameWithoutExtension(path) + ".mtl");
                 *   var objPath = Path.Combine(Path.GetDirectoryName(path), Path.GetFileNameWithoutExtension(path) + ".obj");
                 *   var objNullPath = Path.Combine(Path.GetDirectoryName(path), Path.GetFileNameWithoutExtension(path) + "_null.obj");
                 *
                 *   var fi = new FileInfo(path);
                 *   if (fi.Exists)
                 *   {
                 *       fi.Attributes = FileAttributes.Normal;
                 *       fi.Delete();
                 *   }
                 *
                 *   var mtlFi = new FileInfo(mtlPath);
                 *   if (mtlFi.Exists)
                 *   {
                 *       mtlFi.Attributes = FileAttributes.Normal;
                 *       mtlFi.Delete();
                 *   }
                 *
                 *   var objFi = new FileInfo(objPath);
                 *   if (objFi.Exists)
                 *   {
                 *       objFi.Attributes = FileAttributes.Normal;
                 *       objFi.Delete();
                 *   }
                 *
                 *   var objNullFi = new FileInfo(objNullPath);
                 *   if (objNullFi.Exists)
                 *   {
                 *       objNullFi.Attributes = FileAttributes.Normal;
                 *       objNullFi.Delete();
                 *   }*/
            }
            InitializeListView();
        }
Exemplo n.º 28
0
        /// <summary>
        /// 设置用户个人信息背景图片
        /// </summary>
        /// <param name="userId">用户编号</param>
        /// <param name="iconData">背景图片文件数据</param>
        /// <param name="fileExtName">图片扩展名</param>
        /// <returns>头像图片文件访问的HTTP路径</returns>
        public static string SetUserBackIcon(int userId, byte[] iconData, string fileExtName)
        {
            string iconUrl = iconData.SaveMediaFile(FileTarget.User, userId, MediaType.Image, fileExtName);

            if (!string.IsNullOrEmpty(iconUrl))
            {
                //更新用户背景图片
                UserData.UpdateUserIcon(userId, iconUrl, 1);

                //第一次更新背景图片
                UserInfoUpdateLog log = new UserInfoUpdateLog {
                    UserId = userId, InfoType = 0
                };
                bool isFirst = LogsBiz.IsFirstUpdateSelfInfoByUser(log);
                if (isFirst)
                {
                    UserConfig userConfig = UserConfigs.GetUserConfigCache();
                    if (userConfig.SetBackIconExpChanged != 0)
                    {
                        UpdateUserExp(userId, userConfig.SetBackIconExpChanged, "设置背景图片");
                    }

                    if (userConfig.SetBackIconCoinChanged != 0)
                    {
                        UpdateUserCoin(userId, userConfig.SetBackIconCoinChanged, "设置背景图片");
                    }
                }

                //记录背景图片更新日志
                log.Comment    = "更新背景图片";
                log.CreateDate = DateTime.Now;
                LogsBiz.CreateLogs <UserInfoUpdateLog>(log);

                //重置用户缓存
                SetUserCacheInfo(userId);

                //返回补全的背景图片HTTP路径
                return(iconUrl.ImageUrlFixed(480, 240));
            }
            return(iconUrl);
        }
Exemplo n.º 29
0
        private static void PromptForGameDirIfNotExists()
        {
            string PromptForGameDir()
            {
                using (var fbd = new FolderBrowserDialog())
                {
                    fbd.Description = "VRChat folder";

                    DialogResult result = fbd.ShowDialog();

                    if (result == DialogResult.OK && !string.IsNullOrWhiteSpace(fbd.SelectedPath))
                    {
                        string[] files = Directory.GetFiles(fbd.SelectedPath);

                        if (!files.Any(f => f.ToLowerInvariant() == "vrchat.exe"))
                        {
                            return(PromptForGameDir());
                        }
                        else
                        {
                            return(fbd.SelectedPath);
                        }
                    }

                    return("");
                }
            }

            if (!Config.UserConfigs.Any(c => c.PcUsername == Environment.UserName))
            {
                MessageBox.Show("Game path for your username was not found, a file dialog will open, please select your vrchat installation folder.");

                string gameDir = PromptForGameDir();

                UserConfig user = new UserConfig()
                {
                    PcUsername = Environment.UserName,
                    GamePath   = gameDir
                };
            }
        }
Exemplo n.º 30
0
        public void FillFreeFields(int id, CRMTables crmTables, UserConfig UC)
        {
            string sqlStringQuery;

            sqlStringQuery = "SELECT * FROM ADDEDFIELDS WHERE TABLENAME=" + (byte)crmTables + " ORDER BY VIEWORDER";
            DataSet ds = DatabaseConnection.CreateDataset(sqlStringQuery);

            if (ds.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    try
                    {
                        if (Request.Form["Free_" + dr["name"]].Length > 0)
                        {
                            string sqlString;
                            sqlString = "SELECT ID FROM ADDEDFIELDS_CROSS WHERE ID = " + id + " AND IDRIF=" + dr["id"];
                            using (DigiDapter dg = new DigiDapter(sqlString))
                            {
                                dg.Add("ID", id);
                                dg.Add("IDRIF", dr["id"]);
                                dg.Add("FIELDVAL", Request.Form["Free_" + dr["name"]]);
                                if (dg.HasRows)
                                {
                                    dg.Execute("ADDEDFIELDS_CROSS", "ID = " + id + " AND IDRIF=" + dr["id"]);
                                }
                                else
                                {
                                    dg.Execute("ADDEDFIELDS_CROSS", "PKEY = -1");
                                }
                            }
                        }
                        else
                        {
                            DatabaseConnection.DoCommand("DELETE FROM ADDEDFIELDS_CROSS WHERE ID = " + id + " AND IDRIF=" + dr["id"]);
                        }
                    }
                    catch { }
                }
            }
        }
Exemplo n.º 31
0
        public UserLoginAuthService(
            UserManagerBase userManager, IInterServiceInventoryServices inventoryService,
            LibraryRootFolder libraryRootFolder,
            UserConfig config, string welcomeMess, IRegionProfileRouter regionProfileService)
            : base(userManager, welcomeMess, inventoryService, null, true, libraryRootFolder, null)
        {
            m_config               = config;
            m_defaultHomeX         = m_config.DefaultX;
            m_defaultHomeY         = m_config.DefaultY;
            m_inventoryService     = inventoryService;
            m_regionProfileService = regionProfileService;

            NetworkServersInfo serversinfo = new NetworkServersInfo(1000, 1000);

            serversinfo.GridRecvKey  = m_config.GridRecvKey;
            serversinfo.GridSendKey  = m_config.GridSendKey;
            serversinfo.GridURL      = m_config.GridServerURL.ToString();
            serversinfo.InventoryURL = m_config.InventoryUrl.ToString();
            serversinfo.UserURL      = m_config.AuthUrl.ToString();
            SetServersInfo(serversinfo);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="Options"/> class.
        /// </summary>
        /// <param name="config">The shared configuration object to be updated.</param>
        public Options(UserConfig config) : this()
        {
            this.config = config;

            this.presentationConfig = new UserConfig();
            this.generator          = new PhraseGenerator(
                this.presentationConfig,
                new PresentationPhraseRepository(this.presentationConfig),
                new PresentationSpecialCharsRepository());

            DicewareFileType[] wordLists = { DicewareFileType.Short, DicewareFileType.Long };
            this.uxWordlistComboBox.DataSource = wordLists;

            this.uxNumberOfWords.Value           = config.NumberOfWords;
            this.uxStudlyCapsCheckBox.Checked    = config.StudlyCaps;
            this.uxWordlistComboBox.SelectedItem = config.Wordlist;
            this.uxSeparatorText.Text            = config.Separator;
            this.uxSpecialCharsCheckBox.Checked  = config.SpecialChars;

            this.UpdatePreview();
        }
Exemplo n.º 33
0
        /// <summary>
        /// Generiert ein gültiges Passwort
        /// </summary>
        /// <param name="conf">Parameter Struct für Passwort</param>
        /// <returns>gültiges Passwort</returns>
        /// <exception cref="InvalidOperationException">Wenn ungültiger Status im Switch auftritt.</exception>
        public static string GeneratePasswort(UserConfig conf)
        {
            Random zufallszahl = new Random();
            char[] zeichen = new char[zufallszahl.Next(conf.minimumPwLength, conf.maximumPwLength)];
            int enthalteneSonderzeichen = 0;
            int enthalteneZiffern = 0;
            int maxSwitch = 4;

            for (int i = 0; i < zeichen.Length; i++)
            {
                //Sonderzeichen oder Ziffer an letzter Stelle erzwingen
                if ((i >= zeichen.Length - conf.minimumSpecialChar) && (enthalteneSonderzeichen + enthalteneZiffern < conf.minimumSpecialChar)) maxSwitch = 2;

                //Zufällige Auswahl von Zeichen
                switch (zufallszahl.Next(maxSwitch))
                {
                    case 0:     //Ziffer
                        zeichen[i] = zufallszahl.Next(10).ToString().ToCharArray(0,1)[0];
                        enthalteneZiffern++;
                        break;
                    case 1:     //Sonderzeichen
                        zeichen[i] = conf.specialChar[zufallszahl.Next(conf.specialChar.Length)];
                        enthalteneSonderzeichen++;
                        break;
                    case 2:     //Großbuchstabe
                        zeichen[i] = ALPHABET[zufallszahl.Next(ALPHABET.Length)];
                        break;
                    case 3:     //Kleinbuchstabe
                        zeichen[i] = Char.ToLower(ALPHABET[zufallszahl.Next(ALPHABET.Length)]);
                        break;

                    default:
                        throw new InvalidOperationException("Switch state error!");
                }
            }

            return new string(zeichen);
        }
Exemplo n.º 34
0
 /// <summary>
 /// Legt ein neues Passwort nach Überprüfung auf Gültigkeit an.
 /// </summary>
 /// <param name="conf">Parameter Struct für Passwort</param>
 /// <exception cref="ArgumentException">Wenn Passwort ungültig.</exception>
 /// <param name="passw">anzulegendes Passwort</param>
 public Passw(string passw, UserConfig conf)
 {
     this.PasswortEigenschaften = conf;
     this.Passwort = passw;
 }
Exemplo n.º 35
0
 public CircleController()
 {
     this.votings = new Dictionary<Guid, VotingContainer>();
       Status = new CircleStatus();
       Config = new UserConfig(Path.Combine(Status.DataPath, Files.CircleUserConfigFileName));
 }
Exemplo n.º 36
0
 public static UserConfig FromString(string quellstr)
 {
     UserConfig conf = new UserConfig();
     string[] quell = quellstr.Split(TRENNZEICHEN);
     if (quell.Length < 3)
     {
         throw new ArgumentException("Nicht genügend Einzelkomponenten im String enthalten!");
     }
     try
     {
         conf.minimumPwLength = byte.Parse(quell[0]);
         conf.maximumPwLength = byte.Parse(quell[1]);
         conf.minimumSpecialChar = byte.Parse(quell[2]);
     }
     catch (Exception e)
     {
         throw new ArgumentException(e.Message);
     }
     conf.specialChar = new char[(quell.Length - 3)];
     for (int i = 3; i < quell.Length; i++)
     {
         conf.specialChar[(i - 3)] = quell[i].ToCharArray()[0];
     }
     return conf;
 }
Exemplo n.º 37
0
			void SaveConfig(XmlDocument xmlDoc, XmlNode baseNode, UserConfig config, string configName)
			{
				XmlNode configNode = xmlDoc.CreateElement(configName);
				baseNode.AppendChild(configNode);
				configNode.InnerText = config.Enabled.ToString();

				XmlAttribute attribute = xmlDoc.CreateAttribute("changeable");
				attribute.Value = config.Changeable.ToString();
				configNode.Attributes.Append(attribute);
			}
Exemplo n.º 38
0
        /// <summary>
        /// Solution has been opened.
        /// </summary>
        /// <param name="pUnkReserved">Reserved for future use.</param>
        /// <param name="fNewSolution">true if the solution is being created. false if the solution was created previously or is being loaded.</param>
        /// <returns>If the method succeeds, it returns VSConstants.S_OK. If it fails, it returns an error code.</returns>
        public int solutionOpened(object pUnkReserved, int fNewSolution)
        {
            Config config           = new Config();
            UserConfig userConfig   = new UserConfig();

            bool isNew = !config.load(Environment.SolutionPath, Environment.SolutionFileName);
            Log.Trace("Config Link: '{0}'", config.Link);

            userConfig.load(config.Link);
            Log.Trace("UserConfig Link: '{0}'", userConfig.Link);

            ConfigManager.add(config, ContextType.Solution);
            ConfigManager.add(userConfig, ContextType.Solution);

            ConfigManager.switchOn((isNew || userConfig.Data.Global.IgnoreConfiguration)? ContextType.Common : ContextType.Solution);

            refreshComponents();
            Action.Cmd.MSBuild.initPropByDefault();

            OpenedSolution(this, new EventArgs());
            return VSConstants.S_OK;
        }
Exemplo n.º 39
0
        /// <summary>
        /// Loads data with common configuration.
        /// </summary>
        private void loadData()
        {
            try
            {
                var config      = new Config();
                var userConfig  = new UserConfig();
                Settings.CfgManager.addAndUse(config, userConfig, ContextType.Common);

                config.load();
                Log.Trace("Config Link: '{0}'", config.Link);

                userConfig.load();
                Log.Trace("UserConfig Link: '{0}'", userConfig.Link);
            }
            catch(Exception ex) {
                Log.Fatal("Can't load data with common configuration: '{0}'", ex.Message);
                throw;
            }
        }
Exemplo n.º 40
0
 public StructureCreatedArgs(UserConfig.UserListItem item_)
 {
   ParsedConfig = item_;
 }
Exemplo n.º 41
0
		private PersonIdent(UserConfig config) : this(config.GetCommitterName(), config.GetCommitterEmail
			())
		{
		}
Exemplo n.º 42
0
 string Get(UserConfig config, string name, string valueIfNull)
 {
     string value;
     if (config.Properties.TryGetValue(name, out value))
     {
         return value ?? valueIfNull;
     }
     return valueIfNull;
 }
Exemplo n.º 43
0
 public void BuildConfig(UserConfig config)
 {
     //config.LayoutData = GUIHelper.GetLayout(gridViewTrades);
     config.Properties = new Dictionary<string, string>();
     config.Properties[InactiveDate] = new SimpleDate(dateTimePickerLiveDate.DateTime).ToString();
     config.Properties[OnlyNewTrades] = checkBoxnlyNewTrade.Checked.ToString();
     config.Properties[AllProducts] = checkBoxAllProducts.Checked.ToString();
     config.Properties[UseFeed] = checkBoxUseFeed.Checked.ToString();
     config.Properties[CurrencyList] = checkedComboBoxEditCurrency.Text;
     config.Properties[ProducTypeList] = checkedComboBoxEditProduct.Text;
     config.Properties[StrategyList] = checkedComboBoxEditStrategy.Text;
     //config.Properties[TranIdList] = textBoxTransIds.Text;
     config.Properties[LegalEntityList] = checkedComboBoxEditLegalEntity.Text;
     config.Properties[Folder] = textBoxTradeFolder.Text;
     config.Properties[Market] = comboBoxMarket.Text;
     config.Properties[Feed] = comboBoxFeedName.Text;
     config.Properties[FilterName] = editFilterPanel1.FilterName;
     config.Properties[SourceList] = checkedComboBoxEditSources.Text;
     config.Properties[IsNow] = checkButtonNow.Checked.ToString();
     config.Properties[FilePath] = textBoxPartyFile.Text;
 }
Exemplo n.º 44
0
 void ApplyConfig(UserConfig config, bool all)
 {
     //GUIHelper.SetLayout(gridViewTrades, config, gridControl, typeof(TradeBlotterData), new TradeBlotterData());
     //AdjustColumns
     if (all)
     {
         if (config.Properties == null) return;
         checkBoxnlyNewTrade.Checked = bool.Parse(Get(config, OnlyNewTrades, "false"));
         checkBoxAllProducts.Checked = bool.Parse(Get(config, AllProducts, "false"));
         checkBoxUseFeed.Checked = bool.Parse(Get(config, UseFeed, "false"));
         checkedComboBoxEditCurrency.Text = Get(config, CurrencyList, "");
         checkedComboBoxEditStrategy.Text = Get(config, StrategyList, "");
         checkedComboBoxEditLegalEntity.Text = Get(config, LegalEntityList, "");
         checkedComboBoxEditProduct.Text = Get(config, ProducTypeList, "");
         checkedComboBoxEditCurrency.Text = Get(config, CurrencyList, "");
         //textBoxTransIds.Text = Get(config, TranIdList, "");
         textBoxTradeFolder.Text = Get(config, Folder, "");
         textBoxPartyFile.Text = Get(config, FilePath, "");
         comboBoxMarket.Text = Get(config, Market, "");
         comboBoxFeedName.Text = Get(config, Feed, "");
         editFilterPanel1.FilterName = Get(config, FilterName, "");
         checkedComboBoxEditSources.Text = Get(config, SourceList, "");
         checkButtonNow.Checked = bool.Parse(Get(config, IsNow, "false"));
         if (config.Properties.ContainsKey(InactiveDate))
             dateTimePickerLiveDate.DateTime = checkButtonNow.Checked ?
                 DateTime.Now : SimpleDate.Parse(config.Properties[InactiveDate]).ToDateTime();
         else
             dateTimePickerLiveDate.DateTime = DateTime.Now;
     }
 }
Exemplo n.º 45
0
 internal SwapsSummaryRow(InstrumentWithStats swapInstrument_, UserConfig.UserListItem configSource_=null)
 {
   Instrument = swapInstrument_;
   m_originatingConfig = configSource_;
   subscribeToCentralEvents();
 }
Exemplo n.º 46
0
        public UserConfig GetUserConfig(User user)
        {
            if (dbConnection == null)
                throw new InvalidOperationException("Database Connection is null!");

            UserConfig config = new UserConfig();

            using (var cmd = dbConnection.CreateCommand())
            {
                cmd.CommandText = "SELECT * FROM user WHERE id=@id";
                cmd.Parameters.Add("@id", user.ID);
                using (var reader = cmd.ExecuteReader())
                {
                    reader.Read();
                    config.ID = reader.GetInt32(0);
                    config.Username = reader.GetString(1);
                    config.Rating = reader.GetString(2);
                    config.Feed = reader.GetString(3);
                }
            }

            return config;
        }
Exemplo n.º 47
0
        /// <summary>
        /// Testet das übergebene Passwort auf Gültigkeit.
        /// </summary>
        /// <param name="passw">Passwort zur Überprüfung</param>
        /// <param name="conf">Parameter Struct für Passwort</param>
        /// <returns>false = OK, true = Fehler</returns>
        public static bool CheckPasswort(string passw, UserConfig conf)
        {
            if (passw == null)
            {
                return true;
            }

            if (passw.Length < conf.minimumPwLength)
            {
                return true;
            }

            if (passw.Length > conf.maximumPwLength)
            {
                return true;
            }

            char [] zeichen = passw.ToCharArray();
            int enthalteneSonderzeichen = 0;
            int enthalteneZiffern = 0;
            int ungueltigeZeichen = 0;

            foreach (var item in zeichen)
            {
                if (char.IsDigit(item) == true)
                {
                    enthalteneZiffern++;
                    continue;
                }
                if (conf.specialChar.Contains(item) == true)
                {
                    enthalteneSonderzeichen++;
                    continue;
                }
                if (ALPHABET.Contains(Char.ToUpper(item)) == false)
                {
                    ungueltigeZeichen++;
                }
            }

            if ((enthalteneSonderzeichen + enthalteneZiffern) < conf.minimumSpecialChar) return true;
            if (ungueltigeZeichen > 0) return true;

            return false;
        }
Exemplo n.º 48
0
        public Message Update(UserConfig objUI)
        {
            Message msg = null;

            try
            {
                if (objUI != null)
                {
                    // Get current group in dbContext
                    UserConfig objDb = GetByID(objUI.UserAdminID);

                    if (objDb != null)
                    {
                        // Update info by objUI
                        objDb.IsOff = objUI.IsOff;
                        objDb.AutoReplyMessage = objUI.AutoReplyMessage;
                        objDb.ModuleId = objUI.ModuleId;
                        // Submit changes to dbContext
                        dbContext.SubmitChanges();

                        // Show success message
                        msg = new Message(MessageConstants.I0001, MessageType.Info, objDb.UserAdmin.UserName, "updated");
                    }
                }
            }
            catch
            {
                // Show system error
                msg = new Message(MessageConstants.E0007, MessageType.Error);
            }

            return msg;
        }
Exemplo n.º 49
0
 /// <summary>
 /// Legt ein neues Passwort nach Überprüfung auf Gültigkeit an.
 /// </summary>
 /// <param name="conf">Parameter Struct für Passwort</param>
 /// <exception cref="ArgumentException">Wenn Passwort ungültig.</exception>
 public Passw(UserConfig conf)
 {
     this.PasswortEigenschaften = conf;
     this.passwort = GeneratePasswort(conf);
 }
Exemplo n.º 50
0
 public void ApplyConfig(UserConfig config)
 {
     ApplyConfig(config, true);
 }
Exemplo n.º 51
0
        public Boolean RegisterAccount(AccountRegisterViewModel regModel)
        {
            Random rand = new Random((int)DateTime.Now.Ticks);
            int sizesalt = rand.Next(1, 100);

            String salt = AccountHelper.CreateSalt(sizesalt);
            String passAndSalt = regModel.Password + salt;
            String hassedPass = AccountHelper.HashPassword(passAndSalt);

            var singleOrDefault = _db.Roles.SingleOrDefault(r => r.RoleName == Helper.Const.User);
            if (singleOrDefault != null)
            {
                var user = new User
                {
                    UserName = regModel.Username,
                    Password = hassedPass,
                    KeyValue = salt,
                    IsActive = false,
                    RoleId = singleOrDefault.Id,
                    Status = Const.UActive,
                    Description = ""
                };

                try
                {
                    _db.Users.Add(user);
                    _db.SaveChanges();
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }

                var userinfo = new UserInfo
                {
                    IdCard = regModel.IdNumber,
                    Address = regModel.Address,
                    Phone = regModel.Phonenumber,
                    Gender = regModel.Male,
                    DayOfBirth = regModel.DateOfBirth,
                    LastLogin = DateTime.Now,
                    Description = "",
                    User = _db.Users.Find(user.Id)
                };

                var userconfig = new UserConfig
                {
                    DisplayNickname = false,
                    AllowToSellCard = false,
                    User = _db.Users.Find(user.Id)
                };

                try
                {
                    _db.UserInfoes.Add(userinfo);
                    _db.SaveChanges();
                    _db.UserConfigs.Add(userconfig);
                    _db.SaveChanges();
                    return true;
                }
                catch (DbEntityValidationException dbEx)
                {
                    foreach (var validationErrors in dbEx.EntityValidationErrors)
                    {
                        foreach (var validationError in validationErrors.ValidationErrors)
                        {
                            Trace.TraceInformation("Property: {0} Error: {1}", validationError.PropertyName, validationError.ErrorMessage);
                        }
                    }
                    return false;
                }
            }
            return false;
        }