Example #1
0
 public IProject MakeProject(IProject Project, ProjectPath Path, ICompilerLog Log)
 {
     Log.LogWarning(new LogEntry(
                        "ignored '-make-project'",
                        "the '-make-project' option was ignored because cin does not support any C project formats yet."));
     return(Project);
 }
Example #2
0
 public LogSimple(string logFolderPath, string logName)
 {
     this.logFolderPath   = logFolderPath;
     this.logName         = logName;
     this.logFolderPath   = logFolderPath.Equals("") ? ProjectPath.getProjectFullPath() : logFolderPath;
     this.logFileFullPath = this.logFolderPath + @"\" + this.logName + ".log";
 }
Example #3
0
 public void Canonicalize()
 {
     Assert.AreEqual(@"C:\folder1\file.tmp",
                     ProjectPath.Canonicalize(@"C:\folder1\.\folder2\..\file.tmp"));
     Assert.AreEqual(@"folder1\file.tmp",
                     ProjectPath.Canonicalize(@"folder1\.\folder2\..\file.tmp"));
 }
        protected PlanetsIntegrationTestFixture(string solutionRelativeTargetProjectParentDir)
        {
            var startupAssembly = typeof(TStartup).GetTypeInfo().Assembly;
            var contentRoot     = ProjectPath.Get(solutionRelativeTargetProjectParentDir, startupAssembly);

            ContentRoot = contentRoot;

            var configurationBuilder = new ConfigurationBuilder()
                                       .SetBasePath(contentRoot)
                                       .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true);

            configurationBuilder.AddEnvironmentVariables();
            Configuration = configurationBuilder.Build();

            var builder = new WebHostBuilder()
                          .UseContentRoot(contentRoot)
                          .ConfigureServices(InitializeServices)
                          .UseEnvironment("Development")
                          .UseStartup(typeof(TStartup))
                          .UseConfiguration(Configuration);

            _server = new TestServer(builder);

            Client             = _server.CreateClient();
            Client.BaseAddress = new Uri("http://localhost");
        }
Example #5
0
        public Project(XmlDocument xml)
        {
            if (xml.DocumentElement == null)
            {
                throw new ProjectLoadException();
            }
            for (var i = 0; i < xml.DocumentElement.ChildNodes.Count; i++)
            {
                var node = xml.DocumentElement.ChildNodes.Item(i);
                if (node == null)
                {
                    continue;
                }
                switch (node.Name)
                {
                case "ProjectPath":
                    ProjectPath = node.InnerText;
                    var sp = ProjectPath?.Split('\\');
                    ProjectName = sp.Length > 0 ? sp[sp.Length - 1].Split('.')[0] : "Invalid Project Name".Split('.')[0];
                    break;

                case "RackSetups":
                    LoadRackSetups(node);
                    break;
                }
            }
        }
Example #6
0
        private void UpdateApplicationBase(string appbase)
        {
            string basePath = null;

            if (appbase != String.Empty)
            {
                basePath = Path.Combine(project.BasePath, appbase);
                if (ProjectPath.SamePath(project.BasePath, basePath))
                {
                    basePath = null;
                }
            }

            selectedConfig.BasePath = basePath;

            // TODO: Test what happens if we set it the same as project base
            if (selectedConfig.RelativeBasePath == null)
            {
                applicationBaseTextBox.Text = string.Empty;
            }
            else
            {
                applicationBaseTextBox.Text = selectedConfig.RelativeBasePath;
            }
        }
        internal static void RunOnceWhenAccessTokenAndProjectIdAreInitialized()
        {
            if (string.IsNullOrEmpty(CloudProjectSettings.accessToken))
                return;

            if (!SetupCloudProjectId.HasCloudProjectId())
                return;

            if (!SessionState.GetBool(
                   CloudProjectDownloader.IS_PROJECT_DOWNLOADER_ALREADY_EXECUTED_KEY, false))
                return;

            EditorApplication.update -= RunOnceWhenAccessTokenAndProjectIdAreInitialized;

            string projectPath = ProjectPath.FromApplicationDataPath(
                Application.dataPath);

            string projectGuid = SetupCloudProjectId.GetCloudProjectId();

            if (!ShouldProjectBeMigrated(projectPath, projectGuid))
            {
                SessionState.SetInt(
                    IS_PROJECT_MIGRATED_ALREADY_CALCULATED_KEY,
                    MIGRATED_NOTHING_TO_DO);
                return;
            }

            Execute(
                CloudProjectSettings.accessToken,
                projectPath,
                projectGuid);
        }
 public IProject MakeProject(IProject Project, ProjectPath Path, ICompilerLog Log)
 {
     var newPath = Path.Path.Parent.Combine(Project.Name).ChangeExtension("ecsproj");
     var dsp = DSProject.FromProject(Project, newPath.AbsolutePath.Path);
     dsp.WriteTo(newPath.Path);
     return dsp;
 }
        private static void FromTo(CommandLineValues aCommandLineValues)
        {
            if (!String.IsNullOrWhiteSpace(aCommandLineValues.TargetPath))
            {
                TargetPath     = aCommandLineValues.TargetPath;
                TargetDir      = aCommandLineValues.TargetDir;
                TargetExt      = aCommandLineValues.TargetExt;
                TargetFileName = aCommandLineValues.TargetFileName;
                TargetName     = aCommandLineValues.TargetName;
            }
            if (!String.IsNullOrWhiteSpace(aCommandLineValues.SolutionPath))
            {
                SolutionPath     = aCommandLineValues.SolutionPath;
                SolutionDir      = aCommandLineValues.SolutionDir;
                SolutionExt      = aCommandLineValues.SolutionExt;
                SolutionFileName = aCommandLineValues.SolutionFileName;
                SolutionName     = aCommandLineValues.SolutionName;
            }
            if (!String.IsNullOrWhiteSpace(aCommandLineValues.ProjectPath))
            {
                ProjectPath     = aCommandLineValues.ProjectPath;
                ProjectDir      = aCommandLineValues.ProjectDir;
                ProjectExt      = aCommandLineValues.ProjectExt;
                ProjectFileName = aCommandLineValues.ProjectFileName;
                ProjectName     = aCommandLineValues.ProjectName;
                // XmlFileTweaker assignment
#warning Don't forget to fiddle this value when dealing with Full Framework and UAP projects. One needs the value of the AssemblyInfo file to fiddle with.
                ProjectPath.SetTextFilePath();
            }
            if (!String.IsNullOrWhiteSpace(aCommandLineValues.ConfigurationName))
            {
                ConfigurationName = aCommandLineValues.ConfigurationName;
            }
            if (!String.IsNullOrWhiteSpace(aCommandLineValues.PushToDestination))
            {
                PushToDestination = aCommandLineValues.PushToDestination;
            }
            if (!String.IsNullOrWhiteSpace(aCommandLineValues.Verbosity))
            {
                Verbosity      = aCommandLineValues.Verbosity;
                VerbosityLevel = aCommandLineValues.VerbosityLevel;
            }
            if (!String.IsNullOrWhiteSpace(aCommandLineValues.InternalVersionSelector))
            {
                InternalVersionSelector = aCommandLineValues.InternalVersionSelector;
                SelectedVersion         = aCommandLineValues.SelectedVersion;
            }
            if (!String.IsNullOrWhiteSpace(aCommandLineValues.OverrideVersion))
            {
                OverrideVersion = aCommandLineValues.OverrideVersion;
            }
            MergeDeletions           = aCommandLineValues.MergeDeletes;
            PerformDeletes           = aCommandLineValues.PerformDeletes;
            CommandLineSettings.Wait = aCommandLineValues.Wait;
            CommandLineSettings.Help = aCommandLineValues.Help;
            //HelpSection = aCommandLineValues.HelpSection;
            NoOp            = aCommandLineValues.NoOp;
            NoSpawn         = aCommandLineValues.NoSpawn;
            ShowEnvironment = aCommandLineValues.ShowEnvironment;
        }
Example #10
0
        private void RefreshPreview(string propertyName)
        {
            if (propertyName != "Preview" && !string.IsNullOrEmpty(ProjectPath.Trim()))
            {
                ProjectPathPrinterLayer projectPathPrinterLayer = new ProjectPathPrinterLayer();
                projectPathPrinterLayer.LoadFromViewModel(this);
                using (Bitmap bitmap = new Bitmap(460, 50))
                {
                    PlatformGeoCanvas canvas = new PlatformGeoCanvas();
                    canvas.BeginDrawing(bitmap, new RectangleShape(-180, 90, 180, -90), GeographyUnit.Meter);

                    projectPathPrinterLayer.SafeProcess(() =>
                    {
                        projectPathPrinterLayer.Draw(canvas, new Collection <SimpleCandidate>());
                    });

                    canvas.EndDrawing();
                    MemoryStream ms = new MemoryStream();
                    bitmap.Save(ms, ImageFormat.Png);
                    BitmapImage bitmapImage = new BitmapImage();
                    bitmapImage.BeginInit();
                    bitmapImage.StreamSource = ms;
                    bitmapImage.EndInit();
                    preview = bitmapImage;
                    RaisePropertyChanged(() => Preview);
                }
            }
        }
        public static string[][] getTestData(string fileName)
        {
            string[][] toArray = null;
            int        col     = 0;
            int        row     = 0;

            using (StreamReader sr = new StreamReader(ProjectPath.getProjectPath() + @"TestData\TestData\" + fileName))
            {
                string str;
                while ((str = sr.ReadLine()) != null)
                {
                    string[] temp = str.Split(';').ToArray();
                    col = temp.Length;
                    row++;
                }
            }
            toArray = new string[row][];
            using (StreamReader sr = new StreamReader(ProjectPath.getProjectPath() + @"TestData\TestData\" + fileName))
            {
                for (int i = 0; i < row; i++)
                {
                    string[] temp = new string[col];
                    toArray[i] = new string[col];
                    temp       = sr.ReadLine().Split(';').ToArray();
                    for (int j = 0; j < col; j++)
                    {
                        toArray[i][j] = temp[j];
                    }
                }
            }

            return(toArray);
        }
Example #12
0
 private void DeleteOldGeneratedFiles()
 {
     if (!ProjectPath.Equals(OutputPath))
     {
         FileHelper.DeleteDataServiceStructure(ProjectPath);
     }
     FileHelper.DeleteDataServiceStructure(OutputPath);
 }
Example #13
0
        /// <summary>
        /// Provide folder name to create a folder to store screenshots.
        /// </summary>
        /// <param name="folderName"></param>
        public static void CreateDirectoryForScreenshots(string folderName)
        {
            //GetProjectPath--> Initial Path , TestContext
            string folderPath = ProjectPath.getProjectPath() + "\\Screenshots";

            Directory.CreateDirectory(folderPath + "\\" + folderName);
            folder_Path = folderPath + "\\" + folderName;
        }
Example #14
0
        /// <inheritdoc cref="HtmlBuilder"/>
        public HtmlBuilder(Project project, ILogger <HtmlBuilder> logger, JsBuilder jsBuilder)
        {
            _project   = project;
            _logger    = logger;
            _jsBuilder = jsBuilder;

            _inPath  = Program.InPath.Combine("scriban");
            _outPath = _project.PathTo(Program.OutFolder);
        }
Example #15
0
        public static IisExpress CreateDefaultInstance()
        {
            var webProjectPath = ProjectPath.GetWebProjectFolderPath(ConfigurationManager.AppSettings["TargetProjectFolderName"]);

            var portNumber = GetAvailablePort();

            IisPort = portNumber;

            return(new IisExpress(webProjectPath, portNumber));
        }
 public IProject Parse(ProjectPath Path, ICompilerLog Log)
 {
     if (Path.HasExtension("ecs") || Path.HasExtension("cs") || Path.HasExtension("les"))
     {
         return new SingleFileProject(Path, Log.Options.GetTargetPlatform());
     }
     else
     {
         return DSProject.ReadProject(Path.Path.Path);
     }
 }
Example #17
0
 public void RelativePath()
 {
     Assert.AreEqual(@"folder2\folder3", ProjectPath.RelativePath(
                         @"c:\folder1", @"c:\folder1\folder2\folder3"));
     Assert.AreEqual(@"..\folder2\folder3", ProjectPath.RelativePath(
                         @"c:\folder1", @"c:\folder2\folder3"));
     Assert.AreEqual(@"bin\debug", ProjectPath.RelativePath(
                         @"c:\folder1", @"bin\debug"));
     Assert.IsNull(ProjectPath.RelativePath(@"C:\folder", @"D:\folder"),
                   "Unrelated paths should return null");
 }
Example #18
0
        public Program()
        {
            BuildPath   = Path.Combine("bin", "Debug", "netcoreapp2.2");
            ProjectPath = AppContext.BaseDirectory.Replace(BuildPath, string.Empty);
            ContentPath = ProjectPath.Replace("Tests", "API");

            _configuration = new ConfigurationBuilder()
                             .SetBasePath(ProjectPath)
                             .AddJsonFile("appsettings.json", optional: false, reloadOnChange: false)
                             .Build();
        }
Example #19
0
 public override int GetHashCode()
 {
     unchecked {
         var hashCode = GoDeeper.GetHashCode();
         hashCode = (hashCode * 397) ^ (Path != null ? Path.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ProjectPath != null ? ProjectPath.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (AdditionalOffset != null ? AdditionalOffset.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ IsFile.GetHashCode();
         return(hashCode);
     }
 }
Example #20
0
 public void SamePathOrUnder()
 {
     Assert.IsTrue(ProjectPath.SamePathOrUnder(@"C:\folder1\folder2\folder3", @"c:\folder1\.\folder2\junk\..\folder3"));
     Assert.IsTrue(ProjectPath.SamePathOrUnder(@"C:\folder1\folder2\", @"c:\folder1\.\folder2\junk\..\folder3"));
     Assert.IsTrue(ProjectPath.SamePathOrUnder(@"C:\folder1\folder2", @"c:\folder1\.\folder2\junk\..\folder3"));
     Assert.IsFalse(ProjectPath.SamePathOrUnder(@"C:\folder1\folder2", @"c:\folder1\.\folder22\junk\..\folder3"));
     Assert.IsFalse(ProjectPath.SamePathOrUnder(@"C:\folder1\folder2ile.tmp", @"D:\folder1\.\folder2\folder3\file.tmp"));
     Assert.IsFalse(ProjectPath.SamePathOrUnder(@"C:\", @"D:\"));
     Assert.IsTrue(ProjectPath.SamePathOrUnder(@"C:\", @"c:\"));
     Assert.IsTrue(ProjectPath.SamePathOrUnder(@"C:\", @"c:\bin\debug"));
 }
Example #21
0
        static void AfterWorkspaceMigrated()
        {
            SessionState.SetInt(
                IS_PROJECT_MIGRATED_ALREADY_CALCULATED_KEY,
                MIGRATED_NOTHING_TO_DO);

            CollabPlugin.Disable();

            mLog.DebugFormat(
                "Disabled Collab Plugin after the migration for Project: {0}",
                ProjectPath.FromApplicationDataPath(Application.dataPath));
        }
Example #22
0
        private static IEnumerable <string> GetAllSupportedFiles()
        {
            var projectPath = ProjectPath.EndsWith("/") ? ProjectPath : ProjectPath + "/";

            return(AssetDatabase.GetAllAssetPaths().Where(asset => {
                var absolutePath = Path.GetFullPath(asset).ConvertSeparatorsToUnity();
                if (!absolutePath.StartsWith(projectPath))
                {
                    return false;
                }
                return IsSupportedExtension(Path.GetExtension(asset));
            }));
        }
        protected UnitTestFixture(string solutionRelativeTargetProjectParentDir)
        {
            var startupAssembly = typeof(TStartup).GetTypeInfo().Assembly;
            var contentRoot     = ProjectPath.Get(solutionRelativeTargetProjectParentDir, startupAssembly);

            ContentRoot = contentRoot;

            var configurationBuilder = new ConfigurationBuilder()
                                       .SetBasePath(contentRoot)
                                       .AddJsonFile("appPlanets.json", optional: false, reloadOnChange: true);

            Configuration = configurationBuilder.Build();
        }
        private void BrowseButton_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog projDialog = new OpenFileDialog();

            projDialog.Title  = "Open UE4 Project File";
            projDialog.Filter = "Unreal Engine Project File|*.uproject";

            if (projDialog.ShowDialog() == true)
            {
                projFile = Path.GetFullPath(projDialog.FileName);
                Console.WriteLine("Value returned: " + projFile);
                ProjectPath.Clear();
                ProjectPath.AppendText(projFile);
            }
        }
Example #25
0
        public void Startup()
        {
            //TODO: Make sure the config is valid!

            if (ProjectPath.Contains("\\"))
            {
                ProjectName = ProjectPath.Substring(ProjectPath.LastIndexOf("\\") + 1);
            }
            else
            {
                ProjectName = ProjectPath;
            }

            ProjectName = ProjectName.Replace(".csproj", string.Empty).Replace(".vbproj", string.Empty);

            _publishDir      = Path.Combine(Directory.GetCurrentDirectory(), PublishDirectory ?? "SpecsForMvc.TestSite");
            _intermediateDir = Path.Combine(Directory.GetCurrentDirectory(), IntermediateDirectory ?? "SpecsForMvc.TempIntermediateDir");

            var properties = new Dictionary <string, string>
            {
                { "DeployOnBuild", "true" },
                { "DeployTarget", "Package" },
                { "_PackageTempDir", "\"" + _publishDir + "\"" },
                //If you think this looks bad, that's because it does.  What this
                //actually outputs looks like: "path\to\whatever\\"
                //The backslash on the end has to be escaped, otherwise msbuild.exe
                //will interpret it as escaping the final quote, which is incorrect.
                { "BaseIntermediateOutputPath", "\"" + _intermediateDir + "\\\\\"" },
                { "AutoParameterizationWebConfigConnectionStrings", "false" },
                { "Platform", Platform ?? "AnyCPU" },
                //Needed for Post-Build events that reference the SolutionDir macro/property.
                { "SolutionDir", @"""" + Path.GetDirectoryName(SolutionPath) + "\\\\\"" }
            };

            if (!string.IsNullOrEmpty(Configuration))
            {
                properties.Add("Configuration", Configuration);
            }

            if (!string.IsNullOrEmpty(OutputPath))
            {
                properties.Add("OutputPath", "\"" + OutputPath + "\\\\\"");
            }

            PublishSite(properties);

            StartIISExpress();
        }
Example #26
0
        private static void ConfigureServices(IServiceCollection serviceCollection)
        {
            var currentDir = ProjectPath.GetApplicationRoot();

            // build configuration
            var configuration = new ConfigurationBuilder()
                                .SetBasePath(currentDir)
                                .AddJsonFile("appsettings.json", false)
                                .Build();

            serviceCollection.AddOptions();
            serviceCollection.Configure <WebJobSettings>(configuration.GetSection("WebJobSettings"));
            serviceCollection.Configure <QueueSettings>(configuration.GetSection("QueueSettings"));
            // add app
            serviceCollection.AddTransient <WebJob>();
        }
Example #27
0
        public override int GetHashCode()
        {
            // Two states are the same if the serialized project and path are the same.
            // This is used when a new state is saved - if it equals the previous one, it is discarded.
            // Some information might therefore be lost - add the properties here if necessary.
            unchecked
            {
                int hash = SerializedProject.GetHashCode() * 31 + 17;
                if (ProjectPath != null)
                {
                    hash = hash * 31 + ProjectPath.GetHashCode();
                }

                return(hash);
            }
        }
Example #28
0
            // ReSharper disable once SuggestBaseTypeForParameter
            public ProjectFile(List <FileToWrite> files, bool updateProjectFile, VsTfsSourceControlProvider tfs)
            {
                if (updateProjectFile && files.Count > 0)
                {
                    ProjectFiles = new SortedDictionary <string, string>(StringComparer.OrdinalIgnoreCase);
                    // ReSharper disable once AssignNullToNotNullAttribute
                    var file = GetProjectPath(new DirectoryInfo(files[0].Directory));
                    ProjectFound = file != null;
                    if (file == null)
                    {
                        return;
                    }
                    ProjectPath = file.FullName;
                    Lines       = File.ReadAllLines(ProjectPath).ToList();
                    ProjectDir  = Path.GetDirectoryName(ProjectPath);
                    if (!Lines.Any(l => l.Contains("<Compile Include=")))
                    {
                        ProjectFileIndexStart = Lines.FindLastIndex(l => l.Contains("</PropertyGroup>")) + 1;
                        Lines.Insert(ProjectFileIndexStart, "</ItemGroup>");
                        Lines.Insert(ProjectFileIndexStart, "<ItemGroup>");
                        ProjectFileIndexStart++;
                    }
                    else
                    {
                        ProjectFileIndexStart = Lines.FindIndex(l => l.Contains("<Compile Include="));
                    }
                    foreach (var line in Lines.Skip(ProjectFileIndexStart).TakeWhile(l => l.Contains("<Compile Include=")))
                    {
                        ProjectFiles.Add(line, line);
                    }
                    ProjectFileIndexEnd = ProjectFileIndexStart + ProjectFiles.Count;

                    // Determine Line Format, defaulting if none currently exist
                    var first = ProjectFiles.Keys.FirstOrDefault() ?? (ProjectPath.EndsWith("projitems")
                                    ? "    <Compile Include=\"$(MSBuildThisFileDirectory)\" />"
                                    : "    <Compile Include=\"\" />");

                    var startEndIndex = first.Contains("$(")
                        ? first.IndexOf(")", first.IndexOf("$(", StringComparison.Ordinal), StringComparison.Ordinal) + 1 // Path contains Ms Build Variable
                        : first.IndexOf("\"", StringComparison.Ordinal) + 1;
                    LineFormat = first.Substring(0, startEndIndex) + "{0}" + first.Substring(first.LastIndexOf("\"", StringComparison.Ordinal), first.Length - first.LastIndexOf("\"", StringComparison.Ordinal));
                }

                UpdateProjectFile = updateProjectFile;
                ProjectUpdated    = false;
                Tfs = tfs;
            }
Example #29
0
        private static ProjectPath GetProjectPath(string packagePath)
        {
            var re      = new Regex(@"(.*)\\([^\\]+)");
            var matches = re.Match(packagePath);

            if (!matches.Success)
            {
                throw new ArgumentException("The specified package path was not an expected format: [" + packagePath + "]",
                                            "packagePath");
            }

            var path = new ProjectPath {
                Folder = matches.Groups[1].Value, Project = matches.Groups[2].Value
            };

            return(path);
        }
Example #30
0
        /// <summary>
        /// 创建WebAPI接口
        /// </summary>
        /// <param name="sysTableInfo"></param>
        /// <exception cref="Exception"></exception>
        private void GenerateWebApi(BuilderTable sysTableInfo, List <BuilderTableColumn> sysColumns)
        {
            string domainContent;
            string apiPath = ProjectPath.GetProjectDirectoryInfo()
                             .GetDirectories().FirstOrDefault(x => x.Name.ToLower().EndsWith(".webapi"))?.FullName;

            if (string.IsNullOrEmpty(apiPath))
            {
                throw new Exception("未找到webapi类库,请确认是存在weiapi类库命名以.webapi结尾");
            }

            var controllerName = sysTableInfo.ClassName + "sController";

            CheckExistsModule(controllerName); //单元测试下无效,因为没有执行webapi项目
            var controllerPath = apiPath + $"\\Controllers\\";

            domainContent = FileHelper.ReadFile(@"Template\\BuildControllerApi.html")
                            .Replace("{TableName}", sysTableInfo.TableName)
                            .Replace("{ModuleCode}", sysTableInfo.ModuleCode)
                            .Replace("{ModuleName}", sysTableInfo.ModuleName)
                            .Replace("{ClassName}", sysTableInfo.ClassName)
                            .Replace("{StartName}", StratName);

            var primarykey = sysColumns.FirstOrDefault(u => u.IsKey);

            if (primarykey == null)
            {
                throw new Exception($"未能找到表{sysTableInfo.TableName}的主键字段");
            }
            if (primarykey.ColumnType == "decimal" || primarykey.ColumnType == "numeric") //是否为数字
            {
                if (primarykey.IsIncrement)                                               //是否自增
                {
                    domainContent = domainContent.Replace("{KeyTypeName}", "int");
                }
                else     //普通的雪花算法生成id
                {
                    domainContent = domainContent.Replace("{KeyTypeName}", "decimal");
                }
            }
            else
            {
                domainContent = domainContent.Replace("{KeyTypeName}", "string");
            }
            FileHelper.WriteFile(controllerPath, controllerName + ".cs", domainContent);
        }
Example #31
0
        /// <summary>
        /// 创建应用层
        /// </summary>
        /// <param name="sysTableInfo"></param>
        /// <exception cref="Exception"></exception>
        private void GenerateApp(BuilderTable sysTableInfo, List <BuilderTableColumn> sysColumns)
        {
            string appRootPath = ProjectPath.GetProjectDirectoryInfo()
                                 .GetDirectories().FirstOrDefault(x => x.Name.ToLower().EndsWith(".app"))?.FullName;

            if (string.IsNullOrEmpty(appRootPath))
            {
                throw new Exception("未找到openauth.app类库,请确认是否存在");
            }

            CheckExistsModule(sysTableInfo.ModuleCode);

            string domainContent = FileHelper.ReadFile(@"Template\\BuildApp.html");

            domainContent = domainContent
                            .Replace("{TableName}", sysTableInfo.TableName)
                            .Replace("{ModuleCode}", sysTableInfo.ModuleCode)
                            .Replace("{ModuleName}", sysTableInfo.ModuleName)
                            .Replace("{ClassName}", sysTableInfo.ClassName)
                            .Replace("{StartName}", StratName);


            var primarykey = sysColumns.FirstOrDefault(u => u.IsKey);

            if (primarykey == null)
            {
                throw new Exception($"未能找到表{sysTableInfo.TableName}的主键字段");
            }
            if (primarykey.ColumnType == "decimal" || primarykey.ColumnType == "numeric") //是否为数字
            {
                if (primarykey.IsIncrement)                                               //是否自增
                {
                    domainContent = domainContent.Replace("{BaseAppName}", "BaseIntAutoGenApp");
                }
                else     //普通的雪花算法生成id
                {
                    domainContent = domainContent.Replace("{BaseAppName}", "BaseLongApp");
                }
            }
            else
            {
                domainContent = domainContent.Replace("{BaseAppName}", "BaseStringApp");
            }
            FileHelper.WriteFile($"{appRootPath}\\{sysTableInfo.ModuleCode}", $"{sysTableInfo.ModuleCode}.cs", domainContent);
        }
Example #32
0
        /// <summary>
        /// Helper method to determine if an IDataObject is valid
        /// for dropping on the tree view. It must be a the drop
        /// of a single file with a valid assembly file type.
        /// </summary>
        /// <param name="data">IDataObject to be tested</param>
        /// <returns>True if dropping is allowed</returns>
        private bool IsValidFileDrop(IDataObject data)
        {
            if (!data.GetDataPresent(DataFormats.FileDrop))
            {
                return(false);
            }

            string [] fileNames = data.GetData(DataFormats.FileDrop) as string [];

            if (fileNames == null || fileNames.Length == 0)
            {
                return(false);
            }

            // We can't open more than one project at a time
            if (fileNames.Length == 1)
            {
                if (NUnitProject.IsProjectFile(fileNames[0]))
                {
                    return(true);
                }

                if (UserSettings.Options.VisualStudioSupport)
                {
                    if (VSProject.IsProjectFile(fileNames[0]) ||
                        VSProject.IsSolutionFile(fileNames[0]))
                    {
                        return(true);
                    }
                }
            }

            // Multiple assemblies are allowed - we
            // assume they are all in the same directory
            // since they are being dragged together.
            foreach (string fileName in fileNames)
            {
                if (!ProjectPath.IsAssemblyFileType(fileName))
                {
                    return(false);
                }
            }

            return(true);
        }
Example #33
0
 bool ProjectExistsInCache(ProjectPath projectPath)
 {
     var cachePath = GetProjectCachePath(projectPath);
     return Directory.Exists(cachePath);
 }
Example #34
0
 private string GetProjectCachePath(ProjectPath projectPath)
 {
     var cachePath = Path.Combine(CacheRoot, projectPath.Folder, projectPath.Project);
     return cachePath;
 }
Example #35
0
        private static ProjectPath GetProjectPath(string packagePath)
        {
            var re = new Regex(@"(.*)\\([^\\]+)");
            var matches = re.Match(packagePath);
            if (! matches.Success)
            {
                throw new ArgumentException("The specified package path was not an expected format: [" + packagePath + "]",
                    "packagePath");
            }

            var path = new ProjectPath {Folder = matches.Groups[1].Value, Project = matches.Groups[2].Value};
            return path;
        }