/// <summary> /// Parses the command line arguments. Format of the /// arguments are -option <option arg> /// </summary> /// <param name="args">Args to parse</param> private static void parseCommandLine(string[] args) { var parseState = ParseState.Next; for (int index = 0; index < args.Length; index++) { switch (args[index].ToLower().Trim()) { case "-form": case "/form": case "-f": case "/f": parseState = ParseState.Form; break; case "-culture": case "/culture": parseState = ParseState.Culture; break; } switch (parseState) { case ParseState.Form: args[index] = args[index].Trim(); if (!isOption(args[index])) { _formName = args[index].Trim(); } break; case ParseState.Culture: if (!isOption(args[index])) { CultureUtils.SetCulture(args[index].Trim()); } break; } } }
/// <summary> /// Set culture for the request. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Application_PreRequestHandlerExecute(object sender, EventArgs e) { CultureUtils.SetCulture(WeavyContext.Current.User); }
/// <summary> /// Parses the command line arguments. Format of the /// arguments are -option <option arg> /// </summary> /// <param name="args">Args to parse</param> private static void parseCommandLine(string[] args) { var parseState = ParseState.Next; for (int index = 0; index < args.Length; index++) { switch (args[index].ToLower().Trim()) { case "-user": case "/user": parseState = ParseState.Username; break; case "-profile": case "/profile": parseState = ParseState.Profile; break; case "-panelconfig": case "/panelconfig": parseState = ParseState.PanelConfig; break; case "-culture": case "/culture": parseState = ParseState.Culture; break; } switch (parseState) { case ParseState.Profile: args[index] = args[index].Trim(); if (!isOption(args[index])) { _profile = args[index].Trim(); } break; case ParseState.Username: if (!isOption(args[index])) { _userName = args[index].Trim(); } break; case ParseState.PanelConfig: if (!isOption(args[index])) { _panelConfig = args[index].Trim(); } break; case ParseState.Culture: if (!isOption(args[index])) { CultureUtils.SetCulture(args[index].Trim()); } break; } } }