private static InstallationProperties CreateForInstallation(MPExtendedProduct product)
        {
            var prop = new InstallationProperties();

            prop.FileLayout                    = FileLayoutType.Installed;
            prop.InstallationDirectory         = GetInstallDirectory(product);
            prop.DefaultConfigurationDirectory = Path.Combine(prop.InstallationDirectory, "DefaultConfig");
            prop.ConfigurationDirectory        = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "MPExtended");
            prop.ConfigurationBackupDirectory  = Path.Combine(prop.ConfigurationDirectory, "ConfigBackup");
            return(prop);
        }
 public static InstallationProperties CreateProperties()
 {
     var prop = new InstallationProperties();
     prop.Product = MPExtendedProduct.Service;
     prop.FileLayout = FileLayoutType.Source;
     prop.SourceRoot = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase.Replace("file:///", "")), "../../../.."));
     prop.CacheDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "MPExtended", "Cache");
     prop.LogDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "MPExtended", "Logs");
     prop.ConfigurationDirectory = Path.Combine(prop.SourceRoot, "Config");
     prop.DefaultConfigurationDirectory = prop.ConfigurationDirectory;
     prop.ConfigurationBackupDirectory = Path.Combine(prop.ConfigurationDirectory, "ConfigBackup");
     prop.SourceBuildDirectory = "Debug";
     return prop;
 }
        private static InstallationProperties CreateForSource()
        {
            var prop = new InstallationProperties();

            prop.FileLayout = FileLayoutType.Source;

            // It's a bit tricky to find the root source directory. The assembly might be in a different directory then where its
            // source tree is (which happens with WebMP for example), so we can't use the Location of the current executing assembly.
            // The CodeBase points to it's original location on compilation, but this doesn't work if you send files to other people
            // (so don't do it!). Also, not everybody names the root directory MPExtended. Instead, we look for a directory with a
            // GlobalVersion.cs file, as we use that for detecting source installation too. It's not 100% foolproof but it works
            // good enough.
            Uri           originalPath = new Uri(System.Reflection.Assembly.GetExecutingAssembly().CodeBase);
            DirectoryInfo info         = new DirectoryInfo(Path.GetDirectoryName(originalPath.LocalPath));

            do
            {
                if (File.Exists(Path.Combine(info.FullName, "GlobalVersion.cs")))
                {
                    prop.SourceRoot = info.FullName;
                    break;
                }
                info = info.Parent;
            } while (info != null);

            // Set build directory name. This needs to be updated when we introduce different configurations.
            #if DEBUG
            prop.SourceBuildDirectory = "Debug";
            #else
            prop.SourceBuildDirectory = "Release";
            #endif

            // We don't have separate configuration directories when running from source
            prop.ConfigurationDirectory        = Path.Combine(prop.SourceRoot, "Config");
            prop.DefaultConfigurationDirectory = prop.ConfigurationDirectory;
            prop.ConfigurationBackupDirectory  = Path.Combine(prop.ConfigurationDirectory, "Backup");
            return(prop);
        }
Beispiel #4
0
 public static void Load(MPExtendedProduct product)
 {
     Properties = InstallationProperties.DetectForProduct(product);
 }
 private static InstallationProperties CreateForInstallation(MPExtendedProduct product)
 {
     var prop = new InstallationProperties();
     prop.FileLayout = FileLayoutType.Installed;
     prop.InstallationDirectory = GetInstallDirectory(product);
     prop.DefaultConfigurationDirectory = Path.Combine(prop.InstallationDirectory, "DefaultConfig");
     prop.ConfigurationDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "MPExtended");
     prop.ConfigurationBackupDirectory = Path.Combine(prop.ConfigurationDirectory, "ConfigBackup");
     return prop;
 }
        private static InstallationProperties CreateForSource()
        {
            var prop = new InstallationProperties();
            prop.FileLayout = FileLayoutType.Source;

            // It's a bit tricky to find the root source directory. The assembly might be in a different directory then where its
            // source tree is (which happens with WebMP for example), so we can't use the Location of the current executing assembly.
            // The CodeBase points to it's original location on compilation, but this doesn't work if you send files to other people
            // (so don't do it!). Also, not everybody names the root directory MPExtended. Instead, we look for a directory with a
            // GlobalVersion.cs file, as we use that for detecting source installation too. It's not 100% foolproof but it works
            // good enough.
            Uri originalPath = new Uri(System.Reflection.Assembly.GetExecutingAssembly().CodeBase);
            DirectoryInfo info = new DirectoryInfo(Path.GetDirectoryName(originalPath.LocalPath));
            do
            {
                if (File.Exists(Path.Combine(info.FullName, "GlobalVersion.cs")))
                {
                    prop.SourceRoot = info.FullName;
                    break;
                }
                info = info.Parent;
            } while (info != null);

            // Set build directory name. This needs to be updated when we introduce different configurations.
            #if DEBUG
                prop.SourceBuildDirectory = "Debug";
            #else
                prop.SourceBuildDirectory = "Release";
            #endif

            // We don't have separate configuration directories when running from source
            prop.ConfigurationDirectory = Path.Combine(prop.SourceRoot, "Config");
            prop.DefaultConfigurationDirectory = prop.ConfigurationDirectory;
            prop.ConfigurationBackupDirectory = Path.Combine(prop.ConfigurationDirectory, "Backup");
            return prop;
        }