Ejemplo n.º 1
0
        public async Task <IActionResult> OnGetAsync()
        {
            Target = await _context.Targets.Include(t => t.Latest).SingleOrDefaultAsync(t => t.Slug == TargetSlug);

            if (Target == null)
            {
                return(NotFound());
            }

            if (string.IsNullOrWhiteSpace(VersionNumber))
            {
                TargetVersion = Target.Latest;
            }
            else
            {
                TargetVersion = await _context.TargetVersions.SingleOrDefaultAsync(v => v.TargetId == Target.Id && v.VersionNumber == VersionNumber);

                if (TargetVersion == null)
                {
                    return(NotFound());
                }
            }

            return(Page());
        }
Ejemplo n.º 2
0
        public static string GetDatabaseStructure(TargetVersion version, DatabaseLocation location)
        {
            var builder = new StringBuilder();

            using (var isql = new Process())
            {
                isql.StartInfo = new ProcessStartInfo
                {
                    FileName               = Path.Combine(GetFirebirdLocation(version), "isql.exe"),
                    Arguments              = $"-x {GetDatabasePath(version, location)}",
                    UseShellExecute        = false,
                    CreateNoWindow         = true,
                    RedirectStandardOutput = true
                };
                isql.OutputDataReceived += (sender, e) =>
                {
                    if (e.Data != null)
                    {
                        if (e.Data.StartsWith("/* CREATE DATABASE '", StringComparison.InvariantCulture))
                        {
                            return;
                        }
                        builder.AppendLine(e.Data);
                    }
                };
                isql.Start();
                isql.BeginOutputReadLine();
                isql.WaitForExit();
            }
            return(builder.ToString().Trim());
        }
Ejemplo n.º 3
0
            public static void ExecuteScript(TargetVersion version, DatabaseLocation location, string resourceName)
            {
                var assembly = Assembly.GetExecutingAssembly();

                using (var reader = new StreamReader(assembly.GetManifestResourceStream($"{assembly.GetName().Name}.{resourceName}"), Encoding.UTF8))
                {
                    ExecuteScript(version, location, new FbScript(reader.ReadToEnd()));
                }
            }
Ejemplo n.º 4
0
        public static string[] GetBldCs(ProductId product, TargetVersion target, string build)
        {
            var output = CommandLineExecutor.ExecuteCmd(GetBldCsCommandText(product, target, build));

            return(output.Split(new[] { "\r\n" }, StringSplitOptions.None)
                   .SkipUntil(x => x.Contains(Constants.GetBldCsScriptFileName))
                   .TakeWhile(x => !x.EndsWith(">exit"))
                   .Select(x => x.Replace("# stgsrvload", "#stgsrvload"))
                   .ToArray());
        }
Ejemplo n.º 5
0
        public static bool IsOutdated()
        {
            if (!ready)
            {
                return(true);
            }
            long currSeq = major * 1000000 + minor * 10000 + build * 100 + fix;

            return(currSeq < TargetVersion.GetSeq());
        }
Ejemplo n.º 6
0
 private View(ViewRoot viewRoot, ConfigSpec configSpec, ProductId productId, TargetVersion targetVersion, SrBranchName srBranchName, string build, ViewType?viewType)
 {
     ViewRoot      = viewRoot;
     ConfigSpec    = configSpec;
     ProductId     = productId;
     TargetVersion = targetVersion;
     SrBranchName  = srBranchName;
     Build         = build;
     ViewType      = viewType;
 }
 public static CheckVersionRequest FromDict(JsonData data)
 {
     return(new CheckVersionRequest {
         namespaceName = data.Keys.Contains("namespaceName") && data["namespaceName"] != null ? data["namespaceName"].ToString(): null,
         targetVersions = data.Keys.Contains("targetVersions") && data["targetVersions"] != null ? data["targetVersions"].Cast <JsonData>().Select(value =>
         {
             return TargetVersion.FromDict(value);
         }
                                                                                                                                                   ).ToList() : null,
         duplicationAvoider = data.Keys.Contains("duplicationAvoider") && data["duplicationAvoider"] != null ? data["duplicationAvoider"].ToString(): null,
     });
 }
Ejemplo n.º 8
0
        public ConversionResult Convert(
            ShaderType shaderType, TargetVersion targetVersion, TranslationOptions options,
            string hlslCode, string entryPoint,
            Dictionary <AttributeSemantic, string> overrideAttributeNames = null)
        {
            var compilerPtr = NativeMethods.Hlsl2Glsl_ConstructCompiler(shaderType);

            if (compilerPtr == IntPtr.Zero)
            {
                throw new Exception("Failed to construct Hlsl2Glsl compiler");
            }

            try
            {
                var callbacks = new NativeMethods.Hlsl2Glsl_ParseCallbacks
                {
                    IncludeOpenCallback = null,
                    Data = IntPtr.Zero
                };
                var parseResult = NativeMethods.Hlsl2Glsl_Parse(compilerPtr, hlslCode, targetVersion, ref callbacks, options);
                if (parseResult != 1)
                {
                    throw GetInfoLogAndCreateException(compilerPtr, "Failed to parse HLSL code");
                }

                if (overrideAttributeNames != null)
                {
                    var setUserAttrNamesResult = NativeMethods.Hlsl2Glsl_SetUserAttributeNames(compilerPtr,
                                                                                               overrideAttributeNames.Keys.ToArray(), overrideAttributeNames.Values.ToArray(),
                                                                                               overrideAttributeNames.Count);
                    if (setUserAttrNamesResult != 1)
                    {
                        throw GetInfoLogAndCreateException(compilerPtr, "Failed to user attribute names");
                    }
                }

                var translateResult = NativeMethods.Hlsl2Glsl_Translate(compilerPtr, entryPoint, targetVersion, options);
                if (translateResult != 1)
                {
                    throw GetInfoLogAndCreateException(compilerPtr, "Failed to translate HLSL code");
                }

                var glsl = NativeMethods.Hlsl2Glsl_GetShader(compilerPtr);

                var uniforms = NativeMethods.Hlsl2Glsl_GetUniformInfo(compilerPtr);

                return(new ConversionResult(glsl, uniforms));
            }
            finally
            {
                NativeMethods.Hlsl2Glsl_DestructCompiler(compilerPtr);
            }
        }
Ejemplo n.º 9
0
        private void LoadPatchDefinitions()
        {
            if (LoadingPatchDefinitions)
            {
                return;
            }
            LoadingPatchDefinitions = true;

            string PatchDefinitionName = cmbPatchDefinitionName.Text;
            string TargetVersion       = cmbTargetVersion.Text;
            string TargetPath          = cmbTargetPath.Text;

            cmbPatchDefinitionName.SelectedIndex = -1;
            cmbTargetVersion.SelectedIndex       = -1;
            cmbTargetPath.SelectedIndex          = -1;

            cmbPatchDefinitionName.Items.Clear();
            cmbTargetVersion.Items.Clear();
            cmbTargetPath.Items.Clear();

            cmbPatchDefinitionName.Text = PatchDefinitionName;
            cmbTargetVersion.Text       = TargetVersion;
            cmbTargetPath.Text          = TargetPath;

            try
            {
                string      Definitions = File.ReadAllText(txtPatchDefinitionsFile.Text);
                PatchEngine Engine      = new PatchEngine(Definitions);
                Engine.PatchDefinitions.Where(d => !string.IsNullOrEmpty(d.Name)).Select(d => d.Name).Distinct().ToList().ForEach(n => cmbPatchDefinitionName.Items.Add(n));
                PatchDefinition Definition = null;
                if (cmbPatchDefinitionName.Text.Trim().Length > 0)
                {
                    Definition = Engine.PatchDefinitions.Where(d => string.Compare(d.Name, cmbPatchDefinitionName.Text.Trim(), true) == 0).FirstOrDefault();
                }
                if (Definition != null)
                {
                    Definition.TargetVersions.Where(v => !string.IsNullOrEmpty(v.Description)).Select(v => v.Description).Distinct().ToList().ForEach(d => cmbTargetVersion.Items.Add(d));
                    TargetVersion Version = null;
                    if (cmbTargetVersion.Text.Trim().Length > 0)
                    {
                        Version = Definition.TargetVersions.Where(v => string.Compare(v.Description, cmbTargetVersion.Text.Trim(), true) == 0).FirstOrDefault();
                    }
                    if (Version != null)
                    {
                        Version.TargetFiles.Where(f => !string.IsNullOrEmpty(f.Path)).Select(f => Path.GetDirectoryName(f.Path)).Distinct().ToList().ForEach(f => cmbTargetPath.Items.Add(f));
                    }
                }
            }
            catch { }

            LoadingPatchDefinitions = false;
        }
Ejemplo n.º 10
0
 private static void ExecuteScript(TargetVersion version, DatabaseLocation location, FbScript script)
 {
     using (var connection = new FbConnection(GetConnectionString(version, location)))
     {
         script.Parse();
         if (script.Results.Any())
         {
             var be = new FbBatchExecution(connection);
             be.AppendSqlStatements(script);
             be.Execute();
         }
     }
 }
Ejemplo n.º 11
0
        public static string GetConnectionString(TargetVersion version, DatabaseLocation location)
        {
            var builder =
                new FbConnectionStringBuilder
            {
                Database      = GetDatabasePath(version, location),
                UserID        = "sysdba",
                Password      = "******",
                ServerType    = FbServerType.Embedded,
                ClientLibrary = Path.Combine(GetFirebirdLocation(version), $"fbclient.dll"),
                Charset       = "utf8",
                Pooling       = false,
            };

            return(builder.ToString());
        }
Ejemplo n.º 12
0
        public override void UpgradeToTargetVersion(IConnection connection)
        {
            var dao = new ImageDao(TargetVersion.GetType());

            dao.CurrentConnection = connection;
            dao.CreateTableIfNotExists();
            ++ModifiedCount;
            dao.CreateIndexIfNotExists();
            ++ModifiedCount;

            if (dao.CountAll() > 0)
            {
                dao.Delete(new Dictionary <string, object>());
            }

            dao.UpgradeTable(new VersionChangeUnit(typeof(VersionOrigin), TargetVersion.GetType()));
        }
        public ConversionResult Convert(
            ShaderType shaderType, TargetVersion targetVersion, TranslationOptions options,
            string hlslCode, string entryPoint,
            Dictionary<AttributeSemantic, string> overrideAttributeNames = null)
        {
            var compilerPtr = NativeMethods.Hlsl2Glsl_ConstructCompiler(shaderType);

            if (compilerPtr == IntPtr.Zero)
                throw new Exception("Failed to construct Hlsl2Glsl compiler");

            try
            {
                var callbacks = new NativeMethods.Hlsl2Glsl_ParseCallbacks
                {
                    IncludeOpenCallback = null,
                    Data = IntPtr.Zero
                };
                var parseResult = NativeMethods.Hlsl2Glsl_Parse(compilerPtr, hlslCode, targetVersion, ref callbacks, options);
                if (parseResult != 1)
                    throw GetInfoLogAndCreateException(compilerPtr, "Failed to parse HLSL code");

                if (overrideAttributeNames != null)
                {
                    var setUserAttrNamesResult = NativeMethods.Hlsl2Glsl_SetUserAttributeNames(compilerPtr,
                        overrideAttributeNames.Keys.ToArray(), overrideAttributeNames.Values.ToArray(),
                        overrideAttributeNames.Count);
                    if (setUserAttrNamesResult != 1)
                        throw GetInfoLogAndCreateException(compilerPtr, "Failed to user attribute names");
                }

                var translateResult = NativeMethods.Hlsl2Glsl_Translate(compilerPtr, entryPoint, targetVersion, options);
                if (translateResult != 1)
                    throw GetInfoLogAndCreateException(compilerPtr, "Failed to translate HLSL code");

                var glsl = NativeMethods.Hlsl2Glsl_GetShader(compilerPtr);

                var uniforms = NativeMethods.Hlsl2Glsl_GetUniformInfo(compilerPtr);

                return new ConversionResult(glsl, uniforms);
            }
            finally
            {
                NativeMethods.Hlsl2Glsl_DestructCompiler(compilerPtr);
            }
        }
Ejemplo n.º 14
0
        public Task Seed()
        {
            var unity2018Min =
                _context.UnityVersions.FindExactVersion((VersionNumber)"2018.1.0").Single();

            var unity2018Max =
                _context.UnityVersions.FindExactVersion((VersionNumber)"2018.4.4").Single();

            for (var i = 0; i < 10; i++)
            {
                var displayName = _unparser.Generate("#display_name.title#");
                var slug        = _slugifier.Slugify(displayName);
                var iconUrl     = _iconRandomizer.GetIconUrl();
                var description = _unparser.Generate("#description#");

                var targetVersion = new TargetVersion()
                {
                    Description           = description,
                    Hash                  = $"0123456789abcdef-{i}",
                    DisplayName           = displayName,
                    IconUrl               = iconUrl,
                    WebsiteUrl            = "",
                    VersionNumber         = "1",
                    DisunityCompatibility = new TargetVersionCompatibility()
                    {
                        MinCompatibleVersion = unity2018Min,
                        MaxCompatibleVersion = unity2018Max
                    }
                };

                var target = new Target()
                {
                    Slug     = slug,
                    Versions = new List <TargetVersion>()
                    {
                        targetVersion
                    }
                };

                _context.Targets.Add(target);
            }


            return(_context.SaveChangesAsync());
        }
Ejemplo n.º 15
0
 private static void ExecuteScript(TargetVersion version, DatabaseLocation location, FbScript script)
 {
     // NETProvider#1026
     script.UnknownStatement += (sender, e) =>
     {
         var match = e.Statement.Text.StartsWith("ALTER EXTERNAL FUNCTION ", StringComparison.OrdinalIgnoreCase);
         if (match)
         {
             e.Handled          = true;
             e.NewStatementType = SqlStatementType.AlterFunction;
         }
     };
     using (var connection = new FbConnection(GetConnectionString(version, location)))
     {
         script.Parse();
         if (script.Results.Any())
         {
             var be = new FbBatchExecution(connection);
             be.AppendSqlStatements(script);
             be.Execute();
         }
     }
 }
Ejemplo n.º 16
0
        private static void Compare(TargetVersion targetVersion, string sourceConnectionString, string targetConnectionString)
        {
            var scriptResult = Comparer.ForTwoDatabases(new ComparerSettings(targetVersion), sourceConnectionString, targetConnectionString)
                               .Compare()
                               .Script;


            using (var output = new StreamWriter(Console.OpenStandardOutput(), new UTF8Encoding(false), 512 * 1024))
            {
                output.Write(Header($"GENERATED: {DateTimeOffset.Now.ToString(CultureInfo.InvariantCulture)}"));
                output.Write(Environment.NewLine);

                foreach (var item in scriptResult)
                {
                    output.Write(Header(item.Header));
                    if (!item.Any())
                    {
                        output.Write(Environment.NewLine);
                    }
                    foreach (var groups in item)
                    {
                        output.Write(Environment.NewLine);
                        foreach (string statement in groups)
                        {
                            output.Write(statement);
                            output.Write(Environment.NewLine);
                        }
                    }
                    if (item.Any())
                    {
                        output.Write(Environment.NewLine);
                    }
                }

                output.Write(Header("END OF SCRIPT"));
            }
        }
Ejemplo n.º 17
0
 public static extern bool Hlsl2Glsl_VersionUsesPrecision(TargetVersion version);
Ejemplo n.º 18
0
 public static extern int Hlsl2Glsl_Parse(
     IntPtr handle,
     [MarshalAs(UnmanagedType.LPStr)] string shaderString,
     TargetVersion targetVersion,
     ref Hlsl2Glsl_ParseCallbacks callbacks,
     TranslationOptions options);
Ejemplo n.º 19
0
 public static extern int Hlsl2Glsl_Translate(
     IntPtr handle, 
     [MarshalAs(UnmanagedType.LPStr)] string entry, 
     TargetVersion targetVersion, 
     TranslationOptions options);
 public static bool VersionUsesPrecision(TargetVersion targetVersion)
 {
     return NativeMethods.Hlsl2Glsl_VersionUsesPrecision(targetVersion);
 }
Ejemplo n.º 21
0
 public static void ExecuteScript(TargetVersion version, DatabaseLocation location, IEnumerable <string> commands)
 {
     ExecuteScript(version, location, new FbScript(string.Join(Environment.NewLine, commands)));
 }
Ejemplo n.º 22
0
 public void TestVersionUsesPrecision(TargetVersion targetVersion, bool expectedResult)
 {
     Assert.That(HlslToGlslConverter.VersionUsesPrecision(targetVersion), Is.EqualTo(expectedResult));
 }
Ejemplo n.º 23
0
 public static bool AtLeast(this TargetVersion tv, TargetVersion targetVersion)
 {
     return(tv >= targetVersion);
 }
Ejemplo n.º 24
0
 public static extern int Hlsl2Glsl_Parse(
     IntPtr handle,
     [MarshalAs(UnmanagedType.LPStr)] string shaderString,
     TargetVersion targetVersion,
     ref Hlsl2Glsl_ParseCallbacks callbacks,
     TranslationOptions options);
Ejemplo n.º 25
0
 public static extern bool Hlsl2Glsl_VersionUsesPrecision(TargetVersion version);
Ejemplo n.º 26
0
 public ComparerTests(TargetVersion version)
 {
     m_Version = version;
 }
Ejemplo n.º 27
0
 public static void DropDatabase(TargetVersion version, DatabaseLocation location)
 {
     FbConnection.DropDatabase(GetConnectionString(version, location));
 }
Ejemplo n.º 28
0
 private static string GetFirebirdLocation(TargetVersion version)
 {
     return(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "_Firebird", version.VersionSuffix()));
 }
 public void TestVersionUsesPrecision(TargetVersion targetVersion, bool expectedResult)
 {
     Assert.That(HlslToGlslConverter.VersionUsesPrecision(targetVersion), Is.EqualTo(expectedResult));
 }
Ejemplo n.º 30
0
 public static extern int Hlsl2Glsl_Translate(
     IntPtr handle,
     [MarshalAs(UnmanagedType.LPStr)] string entry,
     TargetVersion targetVersion,
     TranslationOptions options);
Ejemplo n.º 31
0
 public static string VersionSuffix(this TargetVersion tv)
 {
     return(((int)tv).ToString());
 }
Ejemplo n.º 32
0
        static void Main(string[] args)
        {
            var folder = Environment.CurrentDirectory;
            var view   = folder.GetCurrentView();
            var cmd    = args.FirstOrDefault();

            if (cmd == Commands.ConfigSpec)
            {
                var productId     = new ProductId(args[1]);
                var targetVersion = new TargetVersion(args[2]);
                var branch        = "jsrXXXXXX_VC";
                var cs            = MainApi.GetSrCsWeb(productId, targetVersion, branch);
                cs.ForEach(line => Console.WriteLine(line));
            }
            else if (cmd == Commands.LoadRelVobs)
            {
                var productId     = new ProductId(args[1]);
                var targetVersion = new TargetVersion(args[2]);
                var branch        = "jsrXXXXXX_VC";
                var localViewPath = Directory.GetParent(folder).FullName;
                if (!Directory.Exists(Path.Combine(folder, "Products")))
                {
                    Console.WriteLine("Directory does not appear to be a view main VOB directory. Please type YES if you force to continue.");
                    if (Console.ReadLine().ToUpper() != "YES")
                    {
                        return;
                    }
                }
                var cs = MainApi.GetSrCsWeb(productId, targetVersion, branch);
                cs.ForEach(line => Console.WriteLine(line));
                MainApi.ApplyCs(cs, localViewPath);
            }

            else if (cmd != Commands.Cd)
            {
                Console.WriteLine(view?.DisplayText ?? $"{folder} is not ClearCase view path");
            }
            var canOperateOnNonCcViews = args.Length > 3 && cmd.IsOneOf(Commands.NewSr, Commands.NewBuild);

            if (!canOperateOnNonCcViews && (!args.Any() || view?.ViewType == null || view.ViewType.Value != ViewType.Sr))
            {
                return;
            }
            if (cmd == Commands.Help)
            {
                var commands = typeof(Commands)
                               .GetFields(BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy)
                               .Where(x => x.IsLiteral && !x.IsInitOnly)
                               .Select(x => (string)x.GetRawConstantValue())
                               .ToArray();
                Console.WriteLine("These commands are defined:");
                Console.WriteLine(commands.ToLinesString());
            }
            else if (cmd == Commands.FullUpdate)
            {
                Console.WriteLine("Getting latest config spec from css...");
                var cs = MainApi.GetSrCsWeb(view);
                Console.WriteLine("Applying config spec...");
                MainApi.ApplyCs(cs, view.ViewRoot.LocalPath);
            }
            else if (cmd == Commands.FullUpdateGit)
            {
                var gitDir = Directory.GetCurrentDirectory();
                Console.WriteLine("Getting latest config spec from css...");
                var cs = MainApi.GetSrCsWeb(view);
                Console.WriteLine("Applying config spec...");
                MainApi.ApplyCs(cs, view.ViewRoot.LocalPath);
                Console.WriteLine("Syncing with git...");
                Directory.SetCurrentDirectory(gitDir);
                var i   = 0;
                var log = CommandLineExecutor.ExecuteCmd(@"python ""c:\bin2\git-cc-master\gitcc"" update sync", o => o.Subscribe(s => Console.Write(++i % 2000 == 0 ? ">" : i % 1000 == 0 ? "<" : string.Empty)));
                Console.WriteLine(log);
            }
            else if (cmd == Commands.ApplyCs)
            {
                var cs = view.ConfigSpec.Lines;
                Console.WriteLine("Applying config spec...");
                MainApi.ApplyCs(cs, view.ViewRoot.LocalPath);
            }
            else if (cmd == Commands.ShowChangelist)
            {
                MainApi.GetChangelist(view).ForEach(x => Console.WriteLine(x));
            }
            else if (cmd == Commands.NewSr)
            {
                var branch        = args[1];
                var productId     = args.Length > 3 ? new ProductId(args[2]) : view.ProductId;
                var targetVersion = args.Length > 3 ? new TargetVersion(args[3]) : view.TargetVersion;
                if (view == null)
                {
                    var viewDirName = args.Length > 4 ? args[4] : string.Empty;
                    Console.WriteLine("Preparing new view environment...");
                    var currentDir      = Directory.GetCurrentDirectory();
                    var tag             = $"{Environment.MachineName}_{viewDirName}";
                    var baseDir         = new ViewsBaseDirectory($"{currentDir}", $"\\\\{Environment.MachineName}\\{Path.GetFileName(currentDir)}");
                    var networkViewPath = Path.Combine(baseDir.NetworkPath, viewDirName);
                    var localViewPath   = Path.Combine(baseDir.LocalPath, viewDirName);
                    Console.WriteLine($"currentDir = {currentDir}");
                    Console.WriteLine($"viewDirName = {viewDirName}");
                    Console.WriteLine($"tag = {tag}");
                    Console.WriteLine($"baseDir.NetworkPath = {baseDir.NetworkPath}");
                    Console.WriteLine($"baseDir.LocalPath = {baseDir.LocalPath}");
                    Console.WriteLine($"networkViewPath = {networkViewPath}");
                    Console.WriteLine($"localViewPath = {localViewPath}");
                    Console.WriteLine("Creating new view...");
                    CommandLineExecutor.ExecuteCleartool($"mkview -snapshot -tag {tag} \"{networkViewPath}\"");
                    Directory.SetCurrentDirectory(localViewPath);
                    view = folder.GetCurrentView();
                }
                Console.WriteLine("Loading config spec...");
                var cs         = MainApi.GetSrCsWeb(productId, targetVersion, branch);
                var makeBranch = !branch.ToLower().Contains("xxx");
                if (makeBranch)
                {
                    var productToBranch = cs.FirstOrDefault(line => line.StartsWith("# Product: "))?.Trim().Split(' ').LastOrDefault() ?? productId.Name;
                    Console.WriteLine($"Making branch {branch} for product {productToBranch}...");
                    CommandLineExecutor.ExecuteCleartool($@"mkbrtype -c . {branch}@\{productToBranch}");
                }
                Console.WriteLine("Applying config spec...");
                MainApi.ApplyCs(cs, view.ViewRoot.LocalPath);
            }
            else if (cmd == Commands.NewBuild)
            {
                var productId     = new ProductId(args[1]);
                var targetVersion = new TargetVersion(args[2]);
                var build         = args[3];
                if (view == null)
                {
                    var viewDirName = build;
                    Console.WriteLine("Preparing new view environment...");
                    var currentDir      = Directory.GetCurrentDirectory();
                    var tag             = $"{Environment.MachineName}_{viewDirName}";
                    var baseDir         = new ViewsBaseDirectory($"{currentDir}", $"\\\\{Environment.MachineName}\\{Path.GetFileName(currentDir)}");
                    var networkViewPath = Path.Combine(baseDir.NetworkPath, viewDirName);
                    var localViewPath   = Path.Combine(baseDir.LocalPath, viewDirName);
                    Console.WriteLine($"currentDir = {currentDir}");
                    Console.WriteLine($"viewDirName = {viewDirName}");
                    Console.WriteLine($"tag = {tag}");
                    Console.WriteLine($"baseDir.NetworkPath = {baseDir.NetworkPath}");
                    Console.WriteLine($"baseDir.LocalPath = {baseDir.LocalPath}");
                    Console.WriteLine($"networkViewPath = {networkViewPath}");
                    Console.WriteLine($"localViewPath = {localViewPath}");
                    Console.WriteLine("Creating new view...");
                    CommandLineExecutor.ExecuteCleartool($"mkview -snapshot -tag {tag} \"{networkViewPath}\"");
                    Directory.SetCurrentDirectory(localViewPath);
                    view = folder.GetCurrentView();
                }
                Console.WriteLine("Loading config spec...");
                var cs = MainApi.GetBldCsWeb(productId, targetVersion, build);
                Console.WriteLine("Applying config spec...");
                MainApi.ApplyCs(cs, view.ViewRoot.LocalPath);
            }
            else if (cmd == Commands.MergeToRemote)
            {
                Console.WriteLine("Getting changelist...");
                var files    = MainApi.GetChangelist(view);
                var filesCut = files.Where(x => !files.Any(dir => x != dir && x.Contains(dir))).ToArray();
                filesCut.ForEach(x => Console.WriteLine(x));
                var to = args.Length > 1 ? args[1] : "mrg_latest";
                Process.Start("clearmrgman", $@"/t {to} /b {view.SrBranchName.Value} /n {string.Join(" ", filesCut)}");
            }
            else if (cmd == Commands.MergeToRemoteSlow)
            {
                var to = args.Length > 1 ? args[1] : "mrg_latest";
                Process.Start("clearmrgman", $@"/t {to} /b {view.SrBranchName.Value}");
            }
            else if (cmd == Commands.MergeFromRemote)
            {
                var from = args.Length > 1 ? args[1] : "main";
                Process.Start("clearmrgman", $@"/t {view.ViewRoot.LocalPath} /f {from} /n \{view.ProductId.Name}");
            }
            else if (cmd == Commands.OpenBrtool)
            {
                Process.Start("brtool", $@"{view.SrBranchName.Value}");
            }
            else if (cmd == Commands.ShowVersionTree)
            {
                var fileName     = args[1];
                var fullFileName = Path.Combine(folder.Replace(".git", string.Empty), fileName);
                Process.Start("clearvtree", $@"{fullFileName}");
            }
            else if (cmd == Commands.OpenJira)
            {
                if (view.SrBranchName.Value.StartsWith("jsr"))
                {
                    Process.Start("chrome.exe", $@"http://sc-css-devjira/jira/browse/SR-{view.SrBranchName.Value.Substring(3)}");
                }
            }
            else if (cmd == Commands.ShowHistory)
            {
                var fileName     = args[1];
                var fullFileName = Path.Combine(folder.Replace(".git", string.Empty), fileName);
                CommandLineExecutor.ExecuteCleartool($"lshistory -graphical {fullFileName}");
            }
            else if (cmd == Commands.Cd)
            {
                var fileName     = args[1];
                var fullFileName = Path.Combine(folder.Replace(".git", string.Empty), fileName);
                var dir          = Path.GetDirectoryName(fullFileName);
                Clipboard.SetText($"cd {dir}");
            }
            else if (cmd == Commands.Annotate)
            {
                var fileName     = args[1];
                var fullFileName = Path.Combine(folder.Replace(".git", string.Empty), fileName);
                CommandLineExecutor.ExecuteCleartool($"annotate {fullFileName}");
                Process.Start($"{fullFileName}.ann");
            }
            else if (cmd == Commands.CheckinToClearCase)
            {
                CommandLineExecutor.ExecuteCmd(new[]
                {
                    @"git add -A",
                    @"git commit -m ""none""",
                    @"gitcc checkin"
                }, o => o.Subscribe(Console.Write));
            }
            else
            {
                Console.WriteLine("Unknown command: {0}", cmd);
            }
        }
Ejemplo n.º 33
0
 public static bool AtMost(this TargetVersion tv, TargetVersion targetVersion)
 {
     return(tv <= targetVersion);
 }
Ejemplo n.º 34
0
 public static void CreateDatabase(TargetVersion version, DatabaseLocation location)
 {
     FbConnection.CreateDatabase(GetConnectionString(version, location), 16 * 1024, false, true);
 }
 public override bool IsCompatibleWithVersion(TargetVersion targetVersion)
 {
     return(targetVersion.AtLeast(TargetVersion.Version40));
 }
Ejemplo n.º 36
0
 public static void ExecuteScript(TargetVersion version, DatabaseLocation location, string script)
 {
     ExecuteScript(version, location, new FbScript(script));
 }