コード例 #1
0
ファイル: FishHistoryDB.cs プロジェクト: nobupi/EnjoyFishing
        /// <summary>
        /// xmlファイルをコンバートする(1.0.0→1.0.5)
        /// </summary>
        /// <returns></returns>
        private void convert1_0_0to1_0_5(string iXmlFileName, string iPlayerName, DateTime iYmd)
        {
            FishHistoryDBModel1_0_0 history1_0_0 = getHistoryDB1_0_0(iPlayerName, iYmd);
            FishHistoryDBModel1_0_5 history1_0_5 = new FishHistoryDBModel1_0_5();

            history1_0_5.Version    = "1.0.5";
            history1_0_5.PlayerName = history1_0_0.PlayerName;
            history1_0_5.EarthDate  = history1_0_0.EarthDate.ToShortDateString();
            foreach (FishHistoryDBFishModel1_0_0 fish1_0_0 in history1_0_0.Fishes)
            {
                FishHistoryDBFishModel1_0_5 fish1_0_5 = new FishHistoryDBFishModel1_0_5();
                fish1_0_5.FishName  = fish1_0_0.FishName;
                fish1_0_5.ZoneName  = fish1_0_0.ZoneName;
                fish1_0_5.RodName   = fish1_0_0.RodName;
                fish1_0_5.BaitName  = fish1_0_0.BaitName;
                fish1_0_5.ID1       = fish1_0_0.ID1;
                fish1_0_5.ID2       = fish1_0_0.ID2;
                fish1_0_5.ID3       = fish1_0_0.ID3;
                fish1_0_5.ID4       = fish1_0_0.ID4;
                fish1_0_5.Critical  = fish1_0_0.Critical;
                fish1_0_5.FishCount = fish1_0_0.FishCount;
                if (fish1_0_0.ID1 == 0 && fish1_0_0.ID2 == 0 && fish1_0_0.ID3 == 0 && fish1_0_0.ID4 == 0)
                {
                    fish1_0_5.ItemType = FishDBItemTypeKind.Unknown;
                }
                else
                {
                    fish1_0_5.ItemType = FishDBItemTypeKind.Common;
                }
                fish1_0_5.FishType    = fish1_0_0.FishType;
                fish1_0_5.Result      = fish1_0_0.Result;
                fish1_0_5.EarthTime   = fish1_0_0.EarthTime.ToString();
                fish1_0_5.VanaTime    = fish1_0_0.VanaTime + ":00";
                fish1_0_5.VanaWeekDay = fish1_0_0.VanaWeekDay;
                fish1_0_5.MoonPhase   = fish1_0_0.MoonPhase;
                fish1_0_5.X           = (float)Math.Round(fish1_0_0.X, 1, MidpointRounding.AwayFromZero);
                fish1_0_5.Y           = (float)Math.Round(fish1_0_0.Y, 1, MidpointRounding.AwayFromZero);
                fish1_0_5.Z           = (float)Math.Round(fish1_0_0.Z, 1, MidpointRounding.AwayFromZero);
                fish1_0_5.H           = (float)Math.Round(fish1_0_0.H, 1, MidpointRounding.AwayFromZero);
                history1_0_5.Fishes.Add(fish1_0_5);
            }
            //バックアップ
            string backupFileName = iXmlFileName + ".bak";

            if (File.Exists(backupFileName))
            {
                File.Delete(backupFileName);
            }
            File.Copy(iXmlFileName, backupFileName);
            //xml書き込み
            PutHistoryDB1_0_5(iPlayerName, history1_0_5);
        }
コード例 #2
0
 /// <summary>
 /// xmlファイルをコンバートする(1.0.0→1.0.5)
 /// </summary>
 /// <returns></returns>
 private void convert1_0_0to1_0_5(string iXmlFileName, string iPlayerName, DateTime iYmd)
 {
     FishHistoryDBModel1_0_0 history1_0_0 = getHistoryDB1_0_0(iPlayerName, iYmd);
     FishHistoryDBModel1_0_5 history1_0_5 = new FishHistoryDBModel1_0_5();
     history1_0_5.Version = "1.0.5";
     history1_0_5.PlayerName = history1_0_0.PlayerName;
     history1_0_5.EarthDate = history1_0_0.EarthDate.ToShortDateString();
     foreach (FishHistoryDBFishModel1_0_0 fish1_0_0 in history1_0_0.Fishes)
     {
         FishHistoryDBFishModel1_0_5 fish1_0_5 = new FishHistoryDBFishModel1_0_5();
         fish1_0_5.FishName = fish1_0_0.FishName;
         fish1_0_5.ZoneName = fish1_0_0.ZoneName;
         fish1_0_5.RodName = fish1_0_0.RodName;
         fish1_0_5.BaitName = fish1_0_0.BaitName;
         fish1_0_5.ID1 = fish1_0_0.ID1;
         fish1_0_5.ID2 = fish1_0_0.ID2;
         fish1_0_5.ID3 = fish1_0_0.ID3;
         fish1_0_5.ID4 = fish1_0_0.ID4;
         fish1_0_5.Critical = fish1_0_0.Critical;
         fish1_0_5.FishCount = fish1_0_0.FishCount;
         if (fish1_0_0.ID1 == 0 && fish1_0_0.ID2 == 0 && fish1_0_0.ID3 == 0 && fish1_0_0.ID4 == 0)
         {
             fish1_0_5.ItemType = FishDBItemTypeKind.Unknown;
         }
         else
         {
             fish1_0_5.ItemType = FishDBItemTypeKind.Common;
         }
         fish1_0_5.FishType = fish1_0_0.FishType;
         fish1_0_5.Result = fish1_0_0.Result;
         fish1_0_5.EarthTime = fish1_0_0.EarthTime.ToString();
         fish1_0_5.VanaTime = fish1_0_0.VanaTime + ":00";
         fish1_0_5.VanaWeekDay = fish1_0_0.VanaWeekDay;
         fish1_0_5.MoonPhase = fish1_0_0.MoonPhase;
         fish1_0_5.X = (float)Math.Round(fish1_0_0.X, 1, MidpointRounding.AwayFromZero);
         fish1_0_5.Y = (float)Math.Round(fish1_0_0.Y, 1, MidpointRounding.AwayFromZero);
         fish1_0_5.Z = (float)Math.Round(fish1_0_0.Z, 1, MidpointRounding.AwayFromZero);
         fish1_0_5.H = (float)Math.Round(fish1_0_0.H, 1, MidpointRounding.AwayFromZero);
         history1_0_5.Fishes.Add(fish1_0_5);
     }
     //バックアップ
     string backupFileName = iXmlFileName + ".bak";
     if (File.Exists(backupFileName)) File.Delete(backupFileName);
     File.Copy(iXmlFileName, backupFileName);
     //xml書き込み
     PutHistoryDB1_0_5(iPlayerName, history1_0_5);
 }