示例#1
0
 public bool DoesEmblemMatch(NetworkGuildEmblem emblem)
 {
     return(BackgroundColor.ToArgb() == emblem.backgroundColor &&
            BackgroundShape == emblem.backgroundShape &&
            SymbolColor.ToArgb() == emblem.symbolColor &&
            SymbolShape == emblem.symbolShape);
 }
示例#2
0
        internal cef_settings_t *ToNative()
        {
            var ptr = cef_settings_t.Alloc();

            ptr->no_sandbox = NoSandbox ? 1 : 0;
            cef_string_t.Copy(BrowserSubprocessPath, &ptr->browser_subprocess_path);
            cef_string_t.Copy(FrameworkDirPath, &ptr->framework_dir_path);
            cef_string_t.Copy(MainBundlePath, &ptr->main_bundle_path);
            ptr->multi_threaded_message_loop  = MultiThreadedMessageLoop ? 1 : 0;
            ptr->windowless_rendering_enabled = WindowlessRenderingEnabled ? 1 : 0;
            ptr->external_message_pump        = ExternalMessagePump ? 1 : 0;
            ptr->command_line_args_disabled   = CommandLineArgsDisabled ? 1 : 0;
            cef_string_t.Copy(CachePath, &ptr->cache_path);
            cef_string_t.Copy(RootCachePath, &ptr->root_cache_path);
            cef_string_t.Copy(UserDataPath, &ptr->user_data_path);
            ptr->persist_session_cookies  = PersistSessionCookies ? 1 : 0;
            ptr->persist_user_preferences = PersistUserPreferences ? 1 : 0;
            cef_string_t.Copy(UserAgent, &ptr->user_agent);
            cef_string_t.Copy(ProductVersion, &ptr->product_version);
            cef_string_t.Copy(Locale, &ptr->locale);
            cef_string_t.Copy(LogFile, &ptr->log_file);
            ptr->log_severity = LogSeverity;
            cef_string_t.Copy(JavaScriptFlags, &ptr->javascript_flags);
            cef_string_t.Copy(ResourcesDirPath, &ptr->resources_dir_path);
            cef_string_t.Copy(LocalesDirPath, &ptr->locales_dir_path);
            ptr->pack_loading_disabled          = PackLoadingDisabled ? 1 : 0;
            ptr->remote_debugging_port          = RemoteDebuggingPort;
            ptr->uncaught_exception_stack_size  = UncaughtExceptionStackSize;
            ptr->ignore_certificate_errors      = IgnoreCertificateErrors ? 1 : 0;
            ptr->enable_net_security_expiration = EnableNetSecurityExpiration ? 1 : 0;
            ptr->background_color = BackgroundColor.ToArgb();
            cef_string_t.Copy(AcceptLanguageList, &ptr->accept_language_list);
            cef_string_t.Copy(ApplicationClientIdForFileScanning, &ptr->application_client_id_for_file_scanning);
            return(ptr);
        }
示例#3
0
        internal cef_settings_t *ToNative()
        {
            var ptr = cef_settings_t.Alloc();

            ptr->single_process = SingleProcess ? 1 : 0;
            ptr->no_sandbox     = NoSandbox ? 1 : 0;
            cef_string_t.Copy(BrowserSubprocessPath, &ptr->browser_subprocess_path);
            ptr->multi_threaded_message_loop  = MultiThreadedMessageLoop ? 1 : 0;
            ptr->windowless_rendering_enabled = WindowlessRenderingEnabled ? 1 : 0;
            ptr->command_line_args_disabled   = CommandLineArgsDisabled ? 1 : 0;
            cef_string_t.Copy(CachePath, &ptr->cache_path);
            cef_string_t.Copy(UserDataPath, &ptr->user_data_path);
            ptr->persist_session_cookies  = PersistSessionCookies ? 1 : 0;
            ptr->persist_user_preferences = PersistUserPreferences ? 1 : 0;
            cef_string_t.Copy(UserAgent, &ptr->user_agent);
            cef_string_t.Copy(ProductVersion, &ptr->product_version);
            cef_string_t.Copy(Locale, &ptr->locale);
            cef_string_t.Copy(LogFile, &ptr->log_file);
            ptr->log_severity = LogSeverity;
            cef_string_t.Copy(JavaScriptFlags, &ptr->javascript_flags);
            cef_string_t.Copy(ResourcesDirPath, &ptr->resources_dir_path);
            cef_string_t.Copy(LocalesDirPath, &ptr->locales_dir_path);
            ptr->pack_loading_disabled         = PackLoadingDisabled ? 1 : 0;
            ptr->remote_debugging_port         = RemoteDebuggingPort;
            ptr->uncaught_exception_stack_size = UncaughtExceptionStackSize;
            ptr->context_safety_implementation = (int)ContextSafetyImplementation;
            ptr->ignore_certificate_errors     = IgnoreCertificateErrors ? 1 : 0;
            ptr->background_color = BackgroundColor.ToArgb();
            cef_string_t.Copy(AcceptLanguageList, &ptr->accept_language_list);
            return(ptr);
        }
示例#4
0
        private static void WaveTransform(ref DirectBitmap img, uint waveDistortionPeriod, uint waveDistortionAmplitude)
        {
            double F = 0.08 * waveDistortionPeriod / 100d;
            double A = 1.8 * waveDistortionAmplitude / 100d;

            DirectBitmap transImg = new DirectBitmap(img.Width, img.Height);

            int backgroundColor = BackgroundColor.ToArgb();

            for (int i = 0; i < img.Width * img.Height; i++)
            {
                transImg.Bits[i] = backgroundColor;
            }

            for (int x = 0; x < img.Width; x++)
            {
                for (int y = 0; y < img.Height; y++)
                {
                    int _x = Math.Max(Math.Min(Convert.ToInt32(Math.Round(x + (A * Math.Sin(2.0 * Math.PI * y * F)))), img.Width - 1), 0);
                    int _y = y;

                    transImg.Bits[x + y * img.Width] = img.Bits[_x + _y * img.Width];
                }
            }

            img.Dispose();
            img = transImg;
        }
        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);
        }
示例#6
0
        public static void Save()
        {
            try {
                Directory.CreateDirectory(SettingsDir);
                var ms = new MemoryStream();
                var xw = new XmlTextWriter(ms, Encoding.UTF8);
                xw.Formatting = Formatting.Indented;
                xw.WriteStartDocument();
                xw.WriteStartElement("settings");

                xw.WriteElementString("BackgroundColor", BackgroundColor.ToArgb().ToString());
                xw.WriteElementString("Email", Email);
                xw.WriteElementString("Delay", ((int)Delay.TotalMilliseconds).ToString());

                xw.WriteElementString("active_skin", ActiveSkin?.Path ?? "");
                xw.WriteElementString("active_dev_path", GetActiveController()?.DevicePath ?? "");

                xw.WriteStartElement("skin_settings");
                foreach (var skin in Skins)
                {
                    xw.WriteStartElement("skin");
                    xw.WriteAttributeString("skin_path", skin.Path);
                    if (WindowSizes.ContainsKey(skin))
                    {
                        var sz = WindowSizes[skin];
                        xw.WriteAttributeString("window_size", $"{sz.Width}x{sz.Height}");
                    }
                    xw.WriteEndElement();
                }
                xw.WriteEndElement();

                xw.WriteStartElement("arduino_mapping");
                foreach (var mapEntry in ArduinoMapping)
                {
                    xw.WriteStartElement("map");
                    xw.WriteAttributeString("port", mapEntry.Key);
                    xw.WriteAttributeString("type", mapEntry.Value.ToString());
                    xw.WriteEndElement();
                }
                xw.WriteEndElement();

                xw.WriteEndElement();                 // settings
                xw.WriteEndDocument();
                xw.Flush();
                xw.Close();

                File.WriteAllBytes(SettingsFile, ms.ToArray());
                ms.Dispose();
            }
            catch (IOException exc) {
                MessageBox.Show("IO Error while saving: " + exc);
            }
            catch (XmlException exc) {
                MessageBox.Show("XML Error while saving: " + exc);
            }
            catch (Exception exc) {
                MessageBox.Show("Unknown Error while saving: " + exc);
            }
        }
        /// <summary>
        /// Method required for <see cref="ISerializable"/>; serializes the connection data to <paramref name="info"/>.
        /// </summary>
        /// <param name="info">Serialization store that the connection's data will be written to.</param>
        /// <param name="context">Streaming context to use during the serialization process.</param>
        public override void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            base.GetObjectData(info, context);

            info.AddValue("TextColor", TextColor.ToArgb());
            info.AddValue("BackgroundColor", BackgroundColor.ToArgb());
            info.AddValue("FontFamily", FontFamily);
            info.AddValue("FontSize", FontSize);
        }
示例#8
0
        /// <summary>
        /// Method required for <see cref="ISerializable"/>; serializes the connection data to <paramref name="info"/>.
        /// </summary>
        /// <param name="info">Serialization store that the connection's data will be written to.</param>
        /// <param name="context">Streaming context to use during the serialization process.</param>
        public override void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            base.GetObjectData(info, context);

            info.AddValue("IdentityFile", IdentityFile);
            info.AddValue("TextColor", TextColor.ToArgb());
            info.AddValue("BackgroundColor", BackgroundColor.ToArgb());
            info.AddValue("FontFamily", FontFamily);
            info.AddValue("FontSize", FontSize);
            info.AddValue("Encoding", Encoding.ToString("G"));
            info.AddValue("Port", Port);
        }
示例#9
0
        public void AppendRtf(StringBuilder r, Dictionary <int, int> colorTable, Dictionary <string, int> fontTable)
        {
            var a = false;

            if (FontName != null && FontName.Length > 0)
            {
                var ci = fontTable[FontName];
                r.AppendFormat(@"\f{0}", ci);
                a = true;
            }
            if (FontSize > 1)
            {
                r.AppendFormat(@"\fs{0}", (int)(2 * FontSize + 0.5f));
                a = true;
            }

            if (ForegroundColor != null)
            {
                var ci = colorTable[ForegroundColor.ToArgb()];
                r.AppendFormat(@"\cf{0}", ci);
                a = true;
            }

            if (BackgroundColor != null)
            {
                var ci = colorTable[BackgroundColor.ToArgb()];
                r.AppendFormat(@"\highlight{0}", ci);
                a = true;
            }

            if (UnderlineStyle != UnderlineStyle.None)
            {
                var ci = colorTable[UnderlineColor.ToArgb()];
                r.AppendFormat(@"\ulc{0}\ulwave", ci);
                a = true;
            }

            if (!string.IsNullOrEmpty(Link))
            {
                //r.AppendFormat (@"{{{{\field{{\*\fldinst{{HYPERLINK ""{0}"" }}}}{{\fldrslt{{\ul ", Link.Replace ('\"', ' '));
                r.Append(@"\ul");
                a = true;
            }

            if (a)
            {
                r.Append(' ');
            }
        }
示例#10
0
        /// <summary>
        /// Save theme compatible with v1.5+
        /// </summary>
        /// <param name="dir"></param>
        public void SaveAsTheme(string dir)
        {
            XmlDocument doc   = new XmlDocument();
            XmlElement  root  = doc.CreateElement("ImageGlass"); //<ImageGlass>
            XmlElement  nType = doc.CreateElement("Theme");      //<Theme>

            XmlElement n = doc.CreateElement("Info");            // <Info>

            n.SetAttribute("name", name);
            n.SetAttribute("version", version);
            n.SetAttribute("author", author);
            n.SetAttribute("email", email);
            n.SetAttribute("website", website);
            n.SetAttribute("description", description);
            n.SetAttribute("type", "ImageGlass Theme Configuration");
            n.SetAttribute("compatibility", compatibility);
            n.SetAttribute("preview", Path.GetFileName(PreviewImage.Filename));
            nType.AppendChild(n);

            n = doc.CreateElement("main");// <main>
            n.SetAttribute("topbar", Path.GetFileName(ToolbarBackgroundImage.Filename));
            n.SetAttribute("topbarcolor", ToolbarBackgroundColor.ToArgb().ToString());
            n.SetAttribute("bottombar", Path.GetFileName(ThumbnailBackgroundImage.Filename));
            n.SetAttribute("bottombarcolor", ThumbnailBackgroundColor.ToArgb().ToString());
            n.SetAttribute("backcolor", BackgroundColor.ToArgb().ToString());
            n.SetAttribute("statuscolor", TextInfoColor.ToArgb().ToString());
            nType.AppendChild(n);

            n = doc.CreateElement("toolbar_icon");// <toolbar_icon>
            n.SetAttribute("back", Path.GetFileName(ToolbarIcons.ViewPreviousImage.Filename));
            n.SetAttribute("next", Path.GetFileName(ToolbarIcons.ViewNextImage.Filename));
            n.SetAttribute("leftrotate", Path.GetFileName(ToolbarIcons.RotateLeft.Filename));
            n.SetAttribute("rightrotate", Path.GetFileName(ToolbarIcons.RotateRight.Filename));
            n.SetAttribute("zoomin", Path.GetFileName(ToolbarIcons.ZoomIn.Filename));
            n.SetAttribute("zoomout", Path.GetFileName(ToolbarIcons.ZoomOut.Filename));
            n.SetAttribute("zoomlock", Path.GetFileName(ToolbarIcons.LockRatio.Filename));
            n.SetAttribute("scaletofit", Path.GetFileName(ToolbarIcons.ActualSize.Filename));
            n.SetAttribute("scaletowidth", Path.GetFileName(ToolbarIcons.ScaleToWidth.Filename));
            n.SetAttribute("scaletoheight", Path.GetFileName(ToolbarIcons.ScaleToHeight.Filename));
            n.SetAttribute("autosizewindow", Path.GetFileName(ToolbarIcons.AdjustWindowSize.Filename));
            n.SetAttribute("open", Path.GetFileName(ToolbarIcons.OpenFile.Filename));
            n.SetAttribute("refresh", Path.GetFileName(ToolbarIcons.Refresh.Filename));
            n.SetAttribute("gotoimage", Path.GetFileName(ToolbarIcons.GoToImage.Filename));
            n.SetAttribute("thumbnail", Path.GetFileName(ToolbarIcons.ThumbnailBar.Filename));
            n.SetAttribute("caro", Path.GetFileName(ToolbarIcons.CheckedBackground.Filename));
            n.SetAttribute("fullscreen", Path.GetFileName(ToolbarIcons.FullScreen.Filename));
            n.SetAttribute("slideshow", Path.GetFileName(ToolbarIcons.Slideshow.Filename));
            n.SetAttribute("convert", Path.GetFileName(ToolbarIcons.Convert.Filename));
            n.SetAttribute("print", Path.GetFileName(ToolbarIcons.Print.Filename));
            n.SetAttribute("uploadfb", Path.GetFileName(ToolbarIcons.Sharing.Filename));
            n.SetAttribute("extension", Path.GetFileName(ToolbarIcons.Plugins.Filename));
            n.SetAttribute("settings", Path.GetFileName(ToolbarIcons.Settings.Filename));
            n.SetAttribute("about", Path.GetFileName(ToolbarIcons.About.Filename));
            n.SetAttribute("menu", Path.GetFileName(ToolbarIcons.Menu.Filename));
            nType.AppendChild(n);

            root.AppendChild(nType);
            doc.AppendChild(root);

            //create temp directory of theme
            if (Directory.Exists(dir))
            {
                Directory.CreateDirectory(dir);
            }

            doc.Save(Path.Combine(dir, "config.xml")); //save file
        }
示例#11
0
 public override string ToString()
 {
     return($"{Name}|{BackgroundColor.ToArgb()}|{ButtonsColor.ToArgb()}|{TextColor.ToArgb()}");
 }