예제 #1
0
 internal static void Validate(List <String> Arguments)
 {
     AdaTools.Package Package;
     foreach (String Name in Arguments)
     {
         Package = new AdaTools.Package(Name);
         Console.WriteLine(Package.Info.Name + ": ");
         Package.WriteValidation();
     }
 }
예제 #2
0
        /// <summary>
        /// Install the specified package
        /// </summary>
        /// <param name="Package">Package to install</param>
        public static void GlobalInstall(String Name)
        {
            AdaTools.Package Package = new AdaTools.Package(Name);
            if (!Directory.Exists(Settings.SourceSearchPath[1]))
            {
                Directory.CreateDirectory(Settings.SourceSearchPath[1]);
            }
            Package.Archive.GetEntry(Package.Info.Name + ".ads").ExtractToFile(Settings.SourceSearchPath[1] + Path.DirectorySeparatorChar + Package.Info.Name + ".ads", true);
            File.SetAttributes(Settings.SourceSearchPath[1] + Path.DirectorySeparatorChar + Package.Info.Name + ".ads", FileAttributes.ReadOnly);
            if (!(Package.Archive.GetEntry(Package.Info.Name + ".adb") is null))
            {
                Package.Archive.GetEntry(Package.Info.Name + ".adb").ExtractToFile(Settings.SourceSearchPath[1] + Path.DirectorySeparatorChar + Package.Info.Name + ".adb", true);
                File.SetAttributes(Settings.SourceSearchPath[1] + Path.DirectorySeparatorChar + Package.Info.Name + ".adb", FileAttributes.ReadOnly);
            }
            if (!Directory.Exists(Settings.ObjectSearchPath[1]))
            {
                Directory.CreateDirectory(Settings.ObjectSearchPath[1]);
            }
            switch (Environment.OSVersion.Platform)
            {
            case (PlatformID)1:
            case (PlatformID)2:
            case (PlatformID)3:
                Package.Archive.GetEntry(Package.Info.Name + ".dll").ExtractToFile(Settings.ObjectSearchPath[1] + Path.DirectorySeparatorChar + Package.Info.Name + ".dll", true);
                File.SetAttributes(Settings.ObjectSearchPath[1] + Path.DirectorySeparatorChar + Package.Info.Name + ".dll", FileAttributes.ReadOnly);
                break;

            case PlatformID.Unix:
            default:
                Package.Archive.GetEntry(Package.Info.Name + ".so").ExtractToFile(Settings.ObjectSearchPath[1] + Path.DirectorySeparatorChar + Package.Info.Name + ".so", true);
                File.SetAttributes(Settings.ObjectSearchPath[1] + Path.DirectorySeparatorChar + Package.Info.Name + ".so", FileAttributes.ReadOnly);
                break;
            }
            Package.Archive.GetEntry(Package.Info.Name + ".ali").ExtractToFile(Settings.ObjectSearchPath[1] + Path.DirectorySeparatorChar + Package.Info.Name + ".ali", true);
            File.SetAttributes(Settings.ObjectSearchPath[1] + Path.DirectorySeparatorChar + Package.Info.Name + ".ali", FileAttributes.ReadOnly);
            if (!Directory.Exists(Settings.PackageDatabasePath))
            {
                Directory.CreateDirectory(Settings.PackageDatabasePath);
            }
            Package.WriteInfo(new FileStream(Settings.PackageDatabasePath + Path.DirectorySeparatorChar + Package.Info.Name, FileMode.Create));
            File.SetAttributes(Settings.PackageDatabasePath + Path.DirectorySeparatorChar + Package.Info.Name, FileAttributes.Normal);
        }