public GameManager()
 {
     sdata      = new SData();
     gamedata   = new GameData();
     mapManager = new MapManager();
     tokens     = new List <TokenAccess>();
 }
Exemple #2
0
        static void Main(String[] args)
        {
            string str   = "SData";
            var    ctype = Type.GetType(str);
            var    ob    = Activator.CreateInstance(ctype);

            Console.WriteLine(ob.GetType().ToString());
            var m = ctype.GetFields();

            for (int i = 0; i < m.Length; ++i)
            {
                m[i].SetValue(ob, 3);

                break;
            }

            IProto I = ob as IProto;
            var    s = new CStream();

            s.Push(I);
            s.SaveFile("ok.bin");

            var s2 = new CStream("ok.bin");

            SData d2 = new SData();

            s2.Pop(d2);
            Console.WriteLine("ok");
        }
Exemple #3
0
 public SListenTopic(string in_channelID, string in_nonce)
 {
     type  = "LISTEN";
     nonce = in_nonce;
     data  = new SData();
     data.Init(in_channelID);
 }
        //* ────________________________________*
        //* methods ───────────────────────────────-*

        //* -----------------------------------------------------------------------*
        /// <summary>
        /// <para>1フレーム分の更新処理を実行します。</para>
        /// <para>ここではループ中にアセットを遅延読み込みします。</para>
        /// <para>オーバーライドする場合、必ず呼び出してください。</para>
        /// </summary>
        ///
        /// <param name="entity">この状態を適用されているオブジェクト。</param>
        /// <param name="privateMembers">
        /// オブジェクトと状態クラスのみがアクセス可能なフィールド。
        /// </param>
        /// <param name="gameTime">前フレームが開始してからの経過時間。</param>
        public override void update(IEntity entity, object privateMembers, GameTime gameTime)
        {
            if (counter % interval == interval - 1)
            {
                for (int i = loadPerFrame; --i >= 0 && loadQueueList.Count > 0;)
                {
                    SData data = loadQueueList.Dequeue();
                    Func <string, object> loader;
                    if (loaderList.TryGetValue(data.type, out loader))
                    {
                        data.dst.value = loader(data.asset);
                        totalLoaded++;
                    }
                    else
                    {
                        throw new ContentLoadException(data.type.FullName +
                                                       "型のアセットを読み込むためのローダが定義されていません。");
                    }
                }
                if (loadQueueList.Count == 0 && !loaded)
                {
                    loaded = true;
                    onLoaded(entity, privateMembers);
                }
            }
            counter++;
            base.update(entity, privateMembers, gameTime);
        }
    IEnumerator GraphObjectsIndexed()
    {
        parent = new GameObject {
            name = "DataPoints"
        };
        parent.transform.position = Vector3.zero;
        parent.AddComponent <PointPositionHandlerDelete>();
        int currIndex = this.startIndex;

        indexedAnimStopped = false;

        while (!indexedAnimStopped)
        {
            while (MapStore.Instance.secondaryIconGOs.Count < numberOfValues)
            {
                SData      sData  = DataStore.Instance.sDataRecords.ElementAt(currIndex);
                Vector3    pos    = MapStore.Instance.secondaryMap.GeoToWorldPosition(sData.latLon);
                Vector3    adjPos = sData.AdjustPosForDepth(pos);
                GameObject go     = Instantiate(dataPointPrefab, adjPos, Quaternion.identity);
                go.transform.parent = parent.transform;
                MapStore.Instance.secondaryIconGOs.Add(go);
                LerpAnimationDelete lA = go.GetComponent <LerpAnimationDelete>();
                lA.Setup(sData, true, gradient);
                if (currIndex < DataStore.Instance.sDataRecords.Count - 1)
                {
                    currIndex++;
                }
                else
                {
                    currIndex = 0;
                }
            }
            yield return(new WaitForSeconds(secondsPerHour));
        }
    }
        public CPartyModeTicTacToe(int id) : base(id)
        {
            _ScreenSongOptions.Selection.RandomOnly            = false;
            _ScreenSongOptions.Selection.PartyMode             = true;
            _ScreenSongOptions.Selection.CategoryChangeAllowed = true;
            _ScreenSongOptions.Selection.NumJokers             = new int[] { 5, 5 };
            _ScreenSongOptions.Selection.TeamNames             = new string[] { "foo", "bar" };

            _ScreenSongOptions.Sorting.SearchString = String.Empty;
            _ScreenSongOptions.Sorting.SearchActive = false;
            _ScreenSongOptions.Sorting.DuetOptions  = EDuetOptions.NoDuets;

            GameData = new SData
            {
                NumPlayerTeam1  = 2,
                NumPlayerTeam2  = 2,
                NumFields       = 9,
                ProfileIDsTeam1 = new List <int>(),
                ProfileIDsTeam2 = new List <int>(),
                PlayerTeam1     = new List <int>(),
                PlayerTeam2     = new List <int>(),
                CurrentRoundNr  = 0,
                FieldNr         = 0,
                SongSource      = ESongSource.TR_ALLSONGS,
                PlaylistID      = 0,
                CategoryIndex   = 0,
                GameMode        = 0,
                Rounds          = new List <CRound>(),
                Songs           = new List <int>(),
                NumJokerRandom  = new int[2],
                NumJokerRetry   = new int[2]
            };
        }
        public CPartyModeChallenge(int id) : base(id)
        {
            _ScreenSongOptions.Selection.RandomOnly            = false;
            _ScreenSongOptions.Selection.PartyMode             = true;
            _ScreenSongOptions.Selection.CategoryChangeAllowed = true;
            _ScreenSongOptions.Selection.NumJokers             = new int[] { 5, 5 };
            _ScreenSongOptions.Selection.TeamNames             = new string[] { "foo", "bar" };

            _ScreenSongOptions.Sorting.SearchString     = String.Empty;
            _ScreenSongOptions.Sorting.SearchActive     = false;
            _ScreenSongOptions.Sorting.DuetOptions      = EDuetOptions.NoDuets;
            _ScreenSongOptions.Sorting.FilterPlaylistID = -1;

            GameData = new SData
            {
                NumPlayer       = 4,
                NumPlayerAtOnce = 2,
                NumRounds       = 12,
                NumJokers       = 5,
                RefillJokers    = true,
                CurrentRoundNr  = 1,
                ProfileIDs      = new List <Guid>(),
                Sorting         = CBase.Config.GetSongSorting(),
                SongSource      = ESongSource.TR_SONGSOURCE_ALLSONGS,
                PlaylistID      = 0,
                CategoryIndex   = 0,
                GameMode        = EGameMode.TR_GAMEMODE_NORMAL,
                NumMedleySongs  = 5,
                Results         = null,
                Songs           = new List <int>()
            };
        }
    void UpdateLocationNoDepth(GameObject go)
    {
        SData   sData         = go.GetComponent <LerpAnimationDelete>().sData;
        Vector3 unadjustedPos = MapStore.Instance.secondaryMap.GeoToWorldPosition(sData.latLon, true);

        go.transform.localPosition = unadjustedPos;
    }
Exemple #9
0
 void ShowUIPanel(SData data)
 {
     title.text   = data.title;//.texture.name;
     image.sprite = data.sprite;
     openEvent.Invoke();
     image.GetComponent <LayoutElement>().preferredHeight = image.GetComponent <LayoutElement>().preferredWidth / ((float)image.sprite.texture.width / image.sprite.texture.height);
 }
Exemple #10
0
        public ActionResult Index(int?page)
        {
            page = page ?? 1;
            SData data = new SData();

            return(View(data.GetAll($"http://www.thelakewoodscoop.com/news/page/{page}")));
        }
Exemple #11
0
    void UpdateLocation(GameObject go)
    {
        SData   sData         = go.GetComponent <LerpAnimation>().sData;
        Vector3 unadjustedPos = MapStore.Instance.map.GeoToWorldPosition(sData.latLon, true);
        Vector3 adjustedPos   = go.GetComponent <LerpAnimation>().sData.AdjustPosForDepth(unadjustedPos);

        go.transform.localPosition = adjustedPos;
    }
Exemple #12
0
        public void LoadFromFile(string aFilePath)
        {
            StreamReader sr = new StreamReader(aFilePath);

            string fileData = sr.ReadToEnd();

            Data = JsonConvert.DeserializeObject <SData>(fileData);
        }
Exemple #13
0
        //* ────________________________________*
        //* methods ───────────────────────────────-*

        //* -----------------------------------------------------------------------*
        /// <summary>現在のフォグ情報を取得します。</summary>
        ///
        /// <param name="now">現在の時間。</param>
        /// <returns>現在のフォグ情報。</returns>
        public SData getNow(int now)
        {
            SData data   = new SData();
            float amount = interpolate.interpolate(0, 1, now, interval);

            data.color = Color.Lerp(start.color, end.color, amount);
            return(data);
        }
 public int Add(SData sDataItem)
 {
     if (sDataItem != null)
     {
         sDataItem.ParentCollection = this;
         return(this.List.Add(sDataItem));
     }
     return(-1);
 }
Exemple #15
0
 public ActionResult Genetic3(GData item)
 {
     item       = gitem;
     item.kf[0] = new List <double>()
     {
         100 - 83, 100 - 89, 100 - 95, 100 - 98
     };
     item.Solve();
     return(View("Genetic", item));
 }
Exemple #16
0
 public ActionResult Genetic2(GData item)
 {
     item       = gitem;
     item.kf[2] = new List <double>()
     {
         120 - 120 * 0.05, 90 - 90 * 0.05, 80 - 80 * 0.05, 70 - 70 * 0.05, 2800000
     };
     item.Solve();
     return(View("Genetic", item));
 }
Exemple #17
0
        public InstanceDB(string schemaFileName, string instanceFileName, string logFileName)
            : this(instanceFileName)
        {
            //SParser aParser = new SParser();
            //p_schemaModel = aParser.ReadSchemaFile(schemaFileName, schemaFileName + ".log");
            p_schemaModel = SParser.ReadSchema(schemaFileName);
            AssignEntityDefToInstance(logFileName);

            //p_InstanceModel.UpdateGuidToIFCInstanceGuid();
        }
Exemple #18
0
 public ActionResult Simplex3(SData item)
 {
     item = this.item;
     item.dtFunctionVariables = new List <double>
     {
         100 - 83, 100 - 89, 100 - 95, 100 - 98
     };
     item.Solve();
     return(View("Simplex", item));
 }
    void UpdateLocation(GameObject go)
    {
        SData   sData         = go.GetComponent <LerpAnimationDelete>().sData;
        Vector3 unadjustedPos = MapStore.Instance.secondaryMap.GeoToWorldPosition(sData.latLon, true);

        Debug.Log("Here is the pos: " + unadjustedPos);
        Vector3 adjustedPos = go.GetComponent <LerpAnimationDelete>().sData.AdjustPosForDepth(unadjustedPos);

        go.transform.localPosition = adjustedPos;
    }
Exemple #20
0
        public ActionResult Simplex(SData item, string Method)
        {
            try
            {
                item.Solve();
            }
            catch (Exception) { }

            return(View(item));
        }
Exemple #21
0
 public ActionResult Genetic1(GData item)
 {
     item       = gitem;
     item.kf[0] = new List <double>()
     {
         105 - 83 - 83 * 0.05, 105 - 89 - 89 * 0.05, 105 - 95 - 95 - 0.05, 105 - 98 - 98 * 0.05
     };
     item.Solve();
     return(View("Genetic", item));
 }
        //* ────________________________________*
        //* methods ───────────────────────────────-*

        //* -----------------------------------------------------------------------*
        /// <summary>現在のカメラ情報を取得します。</summary>
        ///
        /// <param name="now">現在の時間。</param>
        /// <returns>現在のカメラ情報。</returns>
        public SData getNow(int now)
        {
            SData data   = new SData();
            float amount = interpolate.interpolate(0, 1, now, interval);

            data.up   = Vector3.Lerp(start.up, end.up, amount);
            data.from = Vector3.Lerp(start.from, end.from, amount);
            data.to   = Vector3.Lerp(start.to, end.to, amount);
            data.fov  = interpolate.interpolate(start.fov, end.fov, now, interval);
            return(data);
        }
Exemple #23
0
        public ActionResult Simplex1(SData item)
        {
            item = this.item;
            item.dtFunctionVariables = new List <double>
            {
                105 - 83 - 83 * 0.05, 105 - 89 - 89 * 0.05, 105 - 95 - 95 - 0.05, 105 - 98 - 98 * 0.05
            };

            item.Solve();
            return(View("Simplex", item));
        }
Exemple #24
0
 public void ToSDataFromDData()
 {
     Kind = KindOfData.StringValue;
     SDData.Clear();
     if (DData.Count > 0)
     {
         foreach (double d in DData)
         {
             SData.Add(d.ToString());
         }
     }
 }
Exemple #25
0
        //* ────________________________________*
        //* methods ───────────────────────────────-*

        //* -----------------------------------------------------------------------*
        /// <summary>現在のカメラ情報を取得します。</summary>
        ///
        /// <param name="now">現在の時間。</param>
        /// <returns>現在のカメラ情報。</returns>
        public SData getNow(int now)
        {
            SData data   = new SData();
            float amount = 0.5f *
                           (interpolate.interpolate(0, 1, now, interval) +
                            CInterpolate.amountLinear(now, interval));

            data.up   = Vector3.Lerp(start.up, end.up, amount);
            data.from = Vector3.Lerp(start.from, end.from, amount);
            data.to   = Vector3.Lerp(start.to, end.to, amount);
            data.fov  = MathHelper.Lerp(start.fov, end.fov, amount);
            return(data);
        }
Exemple #26
0
        public void Import(BinaryReader r)
        {
            isRun = false;
            data.Clear();
            int num = r.ReadInt32();

            for (int i = 0; i < num; i++)
            {
                SData temp = new SData();
                temp.Import(r);
                data.Add(temp.index, temp);
            }
        }
Exemple #27
0
        //* -----------------------------------------------------------------------*
        /// <summary>インスタンスを休眠させます。</summary>
        ///
        ///	<param name="instance">インスタンス。</param>
        ///	<returns>インスタンスが休眠した場合、<c>true</c>。</returns>
        public virtual bool sleep(_T instance)
        {
            int  nIndex  = list.FindIndex(info => info.m_instance == instance);
            bool bResult = nIndex >= 0;

            if (bResult)
            {
                SData data = list[nIndex];
                data.m_bActive = false;
                list[nIndex]   = data;
            }
            return(bResult);
        }
Exemple #28
0
        //* ────________________________________*
        //* methods ───────────────────────────────-*

        //* -----------------------------------------------------------------------*
        /// <summary>未使用のインスタンスを取得します。</summary>
        ///
        ///	<returns>
        ///	未使用のインスタンス。存在しないか、全て使用中の場合、<c>null</c>。
        ///	</returns>
        public virtual _T get()
        {
            _T  result = default(_T);
            int nIndex = list.FindIndex(info => !info.m_bActive);

            if (nIndex >= 0)
            {
                SData data = list[nIndex];
                data.m_bActive = true;
                result         = data.m_instance;
                list[nIndex]   = data;
            }
            return(result);
        }
    public void GenerateScatterplot(string xName, string yName, string zName)
    {
        List <SData> sDataList = new List <SData>();

        foreach (GameObject pointGo in MapStore.Instance.selectedGOs)
        {
            SData sData = pointGo.GetComponent <LerpAnimation>().sData;
            sDataList.Add(sData);
        }

        GameObject scatterplotGo  = Instantiate(scatterplotPrefab, Vector3.zero, Quaternion.identity);
        ScatterBox scatterplotObj = scatterplotGo.GetComponentInChildren <ScatterBox>();

        scatterplotObj.InitializeScatterplot(sDataList, xName, yName, zName);
    }
    public void GenerateHistogram(string xName)
    {
        List <SData> sDataList = new List <SData>();

        foreach (GameObject pointGo in MapStore.Instance.selectedGOs)
        {
            SData sData = pointGo.GetComponent <LerpAnimation>().sData;
            sDataList.Add(sData);
        }

        GameObject histogramGo    = Instantiate(histogramPrefab, Vector3.zero, Quaternion.identity);
        Histogram  scatterplotObj = histogramGo.GetComponentInChildren <Histogram>();

        scatterplotObj.InitializeHistogram(sDataList, xName);
    }
Exemple #31
0
        /// <summary>
        /// Converts a USDX 1.1 database into the Vocaluxe format
        /// </summary>
        /// <param name="FilePath">Database file path</param>
        /// <returns>True if succeeded</returns>
        private static bool ConvertFrom110(string FilePath)
        {
            SQLiteConnection connection = new SQLiteConnection();
            connection.ConnectionString = "Data Source=" + FilePath;
            SQLiteCommand command;

            try
            {
                connection.Open();
            }
            catch (Exception)
            {
                return false;
            }

            command = new SQLiteCommand(connection);

            //The USDX database has no column for LineNr, Medley and Duet so just fill 0 in there
            command.CommandText = "INSERT INTO Scores (SongID, PlayerName, Score, LineNr, Date, Medley, Duet, Difficulty) SELECT SongID, Player, Score, '0', Date, '0', '0', Difficulty from US_Scores";
            command.ExecuteNonQuery();

            command.CommandText = "INSERT INTO Songs SELECT ID, Artist, Title, TimesPlayed from US_Songs";
            command.ExecuteNonQuery();

            List<SData> scores = new List<SData>();
            List<SData> songs = new List<SData>();

            SQLiteDataReader reader = null;
            command.CommandText = "SELECT id, PlayerName, Date FROM Scores";
            try
            {
                reader = command.ExecuteReader();
            }
            catch (Exception)
            {
                throw;
            }

            if (reader != null && reader.HasRows)
            {
                while (reader.Read())
                {
                    SData data = new SData();
                    data.id = reader.GetInt32(0);
                    data.str1 = reader.GetString(1);
                    data.ticks = UnixTimeToTicks((int)reader.GetInt64(2));

                    scores.Add(data);
                }
                reader.Close();
            }

            command.CommandText = "SELECT id, Artist, Title FROM Songs";
            try
            {
                reader = command.ExecuteReader();
            }
            catch (Exception)
            {
                throw;
            }

            if (reader != null && reader.HasRows)
            {
                while (reader.Read())
                {
                    SData data = new SData();
                    data.id = reader.GetInt32(0);
                    data.str1 = reader.GetString(1);
                    data.str2 = reader.GetString(2);
                    songs.Add(data);
                }
                reader.Close();
            }

            reader.Dispose();

            SQLiteTransaction _Transaction = connection.BeginTransaction();
            // update Title and Artist strings
            foreach (SData data in songs)
            {
                command.CommandText = "UPDATE Songs SET [Artist] = @artist, [Title] = @title WHERE [ID] = @id";
                command.Parameters.Add("@title", System.Data.DbType.String, 0).Value = data.str2;
                command.Parameters.Add("@artist", System.Data.DbType.String, 0).Value = data.str1;
                command.Parameters.Add("@id", System.Data.DbType.Int32, 0).Value = data.id;
                command.ExecuteNonQuery();
            }

            // update player names
            foreach (SData data in scores)
            {
                command.CommandText = "UPDATE Scores SET [PlayerName] = @player, [Date] = @date WHERE [id] = @id";
                command.Parameters.Add("@player", System.Data.DbType.String, 0).Value = data.str1;
                command.Parameters.Add("@date", System.Data.DbType.Int64, 0).Value = data.ticks;
                command.Parameters.Add("@id", System.Data.DbType.Int32, 0).Value = data.id;
                command.ExecuteNonQuery();
            }
            _Transaction.Commit();

            //Delete old tables after conversion
            command.CommandText = "DROP TABLE US_Scores;";
            command.ExecuteNonQuery();

            command.CommandText = "DROP TABLE US_Songs;";
            command.ExecuteNonQuery();

            command.CommandText = "DROP TABLE us_statistics_info;";
            command.ExecuteNonQuery();

            //This versioning is not used in Vocaluxe so reset it to 0
            command.CommandText = "PRAGMA user_version = 0";
            command.ExecuteNonQuery();

            command.Dispose();
            connection.Close();
            connection.Dispose();

            return true;
        }
Exemple #32
0
        /// <summary>
        /// Converts a USDX 1.01 or CMD 1.01 database to Vocaluxe format
        /// </summary>
        /// <param name="FilePath">Database file path</param>
        /// <returns>True if succeeded</returns>
        private static bool ConvertFrom101(string FilePath)
        {
            SQLiteConnection connection = new SQLiteConnection();
            connection.ConnectionString = "Data Source=" + FilePath;
            SQLiteCommand command;
            SQLiteDataReader reader = null;

            try
            {
                connection.Open();
            }
            catch (Exception)
            {
                return false;
            }

            command = new SQLiteCommand(connection);

            command.CommandText = "PRAGMA table_info(US_Scores);";
            reader = command.ExecuteReader();


            bool dateExists = false;

            //Check for column Date
            while (reader.Read())
            {
                for (int i = 0; i < reader.FieldCount; i++)
                {
                    if (reader.GetName(i) == "name")
                    {
                        if (reader.GetString(i) == "Date")
                            dateExists = true;
                        break;
                    }
                }
            }


            reader.Close();

            //This is a USDX 1.01 DB
            if (!dateExists)
                command.CommandText = "INSERT INTO Scores (SongID, PlayerName, Score, LineNr, Date, Medley, Duet, Difficulty) SELECT SongID, Player, Score, '0', '0', '0', '0', Difficulty from US_Scores";
            else // This is a CMD 1.01 DB
                command.CommandText = "INSERT INTO Scores (SongID, PlayerName, Score, LineNr, Date, Medley, Duet, Difficulty) SELECT SongID, Player, Score, '0', Date, '0', '0', Difficulty from US_Scores";
            command.ExecuteNonQuery();

            command.CommandText = "INSERT INTO Songs SELECT ID, Artist, Title, TimesPlayed from US_Songs";
            command.ExecuteNonQuery();

            // convert from CP1252 to UTF8
            List<SData> scores = new List<SData>();
            List<SData> songs = new List<SData>();

            Sqlite3.sqlite3 OldDB;
            int res = Sqlite3.sqlite3_open(FilePath, out OldDB);

            if (res != Sqlite3.SQLITE_OK)
            {
                CLog.LogError("Error opening Database: " + FilePath + " (" + Sqlite3.sqlite3_errmsg(OldDB) + ")");
            }
            else
            {
                Sqlite3.Vdbe Stmt = new Sqlite3.Vdbe();
                res = Sqlite3.sqlite3_prepare_v2(OldDB, "SELECT id, Artist, Title FROM Songs", -1, ref Stmt, 0);

                if (res != Sqlite3.SQLITE_OK)
                {
                    CLog.LogError("Error query Database: " + FilePath + " (" + Sqlite3.sqlite3_errmsg(OldDB) + ")");
                }
                else
                {
                    //Sqlite3.sqlite3_step(Stmt);

                    Encoding UTF8 = Encoding.UTF8;
                    Encoding CP1252 = Encoding.GetEncoding(1252);

                    while (Sqlite3.sqlite3_step(Stmt) == Sqlite3.SQLITE_ROW)
                    {
                        SData data = new SData();

                        data.id = Sqlite3.sqlite3_column_int(Stmt, 0);

                        byte[] bytes = Sqlite3.sqlite3_column_rawbytes(Stmt, 1);
                        if (bytes != null)
                            data.str1 = UTF8.GetString(Encoding.Convert(CP1252, UTF8, bytes));
                        else
                            data.str1 = "Someone";

                        bytes = Sqlite3.sqlite3_column_rawbytes(Stmt, 2);
                        if (bytes != null)
                            data.str2 = UTF8.GetString(Encoding.Convert(CP1252, UTF8, bytes));
                        else
                            data.str2 = "Someone";

                        songs.Add(data);
                    }
                    Sqlite3.sqlite3_finalize(Stmt);
                }

                Stmt = new Sqlite3.Vdbe();

                if (!dateExists)
                    res = Sqlite3.sqlite3_prepare_v2(OldDB, "SELECT id, PlayerName FROM Scores", -1, ref Stmt, 0);
                else
                    res = Sqlite3.sqlite3_prepare_v2(OldDB, "SELECT id, PlayerName, Date FROM Scores", -1, ref Stmt, 0);

                if (res != Sqlite3.SQLITE_OK)
                {
                    CLog.LogError("Error query Database: " + FilePath + " (" + Sqlite3.sqlite3_errmsg(OldDB) + ")");
                }
                else
                {
                    //Sqlite3.sqlite3_step(Stmt);

                    Encoding UTF8 = Encoding.UTF8;
                    Encoding CP1252 = Encoding.GetEncoding(1252);

                    while (Sqlite3.sqlite3_step(Stmt) == Sqlite3.SQLITE_ROW)
                    {
                        SData data = new SData();

                        data.id = Sqlite3.sqlite3_column_int(Stmt, 0);

                        byte[] bytes = Sqlite3.sqlite3_column_rawbytes(Stmt, 1);
                        if (bytes != null)
                            data.str1 = UTF8.GetString(Encoding.Convert(CP1252, UTF8, bytes));
                        else
                            data.str1 = "Someone";

                        if (dateExists)
                            data.ticks = UnixTimeToTicks(Sqlite3.sqlite3_column_int(Stmt, 2));

                        scores.Add(data);
                    }
                    Sqlite3.sqlite3_finalize(Stmt);
                }
            }
            Sqlite3.sqlite3_close(OldDB);

            SQLiteTransaction _Transaction = connection.BeginTransaction();      
             
            // update Title and Artist strings
            foreach (SData data in songs)
            {
                command.CommandText = "UPDATE Songs SET [Artist] = @artist, [Title] = @title WHERE [ID] = @id";
                command.Parameters.Add("@title", System.Data.DbType.String, 0).Value = data.str2;
                command.Parameters.Add("@artist", System.Data.DbType.String, 0).Value = data.str1;
                command.Parameters.Add("@id", System.Data.DbType.Int32, 0).Value = data.id;
                command.ExecuteNonQuery();
            }           

            // update player names
            foreach (SData data in scores)
            {
                if (!dateExists)
                    command.CommandText = "UPDATE Scores SET [PlayerName] = @player WHERE [id] = @id";
                else
                {
                    command.CommandText = "UPDATE Scores SET [PlayerName] = @player, [Date] = @date WHERE [id] = @id";
                    command.Parameters.Add("@date", System.Data.DbType.Int64, 0).Value = data.ticks;
                }
                command.Parameters.Add("@player", System.Data.DbType.String, 0).Value = data.str1;
                command.Parameters.Add("@id", System.Data.DbType.Int32, 0).Value = data.id;
                command.ExecuteNonQuery();
            }
            _Transaction.Commit();

            //Delete old tables after conversion
            command.CommandText = "DROP TABLE US_Scores;";
            command.ExecuteNonQuery();

            command.CommandText = "DROP TABLE US_Songs;";
            command.ExecuteNonQuery();

            reader.Dispose();
            command.Dispose();
            connection.Close();
            connection.Dispose();

            return true;
        }