示例#1
0
        public string OppTotalsToString(string formatString)
        {
            var min    = MinutesPlayed.ToString(CultureInfo.InvariantCulture);
            var fg     = OppFGM.ToString(CultureInfo.InvariantCulture) + "-" + OppFGA.ToString(CultureInfo.InvariantCulture);
            var threeP = OppThreePM.ToString(CultureInfo.InvariantCulture) + "-" + OppThreePA.ToString(CultureInfo.InvariantCulture);
            var ft     = OppFTM.ToString(CultureInfo.InvariantCulture) + "-" + OppFTA.ToString(CultureInfo.InvariantCulture);
            var pts    = OppPoints.ToString(CultureInfo.InvariantCulture);
            var oreb   = OppOffRebounds.ToString(CultureInfo.InvariantCulture);
            var dreb   = OppDefRebounds.ToString(CultureInfo.InvariantCulture);
            var reb    = OppRebounds.ToString(CultureInfo.InvariantCulture);
            var ast    = OppAssists.ToString(CultureInfo.InvariantCulture);
            var stl    = OppSteals.ToString(CultureInfo.InvariantCulture);
            var blk    = OppBlocks.ToString(CultureInfo.InvariantCulture);
            var to     = OppTurnovers.ToString(CultureInfo.InvariantCulture);
            var pf     = OppFouls.ToString(CultureInfo.InvariantCulture);
            var pm     = OppPlusMinus.ToString(CultureInfo.InvariantCulture);
            var pip    = OppPointsInPaint.ToString(CultureInfo.InvariantCulture);
            var secChP = OppSecondChancePoints.ToString(CultureInfo.InvariantCulture);
            var fbPts  = OppFastBreakPoints.ToString(CultureInfo.InvariantCulture);
            var ptsTO  = OppPointsOffTurnovers.ToString(CultureInfo.InvariantCulture);
            var dunks  = OppDunks.ToString(CultureInfo.InvariantCulture);
            var app    = Appearances.ToString(CultureInfo.InvariantCulture);

            string stats = string.Format(formatString, ">>Opponent", min, fg, threeP, ft, pts, oreb, dreb, reb, ast, stl, blk, to, pf, pm, pts, pip, secChP, fbPts, ptsTO, dunks, app);

            return(stats);
        }
示例#2
0
        /// <summary>
        /// Merges two nodes recursivly by also merging all child nodes
        /// </summary>
        /// <param name="sameNode">The node to be intaken</param>
        /// <param name="replacements">If the node already exist, the id of the sameNode gets added
        /// to the replacement list together with the already existing node. Can be null if not needed</param>
        internal void Merge(Node sameNode)
        {
            if (!Valid || !sameNode.Valid)
            {
                throw new InvalidOperationException("Node is declared invalid");
            }

            Appearances = Appearances.Union(sameNode.Appearances).ToList();

            foreach (var nodeToAdd in sameNode.ChildNodes)
            {
                if (ChildNodes.TryGetValue(nodeToAdd.Key, out Node existingNode))
                {
                    existingNode.Merge(nodeToAdd.Value);
                }
                else
                {
                    var replacement = nodeToAdd.Value.CreateReplacement();
                    AddChild(replacement);
                }
            }

            sameNode.ReplacedBy = this;
            sameNode.Invalidate();
        }
示例#3
0
 private void loadAppearances(String file)
 {
     using (var input = File.OpenRead(file))
     {
         appearances = Appearances.Parser.ParseFrom(input);
     }
 }
示例#4
0
        public string TotalsToString(string formatString)
        {
            var min    = MinutesPlayed.ToString(CultureInfo.InvariantCulture);
            var fg     = FGM.ToString(CultureInfo.InvariantCulture) + "-" + FGA.ToString(CultureInfo.InvariantCulture);
            var threeP = ThreePM.ToString(CultureInfo.InvariantCulture) + "-" + ThreePA.ToString(CultureInfo.InvariantCulture);
            var ft     = FTM.ToString(CultureInfo.InvariantCulture) + "-" + FTA.ToString(CultureInfo.InvariantCulture);
            var pts    = Points.ToString(CultureInfo.InvariantCulture);
            var oreb   = OffRebounds.ToString(CultureInfo.InvariantCulture);
            var dreb   = DefRebounds.ToString(CultureInfo.InvariantCulture);
            var reb    = Rebounds.ToString(CultureInfo.InvariantCulture);
            var ast    = Assists.ToString(CultureInfo.InvariantCulture);
            var stl    = Steals.ToString(CultureInfo.InvariantCulture);
            var blk    = Blocks.ToString(CultureInfo.InvariantCulture);
            var to     = Turnovers.ToString(CultureInfo.InvariantCulture);
            var pf     = Fouls.ToString(CultureInfo.InvariantCulture);
            var pm     = PlusMinus.ToString(CultureInfo.InvariantCulture);
            var pip    = PointsInPaint.ToString(CultureInfo.InvariantCulture);
            var secChP = SecondChancePoints.ToString(CultureInfo.InvariantCulture);
            var fbPts  = FastBreakPoints.ToString(CultureInfo.InvariantCulture);
            var ptsTO  = PointsOffTurnovers.ToString(CultureInfo.InvariantCulture);
            var dunks  = Dunks.ToString(CultureInfo.InvariantCulture);
            var app    = Appearances.ToString(CultureInfo.InvariantCulture);

            string stats = string.Format(formatString, Desc, min, fg, threeP, ft, pts, oreb, dreb, reb, ast, stl, blk, to, pf, pm, pts, pip, secChP, fbPts, ptsTO, dunks, app);

            return(stats);
        }
        public static ToolStripDropDownButton AddDropDownButton(this ToolStripEx parent, string text, Image image = null)
        {
            var item = new ToolStripDropDownButton();

            Appearances.MainRibbonButton(item, text, image);
            parent.Items.Add(item);
            return(item);
        }
示例#6
0
        public Form1()
        {
            InitializeComponent();

            Appearances.MainRibbonButton(toolStripButton4, "새프로젝트", @"Resources\images\app\새프로젝트.png");

            this.toolStripLabel1.Image = Image.FromFile(@"Resources\images\app\구역분할.png");
        }
示例#7
0
        public static ToolStripButton AddButton(this ToolStripEx parent, string text, string imagePath)
        {
            var item = new ToolStripButton();

            Appearances.MainRibbonButton(item, text, imagePath);
            parent.Items.Add(item);
            return(item);
        }
示例#8
0
        public override int GetHashCode()
        {
            var hashCode = -1937534557;

            hashCode = hashCode * -1521134295 + Appearances.GetHashCode();
            hashCode = hashCode * -1521134295 + Goals.GetHashCode();
            return(hashCode);
        }
示例#9
0
        public static ToolStripButton AddButton(this ToolStripPanelItem parent, string text)
        {
            var item = new ToolStripButton();

            Appearances.MainRibbonButton(item, text);
            parent.Items.Add(item);
            return(item);
        }
示例#10
0
        private void InitializeDataGrid(SfDataGrid datagrid1, SfDataGrid datagrid2)
        {
            Appearances.DataGrid(datagrid1);
            Appearances.DataGrid(datagrid2);

            var numberFormat = new NumberFormatInfo();

            numberFormat.NumberDecimalDigits = 0;
            numberFormat.NumberGroupSizes    = new int[] { 3 };

            var numberFormat2 = new NumberFormatInfo();

            numberFormat2.NumberDecimalDigits = 2;
            numberFormat2.NumberGroupSizes    = new int[] { 3 };

            var numberFormat3 = new NumberFormatInfo();

            numberFormat3.NumberDecimalDigits = 3;
            numberFormat3.NumberGroupSizes    = new int[] { 3 };

            datagrid1.AllowEditing = false;
            datagrid1.Style.CellStyle.BackColor = System.Drawing.Color.FromArgb(byte.MaxValue, 239, 239, 239);
            datagrid1.Style.CellStyle.TextColor = System.Drawing.Color.FromArgb(byte.MaxValue, 70, 70, 70);

            datagrid1.Columns.Add(new GridTextColumn()
            {
                HeaderText = "Material", AutoSizeColumnsMode = AutoSizeColumnsMode.AllCells, MappingName = nameof(DataGridModel.Col01)
            });
            datagrid1.Columns.Add(new GridNumericColumn()
            {
                HeaderText = "C Factor log", AutoSizeColumnsMode = AutoSizeColumnsMode.AllCells, MappingName = nameof(DataGridModel.Col02), NumberFormatInfo = numberFormat
            });
            datagrid1.Columns.Add(new GridNumericColumn()
            {
                HeaderText = "C Factor high", AutoSizeColumnsMode = AutoSizeColumnsMode.AllCells, MappingName = nameof(DataGridModel.Col03), NumberFormatInfo = numberFormat
            });
            datagrid1.AutoGenerateColumns = false;

            datagrid2.ShowErrorIcon  = false;
            datagrid2.ValidationMode = GridValidationMode.None;
            datagrid2.Columns.Add(new GridTextColumn()
            {
                HeaderText = "관로ID", AutoSizeColumnsMode = AutoSizeColumnsMode.ColumnHeader, MappingName = nameof(DataGridModel.Col01)
            });
            datagrid2.Columns.Add(new GridTextColumn()
            {
                HeaderText = "관재질", AutoSizeColumnsMode = AutoSizeColumnsMode.ColumnHeader, MappingName = nameof(DataGridModel.Col02)
            });
            datagrid2.Columns.Add(new GridNumericColumn()
            {
                HeaderText = "보정전", AutoSizeColumnsMode = AutoSizeColumnsMode.ColumnHeader, MappingName = nameof(DataGridModel.Col03), NumberFormatInfo = numberFormat
            });
            datagrid2.Columns.Add(new GridNumericColumn()
            {
                HeaderText = "보정후", AutoSizeColumnsMode = AutoSizeColumnsMode.ColumnHeader, MappingName = nameof(DataGridModel.Col04), NumberFormatInfo = numberFormat
            });
            datagrid2.AutoGenerateColumns = false;
        }
示例#11
0
 public PatternView()
 {
     InitializeComponent();
     Appearances.DataGrid(dgPattern);
     Appearances.DataGrid(dgPatternValue);
     InitializePatternMasterDataGrid(dgPattern);
     InitializePatternValuesDataGrid(dgPatternValue);
     InitializeChartControl(chtPattern);
 }
示例#12
0
 public PipeNetworkView2(BackgroundLayerSet backgroundLayerSet)
 {
     InitializeComponent();
     InitializeNetworkMap(backgroundLayerSet);
     InitializePipeDataGrid(dgPipe);
     InitializeJunctionDataGrid(dgJunction);
     Appearances.DataGrid(dgPipe);
     Appearances.DataGrid(dgJunction);
 }
示例#13
0
文件: Player.cs 项目: LMY/yuPong
 protected override void add_appearances()
 {
     DefaultAppearance = Appearance.CharacterFusrodahAppearance;
     Appearances.AddLast(DefaultAppearance);
     Appearances.AddLast(new Appearance(new Color4(Math.Max(DefaultAppearance.Color.R - 0.1f, 0),
                                                   Math.Max(DefaultAppearance.Color.G - 0.1f, 0),
                                                   Math.Max(DefaultAppearance.Color.B - 0.1f, 0),
                                                   DefaultAppearance.Color.A)));
 }
示例#14
0
        /// <summary>
        /// Load appearances file from the catalog.
        /// </summary>
        private static void LoadAppearances()
        {
            string     _datPath = String.Format("{0}{1}", _assetsPath, catalog[0].File);
            FileStream appStream;

            using (appStream = new FileStream(_datPath, FileMode.Open, FileAccess.ReadWrite, FileShare.Read))
            {
                appearances  = Appearances.Parser.ParseFrom(appStream);
                _objectCount = (ushort)appearances.Outfit[^ 1].Id;
示例#15
0
 /// <summary>
 /// Removes the first occurrence of a specific object from the <see cref="T:System.Collections.Generic.ICollection`1"/>.
 /// </summary>
 /// <returns>
 /// true if <paramref name="item"/> was successfully removed from the <see cref="T:System.Collections.Generic.ICollection`1"/>; otherwise, false. This method also returns false if <paramref name="item"/> is not found in the original <see cref="T:System.Collections.Generic.ICollection`1"/>.
 /// </returns>
 /// <param name="item">The object to remove from the <see cref="T:System.Collections.Generic.ICollection`1"/>.</param><exception cref="T:System.NotSupportedException">The <see cref="T:System.Collections.Generic.ICollection`1"/> is read-only.</exception>
 public bool Remove(Appearance item)
 {
     try {
         Appearances.Remove(item.Name);
         return(true);
     } catch (Exception err) {
         System.Diagnostics.Debug.WriteLine(err.Message);
         return(false);
     }
 }
示例#16
0
        static void GenerateEverything(int clientVersion, bool useAlpha)
        {
            // generating new appearances
            string datFile = clientVersion.ToString() + "/Tibia.dat";
            string sprFile = clientVersion.ToString() + "/Tibia.spr";

            if (!File.Exists(datFile) || !File.Exists(sprFile))
            {
                Console.WriteLine("Tibia.dat or Tibia.spr doesn't exist");
                Environment.Exit(0);
                return;
            }

            Appearances appearances = GenerateAppearances(datFile, clientVersion);

            // loading tibia.spr into chunks
            Core.Sprites.ContentSprites sprParser;
            try {
                var bytes = File.ReadAllBytes(sprFile);
                sprParser = new Core.Sprites.ContentSprites(bytes, clientVersion, useAlpha);
                sprParser.Parse();
            } catch (Exception e) {
                Console.WriteLine(e.Message + '\n' + e.StackTrace);
                Environment.Exit(0);
                return;
            }

            Directory.CreateDirectory(clientVersion + "/sprites");

            int start = 0;

            SaveSprites(appearances.Outfits, ref start, sprParser, clientVersion);
            SaveSprites(appearances.Effects, ref start, sprParser, clientVersion);
            SaveSprites(appearances.Missles, ref start, sprParser, clientVersion);
            SaveSprites(appearances.Objects, ref start, sprParser, clientVersion);

            Task.WaitAll(tasks.ToArray());

            // saving appearances.dat (with the respective version)
            using (FileStream file = File.Create(clientVersion + "/appearances.dat")) {
                appearances.WriteTo(file);
            }

            // saving spritesheets information (catalog-content)
            using (FileStream file = File.Create(clientVersion + "/catalog-content.json")) {
                jsonTokens.Sort(ITokenItemSort);
                foreach (var token in jsonTokens)
                {
                    catalogJson.Add(token.GetJObject());
                }

                string str = catalogJson.ToString();
                file.Write(Encoding.ASCII.GetBytes(str), 0, str.Length);
            }
        }
示例#17
0
        /// <summary>
        /// Add a new time to the indicated (key) athlete.
        /// </summary>
        /// <param name="key">unique key</param>
        /// <param name="newTime">new time to add</param>
        public void AddNewTime(int key, Appearances newTime)
        {
            AthleteDetails athlete = AthleteDetails.Find(a => a.Key == key);

            if (athlete == null)
            {
                return;
            }

            athlete.AddRaceTime(newTime);
        }
示例#18
0
        public static ToolStripButton AddButton(this ToolStripEx parent, string name, string text, Image image = null)
        {
            var item = new ToolStripButton()
            {
                Name = name, Text = text
            };

            Appearances.MainRibbonButton(item, text, image);
            parent.Items.Add(item);
            return(item);
        }
示例#19
0
        public BrowserView()
        {
            InitializeComponent();
            Appearances.Chart(chartControl);
            chartControl.ShowLegend   = false;
            chartControl.BackInterior = new BrushInfo(Color.Transparent);
            chartControl.Series.Clear();
            chartControl.Series.Add(new ChartSeries());

            legendPanel.Visible = false;
        }
示例#20
0
        public Shell(AppEnvironment environment, DialogService dialog, ViewService views)
        {
            InitializeComponent();
            AppTitle = "K-water MapMaker v2.0";

            Dialog         = dialog;
            Views          = views;
            appEnvironment = environment;
            DockManager    = new DockManager(dockingManager, this);
            RibbonManager  = new RibbonManager(ribbonControlAdv1);
            Appearances.MainRibbon(ribbonControlAdv1);
            Load += async(s, e) => await Initialize();
        }
示例#21
0
        private void LoadAppearances()
        {
            _datPath = String.Format("{0}{1}", _assetsPath, catalog[0].File);
            if (File.Exists(_datPath) == false)
            {
                return;
            }
            FileStream appStream;

            using (appStream = new FileStream(_datPath, FileMode.Open, FileAccess.ReadWrite, FileShare.Read))
            {
                appearances  = Appearances.Parser.ParseFrom(appStream);
                ObjectCount  = (ushort)appearances.Object[^ 1].Id;
示例#22
0
        /// <summary>
        /// Get Appearance object at index (zero-based).
        /// </summary>
        /// <param name="index"></param>
        /// <returns></returns>
        /// <exception cref="ArgumentOutOfRangeException"><c>index</c> is out of range.</exception>
        public Appearance this[int index] {
            get {
                if (index > Appearances.Count - 1)
                {
                    return(null);
                }

                return(Appearances[index].Value);
            }
            set {
                Appearances.Put(value.Name, value);
            }
        }
示例#23
0
        /// <summary>
        /// Get Appearance object at the given name.
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        /// <exception cref="ArgumentOutOfRangeException"><c>name</c> is out of range.</exception>
        public Appearance this[string name] {
            get {
                if (!Appearances.FoundKey(name))
                {
                    return(null);
                }

                return(Appearances[name].Value);
            }
            set {
                Appearances.Put(name, value);
            }
        }
示例#24
0
        /// <summary>
        /// Loads tibia.dat and generates new a list of appearances
        /// </summary>
        /// <returns></returns>
        static Appearances GenerateAppearances001()
        {
            try {
                var bytes = File.ReadAllBytes("tibia.dat");
                OpenTibiaUnity.Core.Sprites.ContentData parser = new OpenTibiaUnity.Core.Sprites.ContentData(bytes);
                parser.Parse();

                Appearances appearances0001 = new Appearances();

                int index = 0;
                foreach (var thingsDict in parser.ThingTypes)
                {
                    foreach (var thingIt in thingsDict)
                    {
                        var a = GenerateAppearance(thingIt.Value);

                        if (index == 0)
                        {
                            appearances0001.Objects.Add(a);
                        }
                        else if (index == 1)
                        {
                            appearances0001.Outfits.Add(a);
                        }
                        else if (index == 2)
                        {
                            appearances0001.Effects.Add(a);
                        }
                        else if (index == 3)
                        {
                            appearances0001.Missles.Add(a);
                        }
                    }

                    index++;
                }

                JObject obj = new JObject();
                obj.Add("type", "appearances");
                obj.Add("file", "appearances001.dat");

                catalogJson.Add(obj);

                return(appearances0001);
            } catch (System.Exception e) {
                Console.WriteLine(e.Message);
                Environment.Exit(0);
            }

            return(null);
        }
示例#25
0
        private void InitializeChartControl(ChartControl chart)
        {
            Appearances.Chart(chart);

            chart.PrimaryXAxis.RangeType = ChartAxisRangeType.Set;
            chart.PrimaryXAxis.Range     = new MinMaxInfo(0, 25, 1);

            chart.PrimaryYAxis.RangeType = ChartAxisRangeType.Set;
            chart.PrimaryYAxis.Range     = new MinMaxInfo(0, 1.5, 0.1);

            chart.Series[0].Style.Border.Color = Color.Transparent;

            RefreshChart(null);
        }
示例#26
0
        private void InitializeDataGrid(SfDataGrid masterDataGrid, SfDataGrid detailDataGrid)
        {
            Appearances.DataGrid(masterDataGrid);
            Appearances.DataGrid(detailDataGrid);

            var numberFormat = new NumberFormatInfo();

            numberFormat.NumberDecimalDigits = 0;
            numberFormat.NumberGroupSizes    = new int[] { 3 };

            var numberFormat2 = new NumberFormatInfo();

            numberFormat2.NumberDecimalDigits = 2;
            numberFormat2.NumberGroupSizes    = new int[] { 3 };

            var numberFormat3 = new NumberFormatInfo();

            numberFormat3.NumberDecimalDigits = 3;
            numberFormat3.NumberGroupSizes    = new int[] { 3 };

            masterDataGrid.Columns.Add(new GridTextColumn()
            {
                HeaderText = "평가항목", AutoSizeColumnsMode = AutoSizeColumnsMode.AllCells, MappingName = nameof(DataGridModel.Col01)
            });
            masterDataGrid.Columns.Add(new GridNumericColumn()
            {
                HeaderText = "가중치", AutoSizeColumnsMode = AutoSizeColumnsMode.AllCells, MappingName = nameof(DataGridModel.Col02), NumberFormatInfo = numberFormat2
            });
            masterDataGrid.AutoGenerateColumns = false;

            detailDataGrid.Columns.Add(new GridTextColumn()
            {
                HeaderText = "범위", AutoSizeColumnsMode = AutoSizeColumnsMode.AllCells, MappingName = nameof(DataGridModel.Col01)
            });
            detailDataGrid.Columns.Add(new GridNumericColumn()
            {
                HeaderText = "조건값", AutoSizeColumnsMode = AutoSizeColumnsMode.AllCells, MappingName = nameof(DataGridModel.Col02), NumberFormatInfo = numberFormat2
            });
            detailDataGrid.AutoGenerateColumns = false;

            var detailsView = new GridViewDefinition();

            detailsView.RelationalColumn = nameof(DataGridModel.Details);
            detailsView.DataGrid         = detailDataGrid;

            masterDataGrid.DetailsViewDefinitions.Add(detailsView);
        }
示例#27
0
        public void AddAppearance(string appearance)
        {
            if (!Valid)
            {
                throw new InvalidOperationException("Node is declared invalid. This happens when the graph, this node exists in, has already been merged");
            }

            if (Immutable)
            {
                throw new InvalidOperationException("Node can not be modified after set to immutable");
            }

            if (!Appearances.Contains(appearance.ToLower()))
            {
                Appearances.Add(appearance.ToLower());
            }
        }
示例#28
0
文件: D2S.cs 项目: dschu012/D2SLib
    private D2S(IBitReader reader)
    {
        Header         = Header.Read(reader);
        ActiveWeapon   = reader.ReadUInt32();
        Name           = reader.ReadString(16);
        Status         = Status.Read(reader.ReadByte());
        Progression    = reader.ReadByte();
        Unk0x0026      = reader.ReadBytes(2);
        ClassId        = reader.ReadByte();
        Unk0x0029      = reader.ReadBytes(2);
        Level          = reader.ReadByte();
        Created        = reader.ReadUInt32();
        LastPlayed     = reader.ReadUInt32();
        Unk0x0034      = reader.ReadBytes(4);
        AssignedSkills = Enumerable.Range(0, 16).Select(_ => Skill.Read(reader)).ToArray();
        LeftSkill      = Skill.Read(reader);
        RightSkill     = Skill.Read(reader);
        LeftSwapSkill  = Skill.Read(reader);
        RightSwapSkill = Skill.Read(reader);
        Appearances    = Appearances.Read(reader);
        Location       = Locations.Read(reader);
        MapId          = reader.ReadUInt32();
        Unk0x00af      = reader.ReadBytes(2);
        Mercenary      = Mercenary.Read(reader);
        RealmData      = reader.ReadBytes(140);
        Quests         = QuestsSection.Read(reader);
        Waypoints      = WaypointsSection.Read(reader);
        NPCDialog      = NPCDialogSection.Read(reader);
        Attributes     = Attributes.Read(reader);

        ClassSkills    = ClassSkills.Read(reader, ClassId);
        PlayerItemList = ItemList.Read(reader, Header.Version);
        PlayerCorpses  = CorpseList.Read(reader, Header.Version);

        if (Status.IsExpansion)
        {
            MercenaryItemList = MercenaryItemList.Read(reader, Mercenary, Header.Version);
            Golem             = Golem.Read(reader, Header.Version);
        }
    }
示例#29
0
        /// <summary>
        /// Loads tibia.dat and generates new a list of appearances
        /// </summary>
        /// <param name="datFile">the attributes file (tibia.dat)</param>
        /// <param name="clientVersion">the client version of this dat</param>
        /// <returns></returns>
        static Appearances GenerateAppearances(string datFile, int clientVersion)
        {
            try {
                Core.Sprites.ContentData datParser = new Core.Sprites.ContentData(File.ReadAllBytes(datFile), clientVersion);
                datParser.Parse();

                Appearances appearances = new Appearances();
                for (int i = 0; i < datParser.ThingTypeDictionaries.Length; i++)
                {
                    var dict = datParser.ThingTypeDictionaries[i];
                    foreach (var pair in dict)
                    {
                        Appearance appearance = GenerateAppearance(pair.Value);
                        switch (i)
                        {
                        case 0: appearances.Objects.Add(appearance); break;

                        case 1: appearances.Outfits.Add(appearance); break;

                        case 2: appearances.Effects.Add(appearance); break;

                        case 3: appearances.Missles.Add(appearance); break;
                        }
                    }
                }

                jsonTokens.Add(new AppearancesToken()
                {
                    file = "appearances.dat"
                });
                return(appearances);
            } catch (Exception e) {
                Console.WriteLine(e.Message + '\n' + e.StackTrace);
                Environment.Exit(0);
            }

            return(null);
        }
示例#30
0
 private void loadButton_Click(object sender, RoutedEventArgs e)
 {
     errorMessage.Content = null;
     try
     {
         using (SessionNoServer session = new SessionNoServer(s_systemDir))
         {
             Console.WriteLine($"Running with databases in directory: {session.SystemDirectory}");
             session.BeginUpdate();
             File.Copy(s_licenseDbFile, System.IO.Path.Combine(session.SystemDirectory, "4.odb"), true);
             string line;
             using (StreamReader stream = new StreamReader(lahman58db.Text + "\\Allstar.csv", true))
             {
                 line = stream.ReadLine(); // heading title line
                 while ((line = stream.ReadLine()) != null)
                 {
                     AllStar allStar = new AllStar(line);
                     session.Persist(allStar);
                 }
             }
             using (StreamReader stream = new StreamReader(lahman58db.Text + "\\AllstarFull.csv", true))
             {
                 line = stream.ReadLine(); // heading title line
                 while ((line = stream.ReadLine()) != null)
                 {
                     AllStarFull allStar = new AllStarFull(line);
                     session.Persist(allStar);
                 }
             }
             using (StreamReader stream = new StreamReader(lahman58db.Text + "\\Appearances.csv", true))
             {
                 line = stream.ReadLine(); // heading title line
                 while ((line = stream.ReadLine()) != null)
                 {
                     Appearances a = new Appearances(line);
                     session.Persist(a);
                 }
             }
             using (StreamReader stream = new StreamReader(lahman58db.Text + "\\AwardsManagers.csv", true))
             {
                 line = stream.ReadLine(); // heading title line
                 while ((line = stream.ReadLine()) != null)
                 {
                     AwardsManagers a = new AwardsManagers(line);
                     session.Persist(a);
                 }
             }
             using (StreamReader stream = new StreamReader(lahman58db.Text + "\\AwardsPlayers.csv", true))
             {
                 line = stream.ReadLine(); // heading title line
                 while ((line = stream.ReadLine()) != null)
                 {
                     AwardsPlayers a = new AwardsPlayers(line);
                     session.Persist(a);
                 }
             }
             using (StreamReader stream = new StreamReader(lahman58db.Text + "\\AwardsShareManagers.csv", true))
             {
                 line = stream.ReadLine(); // heading title line
                 while ((line = stream.ReadLine()) != null)
                 {
                     AwardsShareManagers a = new AwardsShareManagers(line);
                     session.Persist(a);
                 }
             }
             using (StreamReader stream = new StreamReader(lahman58db.Text + "\\AwardsSharePlayers.csv", true))
             {
                 line = stream.ReadLine(); // heading title line
                 while ((line = stream.ReadLine()) != null)
                 {
                     AwardsSharePlayers a = new AwardsSharePlayers(line);
                     session.Persist(a);
                 }
             }
             using (StreamReader stream = new StreamReader(lahman58db.Text + "\\Batting.csv", true))
             {
                 line = stream.ReadLine(); // heading title line
                 while ((line = stream.ReadLine()) != null)
                 {
                     Batting a = new Batting(line);
                     session.Persist(a);
                 }
             }
             using (StreamReader stream = new StreamReader(lahman58db.Text + "\\BattingPost.csv", true))
             {
                 line = stream.ReadLine(); // heading title line
                 while ((line = stream.ReadLine()) != null)
                 {
                     BattingPost a = new BattingPost(line);
                     session.Persist(a);
                 }
             }
             using (StreamReader stream = new StreamReader(lahman58db.Text + "\\Fielding.csv", true))
             {
                 line = stream.ReadLine(); // heading title line
                 while ((line = stream.ReadLine()) != null)
                 {
                     Fielding a = new Fielding(line);
                     session.Persist(a);
                 }
             }
             using (StreamReader stream = new StreamReader(lahman58db.Text + "\\FieldingOF.csv", true))
             {
                 line = stream.ReadLine(); // heading title line
                 while ((line = stream.ReadLine()) != null)
                 {
                     FieldingOF a = new FieldingOF(line);
                     session.Persist(a);
                 }
             }
             using (StreamReader stream = new StreamReader(lahman58db.Text + "\\FieldingPost.csv", true))
             {
                 line = stream.ReadLine(); // heading title line
                 while ((line = stream.ReadLine()) != null)
                 {
                     FieldingPost a = new FieldingPost(line);
                     session.Persist(a);
                 }
             }
             using (StreamReader stream = new StreamReader(lahman58db.Text + "\\HallOfFame.csv", true))
             {
                 line = stream.ReadLine(); // heading title line
                 while ((line = stream.ReadLine()) != null)
                 {
                     HallOfFame a = new HallOfFame(line);
                     session.Persist(a);
                 }
             }
             using (StreamReader stream = new StreamReader(lahman58db.Text + "\\HOFold.csv", true))
             {
                 line = stream.ReadLine(); // heading title line
                 while ((line = stream.ReadLine()) != null)
                 {
                     HOFold a = new HOFold(line);
                     session.Persist(a);
                 }
             }
             using (StreamReader stream = new StreamReader(lahman58db.Text + "\\Managers.csv", true))
             {
                 line = stream.ReadLine(); // heading title line
                 while ((line = stream.ReadLine()) != null)
                 {
                     Managers a = new Managers(line);
                     session.Persist(a);
                 }
             }
             using (StreamReader stream = new StreamReader(lahman58db.Text + "\\ManagersHalf.csv", true))
             {
                 line = stream.ReadLine(); // heading title line
                 while ((line = stream.ReadLine()) != null)
                 {
                     ManagersHalf a = new ManagersHalf(line);
                     session.Persist(a);
                 }
             }
             using (StreamReader stream = new StreamReader(lahman58db.Text + "\\Master.csv", true))
             {
                 line = stream.ReadLine(); // heading title line
                 while ((line = stream.ReadLine()) != null)
                 {
                     Master a = new Master(line);
                     session.Persist(a);
                 }
             }
             using (StreamReader stream = new StreamReader(lahman58db.Text + "\\Pitching.csv", true))
             {
                 line = stream.ReadLine(); // heading title line
                 while ((line = stream.ReadLine()) != null)
                 {
                     Pitching a = new Pitching(line);
                     session.Persist(a);
                 }
             }
             using (StreamReader stream = new StreamReader(lahman58db.Text + "\\PitchingPost.csv", true))
             {
                 line = stream.ReadLine(); // heading title line
                 while ((line = stream.ReadLine()) != null)
                 {
                     PitchingPost a = new PitchingPost(line);
                     session.Persist(a);
                 }
             }
             using (StreamReader stream = new StreamReader(lahman58db.Text + "\\Salaries.csv", true))
             {
                 line = stream.ReadLine(); // heading title line
                 while ((line = stream.ReadLine()) != null)
                 {
                     Salaries a = new Salaries(line);
                     session.Persist(a);
                 }
             }
             using (StreamReader stream = new StreamReader(lahman58db.Text + "\\Schools.csv", true))
             {
                 line = stream.ReadLine(); // heading title line
                 while ((line = stream.ReadLine()) != null)
                 {
                     Schools a = new Schools(line);
                     session.Persist(a);
                 }
             }
             using (StreamReader stream = new StreamReader(lahman58db.Text + "\\SchoolsPlayers.csv", true))
             {
                 line = stream.ReadLine(); // heading title line
                 while ((line = stream.ReadLine()) != null)
                 {
                     SchoolsPlayers a = new SchoolsPlayers(line);
                     session.Persist(a);
                 }
             }
             using (StreamReader stream = new StreamReader(lahman58db.Text + "\\SeriesPost.csv", true))
             {
                 line = stream.ReadLine(); // heading title line
                 while ((line = stream.ReadLine()) != null)
                 {
                     SeriesPost a = new SeriesPost(line);
                     session.Persist(a);
                 }
             }
             using (StreamReader stream = new StreamReader(lahman58db.Text + "\\Teams.csv", true))
             {
                 line = stream.ReadLine(); // heading title line
                 while ((line = stream.ReadLine()) != null)
                 {
                     Teams a = new Teams(line);
                     session.Persist(a);
                 }
             }
             using (StreamReader stream = new StreamReader(lahman58db.Text + "\\TeamsFranchises.csv", true))
             {
                 line = stream.ReadLine(); // heading title line
                 while ((line = stream.ReadLine()) != null)
                 {
                     TeamsFranchises a = new TeamsFranchises(line);
                     session.Persist(a);
                 }
             }
             using (StreamReader stream = new StreamReader(lahman58db.Text + "\\TeamsHalf.csv", true))
             {
                 line = stream.ReadLine(); // heading title line
                 while ((line = stream.ReadLine()) != null)
                 {
                     TeamsHalf a = new TeamsHalf(line);
                     session.Persist(a);
                 }
             }
             using (StreamReader stream = new StreamReader(lahman58db.Text + "\\Xref_Stats.csv", true))
             {
                 line = stream.ReadLine(); // heading title line
                 while ((line = stream.ReadLine()) != null)
                 {
                     Xref_Stats a = new Xref_Stats(line);
                     session.Persist(a);
                 }
             }
             session.Commit();
             errorMessage.Content = "Done, databases located in: " + session.SystemDirectory + " View objects using VelocityDBBrowser";
         }
     }
     catch (Exception ex)
     {
         errorMessage.Content = ex.Message == null?ex.ToString() : ex.Message;
     }
 }