Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="obj"></param>
        private void aDD(object obj)
        {
            //add the current vars to an object list
            clsWeaponCSV tb = new clsWeaponCSV();

            tb.Update(weapon_name,
                      upgrade_name,
                      hint,
                      cost,
                      weaponVO,
                      weaponVOresp,
                      ammo_cost,
                      create_vox,
                      obsolete_false,
                      in_box,
                      upgrade_in_box,
                      is_limited,
                      limit,
                      upgrade_limit,
                      obsolete2_false,
                      wallbuy_autospawn,
                      classs,
                      is_aat_exempt,
                      is_wonder_weapon,
                      force_attachments);

            AllLines.Add(tb);
            //mspreadsheet.Add(tb);
            //WeaponNames.Add(tb.weapon_name);
            WeaponNames = clsWeaponCSV.UpdateWeaponNames(AllLines);
            NewLine     = false;
            CommentOut  = true;
            duplicating = false;
        }
Example #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="obj"></param>
 public void cOmment(object obj)
 {
     foreach (var item in AllLines.Where(p => p.weapon_name == weapon_name))
     {
         if (!item.weapon_name.StartsWith("//"))
         {
             item.weapon_name = "//" + item.weapon_name;
         }
     }
     UpdateNames();
 }
        private Player GetWinner()
        {
            var winnersLines = AllLines.SelectMany(
                lines => lines.Select(line => line)
                .Where(line => line.Length == lengthToWin)
                ).ToList();
            var winnerId = 0;

            if (winnersLines.Count != 0)
            {
                winnerId = winnersLines[0].Id;
                return(game.Players[winnerId - 1]);
            }

            return(null);
        }
Example #4
0
        public void GenerateGCODE()
        {
            //calcMovementSideToSide();
            calcMovementUpDown();
            AllLines.Clear();
            GeneratedGCODE.Clear();

            double xMinVal = BlackLines[0].X0;
            double xMaxVal = BlackLines[0].X1;
            double yMinVal = BlackLines[0].Y0;
            double yMaxVal = BlackLines[0].Y1;

            for (int i = 0; i < BlackLines.Count - 1; i++)
            {
                AllLines.Add(new TraceLine(BlackLines[i].X0, BlackLines[i].Y0, BlackLines[i].X1, BlackLines[i].Y1, true));          //stores the current line to be drawn
                AllLines.Add(new TraceLine(BlackLines[i].X1, BlackLines[i].Y1, BlackLines[i + 1].X0, BlackLines[i + 1].Y0, false)); //moves draw head to position for next line

                //finding the minimum and maximum values for both X and Y positions. used to draw the bounding box in GUI
                if (BlackLines[i].X0 < xMinVal || BlackLines[i].X1 < xMinVal)
                {
                    xMinVal = Math.Min(BlackLines[i].X0, BlackLines[i].X1);
                }
                if (BlackLines[i].X0 > xMaxVal || BlackLines[i].X1 > xMaxVal)
                {
                    xMaxVal = Math.Max(BlackLines[i].X0, BlackLines[i].X1);
                }
                if (BlackLines[i].Y0 < yMinVal || BlackLines[i].Y1 < yMinVal)
                {
                    yMinVal = Math.Min(BlackLines[i].Y0, BlackLines[i].Y1);
                }
                if (BlackLines[i].Y0 > yMaxVal || BlackLines[i].Y1 > yMaxVal)
                {
                    yMaxVal = Math.Max(BlackLines[i].Y0, BlackLines[i].Y1);
                }
            }

            BoundingCoordinates = new TraceLine(xMinVal, yMinVal, xMaxVal, yMaxVal);        //saves X and Y positions to draw bounding box later

            GeneratedGCODE.Add(StartGCODE + "\n");
            GeneratedGCODE.Add(string.Format("G1 X{0} Y{1}\n", AllLines[0].X0, AllLines[0].Y0));    //goes from home position to start of first line to draw
            foreach (TraceLine line in AllLines)
            {
                GeneratedGCODE.Add("G1 Z" + Convert.ToInt32(!line.Draw) + "\n");
                GeneratedGCODE.Add(string.Format("G1 X{0} Y{1}\nL{2}", line.X1, line.Y1, AllLines.IndexOf(line)));      //added L to save the line number, makes gui stuff easier in main window
            }
            GeneratedGCODE.Add(EndGCODE + "\n");
        }
Example #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="obj"></param>
        public void dElete(object obj)
        {
            int          c    = 0;
            clsWeaponCSV item = new clsWeaponCSV();

            foreach (clsWeaponCSV co in AllLines)
            {
                if (co.weapon_name == weapon_name)
                {
                    item = co;
                    break;
                }
                c++;
            }
            AllLines.Remove(item);
            UpdateNames();
        }
Example #6
0
        public static void UpdateDatesConfig(string symbol, DateTime fromDate, DateTime ToDate)
        {
            string AllLines;
            string dateFormat     = "M/d/yyyy";
            string FutureDateFile = NControl.mainDirectory + symbol + @"\FutureDates.csv";

            using (StreamReader sr = new StreamReader(FutureDateFile))
            {
                AllLines = sr.ReadToEnd();
                AllLines = AllLines.Replace("Earnings," + fromDate.ToString(dateFormat),
                                            "Earnings," + ToDate.ToString(dateFormat));
            }

            using (StreamWriter sw = new StreamWriter(FutureDateFile, append: false))
            {
                sw.Write(AllLines);
            }
        }
Example #7
0
        static void Main(string[] args)
        {
            if (args.Length != 2)
            {
                Console.WriteLine("Please provide a Playlist file path and a report file path");
            }
            else
            {
                string   PlaylistFile = args[0];
                string   ReportFile   = args[1];
                string[] AllLines;

                try
                {
                    AllLines = File.ReadAllLines(PlaylistFile);
                }
                catch
                {
                    Console.WriteLine("Error reading playlist File");
                    Console.ReadLine();
                    return;
                }
                AllLines = AllLines.Skip(1).ToArray();
                var Songs = from line in AllLines
                            let data = line.Split('\t')
                                       select new Song()
                {
                    Name   = data[0],
                    Artist = data[1],
                    Album  = data[2],
                    Genre  = data[3],
                    Size   = Int64.Parse(data[4]),
                    Time   = int.Parse(data[5]),
                    Year   = int.Parse(data[6]),
                    Plays  = int.Parse(data[7]),
                };
                var    SongsWith200PlusPlays = from song in Songs where song.Plays >= 200 select song;
                var    SongsAlternative      = from song in Songs where song.Genre == "Alternative" select song;
                var    SongsRap    = from song in Songs where song.Genre == "Hip-Hop/Rap" select song;
                var    Fishbowl    = from song in Songs where song.Album == "Welcome to the Fishbowl" select song;
                var    OldSongs    = from song in Songs where song.Year < 1970 select song;
                var    LongName    = from song in Songs where song.Name.Length > 85 select song.Name;
                var    LongestSong = from song in Songs where song.Time == Songs.Max(time => time.Time) select song;
                string report      = "";

                report += "Songs that received 200 or more plays:\n";
                foreach (Song c in SongsWith200PlusPlays)
                {
                    report += c.ToString() + " \n";
                }

                int alt = 0;
                foreach (Song c in SongsAlternative)
                {
                    alt++;
                }
                report += "\nNumber of Alternative songs: " + alt + "\n";
                int rap = 0;
                foreach (Song c in SongsRap)
                {
                    rap++;;
                }
                report += "\nNumber of Hip-Hop/Rap songs: " + rap + "\n";

                report += "\nSongs from the album Welcome to the Fishbowl: \n";
                foreach (Song c in Fishbowl)
                {
                    report += c.ToString() + " \n";
                }
                report += "\nSongs from before 1970:\n";
                foreach (Song c in OldSongs)
                {
                    report += c.ToString() + " \n";
                }
                report += "\nSong names longer than 85 characters:\n";
                foreach (string c in LongName)
                {
                    report += c + " \n";
                }
                report += "\nLongest song:\n";
                foreach (Song c in LongestSong)
                {
                    report += c.ToString() + " \n";
                }
                try
                {
                    System.IO.File.WriteAllText(@ReportFile, report);
                }
                catch
                {
                    Console.WriteLine("Report file cannot be opened or writen to.");
                }
            }
            Console.ReadLine();
        }
Example #8
0
 public void DeleteWrongLines()
 {
     // ReSharper disable ImpureMethodCallOnReadonlyValueField
     AllLines = AllLines.Where(_ => _.StartPoint.IsValid() && _.EndPoint.IsValid()).ToList();
     // ReSharper restore ImpureMethodCallOnReadonlyValueField
 }
 private void Lines_LineRemoved(object sender, LineChangedEventArgs e)
 {
     this.Page.RemoveLine(e.Line);
     AllLines.Remove(e.Line);
 }
 private void Lines_LineAdded(object sender, LineChangedEventArgs e)
 {
     this.Page.AddLine(e.Line);
     AllLines.Add(e.Line);
 }