示例#1
0
        private void ResolveNamespaces(IList elements, ExpressionContext context)
        {
            ImportBase currentImport = context.Imports.RootImport;

            while (true)
            {
                var name = GetName(elements);
                if (name == null)
                {
                    break; // TODO: might not be correct. Was : Exit While
                }

                var import = currentImport.FindImport(name);
                if (import == null)
                {
                    break; // TODO: might not be correct. Was : Exit While
                }

                currentImport = import;
                elements.RemoveAt(0);

                if (elements.Count > 0)
                {
                    var newFirst = (MemberElement)elements[0];
                    newFirst.SetImport(currentImport);
                }
            }

            if (elements.Count == 0)
            {
                throw CreateCompileException(CompileErrors.NamespaceCannotBeUsedAsType, CompileExceptionReason.TypeMismatch, currentImport.Name);
            }
        }
示例#2
0
        /// <summary>
        /// Imports content items from the file system to the repository.
        /// </summary>
        /// <param name="sourcePath">File system path of a content item or folder to import.</param>
        /// <param name="targetPath">Target container in the repository. Default: the Root.</param>
        public Installer Import(string sourcePath, string targetPath = null)
        {
            Logger.PackageName = "import";
            Logger.Create(LogLevel.Default);

            using (Repository.Start(RepositoryBuilder))
            {
                ImportBase.Import(sourcePath, targetPath);
            }

            return(this);
        }
        private async Task DownloadLists()
        {
            if (this.idEvent == -1)
                return;

            UserDialogs.ShowSpinner();
            var downloadData = new ImportBase();
            await downloadData.DownloadData(this.Token, this.idEvent);
            UserDialogs.HideSpinner();

            // Le message
            await this.UserDialogs.ShowAlert("OK", "Les listes ont été correctement téléchargées.");

        }
示例#4
0
        private void ResolveNamespaces(IList elements, IServiceProvider services)
        {
            ExpressionContext context       = (ExpressionContext)services.GetService(typeof(ExpressionContext));
            ImportBase        currentImport = context.Imports.RootImport;

            while (true)
            {
                string name = GetName(elements);

                if (name == null)
                {
                    break; // TODO: might not be correct. Was : Exit While
                }

                ImportBase import = currentImport.FindImport(name);

                if (import == null)
                {
                    break; // TODO: might not be correct. Was : Exit While
                }

                currentImport = import;
                elements.RemoveAt(0);

                if (elements.Count > 0)
                {
                    MemberElement newFirst = (MemberElement)elements[0];
                    newFirst.SetImport(currentImport);
                }
            }

            if (elements.Count == 0)
            {
                base.ThrowCompileException(CompileErrorResourceKeys.NamespaceCannotBeUsedAsType, CompileExceptionReason.TypeMismatch, currentImport.Name);
            }
        }
示例#5
0
 public void SetImport(ImportBase import)
 {
     MyImport = import;
 }
示例#6
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static int Main(string[] args)
        {
            InitializeServiceLocator();

            ConsoleLog("Asset Importer v" + Assembly.GetExecutingAssembly().GetName().Version.ToString() + " Copyright 2011-2012 EPiServer AB\n");

            string csvFile      = null;
            string assetFolder  = null;
            string importFolder = "Catalogs";
            string sitePath     = null;

            switch (args.Length)
            {
            case 0:
                DisplayUsage();
                return(0);

            case 1:
                ConsoleLog("Arguments incorrect.");
                return(1);

            case 2:
                ConsoleLog("Arguments incorrect.");
                return(2);

            default:
                csvFile     = args[0];
                assetFolder = args[1];
                sitePath    = args[2];
                break;
            }

            bool importByAsset = false;
            bool uselegacy     = false;
            bool mappingOnly   = false;

            for (int i = 3; i < args.Length; i++)
            {
                if (i == 3 && args[i][0] != '-')
                {
                    importFolder = args[i];
                    continue;
                }
                switch (args[i].ToLower())
                {
                case "-byasset":
                    importByAsset = true;
                    break;

                case "-uselegacy":
                    uselegacy = true;
                    break;

                case "-mappingonly":
                    mappingOnly = true;
                    break;

                case "-verbose":
                    break;

                default:
                    ConsoleLogFormat("Invalid command line option {0}.", args[i]);
                    DisplayUsage();
                    return(1);
                }
            }

            var stopwatch = Stopwatch.StartNew();

            ConsoleLog("Reading mappings from " + csvFile);
            ConsoleLog("Importing assets from " + assetFolder);
            ConsoleLog("Importing assets to   " + importFolder);
            ConsoleLog("Site Path   " + sitePath);

            ImportBase importer = null;

            if (!uselegacy)
            {
                if (!mappingOnly)
                {
                    importer = new ImportByCmsContent(assetFolder, importFolder, sitePath);
                }
                else
                {
                    importer = new CmsContentMapping(ServiceLocator.Current.GetInstance <IConnectionStringHandler>());
                }
            }
            else
            {
                InitAssetDatabase();
                InitECFAppContext();
                if (importByAsset)
                {
                    importer = new ImportByAsset(assetFolder, importFolder);
                }
                else
                {
                    importer = new ImportByProduct(assetFolder, importFolder);
                }
            }
            var reader = new CsvReader(csvFile);

            importer.DoImport(reader.Entries());
            stopwatch.Stop();
            ConsoleLog("\nElapsed time " + stopwatch.Elapsed.ToString());
            return(0);
        }
示例#7
0
		public void SetImport(ImportBase import)
		{
			MyImport = import;
		}
示例#8
0
 /// <summary>Register service method with a service binder with or without implementation. Useful when customizing the  service binding logic.
 /// Note: this method is part of an experimental API that can change or be removed without any prior notice.</summary>
 /// <param name="serviceBinder">Service methods will be bound by calling <c>AddMethod</c> on this object.</param>
 /// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
 public static void BindService(grpc::ServiceBinderBase serviceBinder, ImportBase serviceImpl)
 {
     serviceBinder.AddMethod(__Method_Import, serviceImpl == null ? null : new grpc::DuplexStreamingServerMethod <global::Service.ImportRequest, global::Service.ImportResponse>(serviceImpl.Import));
 }
示例#9
0
 /// <summary>Creates service definition that can be registered with a server</summary>
 /// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
 public static grpc::ServerServiceDefinition BindService(ImportBase serviceImpl)
 {
     return(grpc::ServerServiceDefinition.CreateBuilder()
            .AddMethod(__Method_Import, serviceImpl.Import).Build());
 }