示例#1
0
        public override string AskOpenFileLocation()
        {
            using (OpenFileDialog dialog = new OpenFileDialog()
            {
                AutoUpgradeEnabled = true,
                InitialDirectory = this.ApplicationController.UserSettings.CruiseSaveLocation,
                Filter = Strings.OPEN_CRUISE_FILE_DIALOG_FILTER
            })
            {
                dialog.CustomPlaces.Add(System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\CruiseFiles");

                if (COConverter.IsInstalled() == true)
                {
                    dialog.Filter += String.Format("| {0}(*{1})|*{1}", Strings.FRIENDLY_LEGACY_CRUISE_FILETYPE_NAME, Strings.LEGACY_CRUISE_FILE_EXTENTION);
                }

                if (dialog.ShowDialog((Form)this.ApplicationController.MainWindow) == DialogResult.OK)
                {
                    return(dialog.FileName);
                    //String fileName = dialog.FileName;
                    //String directroy = System.IO.Path.GetDirectoryName(fileName);
                    //this.ApplicationController.UserSettings.CruiseSaveLocation = directroy;
                    //this.ApplicationController.OpenFile(dialog.FileName);
                }
                else
                {
                    return(null);
                }
            }
        }
示例#2
0
        public void COConverterConstructorTest()
        {
            File.Exists(TEST_CRZ_FILE).Should().BeTrue();
            if (File.Exists(OUTPUT_CURSE_FILE))
            {
                File.Delete(OUTPUT_CURSE_FILE);
            }

            COConverter con = new COConverter();
        }
示例#3
0
        public void ConvertTest()
        {
            File.Exists(TEST_CRZ_FILE).Should().BeTrue();
            if (File.Exists(OUTPUT_CURSE_FILE))
            {
                File.Delete(OUTPUT_CURSE_FILE);
            }

            COConverter target = new COConverter();

            var result = target.BenginConvert(TEST_CRZ_FILE, OUTPUT_CURSE_FILE, null, null);
            var value  = target.EndConvert(result);

            target.ErrorOutput.Should().BeNullOrEmpty();
            value.Should().BeTrue();
        }
        public void COConverterConstructorTest()
        {
            String testdir = testContextInstance.TestDeploymentDir;
            COConverter target = new COConverter();
            string targetPath = String.Format("{0}\\{1}", testdir, TEST_CRZ_FILE);
            string outputPath = String.Format("{0}\\{1}", testdir, OUTPUT_CURSE_FILE);
            ProcessUpdateEventHandler updateCaller = null;
            bool expected = true;
            bool actual;
            IAsyncResult result =  target.BenginConvert(targetPath, outputPath, null, null);
            actual = target.EndConvert(result);
            if (actual != expected)
            {
                foreach (String s in target.Output)
                {
                    testContextInstance.WriteLine("{0}",s);

                }
                testContextInstance.WriteLine("{0}",target.ErrorOutput);
            }
            Assert.AreEqual(expected, actual);
        }