void Parse(XElement element, string filterBase, string prepend) { foreach (var child in element.Elements()) { if (child.Name == "Filter") { string filter = (string.IsNullOrEmpty(filterBase) ? "" : filterBase + "\\") + (string)child.Attribute("Name"); Filters.Add(filter, ""); Parse(child, filter, prepend); } else { string path = Path.Combine(prepend, (string)child.Attribute("RelativePath")); string extension = Path.GetExtension(path); if (extension == ".h") { IncludeFiles.Add(path, filterBase); } else if (extension == ".cpp") { SourceFiles.Add(path, filterBase); } else if (extension == ".resx") { ResourceFiles.Add(path, filterBase); } else { OtherFiles.Add(path, filterBase); } } } }
private static void GetResourcePaths(Assembly assembly) { var culture = System.Threading.Thread.CurrentThread.CurrentCulture; var resourceName = assembly.GetName().Name + ".g"; var resourceManager = new ResourceManager(resourceName, assembly); try { var resourceSet = resourceManager.GetResourceSet(culture, true, true); foreach (System.Collections.DictionaryEntry resource in resourceSet) { if (resource.Value != null && !ResourceFiles.ContainsKey(Path.GetFileName(resource.Key.ToString()))) { ResourceFiles.Add(Path.GetFileName(resource.Key.ToString()), resource.Key.ToString()); } } } catch (Exception ex) { } finally { resourceManager.ReleaseAllResources(); } }
public DebugProject() : base(typeof(Target), typeof(Configuration), isInternal: true) { _projectInfo = DebugProjectGenerator.DebugProjects[GetType()]; // set paths RootPath = _projectInfo.ProjectFolder; SourceRootPath = RootPath; // add selected source files SourceFiles.AddRange(_projectInfo.ProjectFiles); // ensure that no file will be automagically added SourceFilesExtensions.Clear(); ResourceFilesExtensions.Clear(); PRIFilesExtensions.Clear(); ResourceFiles.Clear(); NoneExtensions.Clear(); VsctExtension.Clear(); Name = _projectInfo.DisplayName; // Use the new csproj style ProjectSchema = CSharpProjectSchema.NetCore; // prevents output dir to have a framework subfolder CustomProperties.Add("AppendTargetFrameworkToOutputPath", "false"); // we need to disable determinism while because we are using wildcards in assembly versions // error CS8357: The specified version string contains wildcards, which are not compatible with determinism CustomProperties.Add("Deterministic", "false"); AddTargets(DebugProjectGenerator.GetTargets()); }
private void BuildMap() { var sw = Stopwatch.StartNew(); int size = ResourceFiles.Sum(r => r.FileCount); NameToFileMap = new Dictionary <string, List <string> >(size + BackupManager.FileEntriesToBackups.Length); List <string> temp; foreach (var resourceFile in ResourceFiles) { foreach (var file in resourceFile.FilesTable) { string name = file.FileName.ToLower(); if (!NameToFileMap.TryGetValue(name, out temp)) { temp = new List <string>(); NameToFileMap[name] = temp; } temp.Add(resourceFile.Name.ToLower()); } } float z = sw.ElapsedMs(); }
public ProjectNetImguiServer() : base(true) { Name = "netImguiServer"; SourceRootPath = @"[project.SharpmakeCsPath]\..\Code\ServerApp"; ResourceFiles.Add(@"[project.SharpmakeCsPath]\..\Code\ServerApp\small.ico"); ResourceFiles.Add(@"[project.SharpmakeCsPath]\..\Code\ServerApp\netImguiApp.ico"); ResourceFiles.Add(@"[project.SharpmakeCsPath]\..\Code\ServerApp\netImguiApp.rc"); ResourceFiles.Add(@"[project.SharpmakeCsPath]\..\Code\ServerApp\Background.png"); }
public ProjectNetImguiServer() : base(true) { Name = "NetImguiServer"; SourceRootPath = NetImguiTarget.GetPath(@"\Code\ServerApp"); ResourceFiles.Add(NetImguiTarget.GetPath(@"\Code\ServerApp\small.ico")); ResourceFiles.Add(NetImguiTarget.GetPath(@"\Code\ServerApp\netImguiApp.ico")); ResourceFiles.Add(NetImguiTarget.GetPath(@"\Code\ServerApp\netImguiApp.rc")); ResourceFiles.Add(NetImguiTarget.GetPath(@"\Code\ServerApp\Background.png")); SourceFilesBuildExcludeRegex.Add(@".*Code\\ServerApp\\Source\\Fonts\\.*"); AddImguiBackendSources(); }
public DebugProject() : base(typeof(Target)) { // set paths RootPath = DebugProjectGenerator.DebugProjects[GetType()].ProjectFolder; SourceRootPath = RootPath; // add selected source files SourceFiles.AddRange(DebugProjectGenerator.DebugProjects[GetType()].ProjectFiles); // ensure that no file will be automagically added SourceFilesExtensions.Clear(); ResourceFilesExtensions.Clear(); PRIFilesExtensions.Clear(); ResourceFiles.Clear(); NoneExtensions.Clear(); AddTargets(DebugProjectGenerator.GetTargets()); }
private void LoadAllWithExtension(string dataDirectory, string extension) { foreach (var file in Directory.GetFiles(dataDirectory, "*" + extension)) { if (file.EndsWith(extension, StringComparison.OrdinalIgnoreCase)) { FileStream fs = null; try { fs = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); string lcfileName = Path.GetFileName(file).ToLower(); LodFile lod = new LodFile(this, fs); lod.LoadFAT(); ResourceFiles.Add(lod); } catch (Exception ex) { fs.Close(); } } } }
public ExternalResourceManager(bool createNode = true) { if (createNode) { Node = new GameObject("External Resources"); Node.SetActive(false); } try { Directory.CreateDirectory(Settings.ResourcesPath); Directory.CreateDirectory(Settings.SavedRobotsPath); } catch (Exception e) { Logger.Error($"{this}: Error creating directories", e); } if (!File.Exists(Settings.ResourcesFilePath)) { Logger.Debug("ExternalResourceManager: Failed to find file " + Settings.ResourcesFilePath); return; } Logger.Debug("ExternalResourceManager: Using resource file " + Settings.ResourcesFilePath); try { string text = File.ReadAllText(Settings.ResourcesFilePath); resourceFiles = JsonConvert.DeserializeObject <ResourceFiles>(text); } catch (Exception e) { Logger.Error($"{this}: Error reading config file", e); } }
public DebugProject() : base(typeof(Target), typeof(Configuration), isInternal: true) { _projectInfo = DebugProjectGenerator.DebugProjects[GetType()]; // set paths RootPath = _projectInfo.ProjectFolder; SourceRootPath = RootPath; // add selected source files SourceFiles.AddRange(_projectInfo.ProjectFiles); // ensure that no file will be automagically added SourceFilesExtensions.Clear(); ResourceFilesExtensions.Clear(); PRIFilesExtensions.Clear(); ResourceFiles.Clear(); NoneExtensions.Clear(); VsctExtension.Clear(); Name = _projectInfo.DisplayName; AddTargets(DebugProjectGenerator.GetTargets()); }
public ExePackaging() : base(typeof(CommonTarget)) { DeployProject = true; Name = "exepackaging"; SourceRootPath = Path.Combine(ProjectRootPath, @"codebase\temp\projects\" + Name); if (!Directory.Exists(SourceRootPath)) { Directory.CreateDirectory(SourceRootPath); } AndroidManifest = "AndroidManifest.xml"; AntBuildXml = "build.xml"; AntProjectPropertiesFile = "project.properties"; SourceFilesExtensions.Add(".xml"); SourceFilesExclude.Add("AndroidManifest.xml", "build.xml"); AddTargets(CommonTarget.GetAndroidTargets()); //the plugin and gradle version are good and stable version to be used with Android libraries, //we don't want to use the default version on VS(ver. 0.4.0 and 2.8 respectively) since it is quite old GradlePlugin = "gradle:4.2.0"; GradleVersion = "6.7.1"; // Path to the Gradle template files GradleTemplateFiles.Add(@"app\src\main\AndroidManifest.xml.template"); GradleTemplateFiles.Add(@"app\build.gradle.template"); GradleTemplateFiles.Add(@"build.gradle.template"); GradleTemplateFiles.Add(@"settings.gradle.template"); GradleTemplateFiles.Add(@"gradle\wrapper\gradle-wrapper.properties.template"); ResourceFiles.Add(@"app\src\main\res\values\strings.xml"); }
public static string GetPathByFileNameFromResources(string fileName, bool contains = false) { var value = ResourceFiles.FirstOrDefault(f => f.Key.Contains(fileName)); return(value.Key != null ? value.Value : string.Empty); }
public void Process(ConfigurationFile configurationFile) { Dictionary <string, string> aliases = configurationFile.Aliases.ToDictionary(x => x.Alias, x => x.FullClassName); ViewFileReader viewFileReader = new ViewFileReader(aliases); ViewFileProcessor viewFileProcessor = new ViewFileProcessor(); ViewFileWriter viewFileWriter = new ViewFileWriter(); DataTemplateProcessor dataTemplateProcessor = new DataTemplateProcessor(viewFileProcessor, viewFileWriter); List <Resource> globalResources = new List <Resource>(); List <StyleResource> globalStyleResources = new List <StyleResource>(); List <DataTemplateResource> globalDataTemplateResources = new List <DataTemplateResource>(); foreach (string resourceFile in configurationFile.GlobalResourceFiles) { string resourceRelativePath = PathHelper.GetRelativePath(resourceFile); Log.LogMessage(MessageImportance.High, "\t# Preprocessing resource file {0}", resourceRelativePath); List <Resource> resources = viewFileProcessor.ExtractGlobalResources(viewFileReader.Read(resourceFile)); List <StyleResource> styleResources = resources.Where(x => ParsingHelper.IsStyleTag(x.ResourceElement)).Select(x => new StyleResource(x)).ToList(); resources.RemoveAll(x => ParsingHelper.IsStyleTag(x.ResourceElement)); List <DataTemplateResource> dataTemplatesResources = resources.Where(x => ParsingHelper.IsDataTemplateTag(x.ResourceElement)).Select(x => new DataTemplateResource(x)).ToList(); resources.RemoveAll(x => ParsingHelper.IsDataTemplateTag(x.ResourceElement)); //assign an id to all data template before processing it (could be loop or just unordered things) string viewName = Path.GetFileNameWithoutExtension(resourceFile); foreach (DataTemplateResource dataTemplate in dataTemplatesResources) { dataTemplate.ViewId = string.Format("G_{0}_DT_{1}", viewName, dataTemplate.Key); dataTemplate.ViewHolderClassName = NameGeneratorHelper.GetViewHolderName(); } globalResources.AddRange(resources); globalStyleResources.AddRange(styleResources); globalDataTemplateResources.AddRange(dataTemplatesResources); } //process each data template foreach (DataTemplateResource dataTemplate in globalDataTemplateResources) { dataTemplateProcessor.Process(dataTemplate, globalResources, globalStyleResources, globalDataTemplateResources, configurationFile); } foreach (FileBindingDescription fileBindingDescription in configurationFile.FileDescriptions) { string viewInputRelativePath = PathHelper.GetRelativePath(fileBindingDescription.View.InputFile); string viewOutputRelativePath = PathHelper.GetRelativePath(fileBindingDescription.View.OutputFile); Log.LogMessage(MessageImportance.High, "\t# Preprocessing activity {0}.{1} with view {2}", fileBindingDescription.Activity.NamespaceName, fileBindingDescription.Activity.ClassName, viewInputRelativePath); XmlElement rootViewElement = viewFileReader.Read(fileBindingDescription.View.InputFile); //Parse expression, Extract resources and simplify the view file var expressionParsingResult = viewFileProcessor.ExtractExpressions(rootViewElement); List <IdViewObject> viewObjects = expressionParsingResult.Item2; List <XmlAttribute> expressionAttributes = expressionParsingResult.Item1; List <Resource> resources = viewFileProcessor.ExtractResources(rootViewElement); //filter resources for DataTemplate List <DataTemplateResource> dataTemplatesResources = resources.Where(x => ParsingHelper.IsDataTemplateTag(x.ResourceElement)).Select(x => new DataTemplateResource(x)).ToList(); resources.RemoveAll(x => ParsingHelper.IsDataTemplateTag(x.ResourceElement)); //filter resources for Style List <StyleResource> styleResources = resources.Where(x => ParsingHelper.IsStyleTag(x.ResourceElement)).Select(x => new StyleResource(x)).ToList(); resources.RemoveAll(x => ParsingHelper.IsStyleTag(x.ResourceElement)); List <StyleResource> totalStyleResources = new List <StyleResource>(styleResources); totalStyleResources.AddRange(globalStyleResources); //Write the view file for Android (axml format) Log.LogMessage(MessageImportance.High, "\t\t Generating view file {0}", viewOutputRelativePath); viewFileWriter.Write(rootViewElement, fileBindingDescription.View.OutputFile, totalStyleResources); ResourceFiles.Add(viewOutputRelativePath); //assign an id to all data template before processing it (could be loop or just unordered things) string viewName = Path.GetFileNameWithoutExtension(fileBindingDescription.View.OutputFile); foreach (DataTemplateResource dataTemplate in dataTemplatesResources) { dataTemplate.ViewId = string.Format("{0}_DT_{1}", viewName, dataTemplate.Key); dataTemplate.ViewHolderClassName = NameGeneratorHelper.GetViewHolderName(); } List <Resource> totalResources = new List <Resource>(resources); totalResources.AddRange(globalResources); List <DataTemplateResource> totalDataTemplateResources = new List <DataTemplateResource>(dataTemplatesResources); totalDataTemplateResources.AddRange(globalDataTemplateResources); //process each data template foreach (DataTemplateResource dataTemplate in dataTemplatesResources) { dataTemplateProcessor.Process(dataTemplate, totalResources, totalStyleResources, totalDataTemplateResources, configurationFile); } string classOutputFile = fileBindingDescription.Activity.OutputFile; string classOutputRelativePath = PathHelper.GetRelativePath(classOutputFile); List <Resource> mergedResources = new List <Resource>(totalResources); mergedResources.AddRange(totalDataTemplateResources); AbstractBindingHandlerClassGenerator generator; if (fileBindingDescription.Activity.IsFragment) { Log.LogMessage(MessageImportance.High, "\t\t Generating class file for Fragment to {0}", classOutputRelativePath); generator = new FragmentGenerator { BaseClassType = null, ClassName = fileBindingDescription.Activity.ClassName, Configuration = configurationFile, IsPartialClass = true, NamespaceName = fileBindingDescription.Activity.NamespaceName, }; } else { Log.LogMessage(MessageImportance.High, "\t\t Generating class file for Activity to {0}", classOutputRelativePath); generator = new ActivityGenerator { BaseClassType = null, ClassName = fileBindingDescription.Activity.ClassName, Configuration = configurationFile, IsPartialClass = true, NamespaceName = fileBindingDescription.Activity.NamespaceName, }; } generator.Preprocess(expressionAttributes, mergedResources, viewObjects); generator.Generate(classOutputFile); ClassFiles.Add(classOutputRelativePath); } ClassFiles.AddRange(dataTemplateProcessor.ClassFiles); ResourceFiles.AddRange(dataTemplateProcessor.ResourceFiles); CreateDummyClass(configurationFile); }
public void SetMap(string name, bool bufferOnly, bool thread) { if (!thread && !bufferOnly && this.MapSet) { this.Map.Render = false; } if (WaitMap) { WaitMap = false; Spawn.Load(@"Content\Scenes\Spawn\twilight_town_test.spawn"); Loading = LoadingState.NotLoading; } else { int index = BufferedMaps.IndexOf(name); map = null; if (index < 0) { if (thread) { WaitMap = true; new System.Threading.Thread(() => { map = new MAP(name); map.Parse(); ResourceFiles.Insert(0, map); BufferedMaps.Add(name); Maps.Add(map); while (Transition[0] > 0) { } SetMap("", bufferOnly, false); }).Start(); return; } else { map = new MAP(name); for (int i = 0; i < 10; i++) { string plus = @"\texture"; if (i > 0) { plus = @"\texture" + i.ToString(); } if (File.Exists(Path.GetDirectoryName(name) + plus + ".zip") && !File.Exists(Path.GetDirectoryName(name) + plus)) { DecompressFileLZMA(Path.GetDirectoryName(name) + plus + ".zip", Path.GetDirectoryName(name) + plus); } } map.Parse(); ResourceFiles.Insert(0, map); BufferedMaps.Add(name); Maps.Add(map); } } else { map = Maps[index]; } } if (!bufferOnly) { if (Action.thread != null) { Action.thread.Abort(); Action.thread = null; } Action.thread = new System.Threading.Thread(() => { while (true) { if (Action.oldTick != Program.game.ticks && (Loading == LoadingState.NotLoading || Loading_Type != LoadingType.Block)) { int count = Action.aAccount * 1; if (count > 0) { Action.aAccount = -1; for (int i = 0; i < count; i++) { Action.ac[i].Verify(); } Action.aAccount = 0; } count = Action.bAccount * 1; if (count > 0) { Action.bAccount = -1; for (int i = 0; i < count; i++) { Action.be[i].Verify(); } Action.bAccount = 0; } Action.oldTick = Program.game.ticks; } } }); Action.aAccount = 0; Action.bAccount = 0; Action.ac = null; Action.be = null; Action.thread.Start(); if (map != null) { alphaTest.FogEnabled = map.FogStart > 0 || map.FogEnd > 0; alphaTest.FogStart = map.FogStart; alphaTest.FogEnd = map.FogEnd; alphaTest.FogColor = map.FogColor; map.Render = true; map.JustLoaded = true; if (File.Exists(@"Content\Effects\Audio\BGM\" + map.Name + ".wav")) { Audio.NextBGM = @"Content\Effects\Audio\BGM\" + map.Name + ".wav"; } } this.Map = map; } graphics.GraphicsDevice.SamplerStates[0] = MainGame.DefaultSmaplerState; graphics.GraphicsDevice.BlendState = BlendState.NonPremultiplied; }
public LodFile GetByName(string name) { return(ResourceFiles.FirstOrDefault(r => string.Compare(r.Name, name, true) == 0)); }
public View3D( ) { InitializeComponent(); Loaded += UserControl_Loaded; _cameraFront = new Tuple <Vector3D, Point3D>(Camera.LookDirection, Camera.Position); _cameraSide = new Tuple <Vector3D, Point3D>(new Vector3D(20.066, 0, -5.976), new Point3D(-17.066, 0, 20.976)); //viewMover.Click += ( s, e ) => //{ // viewMover.Content = _watchAtSide ? "Вид сбоку" : "Вид сзади"; // _watchAtSide = !_watchAtSide; // if(_watchAtSide) // { // Camera.Position = _cameraSide.Item2; // Camera.LookDirection = _cameraSide.Item1; // } // else // { // Camera.Position = _cameraFront.Item2; // Camera.LookDirection = _cameraFront.Item1; // } //}; try { var path = ResourceFiles.GetFile(Config.Get().BoardBackImagePath); LayoutRoot.Background = new ImageBrush(new BitmapImage(new Uri(path))); } catch { } cancelButton.Click += async(s, e) => { var cur = await Task <bool> .Run(() => { if (_state.Moves.Count < 1) { return(false); } var res = CancelLastMove?.Invoke(); return(res.HasValue && res.Value); }); if (cur) { var move = _state.Moves[_state.Moves.Count - 1]; MovePiece(new Point(move.Item2.Column + 1, 8 - move.Item2.Row), new Point(move.Item1.Column + 1, 8 - move.Item1.Row)); } }; resignButton.Click += (s, e) => { MainPresenter.Get().ShowQuestion("Хотите сдаться?", (val) => { if (val) { Stoped?.Invoke(); GameLose(); } }); }; Border1.Fill = Border2.Fill = Border3.Fill = Border4.Fill = SystemColors.ControlTextBrush; BoardPositions = new ChessPiece[8, 8]; SetupButtons(); #region [Setup all fields] _piecesReg = new List <Tuple <Model.Game.Chess.Figure, ChessPiece> > { new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.BlackBishop, BBishop1), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.BlackBishop, BBishop2), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.BlackKnight, BKnight1), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.BlackKnight, BKnight2), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.BlackRook, BRook1), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.BlackRook, BRook2), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.BlackKing, BKing), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.BlackQueen, BQueen), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.WhiteBishop, WBishop1), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.WhiteBishop, WBishop2), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.WhiteKnight, WKnight1), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.WhiteKnight, WKnight2), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.WhiteRook, WRook1), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.WhiteRook, WRook2), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.WhiteKing, WKing), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.WhiteQueen, WQueen), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.BlackPawn, BPawn1), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.BlackPawn, BPawn2), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.BlackPawn, BPawn3), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.BlackPawn, BPawn4), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.BlackPawn, BPawn5), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.BlackPawn, BPawn6), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.BlackPawn, BPawn7), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.BlackPawn, BPawn8), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.WhitePawn, WPawn1), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.WhitePawn, WPawn2), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.WhitePawn, WPawn3), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.WhitePawn, WPawn4), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.WhitePawn, WPawn5), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.WhitePawn, WPawn6), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.WhitePawn, WPawn7), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.WhitePawn, WPawn8), }; #endregion }
public Settings( ) { InitializeComponent(); textLevelEnter.TextChanged += (s, e) => { try { var item = int.Parse(textLevelEnter.Text); if (item < 1) { e.Handled = true; } } catch { e.Handled = true; } }; comboBoxChessBoardType.ItemsSource = Enum.GetValues(typeof(ChessGameBoard)).Cast <ChessGameBoard>(); buttonBackImageSelect.Click += (s, e) => { var openD = new OpenFileDialog(); openD.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures); if (openD.ShowDialog() == DialogResult.OK) { var name = ResourceFiles.SaveFile(openD.FileName); UIData.BoardBackImagePath = name; } }; buttonColorBlackPiece.Click += (s, e) => { var colorD = new ColorDialog(); colorD.Color = System.Drawing.Color.FromArgb( UIData.BlackPieceColor.A, UIData.BlackPieceColor.R, UIData.BlackPieceColor.G, UIData.BlackPieceColor.B ); if (colorD.ShowDialog() == DialogResult.OK) { UIData.BlackPieceColor = Color.FromArgb( colorD.Color.A, colorD.Color.R, colorD.Color.G, colorD.Color.B); } }; buttonColorWhitePiece.Click += (s, e) => { var colorD = new ColorDialog(); colorD.Color = System.Drawing.Color.FromArgb( UIData.WhitePieceColor.A, UIData.WhitePieceColor.R, UIData.WhitePieceColor.G, UIData.WhitePieceColor.B); if (colorD.ShowDialog() == DialogResult.OK) { UIData.WhitePieceColor = Color.FromArgb( colorD.Color.A, colorD.Color.R, colorD.Color.G, colorD.Color.B); } }; buttonProfileImageSelect.Click += (s, e) => { var openD = new OpenFileDialog(); openD.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures); if (openD.ShowDialog() == DialogResult.OK) { var name = ResourceFiles.SaveFile(openD.FileName); UIData.UserProfile.ImagePath = name; } }; }