public void SaveProfile() { if (String.IsNullOrEmpty(FilePath)) { string filename = string.Empty; // ReSharper disable LoopCanBeConvertedToQuery foreach (char chr in PlayerName) // ReSharper restore LoopCanBeConvertedToQuery { if (char.IsLetter(chr)) { filename += chr.ToString(); } } if (filename == "") { filename = "1"; } FilePath = CHelper.GetUniqueFileName(Path.Combine(CBase.Settings.GetDataPath(), CBase.Settings.GetFolderProfiles()), filename + ".xml"); } var xml = new CXmlSerializer(); xml.Serialize(FilePath, this); }
public void Save() { if (string.IsNullOrEmpty(File)) { string filename = string.Empty; // ReSharper disable LoopCanBeConvertedToQuery foreach (char chr in Name) // ReSharper restore LoopCanBeConvertedToQuery { if (char.IsLetter(chr)) { filename += chr.ToString(); } } if (filename == "") { filename = "1"; } File = CHelper.GetUniqueFileName(Path.Combine(CSettings.DataFolder, CConfig.FolderPlaylists), filename + ".xml"); } SPlaylist data = new SPlaylist { Info = { Name = Name }, Songs = Songs.Select(plSong => plSong.ToStruct()).ToArray() }; var xml = new CXmlSerializer(); xml.Serialize(File, data); }
/// <summary> /// Creates a Screenshot of the current frame /// </summary> public void MakeScreenShot() { string file = CHelper.GetUniqueFileName(Path.Combine(CSettings.DataFolder, CSettings.FolderNameScreenshots), "Screenshot.png"); //create a surface of the frame using (Surface surface = _Device.GetBackBuffer(0, 0)) { var screen = new Bitmap(Surface.ToStream(surface, ImageFileFormat.Png)); screen.Save(file, ImageFormat.Png); screen.Dispose(); } }
private static string _SaveImage(CBase64Image imageDate, string name, string folder) { Image avatarImage = imageDate.GetImage(); string extension = imageDate.GetImageType(); if (!Directory.Exists(folder)) { Directory.CreateDirectory(folder); } string file = CHelper.GetUniqueFileName(folder, name + "." + extension); avatarImage.Save(file); return(file); }
public void MakeScreenShot() { string file = CHelper.GetUniqueFileName(Path.Combine(CSettings.DataFolder, CSettings.FolderNameScreenshots), "Screenshot.png"); int width = GetScreenWidth(); int height = GetScreenHeight(); using (var screen = new Bitmap(width, height)) { BitmapData bmpData = screen.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb); GL.ReadPixels(0, 0, width, height, PixelFormat.Bgra, PixelType.UnsignedByte, bmpData.Scan0); screen.UnlockBits(bmpData); screen.RotateFlip(RotateFlipType.RotateNoneFlipY); screen.Save(file, ImageFormat.Png); } }
private void _OnSaveSnapshot() { string file = CHelper.GetUniqueFileName(Path.Combine(CSettings.DataFolder, CConfig.ProfileFolders[0]), "snapshot.png"); _Snapshot.Save(file, ImageFormat.Png); _Snapshot = null; CDraw.RemoveTexture(ref _WebcamTexture); _Buttons[_ButtonSaveSnapshot].Visible = false; _Buttons[_ButtonDiscardSnapshot].Visible = false; _Buttons[_ButtonTakeSnapshot].Visible = false; _Buttons[_ButtonWebcam].Visible = CWebcam.IsDeviceAvailable(); int id = CProfiles.NewAvatar(file); CProfiles.SetAvatar(_SelectSlides[_SelectSlideProfiles].SelectedTag, id); _LoadAvatars(false); _SelectElement(_Buttons[_ButtonSave]); }
public void MakeScreenShot() { string file = CHelper.GetUniqueFileName(Path.Combine(CSettings.DataFolder, CSettings.FolderNameScreenshots), "Screenshot.png"); _Backbuffer.Save(file, ImageFormat.Png); }