예제 #1
0
    public static bool LoadGameDataXML()
    {
        game_data = new DictionaryFile();
        game_data.LoadFromFile(Path.Combine(DataStorage.Instance.GetPath(), gameData));

        if (!game_data.IsSuccessfullyLoaded)
        {
            Debug.LogErrorFormat("GameData: recreating corrupted {0}.", gameData);
            if (File.Exists(Path.Combine(DataStorage.Instance.GetPath(), gameData)))
            {
                File.Delete(Path.Combine(DataStorage.Instance.GetPath(), gameData));
            }
            if (File.Exists(Path.Combine(DataStorage.Instance.GetPath(), convicted)))
            {
                File.Delete(Path.Combine(DataStorage.Instance.GetPath(), convicted));
            }
        }
        else
        {
            GameData.current = new GameData();
            GameData.current.SetStringValues(game_data.GetArrayValue("GameData.current"));
            GameData.current.SetAllCharactersCompleted(game_data.GetIntArrayValue("CHARACTER_COMPLETED"));
        }

        return(game_data.IsSuccessfullyLoaded);
    }
        public void askForInput()
        {
            Console.WriteLine("Please enter the path of dictionary file: ");
            string dictionaryFile = Console.ReadLine();

            Console.WriteLine("Please enter the start word: ");
            string startWord = Console.ReadLine();

            Console.WriteLine("Please enter the end word: ");
            string endWord = Console.ReadLine();

            Console.WriteLine("Please enter the path of the output file: ");
            string outputFile = Console.ReadLine();

            DictionaryFile = dictionaryFile;
            StartWord      = startWord;
            EndWord        = endWord;
            OutputFile     = outputFile;

            IsValid();

            if (IsValid() != true)
            {
                DictionaryFile.Remove(0);
                StartWord.Remove(0);
                EndWord.Remove(0);
                OutputFile.Remove(0);
                Console.WriteLine("False entries, please try again!");
            }
        }
예제 #3
0
    void LoadOutbox(DictionaryFile file)
    {
        bool resave = false;

        string messages = "";

        if (file.HasKey("outbox") == true)
        {
            messages = file.GetString("outbox", "");
        }
        else
        {
            string rootKey = "Player[" + m_PrimaryKey + "].CloudMailbox";
            messages = PlayerPrefs.GetString(rootKey + ".Outbox", "");

            PlayerPrefs.DeleteKey(rootKey + ".Outbox");

            resave = true;
        }

        //System.IO.File.WriteAllText("Outbox.json", messages);

        m_Outbox = ReconstructFromString(messages);
        m_Outbox = m_Outbox ?? new List <BaseMessage>();

        if (resave == true)
        {
            Save();
        }
    }
예제 #4
0
    void LoadInbox(DictionaryFile file)
    {
        bool resave = false;

        string messages = "";

        if (file.HasKey("inbox") == true)
        {
            messages = file.GetString("inbox", "");
        }
        else
        {
            string rootKey = "Player[" + m_PrimaryKey + "].CloudMailbox";
            messages = PlayerPrefs.GetString(rootKey + ".Inbox", "");

            PlayerPrefs.DeleteKey(rootKey + ".Inbox");

            resave = true;
        }

        m_LastMessageIndexFromProductInbox = file.GetInt("lastMessageIndexFromProductInbox", 0);

        //System.IO.File.WriteAllText("Inbox.json", messages);

        m_Inbox = ReconstructFromString(messages);
        m_Inbox = m_Inbox ?? new List <BaseMessage>();
        m_Inbox = CleanUpMailBox(m_Inbox);

        if (resave == true)
        {
            Save();
        }

        OnInboxChanged();
    }
예제 #5
0
    void Save()
    {
        // delete old cache
        string rootKey = "Player[" + CloudUser.instance.primaryKey + "].FriendList";

        if (PlayerPrefs.HasKey(rootKey + ".ActiveFriends") == true)
        {
            PlayerPrefs.DeleteKey(rootKey + ".ActiveFriends");
        }
        if (PlayerPrefs.HasKey(rootKey + ".PendingFriends") == true)
        {
            PlayerPrefs.DeleteKey(rootKey + ".PendingFriends");
        }

        // store firend list
        DictionaryFile file = GetFile();

        if (file == null)
        {
            return;
        }

        file.SetString("active", JsonMapper.ToJson(m_Friends));
        file.SetString("pendings", JsonMapper.ToJson(m_PendingFriends));

        file.Save();
    }
        public static void DictionaryFileLoadBinaryFile()
        {
            // test whether loading the (obsolete) binary format still works
            // arrange
            const string fileName = "DictionaryStore.bin";

            Assert.IsFalse(new DictionaryFile(fileName).Delete(), "File exists before");
            var dictionary = new Dictionary <string, string>
            {
                { "1", "a" },
                { "2", "b" },
                { "3", "c" }
            };

            using var fs     = File.OpenWrite(fileName);
            using var writer = new BinaryWriter(fs);
            writer.Write(dictionary.Count);
            foreach (var pair in dictionary)
            {
                writer.Write(pair.Key);
                writer.Write(pair.Value);
            }
            // act
            var loadedDictionary = new DictionaryFile(fileName).Load();

            // assert
            AssertDictionariesEqual(dictionary, loadedDictionary);
            Assert.IsTrue(new DictionaryFile(fileName).Delete(), "Delete file after test");
            Assert.IsFalse(File.Exists(fileName), "File does not exist at end");
        }
        private static IDictionaryFile CreateDictionary(IXmlFile first, IXmlFile second, string resultFilename)
        {
            var result  = new DictionaryFile(resultFilename);
            var strings = second.SpecDetails.ToList();

            if (Path.GetFileName(first.FileName) == "strings.xml")
            {
                foreach (var str in first.Details)
                {
                    IOneString item = second.Details.FirstOrDefault(it => it.Name == str.Name);

                    if (item != null && item.OldText != str.OldText)
                    {
                        result.Add(str.OldText, item.OldText);
                    }
                }
            }
            else
            {
                foreach (var sourceString in first.SpecDetails)
                {
                    IOneString item = strings.FirstOrDefault(targetString => sourceString.EqualsNavigations(targetString));

                    if (item != null && sourceString.OldText != item.OldText)
                    {
                        result.Add(sourceString.OldText, item.OldText);
                    }
                }
            }

            return(result);
        }
예제 #8
0
    public static PPIDailyRewards Restore(string primaryKey, ref System.DateTime date, string filename = "rewards")
    {
        DictionaryFile file = GetFile(primaryKey, filename);

        if (file == null)
        {
            return(null);
        }

        file.Load();

        string json = file.GetString("rewards", "");

        if (string.IsNullOrEmpty(json) == true)
        {
            return(null);
        }

        if (System.DateTime.TryParse(file.GetString("date", ""), out date) == false)
        {
            date = CloudDateTime.UtcNow.Date;
        }

        return(Fix(JsonMapper.ToObject <PPIDailyRewards>(json)));
    }
예제 #9
0
    void SaveInbox(DictionaryFile file)
    {
        string messages = ConvertToString(m_Inbox);

        file.SetString("inbox", messages);
        file.SetInt("lastMessageIndexFromProductInbox", m_LastMessageIndexFromProductInbox);
    }
예제 #10
0
        /// <summary>
        /// Start point for the Console Application
        /// </summary>
        public void Start()
        {
            string exit = "";

            do
            {
                string startWord;
                string endWord;
                bool   valid = false;

                // We're going to continously loop through word selection until we have 2 valid words
                do
                {
                    Console.Write("Please enter your start word: ");
                    startWord = Console.ReadLine().ToLower();
                    Console.Write("Please enter your end word: ");
                    endWord = Console.ReadLine().ToLower();

                    // Perform validation on the words
                    valid = Validation.ValidateWords(startWord, endWord);
                    if (!valid)
                    {
                        Console.WriteLine("Please make sure that both words are of equal length.");
                    }
                } while (!valid);

                // We have required input from the user, start processing
                try
                {
                    DictionaryFile dictionaryFile = new DictionaryFile();
                    List <string>  dictionaryList = dictionaryFile.LoadFromSource();

                    dictionaryList = DictionaryProcessing.ProcessDictionary(startWord, endWord, dictionaryList);

                    foreach (string word in dictionaryList)
                    {
                        Console.WriteLine(word);
                    }

                    dictionaryFile.SaveResult(dictionaryList);
                    Console.WriteLine("Your results have also been saved to a txt file.");
                }
                // Either the dictionary failed to load or the results
                catch (System.IO.IOException)
                {
                    Console.WriteLine("The word dictionary could not be found. Please try again later.");
                }
                catch (Exception)
                {
                    Console.WriteLine("An unknown error occurred. Please try again later");
                }

                // Does the user wish to go again or leave?
                Console.WriteLine("Please type 'exit' to leave the application or, press enter to go again.");
                exit = Console.ReadLine().ToLower();
            } while (exit != "exit");
        }
예제 #11
0
 private void AddStartNewDialogueButton()
 {
     if (GUILayout.Button("NEW", GUILayout.MaxWidth(100), GUILayout.MaxHeight(30)))
     {
         dialogueFile = new DictionaryFile();
         dialogueFile.AddNewWord(1, new WordLine());
         importFilePathLbl = string.Empty;
     }
 }
예제 #12
0
 private void ImportAndExportFile()
 {
     //
     showLines = false;
     // Import the data
     dialogueFile = new DictionaryFile();
     dialogueFile.ImportFile(maxWords, lettersToUse);
     // And export the files
     dialogueFile.ExportFile(lettersToUse);
 }
예제 #13
0
        public void Dictionary_DictionaryFileLoads_ExpectedBehaviour()
        {
            // Arrange
            DictionaryFile dictionary = new DictionaryFile();

            // Act
            List <string> dictionaryList = dictionary.LoadFromSource();

            // Assert
            Assert.IsNotNull(dictionaryList);
        }
예제 #14
0
    static DictionaryFile GetFile(string primaryKey, string filename)
    {
        DictionaryFile file = null;

        if (string.IsNullOrEmpty(primaryKey) == false)
        {
            string filepath = string.Format("users/{0}/." + filename, GuiBaseUtils.GetCleanName(primaryKey));
            file = new DictionaryFile(filepath);
        }

        return(file);
    }
예제 #15
0
    DictionaryFile GetFile()
    {
        DictionaryFile file = null;

        if (string.IsNullOrEmpty(m_PrimaryKey) == false)
        {
            string filename = string.Format("users/{0}/.friendlist", GuiBaseUtils.GetCleanName(m_PrimaryKey));
            file = new DictionaryFile(filename);
        }

        return(file);
    }
예제 #16
0
    void Load()
    {
        DictionaryFile file = GetFile();

        if (file == null)
        {
            return;
        }

        file.Load();

        LoadInbox(file);
        LoadOutbox(file);
    }
예제 #17
0
    // =================================================================================================================

    #region --- internal ...

    void Save()
    {
        DictionaryFile file = GetFile();

        if (file == null)
        {
            return;
        }

        SaveInbox(file);
        SaveOutbox(file);

        file.Save();
    }
예제 #18
0
        public void Dictionary_DictionaryFindSolutionFromRandomList_ExpectedBehaviour()
        {
            // Arrange
            string         startWord  = "Matt";
            string         endWord    = "Mark";
            DictionaryFile dictionary = new DictionaryFile();

            // Act
            List <string> dictionaryList   = Shuffle(dictionary.LoadFromSource());
            List <string> dictionaryResult = DictionaryProcessing.ProcessDictionary(startWord, endWord, dictionaryList);

            // Assert
            Assert.IsNotNull(dictionaryResult);
        }
예제 #19
0
    public static void Store(this PPIDailyRewards @this, string primaryKey, string filename = "rewards")
    {
        DictionaryFile file = GetFile(primaryKey, filename);

        if (file == null)
        {
            return;
        }

        file.SetString("rewards", JsonMapper.ToJson(@this));
        file.SetString("date", CloudDateTime.UtcNow.Date.ToString());

        file.Save();
    }
예제 #20
0
 public static void DeleteGameXML()
 {
     try
     {
         if (File.Exists(Path.Combine(DataStorage.Instance.GetPath(), convicted)))
         {
             File.Delete(Path.Combine(DataStorage.Instance.GetPath(), convicted));
         }
     }
     catch (System.Exception e)
     {
         Debug.LogErrorFormat("SaveLoad: cannot deleteGameXML {0} {1}", convicted, e);
     }
     data = new DictionaryFile();
 }
예제 #21
0
        public static Chessboard Load(out Vector3[] fourImageCorners, Size projectorResolution)
        {
            var df = new DictionaryFile(File.ReadAllLines(FourCornersPath));

            fourImageCorners = new[] 
            {
                new Vector3(df.Get<float>("imageCorner0.X"), df.Get<float>("imageCorner0.Y"), 0),
                new Vector3(df.Get<float>("imageCorner1.X"), df.Get<float>("imageCorner1.Y"), 0),
                new Vector3(df.Get<float>("imageCorner2.X"), df.Get<float>("imageCorner2.Y"), 0),
                new Vector3(df.Get<float>("imageCorner3.X"), df.Get<float>("imageCorner3.Y"), 0),
            };

            var tileCount = new Size(df.Get<int>("tileCount.Width"), df.Get<int>("tileCount.Height"));
                
            return new Chessboard(tileCount);
        }
        public void DictionaryFileWaitForLockedFileTest()
        {
            const string fileName = "test.txt";

            if (File.Exists(fileName))
            {
                File.Delete(fileName);
            }
            var file   = File.Create(fileName);
            var waiter = new DictionaryFile(fileName)
            {
                TimeoutSeconds = 0.2
            };

            Assert.IsFalse(waiter.WaitFor());
            file.Close();
            File.Delete(fileName);
        }
        public void DictionaryFileWaitForFileTest()
        {
            const string testFile = "test.txt";

            new DictionaryFile(testFile).Delete();
            var waiter = new DictionaryFile(testFile)
            {
                TimeoutSeconds = 0.2
            };
            var task = new Task(() =>
            {
                Thread.Sleep(100);
                File.WriteAllText(testFile, new string('a', 500000));
            });

            task.Start();
            Assert.IsTrue(waiter.WaitFor(), "Wait for delayed write works");
            task.Wait();
            Assert.IsTrue(waiter.WaitFor(), "Wait for existing file works");
            File.Delete(testFile);
        }
        public void DictionaryFileSaveLoadTest()
        {
            var dictionary = new Dictionary <string, string>
            {
                { "1", "a" },
                { "2", "b" },
                { "3", "c" }
            };
            const string defaultFileName = "DictionaryStore.json";

            new DictionaryFile(defaultFileName).Delete();
            Assert.IsFalse(File.Exists(defaultFileName), "File exists before saving");
            new DictionaryFile(defaultFileName).Save(dictionary);
            Assert.IsTrue(File.Exists(defaultFileName), "File exists after saving");
            var loadedDictionary = new DictionaryFile(defaultFileName).Load();

            AssertDictionariesEqual(dictionary, loadedDictionary);

            new DictionaryFile(defaultFileName).Save(new Dictionary <string, string>());
            Assert.IsFalse(File.Exists(defaultFileName), "File does not exist after saving empty dictionary");
        }
예제 #25
0
    public static bool LoadXML()
    {
        data = new DictionaryFile();
        data.LoadFromFile(Path.Combine(DataStorage.Instance.GetPath(), convicted));

        if (!data.IsSuccessfullyLoaded)
        {
            Debug.LogErrorFormat("Game: recreating corrupted {0}.", convicted);
            if (File.Exists(Path.Combine(DataStorage.Instance.GetPath(), convicted)))
            {
                File.Delete(Path.Combine(DataStorage.Instance.GetPath(), convicted));
            }
            if (File.Exists(Path.Combine(DataStorage.Instance.GetPath(), gameData)))
            {
                File.Delete(Path.Combine(DataStorage.Instance.GetPath(), gameData));
            }
        }
//		else
//			PlayerInfo.Instance.LoadGame();

        return(data.IsSuccessfullyLoaded);
    }
예제 #26
0
    void Load()
    {
        DictionaryFile file = GetFile();

        if (file == null)
        {
            return;
        }

        file.Load();

        string json = file.GetString("active", "");

        m_Friends = JsonMapper.ToObject <List <FriendInfo> >(json);
        m_Friends = m_Friends ?? new List <FriendInfo>();

        // fixing old saves when we don't serialze m_PPIData...
        foreach (FriendInfo fi in m_Friends)
        {
            fi.PPIData = fi.PPIData ?? new PlayerPersistentInfoData();
        }

        // try to read from old cache first so we don't old lose pending list
        string rootKey = "Player[" + CloudUser.instance.primaryKey + "].FriendList";

        if (PlayerPrefs.HasKey(rootKey + ".PendingFriends") == true)
        {
            json = PlayerPrefs.GetString(rootKey + ".PendingFriends", "");
        }
        else
        {
            json = file.GetString("pendings", "");
        }
        m_PendingFriends = JsonMapper.ToObject <List <PendingFriendInfo> >(json);
        m_PendingFriends = m_PendingFriends ?? new List <PendingFriendInfo>();

        // get friend list from cloud
        RetriveFriendListFromCloud(true);
    }
        public bool IsValid()
        {
            bool isValid = false;

            if (DictionaryFile.StartsWith("/", StringComparison.Ordinal) || DictionaryFile.StartsWith(".", StringComparison.Ordinal))
            {
                isValid = true;
            }


            if (OutputFile.StartsWith("/", StringComparison.Ordinal) || OutputFile.StartsWith(".", StringComparison.Ordinal))
            {
                isValid = true;
            }

            if (StartWord == null && EndWord == null)
            {
                isValid = false;
            }


            return(isValid);
        }
예제 #28
0
        private static void Save(Chessboard chessboard, PointF[] projectorQuadCorners)
        {
            var df = new DictionaryFile();

            df.Set("tileCount.Width", chessboard.TileCount.Width);
            df.Set("tileCount.Height", chessboard.TileCount.Height);

            df.Set("corner0.X", projectorQuadCorners[0].X);
            df.Set("corner0.Y", projectorQuadCorners[0].Y);
            df.Set("corner1.X", projectorQuadCorners[1].X);
            df.Set("corner1.Y", projectorQuadCorners[1].Y);
            df.Set("corner2.X", projectorQuadCorners[2].X);
            df.Set("corner2.Y", projectorQuadCorners[2].Y);
            df.Set("corner3.X", projectorQuadCorners[3].X);
            df.Set("corner3.Y", projectorQuadCorners[3].Y);

            using (var sw = File.CreateText(FourCornersPath))
                df.Save(sw);
        }
예제 #29
0
        private Size Load()
        {
            var df = new DictionaryFile(File.ReadAllLines(FourCornersPath));

            ProjectorQuadCorners = new[] 
            {
                new PointF(df.Get<float>("corner0.X"), df.Get<float>("corner0.Y")),
                new PointF(df.Get<float>("corner1.X"), df.Get<float>("corner1.Y")),
                new PointF(df.Get<float>("corner2.X"), df.Get<float>("corner2.Y")),
                new PointF(df.Get<float>("corner3.X"), df.Get<float>("corner3.Y")),
            };

            return new Size(df.Get<int>("tileCount.Width"), df.Get<int>("tileCount.Height"));
        }
예제 #30
0
        private void Save(Chessboard chessboard, Vector3[] fourImageCorners)
        {
            var df = new DictionaryFile();

            df.Set("tileCount.Width", chessboard.TileCount.Width);
            df.Set("tileCount.Height", chessboard.TileCount.Height);

            df.Set("imageCorner0.X", fourImageCorners[0].X);
            df.Set("imageCorner0.Y", fourImageCorners[0].Y);
            df.Set("imageCorner1.X", fourImageCorners[1].X);
            df.Set("imageCorner1.Y", fourImageCorners[1].Y);
            df.Set("imageCorner2.X", fourImageCorners[2].X);
            df.Set("imageCorner2.Y", fourImageCorners[2].Y);
            df.Set("imageCorner3.X", fourImageCorners[3].X);
            df.Set("imageCorner3.Y", fourImageCorners[3].Y);

            using (var sw = File.CreateText(FourCornersPath))
                df.Save(sw);
        }
        private void TranslateOneFolder(string fileFolder, string dictionaryFolder, bool log = true)
        {
            void LogInner(string contents = "", bool writeNewLine = true)
            {
                if (log)
                {
                    Log(contents, writeNewLine);
                }
            }

            LogInner("Opening dictionaries...");

            string[] paths = File.ReadAllLines(Path.Combine(dictionaryFolder, "Paths.dict"));

            List <DictionaryFile> dicts =
                Directory.EnumerateFiles(Path.Combine(dictionaryFolder, "Dictionaries"))
                .Select(file => new DictionaryFile(file))
                .ToList();

            ProgressValue.Value = 0;
            ProgressMax.Value   = paths.Length;

            LogInner("Translating files:");

            for (int i = 0; i < paths.Length; i++)
            {
                ProgressValue.Value++;
                string xmlFilePath = Path.Combine(fileFolder, paths[i]);

                LogInner("  -- " + xmlFilePath, false);

                if (!IOUtils.FileExists(xmlFilePath))
                {
                    LogInner(" - skipped");

                    continue;
                }

                DictionaryFile dict = dicts.Find(d => Path.GetFileNameWithoutExtension(d.FileName) == i.ToString());

                if (dict == null)
                {
                    LogInner(" - skipped");

                    continue;
                }

                try
                {
                    var xmlFile = new XmlFile(xmlFilePath);

                    xmlFile.TranslateWithDictionary(dict, true);

                    LogInner(" - translated");
                }
                catch (Exception ex)
                {
                    MessageBox.Show($"Message: {ex.Message}\nStackTrace: {ex.StackTrace}");
                    LogInner(" - error");
                }
            }

            if (!IOUtils.FileExists(Path.Combine(dictionaryFolder, "Languages.dict")))
            {
                return;
            }

            LogInner("Adding languages:");

            string[] languages = File.ReadAllLines(Path.Combine(dictionaryFolder, "Languages.dict"));

            ProgressValue.Value = 0;
            ProgressMax.Value   = languages.Length;

            foreach (var language in languages)
            {
                ProgressValue.Value++;

                LogInner("  -- " + language);

                IOUtils.CopyFilesRecursively(
                    Path.Combine(dictionaryFolder, "Languages", language),
                    Path.Combine(fileFolder, "res", language)
                    );
            }
        }
예제 #32
0
 void Init()
 {
     dialogueFile      = new DictionaryFile();
     importFilePathLbl = string.Empty;
 }
예제 #33
0
        public void Save(string name, string uuid, Stream s)
        {
            using (var sw = new StreamWriter(s))
            {
                var df = new DictionaryFile();

                df.Set("Lens.K1", Lens.DistortionCoeffs[CoefficientIndexOfK1, 0]);
                df.Set("Lens.K2", Lens.DistortionCoeffs[CoefficientIndexOfK2, 0]);
                df.Set("Lens.K3", Lens.DistortionCoeffs[CoefficientIndexOfK3, 0]);

                df.Set("Lens.Cx", Lens.IntrinsicMatrix[0, 2] / ImageSize.Width);
                df.Set("Lens.Cy", Lens.IntrinsicMatrix[1, 2] / ImageSize.Height);

                df.Set("Lens.Fx", Lens.IntrinsicMatrix[0, 0] / ImageSize.Width);
                df.Set("Lens.Fy", Lens.IntrinsicMatrix[1, 1] / ImageSize.Height);

                df.Set("Name", name);
                df.Set("UUID", uuid);

                df.Set("Image.Width", ImageSize.Width);
                df.Set("Image.Height", ImageSize.Height);
                df.Set("Image.Focal.Length", FocalLength);
                df.Set("Image.AspectRatio", ImageAspectRatio);
                df.Set("Pixel.AspectRatio", PixelAspectRatio);
                df.Set("Reprojection.Error", ReprojectionError);

                df.Set("HorizontalFieldOfView", HorizontalFov);
                df.Set("VerticalFieldOfView", VerticalFov);

                df.Set("NearPlaneDistance", NearPlaneDistance);
                df.Set("FarPlaneDistance", FarPlaneDistance);

                df.Set("Principal.X", PrincipalPoint.X);
                df.Set("Principal.Y", PrincipalPoint.Y);

                df.Save(sw);
            }
        }
예제 #34
0
 private void ImportFile()
 {
     dialogueFile = new DictionaryFile();
     dialogueFile.ImportFile(maxWords, lettersToUse);
     showLines = true;
 }
예제 #35
0
    void SaveOutbox(DictionaryFile file)
    {
        string messages = ConvertToString(m_Outbox);

        file.SetString("outbox", messages);
    }
예제 #36
0
        private static IntrinsicCameraParameters LoadCameraParameters(Size imageSize, Stream s)
        {
            using (var tr = new StreamReader(s))
            {
                DictionaryFile df = new DictionaryFile(tr);
                var cp = new IntrinsicCameraParameters();

                cp.DistortionCoeffs[CoefficientIndexOfK1, 0] = df.Get<double>("Lens.K1");
                cp.DistortionCoeffs[CoefficientIndexOfK2, 0] = df.Get<double>("Lens.K2");
                cp.DistortionCoeffs[CoefficientIndexOfK3, 0] = df.Get<double>("Lens.K3");

                cp.IntrinsicMatrix[0, 2] = df.Get<double>("Lens.Cx") * imageSize.Width;
                cp.IntrinsicMatrix[1, 2] = df.Get<double>("Lens.Cy") * imageSize.Height;

                cp.IntrinsicMatrix[0, 0] = df.Get<double>("Lens.Fx") * imageSize.Width;
                cp.IntrinsicMatrix[1, 1] = df.Get<double>("Lens.Fy") * imageSize.Height;
                cp.IntrinsicMatrix[2, 2] = 1;                
                
                return cp;
            }
        }