Ejemplo n.º 1
0
 public ActionResult DeletePartial(ColorCode color)
 {
     color.Status     = "InActive";
     color.modifiedOn = DateTime.Now;
     _ColorCodeService.Update(color);
     return(RedirectToAction("Details/" + color.colorId, "ColorCode"));
 }
Ejemplo n.º 2
0
        public async Task <IActionResult> PutColorCode(int Id, ColorCode colorCode)
        {
            if (Id != colorCode.Id)
            {
                return(BadRequest());
            }


            try
            {
                var updatedColorCode = new ColorCode(id: Id, code: colorCode.Code, createdDate: colorCode.CreatedDate, isActive: colorCode.IsActive, createdBy: colorCode.CreatedBy);
                await _colorCodeRepository.UpdateAsync(updatedColorCode);
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!await(ColorCodeExists(colorCode)))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Ejemplo n.º 3
0
        public void SetUpUI()
        {
            var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            SetActionBar(toolbar);
            toolbar.SetBackgroundColor(ColorCode.TeamColor(GameModel.Player.Team.ID));

            drawerLayout   = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            navigationView = FindViewById <NavigationView>(Resource.Id.nav_view);

            ActionBar.SetHomeAsUpIndicator(Resource.Mipmap.ic_dehaze_white_24dp);
            ActionBar.SetDisplayHomeAsUpEnabled(true);

            drawerLayout.DrawerStateChanged += DrawerLayout_DrawerStateChanged;

            Button changeUsernameBtn = FindViewById <Button>(Resource.Id.changeUsernameButton);
            Button changePasswordBtn = FindViewById <Button>(Resource.Id.changePasswordButton);
            Button switchTeamBtn     = FindViewById <Button>(Resource.Id.switchTeamButton);
            Button switchMapBtn      = FindViewById <Button>(Resource.Id.switchMapStyleButton);

            changeUsernameBtn.Click += ChangeUsernameBtn_Click;
            changePasswordBtn.Click += ChangePasswordBtn_Click;
            switchTeamBtn.Click     += SwitchTeamBtn_Click;
            switchMapBtn.Click      += SwitchMapBtn_Click;
        }
Ejemplo n.º 4
0
    public Form1()
    {
        InitializeComponent();
        List <ColorMap> colorMaps = new List <ColorMap>()
        {
            new ColorMap(-999, -1, "FF0000"),
            new ColorMap(-0.99, -0.75, "FF3333")
            /* and so on*/
        };

        foreach (DataGridViewRow row in dataGridView1.Rows)
        {
            foreach (DataGridViewCell cell in row.Cells)
            {
                double cellValue;
                if (!double.TryParse(cell.Value.ToString(), out cellValue))
                {
                    continue;    //or whatever logic you want
                }
                ColorMap colorMap = colorMaps.SingleOrDefault(x => x.From <= cellValue && x.To >= cellValue);
                if (colorMap == null)
                {
                    continue;    //or whatever logic you want
                }
                ColorCode colorCode = new ColorCode(colorMap.Value);
                cell.Style.BackColor = Color.FromArgb(colorCode.Red, colorCode.Green, colorCode.Blue);
            }
        }
    }
Ejemplo n.º 5
0
    private void Awake()
    {
        m_cTransform = GetComponent <Transform>();
        m_ColorCode  = GetComponent <ColorCode>();

        GlobalData.PlayModeToggled += OnPlayModeToggled;
    }
Ejemplo n.º 6
0
 public override Int32 GetHashCode()
 {
     return(ShopCode.GetHashCode()
            ^ ArticleCode.GetHashCode()
            ^ ColorCode.GetHashCode()
            ^ SizeCode.GetHashCode());
 }
Ejemplo n.º 7
0
        /// <summary>
        /// ビットマップファイルのバイトデータを返します。
        /// </summary>
        /// <param name="moduleSize">モジュールサイズ(px)</param>
        /// <param name="monochrome">1bitカラーはtrue、24bitカラーはfalseを設定します。</param>
        /// <param name="foreRgb">前景色</param>
        /// <param name="backRgb">背景色</param>
        public byte[] GetBitmap(int moduleSize  = DEFAULT_MODULE_SIZE,
                                bool monochrome = false,
                                string foreRgb  = ColorCode.BLACK,
                                string backRgb  = ColorCode.WHITE)
        {
            if (_dataBitCounter == 0)
            {
                throw new InvalidOperationException();
            }

            if (moduleSize < MIN_MODULE_SIZE)
            {
                throw new ArgumentOutOfRangeException(nameof(moduleSize));
            }

            if (ColorCode.IsWebColor(foreRgb) == false)
            {
                throw new FormatException(nameof(foreRgb));
            }

            if (ColorCode.IsWebColor(backRgb) == false)
            {
                throw new FormatException(nameof(backRgb));
            }

            if (monochrome)
            {
                return(GetBitmap1bpp(moduleSize, foreRgb, backRgb));
            }
            else
            {
                return(GetBitmap24bpp(moduleSize, foreRgb, backRgb));
            }
        }
Ejemplo n.º 8
0
        private void SetChart()
        {
            cellClicked.HoldStrength = GameModel.CellsInView[cellClicked.ID].HoldStrength;

            List <Entry> entries = new List <Entry>
            {
                new Entry(GameModel.maxHoldStrength - cellClicked.HoldStrength)
                {
                    Color      = SKColor.Parse("#ffffff"),
                    Label      = "Remaining",
                    ValueLabel = (GameModel.maxHoldStrength - cellClicked.HoldStrength).ToString()
                },
                new Entry(cellClicked.HoldStrength)
                {
                    Color      = SKColor.Parse(ColorCode.BrightHexColorCode(cellClicked.TeamID)),
                    Label      = "Hold Strength",
                    ValueLabel = cellClicked.HoldStrength.ToString()
                },
            };

            DonutChart chart = new DonutChart()
            {
                Entries         = entries,
                HoleRadius      = 0.6f,
                BackgroundColor = SKColor.Parse("#202020")
            };

            donutChart.Chart = chart;
        }
Ejemplo n.º 9
0
 public PlayerFieldArea(int identifier, ColorCode colorCode, int fieldId)
 {
     Identifier = identifier;
     ColorCode  = colorCode;
     FieldId    = fieldId;
     GeneratePlayerFieldArea(fieldId);
 }
Ejemplo n.º 10
0
        /// <summary>
        /// シンボルをSVG形式でファイルに保存します。
        /// </summary>
        /// <param name="fileName">ファイル名</param>
        /// <param name="moduleSize">モジュールサイズ(px)</param>
        /// <param name="foreRgb">前景色</param>
        public void SaveSvg(string fileName,
                            int moduleSize = DEFAULT_MODULE_SIZE,
                            string foreRgb = ColorCode.BLACK)
        {
            if (_dataBitCounter == 0)
            {
                throw new InvalidOperationException();
            }

            if (string.IsNullOrEmpty(fileName))
            {
                throw new ArgumentNullException(nameof(fileName));
            }

            if (moduleSize < MIN_MODULE_SIZE)
            {
                throw new ArgumentOutOfRangeException(nameof(moduleSize));
            }

            if (ColorCode.IsWebColor(foreRgb) == false)
            {
                throw new FormatException(nameof(foreRgb));
            }

            string newLine = Environment.NewLine;

            string svg = GetSvg(moduleSize, foreRgb) + newLine;

            File.WriteAllText(fileName, svg);
        }
Ejemplo n.º 11
0
        public Int64 CalculateOhmValue(string bandAColor, string bandBColor, string bandCColor, string bandDColor)
        {
            Int64 maxresistance = 0;

            try
            {
                // Validate ColorCodes
                ValidateInput(bandAColor, bandBColor, bandCColor, bandDColor, resistorcolorCodes.ColorCodes);

                //Get Color Codes
                ColorCode bandAColorChar = GetColorCode(bandAColor, resistorcolorCodes.ColorCodes);
                ColorCode bandBColorChar = GetColorCode(bandBColor, resistorcolorCodes.ColorCodes);
                ColorCode bandCColorChar = GetColorCode(bandCColor, resistorcolorCodes.ColorCodes);
                ColorCode bandDColorChar = GetColorCode(bandDColor, resistorcolorCodes.ColorCodes);

                Int64 AverageResistance = Convert.ToInt64(bandAColorChar.SignificantFigues + bandBColorChar.SignificantFigues) * Convert.ToInt64(bandCColorChar.Multiplier);

                double TolernaceCalc = (Convert.ToDouble(bandDColorChar.Tolerance) / 100) * AverageResistance;

                maxresistance = AverageResistance + Convert.ToInt64(TolernaceCalc);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(maxresistance);
        }
Ejemplo n.º 12
0
    void Awake()
    {
        m_Transform = transform;
        m_ColorCode = GetComponent <ColorCode>();

        GlobalData.PlayModeToggled += OnPlayModeToggled;
    }
Ejemplo n.º 13
0
        private async void SetColorbar(int imageID)
        {
            if (_imageID != -1)
            {
                List <Model.ImageColorInfo> lst = await SqliteUtil.Current.QueryImageColorInfoByImageID(_imageID);

                foreach (ImageColorInfo color in lst)
                {
                    BoxView box = new BoxView();
                    box.Color        = Xamarin.Forms.Color.FromHex(color.HEXValue);
                    box.CornerRadius = new CornerRadius(10);
                    pickColorList.Children.Add(box);
                }

                if (lst.Count > 0)
                {
                    ColorCode colorcd = new ColorCode();
                    string    hex     = lst[lst.Count - 1].HEXValue;
                    btnColor.BackgroundColor = Xamarin.Forms.Color.FromHex(hex);
                    lblSelected.Text         = hex;
                    lblHex.Text = hex;

                    Rgb rgb = colorcd.getRgb(hex);
                    lblRgb.Text     = colorcd.getRgbString(rgb);
                    lblHsl.Text     = colorcd.getHslString(rgb);
                    lblHsv.Text     = colorcd.getHsvString(rgb);
                    lblCmyk.Text    = colorcd.getCmykString(rgb);
                    lblLab.Text     = colorcd.getLabString(rgb);
                    lblMunsell.Text = colorcd.getMunsellString(rgb);
                    lblPccs.Text    = colorcd.getPCCSTone(rgb);
                    lblJis.Text     = JisUtil.getJisByMunsell(lblMunsell.Text);
                }
            }
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Recodes the given byte.
        /// </summary>
        internal override byte Recode(byte codedByte)
        {
            // Get key byte
            byte keyByte;
            switch (_colorTracker) {
                case ColorCode.Blue:
                    // Set source information and next color
                    keyByte = _currentColor.Blue;
                    _colorTracker = ColorCode.Red;
                    break;
                case ColorCode.Green:
                    // Set source information and next color
                    keyByte = _currentColor.Green;
                    _colorTracker = ColorCode.Blue;
                    break;
                case ColorCode.Red:
                    // Color code red always sets the new color and updates the position information
                    _currentColor = _imageData.GetNextColor();

                    // Set source information and next color
                    keyByte = _currentColor.Red;
                    _colorTracker = ColorCode.Green;
                    break;
                default:
                    throw new Exception("Bonk");
            }

            // Return the recoded byte
            return (byte)(keyByte - codedByte);
        }
Ejemplo n.º 15
0
 internal Parser(ColorCode.ILanguage lang)
 {
     _lang = lang;
     var repo = new ColorCode.Common.LanguageRepository(new Dictionary<string, ColorCode.ILanguage>());
     var compiler = new ColorCode.Compilation.LanguageCompiler(new Dictionary<string, ColorCode.Compilation.CompiledLanguage>());
     _internalParser = new ColorCode.Parsing.LanguageParser(compiler, repo);
 }
Ejemplo n.º 16
0
        private void NotifyActualPlayer(User user, List <HandCard> handCards, int tableId)
        {
            GameTable       actualGameTable = GameTableService.GetTable(Games, tableId);
            List <HandCard> validCards      = actualGameTable.CardServiceData.ProveCards(handCards, actualGameTable, user);
            IHubContext     context         = GlobalHost.ConnectionManager.GetHubContext <ChatHub>();

            if (validCards.Find(card => card.IsValid) != null)
            {
                Task firstTask = context.Clients.Group(tableId.ToString(), user.ConnectionIds.ToArray()).broadcastSystemMessage(ServerMessages.InformOtherPlayer.Replace("{0}", user.Nickname), tableId, DateTime.Now.Ticks + GetMessageCounter());
                firstTask.Wait();
                actualGameTable.ActualParticipation = ParticipationService.GetParticipation(actualGameTable, user.Nickname);
                user.ConnectionIds.ForEach(cId =>
                {
                    Task task = context.Clients.Client(cId).broadcastSystemMessage(ServerMessages.NofityActualPlayer, actualGameTable.Identifier, DateTime.Now.Ticks + GetMessageCounter());
                    task.Wait();
                    ColorCode colorCode = GameTableService.GetColorCodeForUser(Games, GameTableService.AreAllEndFieldsUsedForColorCode(actualGameTable,
                                                                                                                                       GameTableService.GetColorCodeForUser(Games, user.Nickname, tableId)) ?
                                                                               ParticipationService.GetPartner(user, actualGameTable.Participations).Nickname : user.Nickname, tableId);
                    Clients.Client(cId).notifyActualPlayer(validCards, colorCode, tableId);
                });
            }
            else
            {
                NotifyNextPlayer("", actualGameTable);
            }
        }
Ejemplo n.º 17
0
        public string SaveColorCode(string name, ColorCode ColorCode)
        {
            string returndata;

            try
            {
                string DirectoryName = Path.Combine(DefaultSaveLocation, "ColorCodes");
                if (!Directory.Exists(DirectoryName))//if the project doesnt exist create a directory for it
                {
                    Directory.CreateDirectory(DirectoryName);
                }
                FileStream files = File.Create(Path.Combine(DirectoryName, FileSafe(name)));
                string     data  = "";
                returndata = "Created File";
                for (int x = 0; x < ColorCode.Count; x++)
                {
                    data += ColorCode.Sectors[x] + "/";
                    data += ColorCode.GroupingColors[x] + "/";
                    data += ColorCode.IndividualColors[x] + "/";
                    data += ColorCode.Cores[x] + "";
                    data += "-";
                }
                returndata = "Generated Text" + data;
                files.Write(Encoding.ASCII.GetBytes(data), 0, data.Length);
                returndata = "Wrote Text" + data;
                files.Close();
            }
            catch (Exception ex)
            {
                return(_ = "Caught Exception:" + ex.ToString());
            }
            return(returndata);
        }
Ejemplo n.º 18
0
    public Player(int id, ColorCode colorCode)
    {
        this.id = id;
        playerColor = colorCode;
        gameObj = (GameObject)GameObject.Instantiate(spherePrefab);
        gameObj.name = "Player #" + id;

        //gameObj.renderer.material = (Material)Resources.Load("mat" + id, typeof(Material));
        /*
        if(PlayerPrefs.GetString("Player0") == "Blue")
            playerColor = Color.blue * 0.5f;
        if(PlayerPrefs.GetString("Player1") == "Green")
            playerColor = Color.green * 0.5f;
        if(PlayerPrefs.GetString("Player2") == "Red")
            playerColor = Color.red * 0.5f;
        if(PlayerPrefs.GetString("Player3") == "Yellow")
            playerColor = Color.yellow * 0.5f;
        //*/
        gameObj.renderer.material.color = toColor(playerColor) * 0.5f;
        /*switch (id)
        {
        case 0:
            gameObj.renderer.material.color = Color.blue * 0.5f;
            break;
        case 1:
            gameObj.renderer.material.color = Color.green * 0.5f;
            break;
        case 2:
            gameObj.renderer.material.color = Color.red * 0.5f;
            break;
        case 3:
            gameObj.renderer.material.color = Color.yellow * 0.5f;
            break;
        }*/
    }
Ejemplo n.º 19
0
        public async Task SwitchFaction(int newFactionID)
        {
            await Database.UpdateTeam(GameModel.Player, newFactionID);

            foreach (AntiMine am in AntiMines.Values)
            {
                if (GameModel.CellsInView.ContainsKey(am.CellID))
                {
                    am.Stop();
                    GameModel.CellsInView[am.CellID].MapOverlay.RemoveAntiMine();
                }
            }

            foreach (Mine m in Mines.Values)
            {
                if (GameModel.CellsInView.ContainsKey(m.CellID))
                {
                    GameModel.CellsInView[m.CellID].MapOverlay.RemoveAntiMine();
                }
            }

            AntiMines.Clear();
            Mines.Clear();

            Team = new Team(newFactionID, ColorCode.TeamName(newFactionID));
        }
Ejemplo n.º 20
0
    private void Awake()
    {
        m_ColorCode  = GetComponent <ColorCode>();
        m_TileGrid   = FindObjectOfType <TileGrid>();
        m_cTransform = transform;

        GlobalData.PlayModeToggled += OnPlayModeToggled;
    }
Ejemplo n.º 21
0
 public static String Color(String str, ColorCode foreground)
 {
     if (foreground == ColorCode.None)
     {
         return(str);
     }
     return(String.Concat(ColorBarrierCode, (int)foreground, str, ColorBarrierCode));
 }
Ejemplo n.º 22
0
 // Use this for initialization
 void Start()
 {
     textMesh                       = gameObject.GetComponent <TextMesh>();
     textMesh.fontSize              = 30;
     textMesh.transform.position    = new Vector3(154.7f, 39.4f, 92.4f);
     textMesh.transform.eulerAngles = new Vector3(-90f, -90f, 0f);
     colorCode                      = new ColorCode();
 }
Ejemplo n.º 23
0
 void Start()
 {
     adjColor = ColorCode.FromValue(color);
     //if (Locked)
     {
         transform.FindChild("DoorKnob").GetComponent<Renderer>().material.color = (Locked) ? ColorCode.FromValue( color ).Color : new Color(0.5f,0.25f,0.1f);
     }
 }
Ejemplo n.º 24
0
        public ActionResult Details(int id)
        {
            ColorCode color = new ColorCode();

            TempData["ColorList"] = _ColorCodeService.getAllColorCode();
            color = _ColorCodeService.GetColorCodebyId(id);
            return(View(color));
        }
Ejemplo n.º 25
0
        /// <summary>
        ///     Returns the properties for the given color code
        /// </summary>
        /// <param name="colorCode">The requested color code</param>
        /// <returns></returns>
        public static ColorCodeProperty GetColorCodeProperty(ColorCode colorCode)
        {
            MemberInfo[]      memberInfo = colorCode.GetType().GetMember(colorCode.ToString());
            ColorCodeProperty attributes =
                (ColorCodeProperty)memberInfo[0].GetCustomAttribute(typeof(ColorCodeProperty), false);

            return(attributes);
        }
Ejemplo n.º 26
0
    /**
     * FUNCTION NAME: Start
     * DESCRIPTION  : Caches components.
     * INPUTS       : None
     * OUTPUTS      : None
     **/
    void Start()
    {
        m_cTransform = GetComponent <Transform>();
        m_cColorCode = GetComponent <ColorCode>();

        GlobalData.PlayModePreToggle += OnPlayModePreToggle;
        GlobalData.PlayModeToggled   += OnPlayModeToggled;
    }
Ejemplo n.º 27
0
        public int CalculateOhmValue(ColorCode band1, ColorCode band2, ColorCode band3, ColorCode band4)
        {
            band1.ThrowIfNullOrEmpty(nameof(band1));
            band2.ThrowIfNullOrEmpty(nameof(band2));
            band3.ThrowIfNullOrEmpty(nameof(band3));
            band4.ThrowIfNullOrEmpty(nameof(band4));

            return(CalculateOhmValue(band1.FourBand, band2.FourBand, band3.FourBand, band4.FourBand));
        }
Ejemplo n.º 28
0
    /**
     * FUNCTION NAME: Start
     * DESCRIPTION  : Caches components.
     * INPUTS       : None
     * OUTPUTS      : None
     **/
    void Start()
    {
        m_Transform       = transform;
        m_ColorCode       = GetComponent <ColorCode>();
        m_ComponentColors = GetComponent <SetComponentColorsOnColorSet>();

        GlobalData.PlayModePreToggle += OnPlayModePreToggle;
        GlobalData.PlayModeToggled   += OnPlayModeToggled;
    }
Ejemplo n.º 29
0
        public ColorPair(short pairId, ColorCode forground, ColorCode background)
        {
            this.pairId = pairId;
            Forground   = forground;
            Background  = background;

            InitPair(pairId, forground, background);
            Console.Error.WriteLine(pairId);
        }
Ejemplo n.º 30
0
 internal static ColorCode GetOverridenColorCode(LogEventLevel level, ColorCode colorCode)
 {
     return(level switch
     {
         LogEventLevel.Warning => ColorCode.LvlTokenWrn,
         LogEventLevel.Fatal => ColorCode.LvlTokenFtl,
         LogEventLevel.Error => ColorCode.LvlTokenErr,
         _ => colorCode,
     });
Ejemplo n.º 31
0
 public static String Color(String str, ColorCode foreground, ColorCode background)
 {
     if(foreground == ColorCode.None)
         return str;
     else if(foreground != ColorCode.None && background == ColorCode.None)
         return Color(str, foreground);
     else
         return String.Concat(ColorBarrierCode, (int)foreground, ',', (int)background, str, ColorBarrierCode);
 }
Ejemplo n.º 32
0
        protected override void OnResume()
        {
            base.OnResume();

            var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            SetActionBar(toolbar);
            toolbar.SetBackgroundColor(ColorCode.TeamColor(GameModel.Player.Team.ID));
        }
Ejemplo n.º 33
0
        protected async override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Map);

            var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            SetActionBar(toolbar);
            toolbar.SetBackgroundColor(ColorCode.TeamColor(GameModel.Player.Team.ID));

            drawerLayout   = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            navigationView = FindViewById <NavigationView>(Resource.Id.nav_view);
            statusText     = FindViewById <TextView>(Resource.Id.textBelowMap);
            tagButton      = FindViewById <Button>(Resource.Id.claimButton);
            locationButton = FindViewById <Button>(Resource.Id.clientCameraLocationbtn);

            ActionBar.SetHomeAsUpIndicator(Resource.Mipmap.ic_dehaze_white_24dp);
            ActionBar.SetDisplayHomeAsUpEnabled(true);

            drawerLayout.DrawerStateChanged += DrawerLayout_DrawerStateChanged;

            tagButton.Click      += TagButton_Click;
            locationButton.Click += LocationButton_Click;

            SetUpMap();

            var cellHubSetupTask = SetUpCellHub();

            if (CheckSelfPermission(Android.Manifest.Permission.AccessFineLocation) == Permission.Granted)
            {
                DisplayStatus("Finding location...");
                GetLocation();
            }
            else
            {
                RequestPermissions(LocationPermissions, RequestLocationID);
            }

            navigationView.NavigationItemSelected += (sender, e) =>
            {
                e.MenuItem.SetChecked(true);

                switch (e.MenuItem.ItemId)
                {
                case Resource.Id.nav_logout:
                    GameModel.Logout();
                    StartActivity(new Intent(this, typeof(LoginActivity)));
                    break;

                default:
                    break;
                }
                drawerLayout.CloseDrawers();
            };

            await cellHubSetupTask;
        }
        public void YellowColorTest()
        {
            ColorCode colorCode = new ColorCode("Yellow", "YE", 4, 10000, 0.05);

            Assert.AreEqual(colorCode.Code, "YE");
            Assert.AreEqual(colorCode.Name, "Yellow");
            Assert.AreEqual(colorCode.SignificantFigures.Value, 4);
            Assert.AreEqual(colorCode.Multiplier.Value, 10000);
            Assert.AreEqual(colorCode.Tolerance, 0.05);
        }
        public void GreenColorTest()
        {
            ColorCode colorCode = new ColorCode("Green", "GN", 5, 100000, 0.005);

            Assert.AreEqual(colorCode.Code, "GN");
            Assert.AreEqual(colorCode.Name, "Green");
            Assert.AreEqual(colorCode.SignificantFigures.Value, 5);
            Assert.AreEqual(colorCode.Multiplier.Value, 100000);
            Assert.AreEqual(colorCode.Tolerance, 0.005);
        }
Ejemplo n.º 36
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CoderFox"/> class.
        /// </summary>
        /// <param name="keyPath">A string containing the path to the image that serves as key.</param>
        internal CoderSeal(string keyPath)
            : base(keyPath)
        {
            // Get image data
                        using (Bitmap keyFile = (Bitmap)Bitmap.FromFile(_keyPath))
                _imageData = new ImageData(keyFile);

            // Set default field values
            _colorTracker = ColorCode.Red;
        }
Ejemplo n.º 37
0
 // END CUT HERE
 // BEGIN CUT HERE
 public static void Main()
 {
     try {
     ColorCode ___test = new ColorCode();
     ___test.run_test(-1);
     } catch(Exception e) {
     //Console.WriteLine(e.StackTrace);
     Console.WriteLine(e.ToString());
     }
 }
Ejemplo n.º 38
0
    public MainWindow()
        : base(Gtk.WindowType.Toplevel)
    {
        this.Build();

        colorViewHandler = new ColorView(colorView, DEFAULT_COLOR_CODE);
        colorCodeHandler = new ColorCode(colorCode);
        alphaColorCodeHandler = new AColorCode(aColorCode);
        colorScalesHandler = new ColorScales(redScale, greenScale,
                                             blueScale,
                                             alphaScale);
        clickEventHandler = new ClickEventHandler();

        base.Decorated = false;
        base.Resizable = false;
        base.Title = TITLE;
    }
Ejemplo n.º 39
0
 public static Color toColor(ColorCode cC)
 {
     switch(cC){
     case ColorCode.RED: return Color.red; break;
     case ColorCode.BLUE: return Color.blue; break;
     case ColorCode.GREEN: return Color.green; break;
     case ColorCode.YELLOW: return Color.yellow; break;
     case ColorCode.MAGENTA: return Color.magenta; break;
     default: return new Color(255, 0, 255, 255);
     }
 }
 public RibbonXml(ColorCode.ILanguage []langs)
 {
     this.Languages = langs;
 }
Ejemplo n.º 41
0
 public static bool ValidColor(ColorCode color)
 {
     return ValidColor((int)color);
 }
Ejemplo n.º 42
0
 internal static Flagment FromScope(int baseIndex, string token, ColorCode.Parsing.Scope scope, ColorCode.IStyleSheet stylesheet)
 {
     return new Flagment(scope.Name, token.Substring(scope.Index, scope.Length), stylesheet.Styles[scope.Name].Foreground,
                         baseIndex + scope.Index, scope.Length);
 }
Ejemplo n.º 43
0
 public static String Color(String str, ColorCode foreground)
 {
     if(foreground == ColorCode.None)
         return str;
     return String.Concat(ColorBarrierCode, (int)foreground, str, ColorBarrierCode);
 }
Ejemplo n.º 44
0
            public Color GetColor(ColorCode code)
            {
                int index = (int)code;
                if (index >= 0 && index < m_lookup.Length)
                {
                    return m_lookup[index];
                }

                return m_lookup[(int)ColorCode.Clear];
            }
Ejemplo n.º 45
0
            internal void SetColor(ColorCode code, Color color)
            {
                int index = (int)code;
                if (index < 0 || index >= m_lookup.Length)
                {
                    throw new ArgumentOutOfRangeException("index");
                }

                m_lookup[index] = color;
            }
Ejemplo n.º 46
0
 public static Color GetColor(ColorCode code)
 {
     return colors.GetColor(code);
 }
Ejemplo n.º 47
0
 internal static void SetColor(ColorCode code, Color color)
 {
     colors.SetColor(code, color);
 }