public Dictionary <string, string> ConfigList() { ConfigList operation = new ConfigList(); ODocument document = _connection.ExecuteOperation(operation); return(document.GetField <Dictionary <string, string> >("config")); }
void readConfig() { // 检查是否存在配置文件夹,若无,则创建并导入默认初始配置及数据库 if (!Directory.Exists(_configDir)) { Directory.CreateDirectory(_configDir); File.Copy(Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "Resources\\config.yaml"), _configFile, true); File.Copy(Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "Resources\\Country.mmdb"), Path.Combine(_configDir, "Country.mmdb"), true); } // 检查是否存在托管配置文件夹,若无,创建并建立初始托管配置目录 if (!Directory.Exists(_profileDir)) { Directory.CreateDirectory(_profileDir); File.WriteAllText(_profileListFile, JsonConvert.SerializeObject(new ConfigList())); } // 读取托管配置目录 string cfgStr = File.ReadAllText(_profileListFile); _configList = JsonConvert.DeserializeObject <ConfigList>(cfgStr); if (_configList.index < 0 || _configList.files.Count == 0) { // 目录为空,将当前配置指向默认初始配置 _currentConfig = _configFile; } else { // 目录不为空,设置当前配置 string timestamp = _configList.files[_configList.index].timestamp; _currentConfig = Path.Combine(_profileDir, $"{timestamp}.yaml"); } }
public async Task BAM_Config_HardwareAsset_Get_List() { var queryResult = _bamClient._client.GetAsync("api/V3/Config/GetPopulatedConfigClasses").Result; Assert.IsTrue(queryResult.IsSuccessStatusCode, "Query Status Code isn't Success: " + queryResult.StatusCode.ToString()); Assert.IsNotNull(queryResult, "queryResult is empty"); var resultSring = queryResult.Content.ReadAsStringAsync().Result; Assert.IsFalse(string.IsNullOrEmpty(resultSring), "Query resultSring is null"); var resultTemp = JsonConvert.DeserializeObject <Config[]>(resultSring); Assert.IsNotNull(resultTemp, "Query resultTemp is null"); Assert.IsTrue(resultTemp.Any(), "Query resultTemp doesn't contain any items"); var result = new ConfigList() { Configs = resultTemp.ToList() }; //var result = queryResult.Content.ReadAsAsync<ArticleList>().Result; Assert.IsNotNull(result, "Query result is null"); Assert.IsNotNull(result.Configs, "Articles list is null"); Assert.IsTrue(result.Configs.Any(), "Articles doesn't contain any items"); var hardwareAssetConfigItem = result.Configs.Where(x => x.m_Item2.Contains("Hardware Asset")).FirstOrDefault(); Assert.IsNotNull(hardwareAssetConfigItem, "HardwareAsset Config Item is null"); }
/// <summary> /// 将数据绑定到DataSet /// </summary> public void BindOrder() { DataSet ds = bll.GetItemList(""); ConfigList.DataSource = ds; ConfigList.DataBind(); }
/// <summary> /// 初始化 /// </summary> private void Init() { m_luaEnv = new LuaEnv(); m_luaEnv.AddLoader(Loader); m_luaTable = m_luaEnv.NewTable(); // 为每个脚本设置一个独立的环境,可一定程度上防止脚本间全局变量、函数冲突 LuaTable meta = m_luaEnv.NewTable(); meta.Set("__index", m_luaEnv.Global); m_luaTable.SetMetaTable(meta); meta.Dispose(); m_luaTable.Set("self", this); m_luaEnv.DoString("require('main')", "Lua", m_luaTable); // 获取要加载的配置 ConfigList func = m_luaTable.Get <ConfigList>("init"); if (func != null) { func(m_config); func = null; foreach (var kvp in m_config) { ConfigManager.instance.Add(kvp.Key, (text) => { data.Add(kvp.Key, text); }); } } }
private void GetInput() { if (!load_config) { input = File_input; output = File_output; shader = Shader_shape.ToString(); } else { config = Path.GetFileNameWithoutExtension(config); string jsonIn = path_to_configs + config + ".json"; if (File.Exists(jsonIn)) { list = JsonUtility.FromJson <ConfigList>(File.ReadAllText(jsonIn)); input = list.ModelConfig[index].Input; output = list.ModelConfig[index].Output; shader = list.ModelConfig[index].ShaderShape; } else { Debug.LogError("Config file not found"); EditorApplication.ExecuteMenuItem("Edit/Play"); } } }
private void RenderModel() { // Get inputs GetInput(); // If inputs are valid, get model if (ValidInput()) { model = GetModel(); } // If config file is not used, create a list to store current model rendering configurations if (!load_config) { list = ConfigurationList.CreateList(1); list.ModelConfig[0] = ConfigurationList.CreateNode(); } // Set initial rendering parameters, as stored in the configuration list ResetRenderingConfigurations(); // Initialize position and rotation of camera in 2D desktop view if (initialize_fallback_camera) { ResetFallbackCamera(); } }
private void StoreConfig() { ConfigList clist = ConfigurationList.CreateList(1); clist.ModelConfig[0] = ConfigurationList.CreateNode(); string jsonOut = path_to_configs + output + ".json"; File.WriteAllText(jsonOut, JsonUtility.ToJson(clist)); }
public async Task <ConfigList> GetConfigList(int VoterTypeId, int OrganizationId) { var voters = await _context.Voters.Where(v => v.VoterTypeId == VoterTypeId).ToListAsync(); var organizationUsers = await GetOrganizationReferences(OrganizationId, 0); var CondifgList = new ConfigList() { religion = new List <string> (), politics = new List <string> (), subChapter = new List <string> (), civilIdMouhavaza = new List <string> (), civilIdKadaa = new List <string> (), civilIdRegion = new List <string> (), referenceUsers = new List <SelectObject> () }; foreach (var item in voters) { if (item.Religion != null && item.Religion.Trim() != "" && !CondifgList.religion.Contains(item.Religion)) { CondifgList.religion.Add(item.Religion); } if (item.Politic != null && item.Politic.Trim() != "" && !CondifgList.politics.Contains(item.Politic)) { CondifgList.politics.Add(item.Politic); } if (item.SubChapter != null && item.SubChapter.Trim() != "" && !CondifgList.subChapter.Contains(item.SubChapter)) { CondifgList.subChapter.Add(item.SubChapter); } if (item.CivilIdMouhavaza != null && item.CivilIdMouhavaza.Trim() != "" && !CondifgList.civilIdMouhavaza.Contains(item.CivilIdMouhavaza)) { CondifgList.civilIdMouhavaza.Add(item.CivilIdMouhavaza); } if (item.CivilIdKadaa != null && item.CivilIdKadaa.Trim() != "" && !CondifgList.civilIdKadaa.Contains(item.CivilIdKadaa)) { CondifgList.civilIdKadaa.Add(item.CivilIdKadaa); } if (item.CivilIdRegion != null && item.CivilIdRegion.Trim() != "" && !CondifgList.civilIdRegion.Contains(item.CivilIdRegion)) { CondifgList.civilIdRegion.Add(item.CivilIdRegion); } } foreach (var user in organizationUsers) { var selectObject = new SelectObject() { Value = user.Id, Name = user.UserName }; CondifgList.referenceUsers.Add(selectObject); } return(CondifgList); }
public void Start() { if (ConfigList != null) { ConfigList.Clear(); } GC.Collect(); ConfigList = EmailHelper.GetConfigsFormConfig(); taskThread = new Task(ThreadOfEmail); taskThread.Start(); }
private void SaveConfigList() { var updatedConfigs = new ConfigList(); foreach (var config in _configList) { updatedConfigs.Add(config); } Settings.Default.ConfigList = updatedConfigs; Settings.Default.Save(); }
/// <summary> /// 新增方案 /// </summary> /// <param name="name"></param> /// <returns></returns> public static SchemeData AddScheme(string name) { SchemeData data = new SchemeData(); data.SchemeName = name; ConfigList.Add(data); ConfigNameList.Add(data.SchemeName); SaveEditorSchemeData(); return(data); }
private static void GetConfig() { var strPrintType = ConfigList.Single(p => p.ParamName == "PrintType").ParamValue; PrintType printType; if (Enum.TryParse(strPrintType, true, out printType)) { PrintType = printType; } DefaultPreDays = 3; // DefaultPreDays = Convert.ToInt32(ConfigList.Single(p => p.ParamName == "DefaultPreDays").ParamValue); }
private void LoadConfigurations() { var systemPath = System.Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData); // string[] filePaths = Directory.GetFiles(systemPath); ConfigList.Clear(); foreach (var file in Directory.EnumerateFiles(systemPath, "*.xml")) { string fileName_ = file.ToString().Replace(systemPath.ToString() + "\\", ""); fileName_ = fileName_.Replace(".xml", ""); ConfigList.Add(fileName_); } }
private void Button_ClickAddConfigKey(object sender, RoutedEventArgs e) { if (!string.IsNullOrEmpty(TextBox_ConfigName.Text)) { KeyValue kv = new KeyValue(); kv.Key = TextBox_ConfigName.Text; ConfigList.Add(kv); ConfigList = ConfigList; TextBox_ConfigName.Text = ""; } }
public static ConfigList GetEditConfig(string id, int index) { // Set active row HttpContext.Current.Session["ROW_ID"] = id; HttpContext.Current.Session["ROW"] = index; var configpData = new ConfigList(); var dsDataConfig = new DataSet(); try { using (SqlConnection conn = new SqlConnection(SPlanetUtil.GetConnectionString())) { List <SqlParameter> arrParm = new List <SqlParameter> { new SqlParameter("@config_document", SqlDbType.Char, 2) { Value = "" }, new SqlParameter("@config_type", SqlDbType.Char, 1) { Value = "" }, new SqlParameter("@id", SqlDbType.Int) { Value = Convert.ToInt32(id) } }; conn.Open(); dsDataConfig = SqlHelper.ExecuteDataset(conn, "sp_config_list", arrParm.ToArray()); conn.Close(); } if (dsDataConfig.Tables.Count > 0) { var row = dsDataConfig.Tables[0].Rows[0]; configpData.id = Convert.IsDBNull(row["id"]) ? 0 : Convert.ToInt32(row["id"]); configpData.config_document = Convert.IsDBNull(row["config_document"]) ? null : Convert.ToString(row["config_document"]); configpData.config_type = Convert.IsDBNull(row["config_type"]) ? null : Convert.ToString(row["config_type"]); configpData.config_description = Convert.IsDBNull(row["config_description"]) ? null : Convert.ToString(row["config_description"]); } } catch (Exception ex) { throw ex; } return(configpData); }
/// <summary> /// /// </summary> /// <param name="ctx"></param> /// <param name="userAlias"></param> /// <returns></returns> public Message GetConfigListItemByAlias(WebOperationContext ctx, string userAlias) { Message responseMsg; try { ConfigList configListItem = this.spDataAccess.GetLookupObjectByField <ConfigList>("KPConfigList", "KPUserName", EntityConstants.ItemTypes.TEXT, userAlias); responseMsg = HttpUtilities.GenerateResponse <ConfigList>(ctx, configListItem, this.timer); } catch (Exception ex) { responseMsg = HttpUtilities.GenerateExceptionResponse(ctx, ex, "GET", HttpStatusCode.InternalServerError); } return(responseMsg); }
private void RemoveConfigurationExecute() { var systemPath = System.Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData); System.IO.DirectoryInfo di = new DirectoryInfo(systemPath); foreach (FileInfo file in di.GetFiles()) { if (file.Name == (SelectedConfig + ".xml")) { file.Delete(); ConfigList.Remove(SelectedConfig); } } SelectedConfig = ConfigList.FirstOrDefault(); }
public virtual void Delete(int id) { int index = 0; for (var i = 0; i < ConfigList.Count; i++) { if (ConfigList[i].ID != id) { continue; } index = i; break; } ConfigList.RemoveAt(index); }
private void Button_ClickDelete(object sender, RoutedEventArgs e) { Button btn = sender as Button; string key = (string)btn.Tag; for (int i = 0; i < ConfigList.Count; i++) { if (ConfigList[i].key == key) { ConfigList.RemoveAt(i); } } ConfigList = ConfigList; }
private Config Get_HardwareAsset_ConfigItem() { var queryResult = _bamClient._client.GetAsync("Config/GetPopulatedConfigClasses").Result; var resultSring = queryResult.Content.ReadAsStringAsync().Result; var resultTemp = JsonConvert.DeserializeObject <Config[]>(resultSring); var result = new ConfigList() { Configs = resultTemp.ToList() }; var hardwareAssetConfigItem = result.Configs.Where(x => x.m_Item2.Contains("Hardware Asset")).FirstOrDefault(); return(hardwareAssetConfigItem); }
public static List <T> StringToConfigList <T>(string jsonStr, bool defaultNull = false) { try { ConfigList <T> configList = JsonUtility.FromJson <ConfigList <T> >(jsonStr); if (configList != null) { return(configList.list); } Debugger.LogError("Config is none!"); } catch (Exception e) { Debugger.LogError(string.Format("Can not convert {0} to ConfigList with {1}", jsonStr, e)); } return(defaultNull ? null : new List <T>()); }
public void ExportConfigs(string filePath, int[] indiciesToSave) { var savingConfigs = new ConfigList(); foreach (int index in indiciesToSave) { savingConfigs.Add(_configList[index]); } var tempSettings = new Settings(); tempSettings.ConfigList = savingConfigs; tempSettings.Save(); var config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal); config.SaveAs(filePath); Settings.Default.Save(); }
/// <summary> /// 删除方案 /// </summary> /// <param name="data"></param> public static void DelectScheme(SchemeData data) { ConfigList.Remove(data); ConfigNameList.Remove(data.SchemeName); SaveEditorSchemeData(); SaveGameSchemeConfig(null); string Path1 = Application.dataPath + "/" + c_SDKCachePath + "/" + data.SchemeName + "Plugins"; string Path2 = Application.dataPath + "/" + c_SDKCachePath + "/" + data.SchemeName; string Path3 = Application.dataPath + "/Plugins"; string Path4 = Application.dataPath + "/" + data.SchemeName; FileTool.SafeDeleteDirectory(Path1); FileTool.SafeDeleteDirectory(Path2); FileTool.SafeDeleteDirectory(Path3); FileTool.SafeDeleteDirectory(Path4); }
/// <summary> /// /// </summary> /// <param name="ctx"></param> /// <param name="entityName"></param> /// <param name="dataMsg"></param> /// <returns></returns> public Message SaveLookup(WebOperationContext ctx, string entityName, Message dataMsg) { Message responseMsg = null; string jsonData = JSON.GetPayload(dataMsg); try { switch (entityName) { case "EntityLinks": EntityLinks entityLinks = this.SaveLookup <EntityLinks>(entityName, jsonData); responseMsg = HttpUtilities.GenerateResponse <EntityLinks>(ctx, entityLinks, this.timer); break; case "EventLogging": EventLogger eventLogger = this.SaveLookup <EventLogger>(entityName, jsonData); responseMsg = HttpUtilities.GenerateResponse <EventLogger>(ctx, eventLogger, this.timer); break; case "KPAdmins": Admin kpAdmin = this.SaveLookup <Admin>(entityName, jsonData); responseMsg = HttpUtilities.GenerateResponse <Admin>(ctx, kpAdmin, this.timer); break; case "KPCategoryL1": CategoryL1 kpCatL1 = this.SaveLookup <CategoryL1>(entityName, jsonData); responseMsg = HttpUtilities.GenerateResponse <CategoryL1>(ctx, kpCatL1, this.timer); break; case "KPCategoryL2": CategoryL2 kpCatL2 = this.SaveLookup <CategoryL2>(entityName, jsonData); responseMsg = HttpUtilities.GenerateResponse <CategoryL2>(ctx, kpCatL2, this.timer); break; case "KPConfigList": ConfigList kpConfigList = this.SaveLookup <ConfigList>(entityName, jsonData); responseMsg = HttpUtilities.GenerateResponse <ConfigList>(ctx, kpConfigList, this.timer); break; //case "KPCountry": // Country kpCountry = this.SaveLookup<Country>(entityName, jsonData); // responseMsg = ctx.CreateJsonResponse<Country>(kpCountry); // break; case "KPCustomers": Customer kpCustomers = this.SaveLookup <Customer>(entityName, jsonData); responseMsg = HttpUtilities.GenerateResponse <Customer>(ctx, kpCustomers, this.timer); break; //case "KPEffortInstances": // EffortInstance kpEffortInstances = this.SaveLookup<EffortInstance>(entityName, jsonData); // responseMsg = ctx.CreateJsonResponse<EffortInstance>(kpEffortInstances); // break; //case "KPEfforts": // Effort kpEfforts = this.SaveLookup<Effort>(entityName, jsonData); // responseMsg = ctx.CreateJsonResponse<Effort>(kpEfforts); // break; case "KPGoalSetLocks": GoalSetLock kpGoalSetLock = this.SaveLookup <GoalSetLock>(entityName, jsonData); responseMsg = HttpUtilities.GenerateResponse <GoalSetLock>(ctx, kpGoalSetLock, this.timer); break; case "KPGoalSets": GoalSet kpGoalSet = this.SaveLookup <GoalSet>(entityName, jsonData); responseMsg = HttpUtilities.GenerateResponse <GoalSet>(ctx, kpGoalSet, this.timer); break; //case "KPPerspectives": // Perspective kpPerspective = this.SaveLookup<Perspective>(entityName, jsonData); // responseMsg = ctx.CreateJsonResponse<Perspective>(kpPerspective); // break; case "KPPerspectiveInstances": PerspectiveInstance kpPerspectiveInstance = this.SaveLookup <PerspectiveInstance>(entityName, jsonData); responseMsg = HttpUtilities.GenerateResponse <PerspectiveInstance>(ctx, kpPerspectiveInstance, this.timer); break; case "KingpinLockdown": KingpinLockdown lockdown = this.SaveLookup <KingpinLockdown>(entityName, jsonData); responseMsg = HttpUtilities.GenerateResponse <KingpinLockdown>(ctx, lockdown, this.timer); break; case "Announcements": Announcement announcement = this.SaveLookup <Announcement>(entityName, jsonData); responseMsg = HttpUtilities.GenerateResponse <Announcement>(ctx, announcement, this.timer); break; case "KPTeams": Team kpTeam = this.SaveLookup <Team>(entityName, jsonData); responseMsg = HttpUtilities.GenerateResponse <Team>(ctx, kpTeam, this.timer); break; case "KPVPs": VP kpVP = this.SaveLookup <VP>(entityName, jsonData); responseMsg = HttpUtilities.GenerateResponse <VP>(ctx, kpVP, this.timer); break; case "OneOffConfigurations": OneOffConfiguration oneOffConfiguration = this.SaveLookup <OneOffConfiguration>(entityName, jsonData); responseMsg = HttpUtilities.GenerateResponse <OneOffConfiguration>(ctx, oneOffConfiguration, this.timer); break; case "UserEventLogging": UserLogging userEvent = this.SaveLookup <UserLogging>(entityName, jsonData); responseMsg = HttpUtilities.GenerateResponse <UserLogging>(ctx, userEvent, this.timer); break; default: string errMsg = string.Format("Error: No lookup list found with the name: {0}", entityName); responseMsg = HttpUtilities.GenerateExceptionResponse(ctx, new Exception(errMsg), "POST/PUT", HttpStatusCode.BadRequest); break; } } catch (Exception ex) { responseMsg = HttpUtilities.GenerateExceptionResponse(ctx, ex, "POST/PUT", HttpStatusCode.InternalServerError); } this.timer.Stop(); return(responseMsg); }
static void Main(string[] args) { if (args.Length < 2) { Console.WriteLine("USAGE: BookExtractor <json output> <json inputs...>"); return; } var json = new JSONSerializer(); var booksOutput = new ConfigList(); var sb = new StringBuilder(); for (int i = 1; i < args.Length; i++) { long fsz = new FileInfo(args[i]).Length; using (var sr = new StreamReader(args[i])) { Console.WriteLine("Reading {0}", args[i]); string line; int lastPercent = 0; bool skip = true; while ((line = sr.ReadLine()) != null) { int newPercent = (int)((sr.BaseStream.Position * 100L) / fsz); if (newPercent != lastPercent) { lastPercent = newPercent; Console.WriteLine("{0}: {1,3}%", args[i], lastPercent); } if (line.StartsWith("\t{")) { sb.Clear(); sb.AppendLine("{"); skip = true; } else if (line.StartsWith("\t}")) { if (skip) continue; sb.AppendLine("}"); var lst = json.Deserialize(sb.ToString()); if (lst.ContainsKey("Items")) { var lstt = lst["Items"] as ConfigList; if (lstt != null) { foreach (ConfigPair pair in lstt) { ConfigList pairData = (ConfigList)pair.Value; string pdi = pairData["id"] as string; if (pdi == null) continue; if (pdi == "minecraft:written_book") booksOutput.Add(null, pairData["tag"]); } } } } else { if (line.StartsWith("\t\t\"Items\":")) skip = false; sb.AppendLine(line); } } } } using (var sw = new StreamWriter(args[0])) json.Serialize(booksOutput, sw); }
/// <summary> /// 根据Key获取值 /// </summary> /// <param name="key"></param> /// <returns></returns> public string GetValue(string key) { LoadConfigurationXml(); return(ConfigList.Where(m => m.key == key).FirstOrDefault().value); }
static ConfigList ConvertObject(object o) { var lst = new ConfigList(); if (o is IEnumerable<KeyValuePair<string, object>>) { var oe = (IEnumerable<KeyValuePair<string, object>>)o; foreach(var kvp in oe) { if (kvp.Value is ValueType || kvp.Value is string) lst.Add(kvp); else lst.Add(kvp.Key, ConvertObject(kvp.Value)); } } else if (o is System.Collections.IEnumerable) { var oe = (System.Collections.IEnumerable)o; foreach(var oo in oe) { if (oo is ValueType || oo is string) lst.Add(null, oo); else lst.Add(null, ConvertObject(oo)); } } return lst; }
public void AddNeedScan(EmailConfig ec) { ConfigList.Add(ec); }
public void ThreadOfEmail() { while (true) { if (ConfigList == null) { Thread.Sleep(ScanBetween); continue; } List <EmailConfig> eclist = new List <EmailConfig>(ConfigList); foreach (EmailConfig e in eclist) { try { EmailHelper eh = new EmailHelper(e); int count = eh.GetEmailCount(); eh.Disposed(); if (!Config_MD5.ContainsKey(e)) { Config_MD5.Add(e, e.GetMD5()); } if (!User_Count.ContainsKey(Config_MD5[e])) { User_Count.Add(Config_MD5[e], count); } else { #region 失效 //if (User_Count[Config_MD5[e]] != count) //{ // if (User_Count[Config_MD5[e]] > count) // { // NotifyIcon.ShowBalloonTip(5, "邮件被删除", e.Url + ":" + e.UserName + "删除了" + (count) + "条邮件", ToolTipIcon.Info); // } // else // { // NotifyIcon.ShowBalloonTip(5, "收到了新邮件", e.Url + ":" + e.UserName + "收到了" + (count - User_Count[Config_MD5[e]]) + "条新邮件", ToolTipIcon.Info); // } // User_Count[Config_MD5[e]] = User_Count[Config_MD5[e]] + count; //} #endregion } if (count != 0) { User_Count[Config_MD5[e]] = User_Count[Config_MD5[e]] + count; NotifyIcon.ShowBalloonTip(5, "收到了新邮件", e.Url + ":" + e.UserName + "收到了" + (count) + "条新邮件", ToolTipIcon.Info); if (!MailMessages.ContainsKey(Config_MD5[e])) { MailMessages.Add(Config_MD5[e], new List <MailMessage>()); } EmailHelper ehh = new EmailHelper(e); var ll = ehh.GetAllEmailMessages(); MailMessages[Config_MD5[e]].AddRange(ll); ehh.Disposed(); } else { ; } } catch { ConfigList.Remove(e); Config_MD5.Remove(e); } } Thread.Sleep(ScanBetween); } }
public static void Main(string[] args) { bool mutexReserved; using (Mutex appMutex = new Mutex(true, "SpeditGlobalMutex", out mutexReserved)) { if (mutexReserved) { bool ProgramIsNew = false; #if !DEBUG try { #endif Environment.CurrentDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); #if !DEBUG ProfileOptimization.SetProfileRoot(Environment.CurrentDirectory); ProfileOptimization.StartProfile("Startup.Profile"); #endif //todo implement own updater Options = OptionsControl.Load(out ProgramIsNew); Assembly assembly = Assembly.GetExecutingAssembly(); NeutralResourcesLanguageAttribute a = (NeutralResourcesLanguageAttribute)assembly.GetCustomAttribute(typeof(NeutralResourcesLanguageAttribute)); Culture.cultures = Culture.GetAvailableCultures(); CultureInfo defCultureInfo = new CultureInfo(string.IsNullOrEmpty(Options.Language) ? a.CultureName : Options.Language); CultureInfo.DefaultThreadCurrentUICulture = defCultureInfo; CultureInfo.DefaultThreadCurrentCulture = defCultureInfo; ConfigList = ConfigLoader.Load(); foreach (Config config in ConfigList.Configs.Where(config => config.Name == Options.SelectedConfig)) { ConfigList.CurrentConfig = ConfigList.Configs.IndexOf(config); break; } if (!Options.UseHardwareAcceleration) { RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly; } #if !DEBUG if (ProgramIsNew) { if (Translations.AvailableLanguageIDs.Length > 0) { splashScreen.Close(new TimeSpan(0, 0, 1)); var languageWindow = new UI.Interop.LanguageChooserWindow(Translations.AvailableLanguageIDs, Translations.AvailableLanguages); languageWindow.ShowDialog(); string potentialSelectedLanguageID = languageWindow.SelectedID; if (!string.IsNullOrWhiteSpace(potentialSelectedLanguageID)) { OptionsObject.Language = potentialSelectedLanguageID; Translations.LoadLanguage(potentialSelectedLanguageID); } splashScreen.Show(false, true); } } #endif MainWindow = new MainWindow(); new PipeInteropServer(MainWindow).Start(); #if !DEBUG } catch (Exception e) { File.WriteAllText("CRASH_" + Environment.TickCount.ToString() + ".txt", BuildExceptionString(e, "SPEDIT LOADING")); MessageBox.Show("An error occured while loading." + Environment.NewLine + "A crash report was written in the editor-directory.", "Error while Loading", MessageBoxButton.OK, MessageBoxImage.Error); Environment.Exit(Environment.ExitCode); } #endif Application app = new Application(); #if !DEBUG try { if (OptionsObject.Program_CheckForUpdates) { UpdateCheck.Check(true); } #endif app.Run(MainWindow); OptionsControl.Save(); #if !DEBUG } catch (Exception e) { File.WriteAllText("CRASH_" + Environment.TickCount.ToString() + ".txt", BuildExceptionString(e, "SPEDIT MAIN")); MessageBox.Show("An error occured." + Environment.NewLine + "A crash report was written in the editor-directory.", "Error", MessageBoxButton.OK, MessageBoxImage.Error); Environment.Exit(Environment.ExitCode); } #endif } else { try { StringBuilder sBuilder = new StringBuilder(); bool addedFiles = false; for (int i = 0; i < args.Length; ++i) { if (!string.IsNullOrWhiteSpace(args[i])) { FileInfo fInfo = new FileInfo(args[i]); if (fInfo.Exists) { string ext = fInfo.Extension.ToLowerInvariant().Trim('.', ' '); //todo fix this? if (ext == "sp" || ext == "inc" || ext == "txt" || ext == "smx") { addedFiles = true; sBuilder.Append(fInfo.FullName); if ((i + 1) != args.Length) { sBuilder.Append("|"); } } } } } if (addedFiles) { PipeInteropClient.ConnectToMasterPipeAndSendData(sBuilder.ToString()); } } catch (Exception) { } //dont f**k the user up with irrelevant data } } }