private void savefile() { string output = ""; output += "\"SCREENWIDTH\" \"" + ResolutionX.ToString() + "\"\n"; output += "\"GameScreenWidth\" \"" + ResolutionX.ToString() + "\"\n"; output += "\"SCREENHEIGHT\" \"" + ResolutionY.ToString() + "\"\n"; output += "\"GameScreenHeight\" \"" + ResolutionY.ToString() + "\"\n"; if (GameBitDepth) { output += "\"GameBitDepth\" \"32\"\n"; } else { output += "\"GameBitDepth\" \"16\"\n"; } if (FixTJunc) { output += "\"FixTJunc\" \"1\"\n"; } else { output += "\"FixTJunc\" \"0\"\n"; } output += text; File.WriteAllText(autoexecfile, output); }
///<summary> /// Serves as a hash of this type. ///</summary> public override int GetHashCode() { return (ColorSpace.GetHashCode() ^ CompressionMethod.GetHashCode() ^ Format.GetHashCode() ^ Height.GetHashCode() ^ Interlace.GetHashCode() ^ ResolutionUnits.GetHashCode() ^ ResolutionX.GetHashCode() ^ ResolutionY.GetHashCode() ^ Width.GetHashCode()); }
public void readfile() { StreamReader SR = new StreamReader(autoexecfile); text = ""; string line = ""; ResolutionX = 1280; ResolutionY = 720; GameBitDepth = true; ScaleMenus = 1.0f; TripleBuffer = false; FixTJunc = false; while ((line = SR.ReadLine()) != null) //Yes, I know this is slow... does its job for such files anyway { if (line.StartsWith("\"SCREENWIDTH\"", StringComparison.InvariantCultureIgnoreCase)) { var res = 0; line = Regex.Match(line, @"\d+").Value; if (int.TryParse(line, out res)) { ResolutionX = res; } T_ResolutionX.Text = ResolutionX.ToString(); continue; } else if (line.StartsWith("\"GameScreenWidth\"", StringComparison.InvariantCultureIgnoreCase)) { line = ""; continue; } else if (line.StartsWith("\"SCREENHEIGHT\"", StringComparison.InvariantCultureIgnoreCase)) { var res = 0; line = Regex.Match(line, @"\d+").Value; if (int.TryParse(line, out res)) { ResolutionY = res; } T_ResolutionY.Text = ResolutionY.ToString(); continue; } else if (line.StartsWith("\"GameScreenHeight\"", StringComparison.InvariantCultureIgnoreCase)) { line = ""; continue; } else if (line.StartsWith("\"GameBitDepth\"", StringComparison.InvariantCultureIgnoreCase)) { if (line.EndsWith("\"16\"")) { GameBitDepth = false; C_32color.Checked = false; } else { GameBitDepth = true; C_32color.Checked = true; } continue; } else if (line.StartsWith("\"FixTJunc\"", StringComparison.InvariantCultureIgnoreCase)) { if (line.EndsWith("\"1\"")) { FixTJunc = true; } else { FixTJunc = false; } continue; } else { text = text + line + "\n"; } } B_ManualEdit.Text = text; SR.Close(); notificationToBig = false; notificationWindowed = false; }
/// <summary> /// Converts the page resolution to human-readable string. /// </summary> /// <returns>A string that represents this page resolution.</returns> public override string ToString() { return(ResolutionX.ToString(CultureInfo.CurrentCulture) + " x " + ResolutionY.ToString(CultureInfo.CurrentCulture) + " (Qualitative: " + QualitativeResolution.ToString() + ")"); }
public void FillCurrentPage() { labelColorType.Text += ColorType; labelResolution.Text += (imageType.ToUpper() == "TIF" ? ResolutionY.ToString() + "x" + ResolutionX.ToString() : Environment.StringResources.GetString("PrinterOp_Status2")); labelSize.Text += ((PixelHeight * 2.54) / ResolutionY).ToString("N2") + "cm x " + ((PixelWigth * 2.54) / ResolutionX).ToString("N2") + "cm"; if (PixelHeight > 2950 * ResolutionY / 254 && PixelHeight < 2990 * ResolutionY / 254 && PixelWigth > 2080 * ResolutionY / 254 && PixelWigth < 2120 * ResolutionY / 254) { labelSize.Text += " (A4)"; } if (PixelWigth > 2950 * ResolutionY / 254 && PixelWigth < 2990 * ResolutionY / 254 && PixelHeight > 2080 * ResolutionY / 254 && PixelHeight < 2120 * ResolutionY / 254) { labelSize.Text += " (A4 landscape)"; } }