public static IComponent[] Create(float x, float y) { CBoid boid = new CBoid() { ViewRadius = 16, MoveSpeed = Morro.Maths.Random.Range(60, 80), MaxForce = 0.4f }; CPhysicsBody physicsBody = new CPhysicsBody(Morro.Maths.Random.RandomVector2(boid.MoveSpeed), Microsoft.Xna.Framework.Vector2.Zero); CPosition position = new CPosition(x, y); CDimension dimension = new CDimension(4, 4); CTransform transform = new CTransform() { Scale = new Microsoft.Xna.Framework.Vector3(3, 1, 1), Rotation = -(float)Math.Atan2(physicsBody.Velocity.Y, physicsBody.Velocity.X), RotationOffset = new Microsoft.Xna.Framework.Vector2(dimension.Width / 2, dimension.Height / 2) }; CColor color = new CColor(PICO8.MidnightBlack); return(new IComponent[] { boid, physicsBody, position, dimension, transform, color, new CTriangle(), new CPartitionable(), new CPredator() }); }
public static void CreateFolder(string path, string name) { try { // Determine whether the directory exists. if (!Directory.Exists(path + name)) { Console.Write("Verrà creata una cartella con il nome: "); CColor.WriteLineC(name, "yellow"); } else { return; } // Try to create the directory. DirectoryInfo di = Directory.CreateDirectory(path + name); Console.Write("La cartella e stata creata con successo il "); CColor.WriteLineC(Directory.GetCreationTime(path + name).ToString(), "magenta"); // Delete the directory. //di.Delete(); //Console.WriteLine("The directory was deleted successfully."); } catch (Exception e) { Console.ForegroundColor = ConsoleColor.Red; Console.Write("The process failed: {0}"); Console.WriteLine(e.ToString()); Console.ResetColor(); } finally { } }
public Card(CType type, CValue value) { mColor = GetTColor(type); mType = type; mValue = value; mImage = getTImage(type, value); }
/// <summary> /// Writes a colored string to the output. /// </summary> /// <param name="str">The string to write</param> /// <param name="color">The color to give to the string.</param> public virtual void Write(string str, CColor color) { if (SupportsPartialLines) { throw new NotImplementedException("Missing Write method override"); } }
public void DokonajPlatnosci(Produkt produkt, Konto konto) { CColor.ResetCColor(); CColor.SetCcolor(ConsoleColor.DarkRed, ConsoleColor.White); Console.WriteLine("--->Instancja bramki {0}", GetType()); CColor.ResetCColor(); CColor.SetCcolor(ConsoleColor.DarkYellow, ConsoleColor.Black); Console.WriteLine("---->Sprawdzanie srodkow na koncie"); //CColor.ResetCColor(); if (Wyplata(produkt.Cena, konto)) { CColor.ResetCColor(); CColor.SetCcolor(ConsoleColor.DarkGreen, ConsoleColor.White); Console.WriteLine("---->Pobrano platnosc: ->{0}", produkt.Cena); } else { CColor.ResetCColor(); CColor.SetCcolor(ConsoleColor.DarkRed, ConsoleColor.White); Console.WriteLine("!!!!!!!!!!!!!ODRZUT BRAK SRODKOW!!!!!!!!!!!!!!"); CColor.ResetCColor(); } //Console.WriteLine("--->Dokonywanie płatnosci za towar:"); //Console.WriteLine("\n||Nazwa:{0} \n||Opis:{1} \n||Cena:{2}\n", produkt.Nazwa,produkt.Opis,produkt.Cena); }
protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e) { base.OnMouseLeftButtonDown(e); string backcolor = ""; if (C_ButtonType == ButtonType.close) { backcolor = "#FFE81123"; } else if (C_ButtonType == ButtonType.minimize || C_ButtonType == ButtonType.maximize) { backcolor = "#22FFFFFF"; } ColorAnimation colorChangeAnimation = new ColorAnimation { To = CColor.ChangeColorBrightness((Color)ColorConverter.ConvertFromString(backcolor), (float)-0.1), Duration = new Duration(new TimeSpan(0, 0, 0, 0, 100)) }; PropertyPath colorTargetPath = new PropertyPath("(Background).(SolidColorBrush.Color)"); Storyboard CellBackgroundChangeStory = new Storyboard(); Storyboard.SetTarget(colorChangeAnimation, this); Storyboard.SetTargetProperty(colorChangeAnimation, colorTargetPath); CellBackgroundChangeStory.Children.Add(colorChangeAnimation); CellBackgroundChangeStory.Begin(); }
public static void LineFase(string text) { Console.BackgroundColor = ConsoleColor.White; Console.Write("::::::::::::::::::::::"); CColor.WriteC(text, "black"); Console.BackgroundColor = ConsoleColor.White; Console.WriteLine("::::::::::::::::::::::\r\n"); Console.ResetColor(); }
public void SaveCurrentColorPalette() { var directory = Application.dataPath; if (Directory.Exists(Path.GetDirectoryName(GlobalProperties.Get.LastMembraneFileLoaded))) { directory = Path.GetDirectoryName(GlobalProperties.Get.LastMembraneFileLoaded); } //var path = EditorUtility.SaveFilePanel("Save current palette", directory, "palette_", "json"); var path = ""; var currentPalette = new Dictionary <string, CColor>(); for (int i = 0; i < SceneManager.Get.AllIngredientNames.Count; i++) { var name = SceneManager.Get.AllIngredientNames[i]; var color = CPUBuffers.Get.IngredientsColors[i]; var ccolor = new CColor { x = Mathf.RoundToInt(color.x * 255), y = Mathf.RoundToInt(color.y * 255), z = Mathf.RoundToInt(color.z * 255) }; currentPalette.Add(name, ccolor); } var str = JsonConvert.SerializeObject(currentPalette); File.WriteAllText(path, str); }
protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e) { if (!this.IsEnabled) { return; } base.OnMouseLeftButtonDown(e); string backcolor = "#55000000"; ColorAnimation colorChangeAnimation = new ColorAnimation { To = CColor.ChangeColorBrightness((Color)ColorConverter.ConvertFromString(backcolor), (float)-0.1), Duration = new Duration(new TimeSpan(0, 0, 0, 0, 100)) }; PropertyPath colorTargetPath = new PropertyPath("(Background).(SolidColorBrush.Color)"); Storyboard CellBackgroundChangeStory = new Storyboard(); Storyboard.SetTarget(colorChangeAnimation, this); Storyboard.SetTargetProperty(colorChangeAnimation, colorTargetPath); CellBackgroundChangeStory.Children.Add(colorChangeAnimation); CellBackgroundChangeStory.Begin(); }
private static Control GetEditor(this CColor @this) { var panel = new Panel(); panel.BackColor = System.Drawing.Color.FromArgb(@this.Red.val, @this.Green.val, @this.Blue.val); panel.Click += panel_Click; panel.Height = 18; return(panel); void panel_Click(object sender, EventArgs e) { var dlg = new ColorDialog(); dlg.Color = @this.Color; if (dlg.ShowDialog() == DialogResult.OK) { @this.Red.val = dlg.Color.R; @this.Green.val = dlg.Color.G; @this.Blue.val = dlg.Color.B; ((Panel)sender).BackColor = dlg.Color; } } }
public CMessageBox(string message, string caption, CColor.Theme theme, CImage.ImageType image, CMessageBoxButton _buttonType) { InitializeComponent(); this.SizeToContent = SizeToContent.Height; SystemSounds.Beep.Play(); //set image string imagePath = CImage.GetImagePath(image); ImageBrush imgBrush = new ImageBrush { ImageSource = new BitmapImage(new Uri(imagePath, UriKind.Absolute)) }; RCT_image.Fill = imgBrush; //set text / caption TBL_message.Text = message; windowheader.C_HeaderText = caption; //set theme in border and header background GRD_border.Background = CColor.GetColorBrush(theme); windowheader.C_BackgroundTheme = theme; //enable button by given buttontype buttonType = _buttonType; switch (buttonType) { case CMessageBoxButton.OK: B_3.Visibility = Visibility.Hidden; B_2.Visibility = Visibility.Hidden; B_1.Content = "OK"; break; case CMessageBoxButton.OK_Cancel: B_3.Visibility = Visibility.Hidden; B_2.Content = "OK"; B_1.Content = "Abbrechen"; break; case CMessageBoxButton.Yes_No: B_3.Visibility = Visibility.Hidden; B_2.Content = "Ja"; B_1.Content = "Nein"; break; case CMessageBoxButton.Yes_No_Cancel: B_3.Content = "Ja"; B_2.Content = "Nein"; B_1.Content = "Abbrechen"; break; default: break; } B_1.Focus(); }
public void Add(CColor entity) { using (NorthwindContext context = new NorthwindContext()) { var addedEntity = context.Entry(entity); addedEntity.State = EntityState.Added; } }
public void Delete(CColor entity) { using (NorthwindContext context = new NorthwindContext()) { var deletedEntity = context.Entry(entity); deletedEntity.State = EntityState.Deleted; } }
public void Update(CColor entity) { using (NorthwindContext context = new NorthwindContext()) { var updatedEntity = context.Entry(entity); updatedEntity.State = EntityState.Modified; } }
public BramkaPlatnosciFabryka() { CColor.ResetCColor(); CColor.SetCcolor(ConsoleColor.DarkBlue, ConsoleColor.White); Console.WriteLine("--->Utworzono Instancje bramki {0}", GetType()); CColor.ResetCColor(); CColor.SetCcolor(ConsoleColor.Black, ConsoleColor.White); }
public void Dispose() { CColor.ResetCColor(); CColor.SetCcolor(ConsoleColor.DarkBlue, ConsoleColor.White); Console.WriteLine("--->Uwolniono Instancje bramki {0}", GetType()); CColor.ResetCColor(); }
public void newColor() { GameObject go = allColors[Random.Range(0, allColors.Count)]; NeededColor = go.GetComponent <CColor> (); currentColor.color = NeededColor.color; currentText.text = NeededColor.Name; UpdateUI(); }
public Car(String ID, CColor color) { CarSprite = new Sprite(); CarSprite.depth = 0.80f; CarColor = color; this.ID = ID; }
static Variable Vari(_3COL.Node node, CColor color) { string name = color.name + "X" + node.NodeName; if (curVariables.FirstOrDefault(v => v.Name == name) == null) { Variable variable = new Variable(name); curVariables.Add(variable); } return(curVariables.Find(v => v.Name == name)); }
public static bool IsRipresa() { Console.Write("--- Devi riprendere da una certa puntata? ["); CColor.WriteC("Y", "Green"); Console.Write(" = "); CColor.WriteC("Yes", "green"); Console.Write("]: "); if (Console.ReadKey().KeyChar.ToString().ToLower().Equals("y")) { Console.WriteLine(); return(true); } Console.WriteLine(); return(false); }
public static void OnIsEnabledChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args) { if (sender is CIconTextHorizontalButton control) { control.UpdateIsEnabled(); } if (!(args.NewValue as bool?).Value) { (sender as CIconTextHorizontalButton).Background = CColor.GetColorBrush(CColor.Theme.Disabled); } }
public static int GetNumberOfC(string print, string color) { Console.Write(print); bool repeatC = true; int res = 0; do { try { res = Convert.ToInt32(CColor.ReadLineC(color)); Console.ResetColor(); repeatC = false; } catch { Console.Write("--- Non hai inserito un numero valido, Riprova: "); } } while (repeatC); return(res); }
public override void Write(string str, CColor color) { if (Options.UseColoredOutput) { var prev = SConsole.ForegroundColor; SConsole.ForegroundColor = color.ToConsoleColor(); SConsole.Write(str); SConsole.ForegroundColor = prev; } else { SConsole.Write(str); } }
private void ColorList_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { CColor cclr = ((CColor)e.AddedItems[0]); Color selectedColor = (Color)ColorConverter.ConvertFromString(cclr.Name); Brush brush = new SolidColorBrush(selectedColor); //Brush selectedColor = (Brush)(e.AddedItems[0] as CColor).GetValue(null, null); rtlfill.Fill = brush; } catch (Exception exc) { CKernelTerminal.ErrorStatic("ColorSelectionWindow.ColorList_SelectionChanged", exc); } }
protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e) { base.OnMouseLeftButtonUp(e); ColorAnimation colorChangeAnimation = new ColorAnimation { To = CColor.ChangeColorBrightness((Color)ColorConverter.ConvertFromString("#00000000"), (float)0.15), Duration = new Duration(new TimeSpan(0, 0, 0, 0, 100)) }; PropertyPath colorTargetPath = new PropertyPath("(Background).(SolidColorBrush.Color)"); Storyboard CellBackgroundChangeStory = new Storyboard(); Storyboard.SetTarget(colorChangeAnimation, this); Storyboard.SetTargetProperty(colorChangeAnimation, colorTargetPath); CellBackgroundChangeStory.Children.Add(colorChangeAnimation); CellBackgroundChangeStory.Begin(); }
public COctaeder(double aW = 1.0d) { W = aW; P0 = new CVector3Dbl(Xc, Yb, Zc); P1 = new CVector3Dbl(Xl, Yc, Zf); P2 = new CVector3Dbl(Xr, Yc, Zf); P3 = new CVector3Dbl(Xr, Yc, Zb); P4 = new CVector3Dbl(Xl, Yc, Zb); P5 = new CVector3Dbl(Xc, Yt, Zc); Ps = new CVector3Dbl[] { P0, P1, P2, P3, P4, P5 }; P0C = CColors.C_Red; P1C = CColors.C_Blue; P2C = CColors.C_Yellow; P3C = CColors.C_Blue; P4C = CColors.C_Yellow; P5C = CColors.C_Green; Colors = new CColor[] { P0C, P1C, P2C, P3C, P4C, P5C }; Tis = new int[] { 0, 1, 2, 0, 2, 3, 0, 3, 4, 0, 4, 1, 1, 5, 2, 2, 5, 3, 3, 5, 4, 4, 5, 1 }; var aLineListIndexes = new int[] { 0, 1, 0, 2, 0, 3, 0, 4, 1, 2, 2, 3, 3, 4, 4, 1, 5, 1, 5, 2, 5, 3, 5, 4 }; this.LineList = (from aIdx in aLineListIndexes select Ps[aIdx]).ToArray(); this.ColoredTriangleList = (from aIdx in Enumerable.Range(0, TCount * 3) select Ps[Tis[aIdx]].ToColoredVertex(this.Colors[Tis[aIdx]])).ToArray(); this.ColoredLineList = this.ColoredTriangleList.TriangleListToLineList().ToArray(); }
public void SaveCurrentColorPalette() { var directory = Application.dataPath; if (Directory.Exists(Path.GetDirectoryName(GlobalProperties.Get.LastMembraneFileLoaded))) { directory = Path.GetDirectoryName(GlobalProperties.Get.LastMembraneFileLoaded); } var path = EditorUtility.SaveFilePanel("Save current palette", directory, "palette_", "json"); var currentPalette = new Dictionary<string, CColor>(); for (int i = 0; i < SceneManager.Get.AllIngredientNames.Count; i++) { var name = SceneManager.Get.AllIngredientNames[i]; var color = CPUBuffers.Get.IngredientsColors[i]; var ccolor = new CColor { x = Mathf.RoundToInt(color.x * 255), y = Mathf.RoundToInt(color.y * 255), z = Mathf.RoundToInt(color.z * 255) }; currentPalette.Add(name, ccolor); } var str = JsonConvert.SerializeObject(currentPalette); File.WriteAllText(path, str); }
/// <summary> /// Converts two CColors to a short. /// </summary> /// <param name="bg">Char background color</param> /// <param name="fg">Char color</param> /// <returns>short</returns> public static short TwoColor(CColor bg, CColor fg) { return((short)((byte)bg << 4 | (byte)fg)); }
/// <summary> /// Writes a newline-terminated colored string to the output. /// </summary> /// <param name="str">The line to write.</param> /// <param name="color">The color to give to the line.</param> public virtual void WriteLine(string str, CColor color) => Write(str + "\n", color);
/// <summary> /// Save a feature layer of IPolygon to Ipe /// </summary> public static string TranIpgBoundToIpe(IPolygon ipg, IEnvelope pFLayerEnv, CEnvelope pIpeEnv, CColor StrokeColor, string strBoundWidth = "normal", string strDash = "normal") { ////get the color of the filled part ////we are not allowed to directly use "var pFillRgbColor = pFillSymbol.Color as IRgbColor;" ////Nor can we use "var pFillRgbColor = pFillSymbol.Color.RGB as IRgbColor;" ////pFillSymbol.Color.RGB has type 'int' //IColor pFillSymbolColor = new RgbColorClass(); //pFillSymbolColor.RGB = pFillSymbol.Color.RGB; //var pFillSymbolRgbColor = pFillSymbolColor as IRgbColor; ////get the color of the out line //var pOutlineRgbColor = pFillSymbol.Outline.Color as IRgbColor; //if (strBoundWidth == "") //{ // strBoundWidth = pFillSymbol.Outline.Width.ToString(); //} //get the feature CPolygon cpg = new CPolygon(0, ipg as IPolygon4); //append the string return(CIpeDraw.DrawCpgBound(cpg, pFLayerEnv, pIpeEnv, StrokeColor, strBoundWidth, strDash)); }
public object ReadYaml(IParser parser, Type xtype) { IType result; parser.ReadMappingStart(); // read name property var typeName = parser.SafeReadScalarProperty(s_typeName); var type = Serialization.GetTypeFromRedTypeStr(typeName); if (type == null) { throw new InvalidDataException(); } if (IsArray(type)) { var innertype = type.GetGenericArguments()[0]; var list = (IList)Activator.CreateInstance( typeof(List <>).MakeGenericType( new Type[] { innertype }), BindingFlags.Instance | BindingFlags.Public, binder: null, args: null, culture: null); if (list is null) { throw new InvalidDataException(); } // read values parser.SafeReadScalarValue(s_valueName); if (parser.Current.GetType() != _sequenceStartType) { throw new InvalidDataException("Invalid YAML content."); } parser.MoveNext(); // skip the sequence start do { var x = ReadYaml(parser, innertype); list.Add(x); } while (parser.Current.GetType() != _sequenceEndType); parser.MoveNext(); // skip the mapping end (or crash) var array = (IArray)Activator.CreateInstance( typeof(CArray <>).MakeGenericType( new Type[] { innertype }), BindingFlags.Instance | BindingFlags.Public, binder: null, args: null, culture: null); if (array is null) { throw new InvalidDataException(); } array.SetItems(list); result = array is IType o ? o : throw new JsonException(); } else { if (typeof(IPrimitive).IsAssignableFrom(type)) { result = Parse(parser.SafeReadScalarProperty(s_valueName), type); } else { parser.SafeReadScalarValue(s_valueName); parser.ReadMappingStart(); switch (Serialization.GetEnumFromType(type)) { case ETweakType.CColor: { result = new CColor { Red = byte.Parse(parser.SafeReadScalarProperty(nameof(CColor.Red))), Green = byte.Parse(parser.SafeReadScalarProperty(nameof(CColor.Green))), Blue = byte.Parse(parser.SafeReadScalarProperty(nameof(CColor.Blue))), Alpha = byte.Parse(parser.SafeReadScalarProperty(nameof(CColor.Alpha))), }; break; } case ETweakType.CEulerAngles: { result = new CEulerAngles { Pitch = float.Parse(parser.SafeReadScalarProperty(nameof(CEulerAngles.Pitch))), Yaw = float.Parse(parser.SafeReadScalarProperty(nameof(CEulerAngles.Yaw))), Roll = float.Parse(parser.SafeReadScalarProperty(nameof(CEulerAngles.Roll))), }; break; } case ETweakType.CQuaternion: { result = new CQuaternion { I = float.Parse(parser.SafeReadScalarProperty(nameof(CQuaternion.I))), J = float.Parse(parser.SafeReadScalarProperty(nameof(CQuaternion.J))), K = float.Parse(parser.SafeReadScalarProperty(nameof(CQuaternion.K))), R = float.Parse(parser.SafeReadScalarProperty(nameof(CQuaternion.R))), }; break; } case ETweakType.CVector2: { result = new CVector2 { X = float.Parse(parser.SafeReadScalarProperty(nameof(CVector2.X))), Y = float.Parse(parser.SafeReadScalarProperty(nameof(CVector2.Y))) }; break; } case ETweakType.CVector3: { result = new CVector3 { X = float.Parse(parser.SafeReadScalarProperty(nameof(CVector3.X))), Y = float.Parse(parser.SafeReadScalarProperty(nameof(CVector3.Y))), Z = float.Parse(parser.SafeReadScalarProperty(nameof(CVector3.Z))) }; break; } default: throw new ArgumentOutOfRangeException(); } parser.MoveNext(); // skip the mapping end (or crash) } } parser.MoveNext(); // skip the mapping end (or crash) return(result); }
//public static System.Deployment.Application.ApplicationDeployment CurrentDeployment { get; } static void Main(string[] args) { /*Declaration FASE */ string pLink; string link; string fullNameFile; string baseNameFile; string replace = ""; string path = System.Reflection.Assembly.GetExecutingAssembly().Location; path = path.Replace(path.Split('\\')[path.Split('\\').Length - 1], ""); int riprendiDalla = 0, nEpisodi = 0; NumberEpisode objNEs; Serie serie; /*Preparation FASE*/ Console.WriteLine($"--- <-_ Benvenuti su AnimeWorldDownloader v{version} by Arutosio - Testo a cura di Jamlegend _-> ---"); Console.Write(" ~ "); CColor.WriteC("Per informazione consultare la pagina GitHub della repository", "cyan"); Console.WriteLine(" ~ "); CColor.WriteLineC("Nota: si consiglia fortemente di scaricare l'eseguibile dal sito dello sviluppatore al seguente link", "darkyellow"); CColor.WriteLineC(" https://github.com/Arutosio/AnimeWorldDownloader/releases", "cyan"); Console.Write("Path: "); CColor.WriteC(path, "yellow"); do { Console.WriteLine(); LineFase("Inizio fase PREPARATORIA"); do { Console.WriteLine("--- Inserisci l'URL diretto dell'episodio da Scaricare: "); pLink = CColor.ReadLineC("cyan"); } while (!IsValidUri(pLink)); fullNameFile = FixStringChar(pLink.Split('/')[pLink.Split('/').Length - 1]); baseNameFile = fullNameFile.Split('_')[0]; try { if (Convert.ToInt32(fullNameFile.Split('_')[2]) != -1) { replace = fullNameFile.Split('_')[2]; //numOfZeroOnNumberEp = (fullNameFile.Split('_')[2].Length); Console.Write("Numero dell'episodio riconosciuto con sucesso: "); CColor.WriteLineC(replace, "yellow"); } } catch { CColor.WriteLineC("Numero dell'episodio non riconosciuto, inserire manualmente.", "red"); Console.Write("--- Inserisci il Numero dell'episodio tratto dall'URL (ES:00, 04, 11): "); replace = CColor.ReadLineC("Yellow"); } nEpisodi = GetNumberOfC("--- Inserisci il numero di episodi: ", "yellow"); if (IsRipresa()) { riprendiDalla = GetNumberOfC("--- Inserisci il numero dell'episodio da cui vuoi riprendere a scaricare: ", "yellow"); objNEs = new NumberEpisode(riprendiDalla, replace); } else { objNEs = new NumberEpisode(replace); } serie = new Serie(baseNameFile, nEpisodi, fullNameFile, objNEs); /*Procces FASE*/ LineFase("Inizio fase SCARICAMENTO!"); CreateFolder(path, baseNameFile); while (serie.nEpisodes >= serie.numberEpisode.GetNumber()) { pL = new ProgressLine(30); link = pLink.Replace(replace, serie.numberEpisode.ToString()); Console.Write(" GET> "); CColor.WriteLineC(link, "cyan"); if (FileDownloader.IsURLExist(link)) { string filePath = path + serie.nameSerie + @"\" + serie.GetNameFile(); FileDownloader.DoAGetRequest(link, filePath); pL.SincePrintProgress(); } serie.numberEpisode.IncrementNumber(); } Console.Write("\r\n======> "); CColor.WriteC("PROCESSO CONCLUSO!", "green"); Console.WriteLine(" <======"); Console.Write("Premi "); CColor.WriteC("Y", "green"); Console.Write(" se vuoi scaricare un'altro anime, altrimenti premi un altro tasto per "); CColor.WriteC("USCIRE", "red"); Console.Write(": "); } while (Console.ReadKey().KeyChar.ToString().ToLower().Equals("y")); }