コード例 #1
0
ファイル: Program.cs プロジェクト: ANamelessWolf/Tabalim
        /// <summary>
        /// Creates the full package.
        /// </summary>
        /// <param name="obj">The object.</param>
        private static void CreateFullPackage(string[] obj)
        {
            CheckerController ch = new CheckerController();
            var          files   = ch.GetFiles();
            PackageMaker pMaker  = new PackageMaker(files, true);

            pMaker.MakePackage();
        }
コード例 #2
0
    static bool GeneratePackage(List <string> files)
    {
        if (runtime == null)
        {
            if (IsUnix)
            {
                runtime = Process.GetCurrentProcess().MainModule.FileName;
            }
            else
            {
                Console.Error.WriteLine("You must specify at least one runtime with --runtime or --cross");
                Environment.Exit(1);
            }
        }
        if (!File.Exists(runtime))
        {
            Console.Error.WriteLine($"The specified runtime at {runtime} does not exist");
            Environment.Exit(1);
        }

        if (ctor_func != null)
        {
            Console.Error.WriteLine("--static-ctor not supported with package bundling, you must use native compilation for this");
            return(false);
        }

        var maker = new PackageMaker(output);

        maker.AddFile(runtime);

        foreach (var url in files)
        {
            string fname = LocateFile(new Uri(url).LocalPath);
            string aname = Path.GetFileName(fname);

            maker.Add("assembly:" + aname, fname);
            if (File.Exists(fname + ".config"))
            {
                maker.Add("config:" + aname, fname + ".config");
            }
        }
        if (!MaybeAddFile(maker, "systemconfig:", config_file) || !MaybeAddFile(maker, "machineconfig:", machine_config_file))
        {
            return(false);
        }

        if (config_dir != null)
        {
            maker.Add("config_dir:", config_dir);
        }
        if (embedded_options != null)
        {
            maker.AddString("options:", embedded_options);
        }
        maker.Dump();
        maker.Close();
        return(true);
    }
コード例 #3
0
ファイル: Program.cs プロジェクト: ANamelessWolf/Tabalim
        /// <summary>
        /// Creates the assembly.
        /// </summary>
        /// <param name="arg">The argument.</param>
        private static void CreateAssembly(string[] arg)
        {
            CheckerController ch = new CheckerController();
            var          files   = ch.GetFiles().Where(x => x.IsAssembly);
            PackageMaker pMaker  = new PackageMaker(files, true);

            pMaker.MakePackage();
            var json = JsonConvert.SerializeObject(pMaker.Info);
        }
コード例 #4
0
    static bool MaybeAddFile(PackageMaker maker, string code, string file)
    {
        if (file == null)
        {
            return(true);
        }

        if (!File.Exists(file))
        {
            Console.Error.WriteLine("The file {0} does not exist", file);
            return(false);
        }
        maker.Add(code, file);
        return(true);
    }
コード例 #5
0
ファイル: mkbundle.cs プロジェクト: mono/mono
	static bool GeneratePackage (List<string> files)
	{
		if (runtime == null){
			if (IsUnix)
				runtime = Process.GetCurrentProcess().MainModule.FileName;
			else {
				Error ("You must specify at least one runtime with --runtime or --cross");
				Environment.Exit (1);
			}
		}
		if (!File.Exists (runtime)){
			Error ($"The specified runtime at {runtime} does not exist");
			Environment.Exit (1);
		}
		
		if (ctor_func != null){
			Error ("--static-ctor not supported with package bundling, you must use native compilation for this");
			return false;
		}
		
		var maker = new PackageMaker (output);
		Console.WriteLine ("Using runtime: " + runtime);
		maker.AddFile (runtime);
		
		foreach (var url in files){
			string fname = LocateFile (new Uri (url).LocalPath);
			string aname = MakeBundle.GetAssemblyName (fname);

			maker.Add ("assembly:" + aname, fname);
			Console.WriteLine ("     Assembly: " + fname);
			if (File.Exists (fname + ".config")){
				maker.Add ("config:" + aname, fname + ".config");
				Console.WriteLine ("       Config: " + runtime);
			}
		}
		
		if (!MaybeAddFile (maker, "systemconfig:", config_file) || !MaybeAddFile (maker, "machineconfig:", machine_config_file))
			return false;

		if (config_dir != null)
			maker.Add ("config_dir:", config_dir);
		if (embedded_options != null)
			maker.AddString ("options:", embedded_options);
		if (environment.Count > 0){
			foreach (var key in environment.Keys)
				maker.AddStringPair ("env:" + key, key, environment [key]);
		}
		if (libraries.Count > 0){
			foreach (var alias_and_path in libraries){
				Console.WriteLine ("     Library:  " + alias_and_path.Value);
				maker.Add ("library:" + alias_and_path.Key, alias_and_path.Value);
			}
		}
		maker.Dump ();
		maker.Close ();
		return true;
	}
コード例 #6
0
ファイル: mkbundle.cs プロジェクト: mono/mono
	static bool MaybeAddFile (PackageMaker maker, string code, string file)
	{
		if (file == null)
			return true;
		
		if (!File.Exists (file)){
			Error ("The file {0} does not exist", file);
			return false;
		}
		maker.Add (code, file);
		return true;
	}