Example #1
0
        static public string FindMoonLoaderSdkDir()
        {
            try {
                string desktopFolder = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);

                // Try common locations of MoonLoader SDK first.
                {
                    string[] likelyFolders =
                    {
                        desktopFolder + "\\moonloader_module_sdk",
                        desktopFolder + "\\moonloader_sdk",
                        "D:\\Projects\\moonloader_module_sdk",
                        "D:\\Projects\\moonloader_sdk"
                    };

                    foreach (string tryLoc in likelyFolders)
                    {
                        if (PathLogic.IsMoonLoaderSdkDirectory(tryLoc))
                        {
                            throw new PathLogic.FoundFolderException(tryLoc);
                        }
                    }
                }
            }
            catch (PathLogic.FoundFolderException except) {
                return(except.GetFolder());
            }

            return(null);
        }
Example #2
0
        static public string FindRWD3D9SdkDir()
        {
            try
            {
                string desktopFolder = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);

                // Try common locations of RWD3D9 first.
                {
                    string[] likelyFolders =
                    {
                        desktopFolder + "\\rwd3d9",
                        "D:\\Projects\\rwd3d9"
                    };

                    foreach (string tryLoc in likelyFolders)
                    {
                        if (PathLogic.IsRWD3D9Directory(tryLoc))
                        {
                            throw new PathLogic.FoundFolderException(tryLoc);
                        }
                    }
                }
            }
            catch (PathLogic.FoundFolderException except)
            {
                return(except.GetFolder());
            }

            return(null);
        }
        private void SetTextBoxTextToOsVariable(TextBox tbx)
        {
            bool   isSdk  = tbx.Name == "tbxSDK";
            Button setBtn = GetElement(tbx, "set") as Button;
            Image  img    = GetElement(tbx, "img") as Image;
            string envVar = PathLogic.GetOsVariable(setBtn.Tag.ToString());

            tbx.Tag  = envVar;
            tbx.Text = envVar;
            if (envVar == "")
            {
                if (isSdk)
                {
                    img.Source = iconError;
                }
                else
                {
                    img.Source = iconNothing;
                }
            }
            else
            {
                if (isSdk)
                {
                    grdWizTmplButtons.IsEnabled   = true;
                    grdGenerateSolution.IsEnabled = true;
                }
                img.Source = iconOk;
            }
        }
        static private string GetPluginSdkDir()
        {
            string sdkDir = PathLogic.GetOsVariable("PLUGIN_SDK_DIR");

            if (sdkDir == "")
            {
                MessageBox.Show("Can't find plugin-sdk directory (PLUGIN_SDK_DIR)");
            }
            return(sdkDir);
        }
Example #5
0
        static public string FindPluginSdkDir()
        {
            try
            {
                string desktopFolder = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);

                // Scan common plugin-sdk locations.
                {
                    string[] likelyFolders =
                    {
                        desktopFolder + "\\plugin-sdk",
                        "C:\\plugin-sdk",
                        "C:\\Projects\\plugin-sdk",
                        "D:\\plugin-sdk",
                        "D:\\Projects\\plugin-sdk",
                        Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\plugin-sdk"
#if NETFW_4
                        , Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + "\\plugin-sdk"
#endif
                    };

                    foreach (string tryLoc in likelyFolders)
                    {
                        if (PathLogic.IsPluginSDKDirectory(tryLoc))
                        {
                            throw new PathLogic.FoundFolderException(tryLoc);
                        }
                    }
                }

                // If not found in likely folders, we scan the desktop ones next.
                PathLogic.ForAllFolders(desktopFolder, true,
                                        (tryLoc) => {
                    if (PathLogic.IsPluginSDKDirectory(tryLoc))
                    {
                        throw new PathLogic.FoundFolderException(tryLoc);
                    }
                }
                                        );
            }
            catch (PathLogic.FoundFolderException except)
            {
                return(except.GetFolder());
            }

            // Could not find anything.
            return(null);
        }
Example #6
0
        static public string FindDirectX9SdkDir()
        {
            try
            {
#if NETFW_4
                string progFilesPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86);
#else
                string progFilesPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
#endif

                // Check common folders first.
                {
                    string[] likelyFolders =
                    {
                        "D:\\Projects\\DXSDK\\9.0",
                        "D:\\Projects\\DXSDK\\9.0c",
                        progFilesPath + "\\Microsoft DirectX SDK (June 2010)"
                    };

                    foreach (string tryLoc in likelyFolders)
                    {
                        if (PathLogic.IsDirectX9Directory(tryLoc))
                        {
                            throw new PathLogic.FoundFolderException(tryLoc);
                        }
                    }
                }

                // Try scanning the entire program files folder (x86) for the DX9 SDK.
                PathLogic.ForAllFolders(progFilesPath, false,
                                        (tryLoc) =>
                {
                    if (PathLogic.IsDirectX9Directory(tryLoc))
                    {
                        throw new PathLogic.FoundFolderException(tryLoc);
                    }
                }
                                        );
            }
            catch (PathLogic.FoundFolderException except)
            {
                return(except.GetFolder());
            }

            return(null);
        }
        static private string FindDirByVariableName(string varName)
        {
            switch (varName)
            {
            case "PLUGIN_SDK_DIR":        return(SDKFolders.FindPluginSdkDir());

            case "DIRECTX9_SDK_DIR":      return(SDKFolders.FindDirectX9SdkDir());

            case "RWD3D9_DIR":            return(SDKFolders.FindRWD3D9SdkDir());

            case "MOONLOADER_SDK_SA_DIR": return(SDKFolders.FindMoonLoaderSdkDir());

            case "GTA_SA_DIR":            return(PathLogic.ScanGTASAGameDirectory());

            case "GTA_VC_DIR":            return(PathLogic.ScanGTAVCGameDirectory());

            case "GTA_III_DIR":           return(PathLogic.ScanGTA3GameDirectory());
            }

            return(null);
        }