public static bool Save() { bool returnValue; try { using (RegistryKey registryKey = OpenRegistryKey()) { registryKey.SetValue(BACKGROUND_COLOR, BackgroundColor.ToArgb(), RegistryValueKind.DWord); registryKey.SetValue(BACKGROUND_IMAGE, BackgroundImage, RegistryValueKind.String); registryKey.SetValue(BORDER_COLOR, BorderColor.ToArgb(), RegistryValueKind.DWord); registryKey.SetValue(FADE_DELAY, FadeDelay, RegistryValueKind.DWord); registryKey.SetValue(FADESPEED, FadeSpeed, RegistryValueKind.DWord); registryKey.SetValue(FOREGROUND_COLOR, ForegroundColor.ToArgb(), RegistryValueKind.DWord); registryKey.SetValue(MAXIMUM_CACHE_ITEMS, MaximumCacheItems, RegistryValueKind.DWord); registryKey.SetValue(RANDOM_VERSE, RandomVerse.ToString(), RegistryValueKind.String); registryKey.SetValue(TEXT_FONT, TextFont.ToStringEx()); registryKey.SetValue(TITLE_FONT, TitleFont.ToStringEx()); registryKey.Close(); } returnValue = true; } catch (Exception e) { Logging.LogException(e); returnValue = false; } return(returnValue); }
//Implement ISerializable //No layer is required public virtual void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { info.AddValue("Key", Key); info.AddValue("BorderColor", BorderColor.ToArgb().ToString()); info.AddValue("BorderStyle", Convert.ToInt32(BorderStyle).ToString()); info.AddValue("BorderWidth", BorderWidth); info.AddValue("DrawShadow", DrawShadow); info.AddValue("Opacity", Opacity); info.AddValue("SmoothingMode", Convert.ToInt32(SmoothingMode).ToString()); info.AddValue("Tooltip", Tooltip); info.AddValue("Visible", Visible); info.AddValue("ZOrder", ZOrder); info.AddValue("Path", Serialize.AddPath(GetPathInternal())); //Check if tag can be added Serialize.SerializeTag(info, Tag); }
//Implement ISerializable public virtual void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { info.AddValue("Key", Key); info.AddValue("Redraw", Redraw); info.AddValue("BasePath", Serialize.AddPath(mBasePath)); info.AddValue("BaseSize", Serialize.AddSizeF(BaseSize)); info.AddValue("BaseInternalRectangle", Serialize.AddRectangleF(BaseInternalRectangle)); info.AddValue("BorderColor", BorderColor.ToArgb().ToString()); info.AddValue("BorderStyle", Convert.ToInt32(BorderStyle).ToString()); info.AddValue("SmoothingMode", Convert.ToInt32(SmoothingMode).ToString()); info.AddValue("BackColor", BackColor.ToArgb().ToString()); info.AddValue("GradientColor", GradientColor.ToArgb().ToString()); info.AddValue("GradientMode", Convert.ToInt32(GradientMode).ToString()); info.AddValue("DrawGradient", DrawGradient); info.AddValue("Options", Convert.ToInt32(Options).ToString()); }
public void Save() { string[] values = new string[17]; values[0] = name; values[1] = imagePath; values[2] = anchor.ToString(); values[3] = increment.ToString(); values[4] = xPos.ToString(); values[5] = yPos.ToString(); values[6] = lastUsed.ToString(); values[7] = FontName; values[8] = FontSize.ToString(); values[9] = IsBold.ToString(); values[10] = IsCursive.ToString(); values[11] = FontColor.ToArgb().ToString(); values[12] = BorderSize.ToString(); values[13] = BorderColor.ToArgb().ToString(); DataHelper.SaveData(values, name); }
private SQLiteParameter[] GetSqlParameters() { List <SQLiteParameter> SqlParmColl = new List <SQLiteParameter>(); try { SqlParmColl.Add(CommonDB.AddSqlParm("@ID", ID, DbType.Int64)); SqlParmColl.Add(CommonDB.AddSqlParm("@DisplayID", DisplayID, DbType.Int64)); SqlParmColl.Add(CommonDB.AddSqlParm("@oIndex", oIndex, DbType.Int32)); SqlParmColl.Add(CommonDB.AddSqlParm("@DlgType", DlgType, DbType.Byte)); SqlParmColl.Add(CommonDB.AddSqlParm("@DlgIndex", DlgIndex, DbType.Int32)); SqlParmColl.Add(CommonDB.AddSqlParm("@Left", Left, DbType.Int32)); SqlParmColl.Add(CommonDB.AddSqlParm("@Right", Right, DbType.Int32)); SqlParmColl.Add(CommonDB.AddSqlParm("@Top", Top, DbType.Int32)); SqlParmColl.Add(CommonDB.AddSqlParm("@Bottom", Bottom, DbType.Int32)); SqlParmColl.Add(CommonDB.AddSqlParm("@VertHorz", VertHorz, DbType.Boolean)); SqlParmColl.Add(CommonDB.AddSqlParm("@RoolerFormat", RoolerFormat, DbType.Byte)); SqlParmColl.Add(CommonDB.AddSqlParm("@Direction", Direction, DbType.Byte)); SqlParmColl.Add(CommonDB.AddSqlParm("@BarColor", BarColor, DbType.String)); SqlParmColl.Add(CommonDB.AddSqlParm("@BarColorID", BarColorID, DbType.Int32)); SqlParmColl.Add(CommonDB.AddSqlParm("@BarColorDefult", BarColorDefult.ToArgb(), DbType.Int32)); SqlParmColl.Add(CommonDB.AddSqlParm("@BackColor", BackColor.ToArgb(), DbType.Int32)); SqlParmColl.Add(CommonDB.AddSqlParm("@BorderColor", BorderColor.ToArgb(), DbType.Int32)); SqlParmColl.Add(CommonDB.AddSqlParm("@Index", Index, DbType.Int32)); SqlParmColl.Add(CommonDB.AddSqlParm("@Font", Font, DbType.String)); SqlParmColl.Add(CommonDB.AddSqlParm("@FontColor", FontColor.ToArgb(), DbType.Int32)); SqlParmColl.Add(CommonDB.AddSqlParm("@LastRev", LastRev, DbType.Boolean)); SqlParmColl.Add(CommonDB.AddSqlParm("@LockPosition", LockPosition, DbType.Boolean)); SqlParmColl.Add(CommonDB.AddSqlParm("@LockEdit", LockEdit, DbType.Boolean)); SqlParmColl.Add(CommonDB.AddSqlParm("@Layer", Layer, DbType.Int32)); SqlParmColl.Add(CommonDB.AddSqlParm("@CompiledExp", CompiledExp, DbType.Binary)); SqlParmColl.Add(CommonDB.AddSqlParm("@validexpression", validexpression, DbType.Boolean)); return(SqlParmColl.ToArray()); } catch (SQLiteException Exc) { throw Exc; } }
public override void Render(RenderContext renderContext, Stretch stretchMode, StretchDirection stretchDirection) { Allocate(); Texture currentTexture = CurrentTexture; SizeF currentRawSourceSize = CurrentRawSourceSize; RectangleF currentTextureClip = CurrentTextureClip; Vector4 frameData = new Vector4(currentRawSourceSize.Width, currentRawSourceSize.Height, (float)EffectTimer, 0); if (_transitionActive) { double elapsed = (SkinContext.FrameRenderingStartTime - _transitionStart).TotalSeconds / Math.Max(TransitionDuration, 0.01); if (elapsed > 1.0) { _transitionActive = false; } else { Texture lastTexture = LastTexture; SizeF lastRawSourceSize = LastRawSourceSize; RectangleF lastTextureClip = LastTextureClip; Vector4 lastFrameData = new Vector4(lastRawSourceSize.Width, lastRawSourceSize.Height, (float)EffectTimer, 0); Texture start = lastTexture ?? NullTexture.Texture; Texture end = currentTexture ?? NullTexture.Texture; if (start != end) { SizeF startSize = StretchSource(_lastImageContext.RotatedFrameSize, lastRawSourceSize, stretchMode, stretchDirection); SizeF endSize = StretchSource(_imageContext.RotatedFrameSize, currentRawSourceSize, stretchMode, stretchDirection); // Render transition from last texture to current texture _lastImageContext.Update(startSize, start, lastTextureClip); if (_imageContext.StartRenderTransition(renderContext, (float)elapsed, _lastImageContext, endSize, end, currentTextureClip, BorderColor.ToArgb(), lastFrameData, frameData)) { _primitiveBuffer.Render(0); _imageContext.EndRenderTransition(); } } return; } } if (IsAllocated) { SizeF sourceSize = StretchSource(_imageContext.RotatedFrameSize, currentRawSourceSize, stretchMode, stretchDirection); if (_imageContext.StartRender(renderContext, sourceSize, currentTexture, currentTextureClip, BorderColor.ToArgb(), frameData)) { _primitiveBuffer.Render(0); _imageContext.EndRender(); } } }
public override void Render(RenderContext renderContext, Stretch stretchMode, StretchDirection stretchDirection) { if (!IsAllocated) { return; } SizeF rawSourceSize = RawSourceSize; SizeF modifiedSourceSize = StretchSource(_imageContext.RotatedFrameSize, rawSourceSize, stretchMode, stretchDirection); Vector4 frameData = new Vector4(rawSourceSize.Width, rawSourceSize.Height, (float)EffectTimer, 0); if (_imageContext.StartRender(renderContext, modifiedSourceSize, Texture, TextureClip, BorderColor.ToArgb(), frameData)) { _primitiveBuffer.Render(0); _imageContext.EndRender(); } }
public void WriteToRegistry(RegistryKey key) { Modified = false; // save the standard color values that all schemes have key.SetValue("BorderColor", unchecked ((Int32)BorderColor.ToArgb()), RegistryValueKind.DWord); key.SetValue("HighlightColor", unchecked ((Int32)HighlightColor.ToArgb()), RegistryValueKind.DWord); key.SetValue("TextColor", unchecked ((Int32)TextColor.ToArgb()), RegistryValueKind.DWord); // save out all square colors/textures counting the number of // square colors in the scheme as we go int nSquareColors = 0; while (true) { if (SquareTextures != null && SquareTextures.ContainsKey(nSquareColors)) { key.SetValue("SquareTexture" + (nSquareColors + 1).ToString(), SquareTextures[nSquareColors].Name, RegistryValueKind.String); } else if (SquareColors.ContainsKey(nSquareColors)) { key.SetValue("SquareColor" + (nSquareColors + 1).ToString(), unchecked ((Int32)SquareColors[nSquareColors].ToArgb()), RegistryValueKind.DWord); // if there's a specified texture already, remove it or else // it will override the color when we load this scheme again if (key.GetValue("SquareTexture" + (nSquareColors + 1).ToString()) != null) { key.DeleteValue("SquareTexture" + (nSquareColors + 1).ToString()); } } else { break; } nSquareColors++; } // clear out any additional colors/textures specified in // the registry that we no longer have while (true) { bool found = false; int extraColorCount = nSquareColors + 1; if (key.GetValue("SquareTexture" + extraColorCount.ToString()) != null) { key.DeleteValue("SquareTexture" + extraColorCount.ToString()); found = true; } if (key.GetValue("SquareColor" + extraColorCount.ToString()) != null) { key.DeleteValue("SquareColor" + extraColorCount.ToString()); found = true; } extraColorCount++; if (!found) { break; } } // write out the player colors foreach (KeyValuePair <int, Color> pair in PlayerColors) { key.SetValue("PlayerColor" + (pair.Key + 1).ToString(), unchecked ((Int32)pair.Value.ToArgb()), RegistryValueKind.DWord); } }