public static void RefreshVersionsList(ref ModManager Instance, bool fullRefresh = false)
        {
            if (fullRefresh)
            {
                InstalledVersions.Clear();
                Instance.VersionsListView.Items.Clear();
                DirectoryInfo directoryInfo = new DirectoryInfo(Management.ProgramPaths.Sonic3AIR_MM_VersionsFolder);
                var           folders       = directoryInfo.GetDirectories().ToList();
                if (folders.Count != 0)
                {
                    foreach (var folder in folders.VersionSort().Reverse())
                    {
                        string filePath = Path.Combine(folder.FullName, "sonic3air_game", "Sonic3AIR.exe");
                        if (File.Exists(filePath))
                        {
                            VersionReader.AIRVersionData data = VersionReader.GetVersionData(Path.GetDirectoryName(filePath), false);
                            Instance.VersionsListView.Items.Add(new AIRVersionListItem(data.ToString(), folder.FullName, (filePath == ProgramPaths.Sonic3AIRPath ? true : false)));
                            InstalledVersions.Add(data);
                        }
                    }
                }
            }

            bool enabled = Instance.VersionsListView.SelectedItem != null;

            Instance.removeVersionButton.IsEnabled       = enabled;
            Instance.selectVersionButton.IsEnabled       = enabled;
            Instance.openVersionLocationButton.IsEnabled = enabled;
        }
    public TestAssemblyResolver(string targetPath, string projectPath)
    {
        directories = new List<string>();
        if (projectPath != null)
        {
            var versionReader = new VersionReader(projectPath);
            if (string.IsNullOrEmpty(versionReader.TargetFrameworkProfile))
            {
                if (versionReader.FrameworkVersionAsNumber == new Version(3, 5))
                {
                    directories.Add($@"{GetProgramFilesPath()}\Reference Assemblies\Microsoft\Framework\v3.5\");
                    directories.Add($@"{GetProgramFilesPath()}\Reference Assemblies\Microsoft\Framework\v3.0\");
                    directories.Add(Environment.ExpandEnvironmentVariables(@"%WINDIR%\Microsoft.NET\Framework\v2.0.50727\"));
                }
                else
                {
                    directories.Add($@"{GetProgramFilesPath()}\Reference Assemblies\Microsoft\Framework\.NETFramework\{versionReader.FrameworkVersionAsString}\");
                }
            }
            else
            {
                directories.Add($@"{GetProgramFilesPath()}\Reference Assemblies\Microsoft\Framework\.NETFramework\{versionReader.FrameworkVersionAsString}\Profile\{versionReader.TargetFrameworkProfile}");
            }
            if (versionReader.IsFSharp)
            {
                //C:\Program Files (x86)\Reference Assemblies\Microsoft\FSharp\.NETFramework\v4.0\4.3.0.0\FSharp.Core.dll
                var path = $@"{GetProgramFilesPath()}\Reference Assemblies\Microsoft\FSharp\.NETFramework\{versionReader.FrameworkVersionAsString}\{versionReader.TargetFSharpCoreVersion}\";
                directories.Add(path);
            }
        }
        directories.Add(Path.GetDirectoryName(targetPath));

        GetGacPaths();
    }
Exemple #3
0
    public TestAssemblyResolver(string targetPath, string projectPath)
    {
        directories = new List <string>();
        if (projectPath != null)
        {
            var versionReader = new VersionReader(projectPath);
            if (string.IsNullOrEmpty(versionReader.TargetFrameworkProfile))
            {
                if (versionReader.FrameworkVersionAsNumber == new Version(3, 5))
                {
                    directories.Add($@"{GetProgramFilesPath()}\Reference Assemblies\Microsoft\Framework\v3.5\");
                    directories.Add($@"{GetProgramFilesPath()}\Reference Assemblies\Microsoft\Framework\v3.0\");
                    directories.Add(Environment.ExpandEnvironmentVariables(@"%WINDIR%\Microsoft.NET\Framework\v2.0.50727\"));
                }
                else
                {
                    directories.Add($@"{GetProgramFilesPath()}\Reference Assemblies\Microsoft\Framework\.NETFramework\{versionReader.FrameworkVersionAsString}\");
                }
            }
            else
            {
                directories.Add($@"{GetProgramFilesPath()}\Reference Assemblies\Microsoft\Framework\.NETFramework\{versionReader.FrameworkVersionAsString}\Profile\{versionReader.TargetFrameworkProfile}");
            }
            if (versionReader.IsFSharp)
            {
                //C:\Program Files (x86)\Reference Assemblies\Microsoft\FSharp\.NETFramework\v4.0\4.3.0.0\FSharp.Core.dll
                var path = $@"{GetProgramFilesPath()}\Reference Assemblies\Microsoft\FSharp\.NETFramework\{versionReader.FrameworkVersionAsString}\{versionReader.TargetFSharpCoreVersion}\";
                directories.Add(path);
            }
        }
        directories.Add(Path.GetDirectoryName(targetPath));

        GetGacPaths();
    }
Exemple #4
0
 public LaunchHandler(string gamepath, Java java, bool isversionIsolation)
 {
     this.GameRootPath     = gamepath;
     this.Java             = java;
     this.VersionIsolation = isversionIsolation;
     versionReader         = new VersionReader(this);
     assetsReader          = new AssetsReader(this);
     argumentsParser       = new ArgumentsParser(this);
 }
        public async Task WhenReadVersionThenVersionMatch()
        {
            await using var pfs3AioStream = new MemoryStream(await File.ReadAllBytesAsync(@"TestData\pfs3aio"));
            var version = await VersionReader.Read(pfs3AioStream);

            Assert.Equal(
                "$VER: Professional-File-System-III 19.2 PFS3AIO-VERSION (2.10.2018) written by Michiel Pelt and copyright (c) 1994-2012 Peltin BV",
                version);
        }
Exemple #6
0
    public override void Execute()
    {
        ReadConfig();
        FindEditorBrowsableTypes();
        FindObsoleteType();

        assemblyVersion = VersionReader.Read(ModuleDefinition.Assembly);

        ProcessAssembly();
    }
        public static MenuItem GenerateInstalledVersionsToolstripItem(DirectoryInfo folder, string filepath, ref ModManager Instance)
        {
            MenuItem item = new MenuItem();

            item.Header      = $"{folder.Name} ({VersionReader.GetVersionData(folder.FullName).ToString()})";
            item.Tag         = new VersionTag(Instance, filepath);
            item.Click      += ChangeAIRPathByInstalls;
            item.IsCheckable = false;
            item.IsChecked   = (filepath == Management.ProgramPaths.Sonic3AIRPath);
            return(item);
        }
    public TestAssemblyResolver(string targetPath, string projectPath) {
        var versionReader = new VersionReader(projectPath);
        this.directories = new List<string>();

        if (versionReader.IsSilverlight) {
            if (string.IsNullOrEmpty(versionReader.TargetFrameworkProfile)) {
                this.directories.Add(
                    string.Format(
                        @"{0}\Reference Assemblies\Microsoft\Framework\Silverlight\{1}\",
                        this.GetProgramFilesPath(),
                        versionReader.FrameworkVersionAsString));
            }
            else {
                this.directories.Add(
                    string.Format(
                        @"{0}\Reference Assemblies\Microsoft\Framework\Silverlight\{1}\Profile\{2}",
                        this.GetProgramFilesPath(),
                        versionReader.FrameworkVersionAsString,
                        versionReader.TargetFrameworkProfile));
            }
        }
        else {
            if (string.IsNullOrEmpty(versionReader.TargetFrameworkProfile)) {
                if (versionReader.FrameworkVersionAsNumber == 3.5m) {
                    this.directories.Add(
                        string.Format(@"{0}\Reference Assemblies\Microsoft\Framework\v3.5\", this.GetProgramFilesPath()));
                    this.directories.Add(
                        string.Format(@"{0}\Reference Assemblies\Microsoft\Framework\v3.0\", this.GetProgramFilesPath()));
                    this.directories.Add(
                        Environment.ExpandEnvironmentVariables(@"%WINDIR%\Microsoft.NET\Framework\v2.0.50727\"));
                }
                else {
                    this.directories.Add(
                        string.Format(
                            @"{0}\Reference Assemblies\Microsoft\Framework\.NETFramework\{1}\",
                            this.GetProgramFilesPath(),
                            versionReader.FrameworkVersionAsString));
                }
            }
            else {
                this.directories.Add(
                    string.Format(
                        @"{0}\Reference Assemblies\Microsoft\Framework\.NETFramework\{1}\Profile\{2}",
                        this.GetProgramFilesPath(),
                        versionReader.FrameworkVersionAsString,
                        versionReader.TargetFrameworkProfile));
            }
        }
        this.directories.Add(Path.GetDirectoryName(targetPath));

        this.GetGacPaths();
    }
    public TestAssemblyResolver(string targetPath, string projectPath)
    {
        var versionReader = new VersionReader(projectPath);

        directories = new List <string>();

        if (versionReader.IsSilverlight)
        {
            if (string.IsNullOrEmpty(versionReader.TargetFrameworkProfile))
            {
                directories.Add(string.Format(@"{0}\Reference Assemblies\Microsoft\Framework\Silverlight\{1}\", GetProgramFilesPath(), versionReader.FrameworkVersionAsString));
            }
            else
            {
                directories.Add(string.Format(@"{0}\Reference Assemblies\Microsoft\Framework\Silverlight\{1}\Profile\{2}", GetProgramFilesPath(), versionReader.FrameworkVersionAsString, versionReader.TargetFrameworkProfile));
            }
        }
        else if (versionReader.IsWindowsPhone)
        {
            if (string.IsNullOrEmpty(versionReader.TargetFrameworkProfile))
            {
                directories.Add(string.Format(@"{0}\Reference Assemblies\Microsoft\Framework\WindowsPhone\{1}\", GetProgramFilesPath(), versionReader.FrameworkVersionAsString));
            }
            else
            {
                directories.Add(string.Format(@"{0}\Reference Assemblies\Microsoft\Framework\WindowsPhone\{1}\Profile\{2}", GetProgramFilesPath(), versionReader.FrameworkVersionAsString, versionReader.TargetFrameworkProfile));
            }
        }
        else
        {
            if (string.IsNullOrEmpty(versionReader.TargetFrameworkProfile))
            {
                if (versionReader.FrameworkVersionAsNumber == 3.5m)
                {
                    directories.Add(string.Format(@"{0}\Reference Assemblies\Microsoft\Framework\v3.5\", GetProgramFilesPath()));
                    directories.Add(string.Format(@"{0}\Reference Assemblies\Microsoft\Framework\v3.0\", GetProgramFilesPath()));
                    directories.Add(Environment.ExpandEnvironmentVariables(@"%WINDIR%\Microsoft.NET\Framework\v2.0.50727\"));
                }
                else
                {
                    directories.Add(string.Format(@"{0}\Reference Assemblies\Microsoft\Framework\.NETFramework\{1}\", GetProgramFilesPath(), versionReader.FrameworkVersionAsString));
                }
            }
            else
            {
                directories.Add(string.Format(@"{0}\Reference Assemblies\Microsoft\Framework\.NETFramework\{1}\Profile\{2}", GetProgramFilesPath(), versionReader.FrameworkVersionAsString, versionReader.TargetFrameworkProfile));
            }
        }
        directories.Add(Path.GetDirectoryName(targetPath));

        GetGacPaths();
    }
        public void WhenParseVersionThenFileVersionMatch()
        {
            var version =
                "$VER: Professional-File-System-III 19.2 PFS3AIO-VERSION (2.10.2018) written by Michiel Pelt and copyright (c) 1994-2012 Peltin BV";
            var fileVersion = VersionReader.Parse(version);

            Assert.Equal("Professional-File-System-III", fileVersion.Name);
            Assert.Equal(19, fileVersion.Version);
            Assert.Equal(2, fileVersion.Revision);
            Assert.Equal(2, fileVersion.DateDay);
            Assert.Equal(10, fileVersion.DateMonth);
            Assert.Equal(2018, fileVersion.DateYear);
        }
        public AssemblyResolver(VersionReader versionReader, string projectPath, string assemblyPath)
        {

            Directories = new List<string>();
            Directories.Add(Path.GetDirectoryName(assemblyPath));

            if (versionReader.IsSilverlight)
            {

                if (versionReader.FrameworkVersionAsNumber < 3)
                {
                    throw new WeavingException("Only Silverlight 3 and up is supported.");
                }
                if (string.IsNullOrEmpty(versionReader.TargetFrameworkProfile))
                {
                    Directories.Add(string.Format(@"{0}\Reference Assemblies\Microsoft\Framework\Silverlight\{1}\", GetProgramFilesPath(), versionReader.FrameworkVersionAsString));
                }
                else
                {
                    Directories.Add(string.Format(@"{0}\Reference Assemblies\Microsoft\Framework\Silverlight\{1}\Profile\{2}", GetProgramFilesPath(), versionReader.FrameworkVersionAsString, versionReader.TargetFrameworkProfile));
                }

            }
            else
            {
                if (versionReader.FrameworkVersionAsNumber < 3.5M)
                {
                    throw new WeavingException("Only .net 3.5 and up is supported.");
                }
                if (string.IsNullOrEmpty(versionReader.TargetFrameworkProfile))
                {
                    if (versionReader.FrameworkVersionAsNumber == 3.5M)
                    {
                        Directories.Add(string.Format(@"{0}\Reference Assemblies\Microsoft\Framework\v3.5\", GetProgramFilesPath()));
                        Directories.Add(string.Format(@"{0}\Reference Assemblies\Microsoft\Framework\v3.0\", GetProgramFilesPath()));
                        Directories.Add(Environment.ExpandEnvironmentVariables(@"%WINDIR%\Microsoft.NET\Framework\v2.0.50727\"));
                    }
                    else
                    {
                        Directories.Add(string.Format(@"{0}\Reference Assemblies\Microsoft\Framework\.NETFramework\{1}\", GetProgramFilesPath(), versionReader.FrameworkVersionAsString));
                    }
                }
                else
                {
                    Directories.Add(string.Format(@"{0}\Reference Assemblies\Microsoft\Framework\.NETFramework\{1}\Profile\{2}", GetProgramFilesPath(), versionReader.FrameworkVersionAsString, versionReader.TargetFrameworkProfile));
                }
            }
            Directories.Add(Path.GetDirectoryName(projectPath));

        }
        public static void InstallVersionFromZIP()
        {
            OpenFileDialog ofd = new OpenFileDialog()
            {
                Filter = $"{Program.LanguageResource.GetString("SonicAIRVersionZIP")} (*.zip)|*.zip",
                Title  = Program.LanguageResource.GetString("SelectSonicAIRVersionZIP")
            };

            if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                try
                {
                    string destination = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Sonic3AIR_MM\\downloads";
                    string output      = destination;

                    using (var archive = SharpCompress.Archives.Zip.ZipArchive.Open(ofd.FileName))
                    {
                        foreach (var entry in archive.Entries.Where(entry => !entry.IsDirectory))
                        {
                            entry.WriteToDirectory(output, new ExtractionOptions()
                            {
                                ExtractFullPath = true,
                                Overwrite       = true
                            });
                        }
                    }

                    string exe = Directory.GetFiles(destination, "Sonic3AIR.exe", SearchOption.AllDirectories).FirstOrDefault();
                    if (exe != null && exe != "")
                    {
                        VersionReader.AIRVersionData version_data = VersionReader.GetVersionData(output, true);
                        string folder_path = $"{Management.ProgramPaths.Sonic3AIR_MM_VersionsFolder}\\{version_data.ToString()}";
                        MoveVersionToFinalLocation(destination, folder_path);
                    }
                    else
                    {
                        //TODO : Proper Message Implemented
                        string message = "";
                        MessageBox.Show(message);
                        CleanUpDownloadsFolder();
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    CleanUpDownloadsFolder();
                }
            }
        }
Exemple #13
0
        public static RigidDiskBlock AddFileSystem(this RigidDiskBlock rigidDiskBlock,
                                                   byte[] dosType, byte[] fileSystemBytes)
        {
            var version     = VersionReader.Read(fileSystemBytes);
            var fileVersion = VersionReader.Parse(version);

            var fileSystemHeaderBlock = BlockHelper.CreateFileSystemHeaderBlock(dosType, fileVersion.Version,
                                                                                fileVersion.Revision,
                                                                                fileSystemBytes);

            rigidDiskBlock.FileSystemHeaderBlocks = rigidDiskBlock.FileSystemHeaderBlocks.Concat(new[]
                                                                                                 { fileSystemHeaderBlock });

            return(rigidDiskBlock);
        }
        public AssemblyResolver(VersionReader versionReader, string projectPath, string assemblyPath)
        {
            Directories = new List <string>();
            Directories.Add(Path.GetDirectoryName(assemblyPath));

            if (versionReader.IsSilverlight)
            {
                if (versionReader.FrameworkVersionAsNumber < 3)
                {
                    throw new WeavingException("Only Silverlight 3 and up is supported.");
                }
                if (string.IsNullOrEmpty(versionReader.TargetFrameworkProfile))
                {
                    Directories.Add(string.Format(@"{0}\Reference Assemblies\Microsoft\Framework\Silverlight\{1}\", GetProgramFilesPath(), versionReader.FrameworkVersionAsString));
                }
                else
                {
                    Directories.Add(string.Format(@"{0}\Reference Assemblies\Microsoft\Framework\Silverlight\{1}\Profile\{2}", GetProgramFilesPath(), versionReader.FrameworkVersionAsString, versionReader.TargetFrameworkProfile));
                }
            }
            else
            {
                if (versionReader.FrameworkVersionAsNumber < 3.5)
                {
                    throw new WeavingException("Only .net 3.5 and up is supported.");
                }
                if (string.IsNullOrEmpty(versionReader.TargetFrameworkProfile))
                {
                    if (versionReader.FrameworkVersionAsNumber == 3.5)
                    {
                        Directories.Add(string.Format(@"{0}\Reference Assemblies\Microsoft\Framework\v3.5\", GetProgramFilesPath()));
                        Directories.Add(string.Format(@"{0}\Reference Assemblies\Microsoft\Framework\v3.0\", GetProgramFilesPath()));
                        Directories.Add(Environment.ExpandEnvironmentVariables(@"%WINDIR%\Microsoft.NET\Framework\v2.0.50727\"));
                    }
                    else
                    {
                        Directories.Add(string.Format(@"{0}\Reference Assemblies\Microsoft\Framework\.NETFramework\{1}\", GetProgramFilesPath(), versionReader.FrameworkVersionAsString));
                    }
                }
                else
                {
                    Directories.Add(string.Format(@"{0}\Reference Assemblies\Microsoft\Framework\.NETFramework\{1}\Profile\{2}", GetProgramFilesPath(), versionReader.FrameworkVersionAsString, versionReader.TargetFrameworkProfile));
                }
            }
            Directories.Add(Path.GetDirectoryName(projectPath));
        }
        public static void RefreshVersionsList()
        {
            InstalledVersions.Clear();
            DirectoryInfo directoryInfo = new DirectoryInfo(Management.ProgramPaths.Sonic3AIR_MM_VersionsFolder);
            var           folders       = directoryInfo.GetDirectories().ToList();

            if (folders.Count != 0)
            {
                foreach (var folder in folders.VersionSort().Reverse())
                {
                    string filePath = Path.Combine(folder.FullName, "sonic3air_game", "Sonic3AIR.exe");
                    if (File.Exists(filePath))
                    {
                        VersionReader.AIRVersionData data = VersionReader.GetVersionData(Path.GetDirectoryName(filePath), false);
                        InstalledVersions.Add(data);
                    }
                }
            }
        }
    public TestAssemblyResolver(string targetPath, string projectPath)
    {
        var versionReader = new VersionReader(projectPath);
        directories = new List<string>();
        if (string.IsNullOrEmpty(versionReader.TargetFrameworkProfile))
        {
            directories.Add($@"{GetProgramFilesPath()}\Reference Assemblies\Microsoft\Framework\.NETFramework\{versionReader.FrameworkVersionAsString}\");
        }
        else
        {
            directories.Add($@"{GetProgramFilesPath()}\Reference Assemblies\Microsoft\Framework\.NETFramework\{versionReader.FrameworkVersionAsString}\Profile\{versionReader.TargetFrameworkProfile}");
        }
        if (versionReader.IsFSharp)
        {
            //C:\Program Files (x86)\Reference Assemblies\Microsoft\FSharp\.NETFramework\v4.0\4.3.0.0\FSharp.Core.dll
            var path = $@"{GetProgramFilesPath()}\Reference Assemblies\Microsoft\FSharp\.NETFramework\{versionReader.FrameworkVersionAsString}\{versionReader.TargetFSharpCoreVersion}\";
            directories.Add(path);
        }
        directories.Add(Path.GetDirectoryName(targetPath));

        GetGacPaths();
    }
    public TestAssemblyResolver(string targetPath, string projectPath)
    {
        var versionReader = new VersionReader(projectPath);
        directories = new List<string>();
        if (versionReader.IsPhone)
        {
            directories.Add(string.Format(@"{0}\Reference Assemblies\Microsoft\Framework\WindowsPhone\{1}\", GetProgramFilesPath(), versionReader.FrameworkVersionAsString));
        }
        else
        {
            if (string.IsNullOrEmpty(versionReader.TargetFrameworkProfile))
            {
                if (versionReader.FrameworkVersionAsNumber == 3.5m)
                {
                    directories.Add(string.Format(@"{0}\Reference Assemblies\Microsoft\Framework\v3.5\", GetProgramFilesPath()));
                    directories.Add(string.Format(@"{0}\Reference Assemblies\Microsoft\Framework\v3.0\", GetProgramFilesPath()));
                    directories.Add(Environment.ExpandEnvironmentVariables(@"%WINDIR%\Microsoft.NET\Framework\v2.0.50727\"));
                }
                else
                {
                    directories.Add(string.Format(@"{0}\Reference Assemblies\Microsoft\Framework\.NETFramework\{1}\", GetProgramFilesPath(), versionReader.FrameworkVersionAsString));
                }
            }
            else
            {
                directories.Add(string.Format(@"{0}\Reference Assemblies\Microsoft\Framework\.NETFramework\{1}\Profile\{2}", GetProgramFilesPath(), versionReader.FrameworkVersionAsString, versionReader.TargetFrameworkProfile));
            }
        }
        if (versionReader.IsFSharp)
        {
            //C:\Program Files (x86)\Reference Assemblies\Microsoft\FSharp\.NETFramework\v4.0\4.3.0.0\FSharp.Core.dll
            var path = string.Format(@"{0}\Reference Assemblies\Microsoft\FSharp\.NETFramework\{1}\{2}\", GetProgramFilesPath(), versionReader.FrameworkVersionAsString, versionReader.TargetFSharpCoreVersion);
            directories.Add(path);
        }
        directories.Add(Path.GetDirectoryName(targetPath));

        GetGacPaths();
    }
Exemple #18
0
    public TestAssemblyResolver(string targetPath, string projectPath)
    {
        var versionReader = new VersionReader(projectPath);

        directories = new List <string>();
        if (string.IsNullOrEmpty(versionReader.TargetFrameworkProfile))
        {
            directories.Add($@"{GetProgramFilesPath()}\Reference Assemblies\Microsoft\Framework\.NETFramework\{versionReader.FrameworkVersionAsString}\");
        }
        else
        {
            directories.Add($@"{GetProgramFilesPath()}\Reference Assemblies\Microsoft\Framework\.NETFramework\{versionReader.FrameworkVersionAsString}\Profile\{versionReader.TargetFrameworkProfile}");
        }
        if (versionReader.IsFSharp)
        {
            //C:\Program Files (x86)\Reference Assemblies\Microsoft\FSharp\.NETFramework\v4.0\4.3.0.0\FSharp.Core.dll
            var path = $@"{GetProgramFilesPath()}\Reference Assemblies\Microsoft\FSharp\.NETFramework\{versionReader.FrameworkVersionAsString}\{versionReader.TargetFSharpCoreVersion}\";
            directories.Add(path);
        }
        directories.Add(Path.GetDirectoryName(targetPath));

        GetGacPaths();
    }
Exemple #19
0
        private void pathTextBox_TextChanged(object sender, EventArgs e)
        {
            loadProjectBtn.Enabled = false;
            projectName.Text       = translations.StartupForm_pathTextBox_TextChanged_None;
            projectVersion.Text    = translations.StartupForm_pathTextBox_TextChanged_None;

            if (GeneralFunctions.IsValidExtremeProject(pathTextBox.PathText.Text))
            {
                Program.MainForm.CurrentProject.ProjectPath = pathTextBox.PathText.Text;
                Program.MainForm.CurrentProject.ReadInfo();
                projectName.Text = Program.MainForm.CurrentProject.ProjectName;

                string projVersion = Convert.ToString(Program.MainForm.CurrentProject.ProjectVersion);
                string progVersion = Convert.ToString(_versionHandler.CurrentVersion);

                VersionReader.CompareVersionResult versionCompare =
                    VersionReader.CompareVersions(projVersion, progVersion);
                if (versionCompare == VersionReader.CompareVersionResult.VersionSame)
                {
                    projectVersion.Text    = translations.StartupForm_pathTextBox_TextChanged_ProjectVersionSame;
                    loadProjectBtn.Enabled = true;
                }
                else if (versionCompare == VersionReader.CompareVersionResult.VersionNew)
                {
                    projectVersion.Text    = translations.StartupForm_pathTextBox_TextChanged_ProjectVersionOlder;
                    loadProjectBtn.Enabled = true;
                }
                else if (versionCompare == VersionReader.CompareVersionResult.VersionOld)
                {
                    projectVersion.Text = translations.StartupForm_pathTextBox_TextChanged_ProjectVersionNewer;
                }
            }
            else
            {
                MessageBox.Show(Convert.ToString(translations.StartupForm_pathTextBox_TextChanged_InvalidESPrj));
            }
        }
Exemple #20
0
        public ActionResult DBInstall()
        {
            HttpCookie cookie = System.Web.HttpContext.Current.Request.Cookies.Get("IFDBSignIn");

            if (cookie == null)
            {
                return(RedirectToAction("DBInstallLogin"));
            }
            else
            {
                InstallInfo info       = new InstallInfo();
                string      appVersion = ConfigReader.GetAppSetting();
                info.AppVersion = appVersion;

                try
                {
                    DBSetup  setup = new DBSetup();
                    DBObject db    = setup.Initialize();

                    info.DBVersion   = VersionReader.DatabaseVersion(db).ToString();
                    info.DBDrive     = db.DbDrive.ToString();
                    info.DBCreateNew = false;
                    info.DBServer    = db.DbServer;
                    info.DBUserID    = db.UserId;
                    info.DBPassWord  = db.Password;
                    info.DBName      = db.DbName;
                }

                catch
                {
                    info.DBVersion   = "1.0";
                    info.DBDrive     = "SqlServer2005";
                    info.DBCreateNew = false;
                    info.DBServer    = "";
                    info.DBUserID    = "";
                    info.DBPassWord  = "";
                    info.DBName      = "";
                }


                //Mongo
                string mongoStr = "";
                try
                {
                    mongoStr = ConfigurationManager.ConnectionStrings["MongoDB"].ConnectionString;
                }
                catch {}

                if (mongoStr == "")
                {
                    info.MongoSetting = false;
                }
                else
                {
                    info.MongoSetting = true;
                    //mongodb://10.210.160.98:20001/test
                    //mongodb://libin1:[email protected]:27017/test
                    //要区分@ 和没有@两种情况
                    string[] mongoArr = new string[] { };
                    if (mongoStr.Contains('@'))
                    {
                        mongoArr           = mongoStr.Split(new char[] { '/', ':', '@' });
                        info.MongoUserName = mongoArr[3];
                        info.MongoPassword = mongoArr[4];
                    }
                    else
                    {
                        mongoArr           = mongoStr.Split(new char[] { '/', ':' });
                        info.MongoUserName = "******";
                        info.MongoPassword = "******";
                    }
                    info.MongoServer = mongoArr[mongoArr.Length - 3] + ":" + mongoArr[mongoArr.Length - 2];
                    info.MongoDBName = mongoArr[mongoArr.Length - 1];
                }

                Account configAccout = ConfigReader.GetAccount();
                info.LoginUser     = configAccout.UserName;
                info.LoginPassword = configAccout.PassWord;

                return(View(info));
            }
        }
Exemple #21
0
        private async void StartupForm_Load(object sender, EventArgs e)
        {
            //Download SAMPCTL
            await SampCtl.EnsureLatestInstalled(Application.StartupPath);

            //Add event.
            pathTextBox.PathText.TextChanged += pathTextBox_TextChanged;

            //Check for updates
            AutoUpdater.ParseUpdateInfoEvent += AutoUpdater_ParseUpdateInfoEvent;
            DownloadForm.DownloadFile(translations.StartupForm_StartupForm_Load_Checking_for_updates, "https://api.github.com/repos/Ahmad45123/ExtremeStudio/releases/latest", Application.StartupPath + "/latest.txt");
            AutoUpdater.Start(Application.StartupPath + "/latest.txt");

            //If the interop files don't exist, Extract the files.

            /*if (IsFirst &&
             *  (!File.Exists(
             *       Application.StartupPath + "/x64/SQLite.Interop.dll") ||
             *   !File.Exists(
             *       Application.StartupPath + "/x86/SQLite.Interop.dll")))
             * {
             *  //Remove old.
             *  if (File.Exists(
             *      Application.StartupPath + "/x64/SQLite.Interop.dll"))
             *  {
             *      File.Delete(
             *          Application.StartupPath + "/x64/SQLite.Interop.dll");
             *  }
             *
             *  if (File.Exists(
             *      Application.StartupPath + "/x86/SQLite.Interop.dll"))
             *  {
             *      File.Delete(
             *          Application.StartupPath + "/x86/SQLite.Interop.dll");
             *  }
             *
             *  //Extract New
             *  File.WriteAllBytes(
             *      Application.StartupPath + "/interop.zip", Properties.Resources.SQLite_Interop); //Write the file.
             *  GeneralFunctions.FastZipUnpack(Application.StartupPath + "/interop.zip",
             *      Application.StartupPath); //Extract it.
             *  File.Delete(
             *      Application.StartupPath + "/interop.zip"); //Delete the temp file.
             * }*/

            //Create needed folders and files.
            if (!Directory.Exists(
                    Application.StartupPath + "/cache"))
            {
                Directory.CreateDirectory(
                    Application.StartupPath + "/cache");
            }

            if (!Directory.Exists(
                    Application.StartupPath + "/cache/serverPackages"))
            {
                Directory.CreateDirectory(
                    Application.StartupPath + "/cache/serverPackages");
            }

            if (!Directory.Exists(
                    Application.StartupPath + "/cache/includes"))
            {
                Directory.CreateDirectory(
                    Application.StartupPath + "/cache/includes");
            }

            if (!Directory.Exists(
                    Application.StartupPath + "/configs"))
            {
                Directory.CreateDirectory(
                    Application.StartupPath + "/configs");
                File.WriteAllText(
                    Application.StartupPath + "/configs/recent.json", "");
            }

            //Setting the IsGlobal in Settings will make sure the settings are in place and correct.
            Program.SettingsForm.IsGlobal = true;

            //Load all the recent.
            if (File.Exists(
                    Application.StartupPath + "/configs/recent.json"))
            {
                try
                {
                    Recent = JsonConvert.DeserializeObject <List <string> >(
                        File.ReadAllText(
                            Application.StartupPath + "/configs/recent.json"));
                    if (ReferenceEquals(Recent, null))
                    {
                        Recent = new List <string>();
                    }
                }
                catch (Exception)
                {
                }
            }

            if (ProjectToOpen != "")
            {
                if (GeneralFunctions.IsValidExtremeProject(ProjectToOpen))
                {
                    Program.MainForm.CurrentProject.ProjectPath = ProjectToOpen;
                    Program.MainForm.CurrentProject.ReadInfo();
                    projectName.Text = Program.MainForm.CurrentProject.ProjectName;

                    string projVersion = Convert.ToString(Program.MainForm.CurrentProject.ProjectVersion);
                    string progVersion = Convert.ToString(_versionHandler.CurrentVersion);

                    VersionReader.CompareVersionResult versionCompare =
                        VersionReader.CompareVersions(projVersion, progVersion);
                    if (versionCompare == VersionReader.CompareVersionResult.VersionSame)
                    {
                        loadProjectBtn_Click(null, EventArgs.Empty);
                    }
                    else if (versionCompare == VersionReader.CompareVersionResult.VersionNew)
                    {
                        loadProjectBtn_Click(null, EventArgs.Empty);
                    }
                    else if (versionCompare == VersionReader.CompareVersionResult.VersionOld)
                    {
                        MessageBox.Show(translations.StartupForm_pathTextBox_TextChanged_ProjectVersionNewer);
                        Application.Exit();
                    }
                }
                else
                {
                    MessageBox.Show(Convert.ToString(translations.StartupForm_pathTextBox_TextChanged_InvalidESPrj));
                    Application.Exit();
                }
            }
        }
Exemple #22
0
        /// <summary>
        /// Parses the passed Stream into Puppet structures
        /// </summary>
        /// <param name="data">Stream containing the Puppet file data</param>
        /// <param name="catchExceptions">Flag allowing conditional exception catching</param>
        private void Parse(Stream data, bool catchExceptions = false)
        {
            using (BinaryReader reader = new BinaryReader(data))
            {
                while (reader.BaseStream.Position < reader.BaseStream.Length)
                {
                    string sectionName   = Encoding.UTF8.GetString(reader.ReadBytes(4));
                    int    sectionLength = reader.ReadInt32();
                    byte[] sectionBytes  = reader.ReadBytes(sectionLength);

                    using (BinaryReader sectionReader = new BinaryReader(new MemoryStream(sectionBytes)))
                    {
                        try
                        {
                            switch (sectionName)
                            {
                            case "VERS":
                                Version = VersionReader.ReadVersion(sectionReader);
                                break;

                            case "TEXT":
                                Textures = TextureReader.ReadAllTextures(sectionReader);
                                break;

                            case "SMTL":
                                SpecularMaterial = true;
                                break;

                            case "BONE":
                                Bones = BoneReader.ReadAllBones(sectionReader, Version);
                                break;

                            case "EXTR":
                                Extra = ExtraReader.ReadExtra(sectionReader);
                                break;

                            case "ANIM":
                                Animations = AnimationReader.ReadAllAnimations(sectionReader, Version);
                                break;

                            case "MESH":
                                Mesh = MeshReader.ReadMesh(sectionReader, Version);
                                break;

                            case "FANM":
                                // TODO: Implement parsing of FANM section
                                break;

                            case "FRAM":
                                Frames = FrameReader.ReadAllFrames(sectionReader);
                                break;

                            case "MOTI":
                                Motions = MotionReader.ReadAllMotions(sectionReader);
                                break;

                            case "COLL":
                                CollisionBoxes = CollisionBoxReader.ReadAllCollisionBoxes(sectionReader, Version);
                                break;

                            default:
                                Debug.WriteLine($"Unknown section '${sectionName}' with size of ${sectionLength.ToString()} bytes");
                                break;
                            }
                        }
                        catch (Exception e) when(catchExceptions)
                        {
                            Debug.WriteLine($"{e.Message}\n{e.StackTrace}");
                        }
                    }
                }
            }
        }