示例#1
0
 private Either <string> DownloadLatestCompiler()
 {
     try
     {
         Message = "Downloading DSL compiler...";
         ChangeMessage();
         Compiler.Stop(false);
         var result = ServerActions.DownloadZip("dsl-platform", "dsl-compiler.zip", Compiler.RootPath);
         if (result.Success)
         {
             var newPath = Path.Combine(Compiler.RootPath, "dsl-compiler.exe");
             var fi      = new FileInfo(newPath);
             var asm     = System.Reflection.AssemblyName.GetAssemblyName(newPath);
             CompilerInfo         = "Compiler: " + asm.Version;
             oldDslCompiler       = DslCompiler;
             Targets.CompilerPath = newPath;
             DslCompiler          = newPath;
             ChangeProperty("CompilerInfo");
             return(Either.Success(DslCompiler));
         }
         return(Either <string> .Fail(result.Error));
     }
     catch (Exception ex)
     {
         return(Either <string> .Fail(ex.Message));
     }
 }
示例#2
0
 private void DownloadCompilerAndLogIn()
 {
     try
     {
         Message = "Downloading DSL compiler...";
         ChangeMessage();
         Compiler.Stop(false);
         var result = ServerActions.DownloadZip("dsl-platform", "dsl-compiler.zip", Compiler.RootPath);
         if (result.Success)
         {
             var old = DslCompiler;
             DslCompiler = Path.Combine(Compiler.RootPath, "dsl-compiler.exe");
             CheckCompiler();
             oldDslCompiler = old;
         }
         else
         {
             Message = result.Error;
         }
         ChangeMessage();
     }
     catch (Exception ex)
     {
         Message = ex.Message;
         ChangeMessage();
     }
 }
示例#3
0
        private void DonwloadLibraryAction(string arg)
        {
            var splt = arg.Split(':');
            var lib  = Targets.ChooseLibrary(splt[0]);

            if (!lib.Success)
            {
                Message = lib.Error;
                ChangeMessage();
                return;
            }
            var info = lib.Value;

            if (string.IsNullOrWhiteSpace(info.Dependencies))
            {
                Message = "Dependency folder not specified. Please specify " + info.Name + " dependency folder";
            }
            else
            {
                if (!info.DependenciesExists)
                {
                    Directory.CreateDirectory(info.DependenciesPath);
                }
                TryAction("Downloading library...", () => ServerActions.DownloadZip(splt[1], splt[splt.Length - 1], info.DependenciesPath))
                .OnSuccess(ef =>
                {
                    Message = "Library downloaded";
                    if (!ef)
                    {
                        Message += ". Extra files found in library folder.";
                        System.Diagnostics.Process.Start(info.DependenciesPath);
                    }
                    ChangeMessage();
                });
            }
            ChangeMessage();
        }