Пример #1
0
        public async Task ImportImage(string tag)
        {
            var credential = new AzureCredentials(
                new ServicePrincipalLoginInformation
            {
                ClientId     = TestEnvironment.ClientId,
                ClientSecret = TestEnvironment.ClientSecret,
            },
                TestEnvironment.TenantId,
                AzureEnvironment.AzureGlobalCloud);

            var _registryClient = new ContainerRegistryManagementClient(credential.WithDefaultSubscription(TestEnvironment.SubscriptionId));

            _registryClient.SubscriptionId = TestEnvironment.SubscriptionId;

            var importSource = new ImportSource
            {
                SourceImage = "library/hello-world",
                RegistryUri = "registry.hub.docker.com"
            };

            await _registryClient.Registries.ImportImageAsync(
                resourceGroupName : TestEnvironment.ResourceGroup,
                registryName : TestEnvironment.Registry,
                parameters :
                new ImportImageParameters
            {
                Mode       = ImportMode.Force,
                Source     = importSource,
                TargetTags = new List <string>()
                {
                    $"library/hello-world:{tag}"
                }
            });
        }
Пример #2
0
        public async Task ImportImageAsync(string registry, string repository, List <string> tags)
        {
            var credential = new AzureCredentials(
                new ServicePrincipalLoginInformation
            {
                ClientId     = TestEnvironment.ClientId,
                ClientSecret = TestEnvironment.ClientSecret,
            },
                TestEnvironment.TenantId,
                AzureEnvironment.AzureGlobalCloud);

            var managementClient = new ContainerRegistryManagementClient(credential.WithDefaultSubscription(TestEnvironment.SubscriptionId));

            managementClient.SubscriptionId = TestEnvironment.SubscriptionId;

            var importSource = new ImportSource
            {
                SourceImage = repository,
                RegistryUri = "registry.hub.docker.com"
            };

            var targetTags = tags.Select(tag => $"{repository}:{tag}");

            await managementClient.Registries.ImportImageAsync(
                resourceGroupName : TestEnvironment.ResourceGroup,
                registryName : registry,
                parameters :
                new ImportImageParameters
            {
                Mode       = ImportMode.Force,
                Source     = importSource,
                TargetTags = targetTags.ToList()
            });
        }
Пример #3
0
        static CardBase()
        {
            Cards    = new List <Card>();
            Editions = new List <Edition>();

            IsInitialized = false;

            if (ImportSource == null)
            {
                ImportSource = Import.ImportSource.Cockatrice;
            }

            switch (ImportSource)
            {
            case ImportSource.Cockatrice:
                MaxItems = CockatriceImport.MaxItems;
                break;

            case ImportSource.MagiccardsInfo:
                MaxItems = 0;
                break;

            default:
                break;
            }
        }
		public SourceItem (ImportSource source) : base (source.Name.Replace ("_", "__"))
		{
			this.Source = source;
	
			Gdk.Pixbuf icon = source.Icon;
			if (icon != null)
				this.Image = new Gtk.Image (icon);
		}
 /// <summary>
 /// Создаёт объект для чтения температур с указанного источника.
 /// </summary>
 /// <param name="source"></param>
 /// <returns></returns>
 private static ITempertatureReader CreateReader(ImportSource source)
 {
     return(source switch
     {
         ImportSource.MeteoInfo => new Importers.MemeoInfoReader(),
         ImportSource.PogodaIKlimat => new Importers.PogodaIKlimatReader(),
         ImportSource.GisMeteo => new Importers.GisMeteoReader(),
         _ => throw new ArgumentOutOfRangeException(nameof(source))
     });
        public SourceItem(ImportSource source) : base(source.Name.Replace("_", "__"))
        {
            this.Source = source;

            Gdk.Pixbuf icon = source.Icon;
            if (icon != null)
            {
                this.Image = new Gtk.Image(icon);
            }
        }
Пример #7
0
        public void SwitchToFolderSource(Uri uri)
        {
            if (!history_sources.TryGetValue(uri.AbsoluteUri, out var source))
            {
                var name = uri.GetFilename();
                source = new ImportSource(uri, name, "folder");
                history_sources[uri.AbsoluteUri] = source;
            }

            PopulateSourceCombo(source);
            Controller.ActiveSource = source;
        }
Пример #8
0
 public async void OnClosePopup(View item, object parameter)
 {
     if (item is SelectImportSourceView)
     {
         if (parameter != null)
         {
             Dictionary <string, object> parameters = parameter as Dictionary <string, object>;
             if (parameters != null)
             {
                 CSVImporter  csvImporter  = (CSVImporter)parameters["CSVImporter"];
                 ImportSource importSource = (ImportSource)parameters["ImportSource"];
                 if (importSource.Format != Common.CSVFormat.Unknown)
                 {
                     List <ImportFieldMapping> mappings = CSVImporter.CreateMappings(importSource.Format);
                     await csvImporter.ImportToVault(Vault, mappings);
                 }
                 else
                 {
                     App.Controller.ShowPopup(
                         "vault.importmap",
                         new KeyValuePair <string, object>("CSVImporter", csvImporter),
                         new KeyValuePair <string, object>("ImportHeaders", csvImporter.Headers),
                         new KeyValuePair <string, object>("StandardFields", Credential.StandardFields));
                 }
             }
         }
     }
     else if (item is ImportMappingView)
     {
         Dictionary <string, object> parameters = parameter as Dictionary <string, object>;
         if (parameters != null)
         {
             CSVImporter csvImporter            = (CSVImporter)parameters["CSVImporter"];
             List <ImportFieldMapping> mappings = (List <ImportFieldMapping>)parameters["Mappings"];
             await csvImporter.ImportToVault(Vault, mappings);
         }
     }
     else if (item is VaultReportView)
     {
         string filter = (string)parameter;
         if (!String.IsNullOrEmpty(filter))
         {
             Entry searchEntry = View.FindByName <Entry>("SearchEntry");
             if (searchEntry != null)
             {
                 searchEntry.Text = "@" + filter;
             }
         }
     }
     ResetIdleTime();
     ClearSelectedCredential(true);
     NotifyPropertyChanged("FilteredCredentials");
 }
Пример #9
0
        public static void LoadImportSource([NotNull] Type type, [NotNull] ImportSourceAttribute importSourceAttribute)
        {
            Assert.ArgumentNotNull(type, nameof(type));
            Assert.ArgumentNotNull(importSourceAttribute, nameof(importSourceAttribute));

            var where = new ImportSource
            {
                Type      = type,
                Attribute = importSourceAttribute
            };

            importSources.Add(where);
        }
Пример #10
0
        public async System.Threading.Tasks.Task ImportImageAsync(
            Registry sourceRegistry,
            string sourceImage,
            bool force = true,
            CancellationToken cancellationToken = default(CancellationToken))
        {
            if (sourceRegistry == null)
            {
                throw new ArgumentNullException(nameof(sourceRegistry));
            }

            var sourceResourceId  = sourceRegistry.ResourceId?.ToString();
            var sourceLoginServer = string.IsNullOrEmpty(sourceResourceId) ? sourceRegistry.LoginServer : null;
            var importSource      = new ImportSource()
            {
                ResourceId  = sourceResourceId,
                RegistryUri = sourceLoginServer,
                SourceImage = sourceImage
            };

            if (!string.IsNullOrEmpty(sourceRegistry.UserName))
            {
                importSource.Credentials = new ImportSourceCredentials()
                {
                    Username = sourceRegistry.UserName,
                    Password = sourceRegistry.Password
                };
            }

            var importImageParameters = new ImportImageParameters()
            {
                Mode       = force ? ImportModeForce : ImportModeNoForce,
                Source     = importSource,
                TargetTags = new List <string> {
                    sourceImage
                }
            };

            importImageParameters.Validate();

            await _registryClient.Registries.ImportImageAsync(
                _registryConfiguration.ResourceGroupName,
                _registryConfiguration.Name,
                importImageParameters,
                cancellationToken).ConfigureAwait(false);
        }
Пример #11
0
        void PopulateSourceCombo(ImportSource sourceToActivate)
        {
            int activate_index = 0;

            sources_combo.Changed -= OnSourceComboChanged;
            Sources.Clear();
            Sources.AppendValues(null, Strings.ChooseImportSource, string.Empty, true);
            Sources.AppendValues(null, select_folder_label, "folder", true);
            Sources.AppendValues(null, string.Empty, string.Empty);
            bool mount_added = false;

            foreach (var source in Controller.Sources)
            {
                if (source == sourceToActivate)
                {
                    activate_index = Sources.IterNChildren();
                }
                Sources.AppendValues(source, source.Name, source.IconName, true);
                mount_added = true;
            }
            if (!mount_added)
            {
                Sources.AppendValues(null, Strings.ParenNoCamerasDetectedParen, string.Empty, false);
            }

            if (history_sources.Count > 0)
            {
                Sources.AppendValues(null, string.Empty, string.Empty);
                foreach (var source in history_sources.Values)
                {
                    if (source == sourceToActivate)
                    {
                        activate_index = Sources.IterNChildren();
                    }
                    Sources.AppendValues(source, source.Name, source.IconName, true);
                }
            }
            sources_combo.Changed += OnSourceComboChanged;
            sources_combo.Active   = activate_index;
        }
Пример #12
0
        public async Task <List <ProductDto> > MapRange(ImportSource importSourceProducts)
        {
            var directory      = Path.Combine(Directory.GetCurrentDirectory(), "App_Data", "Import");
            var productQty     = 0;
            var updatedProduct = 0;

            foreach (var sourceProduct in importSourceProducts.ProductDto)
            {
                var queryProduct = from c in _productRepository.Table
                                   where c.VendorCode == sourceProduct.Article ||
                                   c.Price == sourceProduct.Price &&
                                   c.FullDescription == sourceProduct.Description &&
                                   c.Name == sourceProduct.Name
                                   select c;
                var productResult    = IAsyncCursorSourceExtensions.FirstOrDefault(queryProduct);
                var isExistedProduct = productResult != null;

                if (isExistedProduct)
                {
                    if (productResult.Length == 0 && sourceProduct.Length != 0)
                    {
                        productResult.Length = sourceProduct.Length;
                    }

                    await _productRepository.UpdateAsync(productResult);

                    updatedProduct++;

                    continue;
                }

                var product = new ProductDto {
                    LWHMeasure               = sourceProduct.LWHMeasure,
                    WeightMeasure            = sourceProduct.WeightMeasure,
                    Name                     = sourceProduct.Name,
                    Width                    = sourceProduct.Width,
                    Height                   = Convert.ToDecimal(sourceProduct.Height),
                    Weight                   = Convert.ToDecimal(sourceProduct.Weight),
                    SeName                   = sourceProduct.Name.Replace(' ', '-').ToLower().Unidecode(),
                    VendorCode               = sourceProduct.Article,
                    FullDescription          = sourceProduct.Description,
                    ShortDescription         = sourceProduct.Description,
                    Price                    = sourceProduct.Price,
                    Published                = true,
                    DisplayStockAvailability = true,
                    DisplayStockQuantity     = true,
                    VisibleIndividually      = true,
                    OrderMinimumQuantity     = 1,
                    OrderMaximumQuantity     = 10000,
                    ProductTemplateId        = "5f74eb009eb59f4650635823",
                    StockQuantity            = sourceProduct.Mark == 1 ? 10000 : 0,
                    Gibkiy                   = sourceProduct.Gibkiy == 1,
                    Obrazci                  = sourceProduct.Obrazci,
                    MarkAsNew                = sourceProduct.IsNew,
                    Podsvetka                = sourceProduct.Podsvetka == 1,
                    QuantityInBox            = sourceProduct.QuantityInBox,
                    Material                 = sourceProduct.Material,
                    Mark                     = sourceProduct.Mark,
                    Collection               = sourceProduct.Collection,
                    Razdel                   = sourceProduct.Razdel,
                    UseWith                  = sourceProduct.UseWith,
                    Analogs                  = sourceProduct.Analogs
                };

                var queryCategory = from c in _categoryRepository.Table
                                    where c.Name == sourceProduct.Category
                                    select c;

                var isExistedCategory = IAsyncCursorSourceExtensions.FirstOrDefault(queryCategory) != null;
                var categoryDto       = new CategoryDto();

                if (!isExistedCategory)
                {
                    categoryDto = await _mediator.Send(new AddCategoryCommand {
                        Model = new CategoryDto {
                            Name               = sourceProduct.Category,
                            Published          = true,
                            HideOnCatalog      = false,
                            ShowOnSearchBox    = false,
                            ShowOnHomePage     = true,
                            CategoryTemplateId = "5f66096097db2b2da47b957d",
                            ParentCategoryId   = "5f8c210ea1bd7e55c439472b"
                        }
                    });

                    product.Categories.Add(new ProductCategoryDto {
                        CategoryId = categoryDto.Id
                    });
                }
                else
                {
                    var categoryId = IAsyncCursorSourceExtensions.FirstOrDefault(queryCategory).Id;
                    categoryDto.Id = categoryId;
                    product.Categories.Add(new ProductCategoryDto {
                        CategoryId = categoryId
                    });
                }

                var pictureDtos = new List <PictureDto>();

                foreach (var image in sourceProduct.Image)
                {
                    if (image == "")
                    {
                        continue;
                    }
                    var binary = Path.Combine(directory, "images", image).ToBytes();

                    if (binary == null)
                    {
                        continue;
                    }

                    pictureDtos.Add(await _mediator.Send(new AddPictureCommand {
                        PictureDto = new PictureDto {
                            SeoFilename   = image,
                            MimeType      = ("." + image.Split(".")[1]).ToMimeType(),
                            PictureBinary = binary
                        }
                    }));
                }

                var queryManufacturer = from c in _manufacturerRepository.Table
                                        where c.Name == sourceProduct.Brand
                                        select c;

                var isExistedManufacturer = IAsyncCursorSourceExtensions.FirstOrDefault(queryManufacturer) != null;

                var manufacturerDto = new ManufacturerDto();

                if (!isExistedManufacturer)
                {
                    manufacturerDto = await _mediator.Send(new AddManufacturerCommand {
                        Model = new ManufacturerDto {
                            Name      = sourceProduct.Brand,
                            Published = true,
                            ManufacturerTemplateId = "5f66096097db2b2da47b957e"
                        }
                    });

                    product.Manufacturers.Add(new ProductManufacturerDto {
                        ManufacturerId = manufacturerDto.Id
                    });
                }
                else
                {
                    var manufacturerId = IAsyncCursorSourceExtensions.FirstOrDefault(queryManufacturer).Id;
                    manufacturerDto.Id = manufacturerId;
                    product.Manufacturers.Add(new ProductManufacturerDto {
                        ManufacturerId = manufacturerId
                    });
                }

                var productDto = await _mediator.Send(
                    new AddProductCommand {
                    Model = product
                });

                await _categoryService.InsertProductCategory(new ProductCategory {
                    CategoryId        = categoryDto.Id,
                    ProductId         = productDto.Id,
                    IsFeaturedProduct = true
                });

                var productDtoExample = new ProductDto();
                var productExample    = new ProductDto();
                if (product.Obrazci > 0)
                {
                    productExample = (ProductDto)product.Clone();
                    var exampleCategoryName  = "Образцы";
                    var queryCategoryExample = from c in _categoryRepository.Table
                                               where c.Name == exampleCategoryName
                                               select c;

                    var isExistedCategoryExample =
                        IAsyncCursorSourceExtensions.FirstOrDefault(queryCategoryExample) != null;
                    var categoryDtoExample = new CategoryDto();

                    if (!isExistedCategoryExample)
                    {
                        categoryDtoExample = await _mediator.Send(new AddCategoryCommand {
                            Model = new CategoryDto {
                                Name               = exampleCategoryName,
                                Published          = true,
                                HideOnCatalog      = true,
                                ShowOnSearchBox    = false,
                                ShowOnHomePage     = false,
                                CategoryTemplateId = "5f66096097db2b2da47b957d",
                                ParentCategoryId   = "5f8c210ea1bd7e55c439472b"
                            }
                        });

                        var categoryForDelete = productExample.Categories.FirstOrDefault(
                            x => x.CategoryId == categoryDto.Id);
                        productExample.Categories.Remove(categoryForDelete);
                        productExample.Categories.Add(new ProductCategoryDto {
                            CategoryId = categoryDtoExample.Id
                        });
                    }
                    else
                    {
                        var categoryId = IAsyncCursorSourceExtensions.FirstOrDefault(queryCategoryExample).Id;
                        categoryDtoExample.Id = categoryId;
                        productExample.Categories.Add(new ProductCategoryDto {
                            CategoryId = categoryId
                        });
                    }

                    productDtoExample = await _mediator.Send(
                        new AddProductCommand {
                        Model = productExample
                    });

                    await _categoryService.InsertProductCategory(new ProductCategory {
                        CategoryId        = categoryDtoExample.Id,
                        ProductId         = productDtoExample.Id,
                        IsFeaturedProduct = true
                    });
                }

                await _manufacturerService.InsertProductManufacturer(new ProductManufacturer {
                    ManufacturerId    = manufacturerDto.Id,
                    ProductId         = productDto.Id,
                    IsFeaturedProduct = true
                });

                foreach (var item in pictureDtos)
                {
                    product.Pictures.Add(new ProductPictureDto {
                        MimeType  = item.MimeType,
                        PictureId = item.Id
                    });

                    await _productService.InsertProductPicture(new ProductPicture {
                        PictureId = item.Id,
                        ProductId = productDto.Id
                    });

                    if (product.Obrazci > 0)
                    {
                        productExample.Pictures.Add(new ProductPictureDto {
                            MimeType  = item.MimeType,
                            PictureId = item.Id
                        });

                        await _productService.InsertProductPicture(new ProductPicture {
                            PictureId = item.Id,
                            ProductId = productDtoExample.Id
                        });

                        _productDtos.Add(productDtoExample);
                    }
                }

                _productDtos.Add(productDto);

                await _logger.InsertLog(LogLevel.Information, $"Добавлен товар №{productQty}");

                productQty++;
            }

            await _logger.InsertLog(LogLevel.Information, updatedProduct.ToString());

            return(_productDtos);
        }
Пример #13
0
 private void c_source_SelectedIndexChanged(object sender, System.EventArgs e)
 {
     ISource = (ImportSource)c_source.SelectedIndex;
     update();
 }
Пример #14
0
        //結構物設置
        //public bool tBarCheck = false;
        //public bool bridgePierCheck = false;
        //public bool groundsillWorkCheck = false;
        //public bool sedimentationWeirCheck = false;
        //public int tBarNum = 0;
        //public int bridgePierNum = 0;
        //public int groundsillWorkNum = 0;
        //public int sedimentationWeirNum = 0;
        // private int _dryBedNum = 0;
        //private List<Point>[] _tBarPts = null;
        //private List<Point>[] _bridgePierPts = null;
        //private List<Point>[] _groundsillWorkPts = null;
        //private List<Point>[] _sedimentationWeirPts = null;
        //public List<Point>[] TBarSets
        //{
        //    get { return _tBarSets; }
        //    set { _tBarSets = (List<Point>[])value.Clone(); }
        //}
        //浸沒邊界資訊
        //private int _immersedBoundaryNum = 0;
        //private List<Point>[] _immersedBoundaryPts = null;
        //public bool sidewallBoundarySlip = false;      //4.1.3.1
        private void Initialization()
        {
            //模組特殊功能高程
            dimensionType = DimensionType.None;   //維度選擇
            modelingType = ModelingType.None;      //模組選擇

            //Special Functions
            //水理
            closeDiffusionEffectFunction = false;              //關閉移流擴散效應
            secondFlowEffectFunction = false;                  //二次流效應
            structureSetFunction = false;                      //結構物設置
            sideInOutFlowFunction = false;                     //側出入流
            waterHighSandContentEffectFunction = false;        //水理高含砂效應

            //動床
            bedrockFunction = false;                           //岩床
            quayStableAnalysisFunction = false;                //岩壁穩定分析
            movableBedHighSandContentEffectFunction = false;   //動床高含砂效應

            //全域參數
            inputGrid = null;
            importSource = ImportSource.None;
            coorType = TWD97;
            verticalLevelNumber = 19;      //0.1.1 垂向格網分層數目
            levelProportion = null;       //0.1.1.1 分層比例 陣列大小_verticalLevelNumber

            //水理參數
            flowType = FlowType.None;               //1.0 定/變量流
            //1.1 數值參數 =========================================
            //1.1.1 時間
            totalSimulationTime = 0;         //1.1.1.1 總模擬時間
            timeSpan2d = 0;                  //1.1.1.2 二維時間間距
            outputFrequency = 0;              //1.1.1.3 輸出頻率
            steppingTimesInVertVslcTime = 10;  //1.1.1.4 垂直方向計算時間步進次數
            //1.1.2 收斂條件
            waterModelingConvergenceCriteria2d = 0.0001;          //1.1.2.1 二維水理收斂標準
            waterModelingConvergenceCriteria3d = 0.0001;          //1.1.2.2 三維水理收斂標準
            waterModelingMaxIterationTimes = 10000;               //1.1.2.3 水理最大疊代次數

            //1.1.3 輸出控制
            //2D
            outputControlInitialBottomElevation = false;   //1.1.3 輸出控制 初始底床高程
            outputControlLevel = false;                    //1.1.3 輸出控制 水位
            outputControlDepth = false;                    //1.1.3 輸出控制 水深
            outputControlAverageDepthFlowRate = false;     //1.1.3 輸出控制 水深平均流速
            outputControlFlow = false;                     //1.1.3 輸出控制 流量
            outputControlBottomShearingStress = false;     //1.1.3 輸出控制 底床剪應力
            //3D
            outputControlVelocityInformation3D = false;    //1.1.3 輸出控制 三維流速資訊

            minWaterDeoth = 0.0001;                               //1.1.4 最小水深 單一數值 m 0.0001 實數(>0) 實數 8 格 (隱藏版功能)
            viscosityFactorAdditionInMainstream = 1;         //1.1.5 主流方向黏滯係數加成比例 單一數值 1 實數(>=0) 實數 8 格 (隱藏版功能)
            viscosityFactorAdditionInSideDirection = 1;      //1.1.6 側方向黏滯係數加成比例 單一數值 1 實數(>=0) 實數 8 格 (隱藏版功能)
            //1.2 物理參數 =========================================
            roughnessType = RoughnessType.None;        //1.2.1 糙度係數 二選一 整數 8 格
            manningN = new TwoInOne(TwoInOne.ValueType.Double, TwoInOne.ArrayType.TwoDim);                    //1.2.1.1 Manning n 二選一 -- 均一值
            chezy = new TwoInOne(TwoInOne.ValueType.Double, TwoInOne.ArrayType.TwoDim);                       //1.2.1.2 Chezy 二選一 -- 均一值
            roughnessHeightKs = new TwoInOne(TwoInOne.ValueType.Double, TwoInOne.ArrayType.TwoDim);           //1.2.1.3 粗糙高度 ks mm -- 均一值

            turbulenceViscosityType = TurbulenceViscosityType.None;    //1.2.2 紊流黏滯係數 四選一 整數 8 格
            //1.2.2.1 使用者輸入 模擬功能為二維或三維都可選擇此項輸入
            //1.2.2.1.1 紊流黏滯係數 Ns/m2 實數(>0) 實數 8 格
            tvInMainstreamDirection = 0;     //需確認
            tvInSideDirection = 0;           //需確認
            zeroEquationType = ZeroEquationType.Constant;  //1.2.2.2 零方程 五選一 總共 5 種選項
            //1.2.2.3 單方程 --
            //1.2.2.4 雙方程(k-ε) 三維 only,僅一項,不用下拉選單。

            //1.2.3 其他
            gravityConstant = 9.81;             //1.2.3.1 重力常數 單一數值 m/s2 9.81 實數 Free
            waterDensity = 1000;                //1.2.3.2 水密度 單一數值 kg/m3 1000 實數(>0) Free

            //1.3 二次流效應 二維 only
            curvatureRadiusType = 0;      //1.3.1 曲率半徑 是否自動計算
            curvatureRadius = null;      //1.3.1 曲率半徑 矩陣(I,J) m 0 實數 Free

            //1.4 結構物設置 四種結構物:丁壩、橋墩、固床工、攔河堰。
            tBarSet = false;                   //丁壩設置
            bridgePierSet = false;             //橋墩設置
            groundsillWorkSet = false;         //固床工設置
            sedimentationWeirSet = false;      //攔河堰設置
            //1.4.1 結構物數量
            tBarNumber = 0;               //丁壩數量
            bridgePierNumber = 0;         //橋墩數量
            groundsillWorkNumber = 0;     //固床工數量
            sedimentationWeirNumber = 0;  //攔河堰數量
            //1.4.1.1 格網位置
            tBarSets = null;                 //丁壩位置集合
            bridgePierSets = null;           //橋墩位置集合
            groundsillWorkSets = null;       //固床工位置集合
            sedimentationWeirSets = null;    //攔河堰位置集合

            //1.6 高含砂效應 供使用者輸入 6 個常數:α1、β1、c 1、α2、β2、c 2
            highSandEffectAlpha1 = 0;
            highSandEffectBeta1 = 0;
            highSandEffectC1 = 0;
            highSandEffectAlpha2 = 0;
            highSandEffectBeta2 = 0;
            highSandEffectC2 = 0;

            //動床參數
            //2.1 數值參數 =========================================
            waterTimeSpan = 0;                //2.1.1 時間間距
            waterOutputFrequency = 0;          //2.1.2 輸出頻率

            //2.1.3 輸出控制
            //2D
            outputControlBottomElevation = false;       //2.1.3 輸出控制 初始底床高程
            outputControlAverageDepthDensity = false;   //2.1.3 輸出控制 水深平均流速
            outputControlErosionDepth = false;          //2.1.3 沖淤深度

            //3D
            outputControlDensityInformation3D = false;   //2.1.3 輸出控制 三維流速資訊

            //2.1.4 選擇擴散公式
            diffusionFormulaUse = false;;                //2.1.4 擴散公式
            diffusionFormula = DiffusionFormulaType.None;   //2.1.4 擴散公式

            diffusionBonusProportionalInMainstream = 1.0;   //2.1.5 主流方向擴散係數加成比例單一數值 1 實數(>=0) 實數8 格三維 only (隱藏版功能)
            diffusionBonusProportionalInSideflow = 1.0;     //2.1.6 側方向擴散係數加成比例單一數值 1 實數(>=0) 實數8 格三維 only (隱藏版功能)
            diffusionBonusProportionalInSurface = 1.0;      //2.1.7 水面擴散係數加成比例單一數值 1 實數(>=0) 實數8 格三維 only (隱藏版功能)
            diffusionBonusProportionalInBottom = 1.0;       //2.1.8 底床擴散係數加成比例單一數值 1 實數(>=0) 實數8 格三維 only (隱藏版功能)

            //2.2 物理參數
            kinematicViscosityCoefficient = 1.12e-6;    //2.2.1 動力黏滯係數單一數值 秒 1.12e-6 實數(>=0) 實數16 格
            sedimentPoreRatio = 0.4;                //2.2.2 泥砂孔隙比單一數值 -- 0.4 實數(>=0) 實數8 格
            sedimentDensity = 2700;                  //2.2.3 泥砂密度單一數值 Kg/m3 2700 實數(>=0) 實數8 格
            sedimentParticlesNumber = 3;           //2.2.4 泥砂顆粒數目單一數值K 3 整數(>2) 最優先設定
            sedimentParticleSize = null;          //2.2.4.1 泥砂粒徑矩陣(K) m 實數(>0) 實數16 格矩陣(K)為泥砂顆粒數目
            //2.3 底床組成
            bottomLevelNumber = 6;                 //2.3.1 底床分層數目單一數值 整數(>0) a. 使用者輸入底床分層數目後
            bottomLevelArray = null;               //2.3.1.1 底床分層厚度矩陣(L) m 實數(>0) 矩陣(L)為底床分層數目
            sedimentCompositionArray = null;      //2.3.1.2 泥砂組成比例矩陣(K,L) 實數(>0) 矩陣(K,L)為(泥砂顆粒數目, 底床分層數目)

            shenCohesiveSediment = false;  //2.3.2 凝聚性沉滓option

            surfaceErosion = false;                 //2.3.2.1 表層沖刷 -- 實數(>0) 供者用者輸入係數及臨界剪應力(N/m2)兩個值
            surfaceErosionCoefficient = 0;          //2.3.2.1 表層沖刷 -- 實數(>0) 供者用者輸入係數及臨界剪應力(N/m2)兩個值
            surfaceErosionCriticalShearStress = 0;  //2.3.2.1 表層沖刷 -- 實數(>0) 供者用者輸入係數及臨界剪應力(N/m2)兩個值

            massiveErosion = false;                 //2.3.2.2 塊狀沖蝕 單一數值 N/m2。 -- 實數(>0) 供者用者輸入臨界剪應力(N/m2)
            massiveErosionCriticalShearStress = 0;  //2.3.2.2 塊狀沖蝕 單一數值 N/m2。 -- 實數(>0) 供者用者輸入臨界剪應力(N/m2)
            noErosionElevationUse = false;             //2.3.3 不可沖刷高程 二選一 m 實數 a. option 用 check box
            noErosionElevation = new TwoInOne(TwoInOne.ValueType.Double, TwoInOne.ArrayType.TwoDim);            //b. 0:均一值,逐點給:-1

            //2.4.2 高含砂輸砂公式 多選一 -- -- 整數 8 格 共 3 種選項
            sandTransportEquation = SandTransportEquationType.None;
            waterJettingAlpha = 0;    //2.5.1 水力沖刷 實數 供使用者輸入α及β兩個常數。
            waterJettingBeta = 0;     //2.5.1 水力沖刷 實數 供使用者輸入α及β兩個常數。

            sedimentErosion = false;                            //2.5.2 泥砂磨蝕
            sedimentErosionElasticModulusValue = 0;       //2.5.2.1 彈性模數 二選一 pa 實數(>=0) a. 0:均一值,逐點給:-1
            sedimentErosionElasticModulusArray = null;    //2.5.2.1 彈性模數 二選一 pa 實數(>=0) a. 若為逐點給,則參數形式為矩陣(I,J)
            sedimentErosionTensileStrengthValue = 0;      //2.5.2.2 張力強度 二選一 pa 實數(>=0) a. 0:均一值,逐點給:-1
            sedimentErosionTensileStrengthArray = null;   //2.5.2.2 張力強度 二選一 pa 實數(>=0) a. 若為逐點給,則參數形式為矩陣(I,J)

            bedrockElevation = false;           //2.5.3 岩床高程
            bedrockElevationValue = 0;;    //2.5.3 岩床高程 二選一 m 實數 a. 0:均一值,逐點給:-1。
            bedrockElevationArray = null; //2.5.3 岩床高程 二選一 m 實數 a. 為逐點給,則參數形式為矩陣(I,J)

            //2.6 岸壁穩定分析 option
            //2.6.1 分析位置
            positionAnalysis = false;   //2.6.1 分析位置
            positionAnalysisType = PositionAnalysisType.None;   //2.6.1 分析位置二選一 -- a. 僅供介面用,不用輸入到input 檔。此選項為提供全部模擬與局部模擬兩個選項
            localBlockNumber = 0;                        //2.6.1.1 數值格網數目的表格供使用者填入欲分析位置數目IB,其中IB 的數目不可超過格網數目I。
            localBlockArray = null;                         //2.6.1.1 局部區塊數目矩陣(2, IB) -- a. 矩陣(2, IB),1 代表左岸,2 代表右岸。僅為0、1 兩個數目字可供選擇,若1 為計算,若0 為不計算。

            //2.6.2 入滲效應
            infiltrationEffect = false;        //2.6.2 入滲效應 option
            infiltrationEffectTimeFormat = InfiltrationEffectTimeFormat.Minute;   //2.6.2.1 時間格式二選一 小時/分鐘,二選一。
            infiltrationEffectTimeSpacing = 0;                        //2.6.2.2 間距單一數值 實數(>0) 使用者自行輸入數值ex:1.5 小時or 90 分鐘
            rainfall = null;                                           //2.6.2.2.1 降雨量矩陣 mm 實數(>0) Free a. 矩陣大小需計算:首先將間距換為秒,然後“總模擬時間” (秒)除於間距(秒),即為矩陣大小

            //2.6.3 岸壁幾何條件
            quayGeometry = false;      //2.6.3 岸壁幾何條件
            soilStratificationNumber = 0;        //2.6.3.1 岸壁土壤分層數目單一數值 整數(>0) option
            layerThicknessArray = null;       //2.6.3.1.1 分層厚度矩陣(LBK)m 實數(>0) 矩陣(LBK)為岸壁土壤分層數目
            quayHeightArray = null;           //2.6.3.2 岸壁高度矩陣(2, IB) m 實數
            dikeToWharfLengthArray = null;    //2.6.3.3 堤防到岸壁的長度矩陣(2, IB)m 實數(>0)

            //2.6.4 岸壁土壤性質
            quaySoilProperties = false;   //2.6.4 岸壁土壤性質
            cohesion = 0;                         //2.6.4.1 凝聚力 二選一 pa 實數(>0) a. 0:均一值,逐點給:-1
            cohesionArray = null;                //2.6.4.1 凝聚力 若為逐點給,則參數形式為矩陣(2,IB,LBK)

            reposeAngle = 0;                      //2.6.4.2 安息角 二選一 deg 實數(>0) a. 0:均一值,逐點給:-1
            reposeAngleArray = null;             //2.6.4.2 安息角 若為逐點給,則參數形式為矩陣(2,IB,LBK)

            frictionAngle = 0;                    //2.6.4.3 內摩擦角 二選一 deg 實數(>0) a. 0:均一值,逐點給:-1
            frictionAngleArray = null;           //2.6.4.3 內摩擦角 若為逐點給,則參數形式為矩陣(2,IB,LBK)

            flowRateRatio = 0;                    //2.6.4.3 比流率 二選一 deg 實數(>0) a. 0:均一值,逐點給:-1
            flowRateRatioArray = null;          //2.6.4.3 比流率 若為逐點給,則參數形式為矩陣(2,IB,LBK)

            porosityRatio = 0;                    //2.6.4.5 孔隙率二選一 -- 實數(>0) a. 0:均一值,逐點給:-1
            porosityRatioArray = null;           //若為逐點給,則參數形式為矩陣(2,IB,LBK)

            soilProportion = 0;                  //2.6.4.6 土壤比重二選一 -- 實數(>0) a. 0:均一值,逐點給:-1
            soilProportionArray = null;         //若為逐點給,則參數形式為矩陣(2,IB,LBK)

            ShearStrengthAngle = 0;              //2.6.4.7 岸壁未飽和基值吸力造成剪力強度增加所對應角度 二選一 deg 實數(>0) a. 0:均一值,逐點給:-1
            ShearStrengthAngleArray = null;      //2.6.4.7 岸壁未飽和基值吸力造成剪力強度增加所對應角度 若為逐點給,則參數形式為矩陣(2,IB,LBK)

            //3. 初始條件
            //3.1 水理模組 =========================================
            depthAverageFlowSpeedU = new TwoInOne(TwoInOne.ValueType.Double, TwoInOne.ArrayType.TwoDim);
            depthAverageFlowSpeedV = new TwoInOne(TwoInOne.ValueType.Double, TwoInOne.ArrayType.TwoDim);
            waterLevel = new TwoInOne(TwoInOne.ValueType.Double, TwoInOne.ArrayType.TwoDim); ;      //3.1.4 水位 二選一 m 實數 實數 8 格a. 若為逐 點給,則參數形式為矩陣(I,J)
            verticalVelocitySlice = VerticalVelocitySliceType.None;         //3.1.4 垂向流速剖面二選一 -- -- 整數8 格a. 三維only b. 0:關;1:開

            //3.2 動床模組
            depthAverageConcentration = new TwoInOne(TwoInOne.ValueType.ThreeDim, TwoInOne.ArrayType.ThreeDim);      //3.2.1 水深平均濃度二選一 ppm -- 實數(>=0) 實數8 格a. 總共有K 個粒徑種類,每種粒徑都要輸入。
            verticalConcentrationSlice = VerticalConcentrationSliceType.None;         //3.2.2 垂向濃度剖面二選一 -- -- 整數8 格a. 三維only b. 0:關;1:開

            //4. 邊界條件
            //4.1 水理模組
            boundaryTimeNumber = 0;         //4.1.0 邊界時間數目
            boundaryTime = null;            //4.1.0 邊界時間

            //4.1.1 上游
            upFlowCondition = FlowConditionType.None;         //4.1.1.1 流況設定 二選一

            //4.1.1.1.1 超臨界流
            //boundaryConditionNumber = 0;                   //4.1.1.1.2.0 邊界條件數目 T 整數(>1) 定量流不輸入
            superMainFlowQuantity = new TwoInOne(TwoInOne.ValueType.TwoDim, TwoInOne.ArrayType.TwoDim);                 //4.1.1.1.2.1 流量 實數(>=0) 同 4.1.1.1.1.1
            superSideFlowQuantity = new TwoInOne(TwoInOne.ValueType.TwoDim, TwoInOne.ArrayType.TwoDim);                 //4.1.1.1.2.1 流量 實數(>=0) 同 4.1.1.1.1.1
            superWaterLevel = new TwoInOne(TwoInOne.ValueType.TwoDim, TwoInOne.ArrayType.TwoDim);                   //4.1.1.1.1.2 水位 m 實數

            //4.1.1.1.2 亞臨界流
            //subBoundaryConditionNumber = 0;                 //4.1.1.1.2.0 邊界條件數目 T 整數(>1) 定量流不輸入
            subMainFlowQuantity = new TwoInOne(TwoInOne.ValueType.TwoDim, TwoInOne.ArrayType.TwoDim);               //4.1.1.1.2.1 流量 實數(>=0) 同 4.1.1.1.1.1
            subSideFlowQuantity = new TwoInOne(TwoInOne.ValueType.TwoDim, TwoInOne.ArrayType.TwoDim);               //4.1.1.1.2.1 流量 實數(>=0) 同 4.1.1.1.1.1

            verticalVelocityType = VerticalVelocityType.Auto;       //4.1.1.2 垂向流速分布(3D) 矩陣(2,P) 實數(>=0)
            verticalVelocityDistributionArray = null;     //4.1.1.2 垂向流速分布(3D) 矩陣(2,P) 實數(>=0)

            //4.1.2 下游 二選一
            downFlowCondition = FlowConditionType.None;         //4.1.2 下游 二選一
            downSubWaterLevel = new TwoInOne(TwoInOne.ValueType.TwoDim, TwoInOne.ArrayType.TwoDim);                   //4.1.2.2.1 水位 實數 同 4.1.1.1.1.2,T 與前同(4.1.1.1.1.0 或4.1.1.1.2.0)

            //4.1.3 側壁
            sidewallBoundarySlip = false;               //4.1.3.1 側壁邊界滑移 -- 0 整數(>0) 整數 8 格 0:非滑移、1:滑移,check box

            //4.1.4 水面 三維 only。(”即時互動處”不放圖示)
            mainstreamWindShear = 0;              //4.1.4.1 主流方向風剪 單一數值 N/m2 0 實數 實數 8 格
            sideWindShear = 0;                    //4.1.4.2 側方向風剪 單一數值 N/m2 0 實數 實數 8 格
            coriolisForce = 0;                    //4.1.4.3 科氏力 單一數值 N/m2 0 實數 實數 8 格

            //4.1.5 底床 實數 三維 only。(”即時互動處”不放圖示)
            boundaryLayerThickness = 3;              //4.1.5.1 邊界層厚度 三選一 3 整數(>0) 整數 8 格 1、2、3,三維 only,下拉選單。
            seabedBoundarySlip = SeabedBoundarySlipType.NonSlip;   //4.1.5.2 底床邊界滑移 三選一 -- 0 整數(>0) 整數 8 格 a. 三維 only,下拉選單 b. 0:非滑移、1:滑移、2:壁函數

            //4.2 動床模組
            //4.2.1 上游
            //4.2.1.1 入流泥砂設定
            bottomBedLoadFluxType = BottomBedLoadFluxType.Auto; //4.2.1.1.1 底床載通量 實數(>=0)“模式自動計算”
            bottomBedLoadFluxArray = new TwoInOne(TwoInOne.ValueType.ThreeDim, TwoInOne.ArrayType.ThreeDim); ;            //4.2.1.1.1 底床載通量 實數(>=0)“自行輸入”,如果為“自行輸入”,則如圖4.2.1.1.1 所示
            suspendedLoadDepthAvgConcentration = new TwoInOne(TwoInOne.ValueType.ThreeDim, TwoInOne.ArrayType.ThreeDim);  //4.2.1.1.2 懸浮載水深平均濃度實數(>=0) 如圖 4.2.1.1.1 所示
            boundaryUpVerticalDistributionNum = 0;
            boundaryUpVerticalDistribution = new TwoInOne(TwoInOne.ValueType.Double, TwoInOne.ArrayType.TwoDim);    //4.2.1.1.3 垂向濃度分布(3D) 矩陣(2,PP) 均一值 實數(>=0) a. 可為均一值或自行輸入。

            //4.2.1.2 上游邊界底床
            upBoundaryElevationType = BottomBedLoadFluxType.Auto;   //4.2.1.2.1 可採用初始上游邊界底床高程或自行輸入
            upBoundaryElevationArray = null;              //4.2.1.2.1 高程矩陣(T,J) m 初始實數 可採用初始上游邊界底床高程或自行輸入,
            bottomBedParticleSizeRatio = null;            //4.2.1.2.2 底床粒徑比例實數(>=0) 如圖 4.2.1.1.3 所示

            //4.2.2 下游 圖5,“即時互動處”不放圖示
            movableBedDownType = BottomBedLoadFluxType.Auto;        //4.2.2.1 通量實數(>=0) 如圖 2.2.2.1 所示
            movableBedDownConcentration = null;           //4.2.2.2 濃度 實數(>=0) 如圖 2.2.2.1 所示

            boundaryDownVerticalDistributionNum = 0;
            boundaryDownVerticalDistribution = new TwoInOne(TwoInOne.ValueType.Double, TwoInOne.ArrayType.TwoDim);    //4.2.1.1.3 垂向濃度分布(3D) 矩陣(2,PP) 均一值 實數(>=0) a. 可為均一值或自行輸入。
            nearBedBoundaryType = NearBedBoundaryType.None;         //4.2.3 近底床濃度邊界二選一 實數 a. 三維only
            concentrationCalculation = ConcentrationCalculationType.None;   //4.2.3.1 濃度計算公式多選一 整數 8 格下拉式選單(總共2~3 種選項)
            inputConcentration = new TwoInOne(TwoInOne.ValueType.Double, TwoInOne.ArrayType.TwoDim);    //4.2.3.2 通量/給定濃度二選一 a. 先令使用者選擇是通量或者是給定濃
            stopFlah = false;
        }
Пример #15
0
 private void c_source_SelectedIndexChanged(object sender, System.EventArgs e)
 {
     ISource = (ImportSource)c_source.SelectedIndex;
     update();
 }
Пример #16
0
        private void runImport(ImportSource sourceData)
        {
            iCount = 0;
            iFiles = 0;
            DateTime start = DateTime.Now;


            FileManager fmRoot;

            if (ebParentFileID.Text.Length > 0)
            {
                fmRoot = AtMng.GetFile(Convert.ToInt32(ebParentFileID.Text));
            }
            else
            {
                fmRoot = AtMng.GetFile((int)ucDest.FileId);
            }

            acsr = AtMng.acMng.DB.ACSeries.FindByACSeriesId((int)ucMultiDropDown1.SelectedValue);

            switch (sourceData)
            {
            case ImportSource.LocalPath:
                MakeFile(ebImportFile.Text, fmRoot);
                break;

            case ImportSource.LotusPrePass:
                string ExtFilePath = Path.Combine("C:\\AtriumFileExtensionRejects", "FileExtRejects.txt");
                ExtTW = new StreamWriter(ExtFilePath);
                ImportPrepass(AtMng, ebImportFile.Text);
                ExtTW.Close();
                break;

            case ImportSource.LotusEmptyFolderFinder:
                string ExtFilePath2 = Path.Combine("C:\\AtriumRejects", "emptyDiskFoldersFromLotusExtract.txt");
                ExtTW = new StreamWriter(ExtFilePath2);
                CheckForEmptyLotusFolder(AtMng, ebImportFile.Text);
                ExtTW.Close();
                break;

            case ImportSource.LotusNotes:
                DateTime dt  = DateTime.Now;
                string   sDt = dt.ToString("yyyy-MM-dd hh_mm");
                string   PathToListOfDocsWithModifiedDocDate = "C:\\AtriumFileExtensionRejects\\ListOfDocsWithModifiedDocDate" + sDt + ".txt";
                DocsWithModifiedDocDate = new StreamWriter(PathToListOfDocsWithModifiedDocDate);
                StartPath = ebStartAt.Text;
                if (StartPath.Length > 0)
                {
                    isOkToContinue = false;
                }
                MakeLotusFile(ebImportFile.Text, fmRoot);
                DocsWithModifiedDocDate.Close();
                break;

            case ImportSource.InfoBank:
                MessageBox.Show("InfoBank import not implemented");
                break;
            }
            AddListItem(iFiles.ToString() + " files created in Atrium");
            AddListItem(iCount.ToString() + " documents created in Atrium");
            TimeSpan ts = DateTime.Now.Subtract(start);

            AddListItem(ts.ToString() + " elapsed time");
        }
 void DeactivateSource(ImportSource source)
 {
     if (source == null)
         return;
     source.Deactivate ();
 }
Пример #18
0
 private IStep GetStep(int step, ImportSource importSource)
 {
     return(pnl_steps.Controls.OfType <IStep>().Where(x => x.Step == step && x.ImportSource == importSource).FirstOrDefault());
 }
Пример #19
0
        private static async System.Threading.Tasks.Task ImportImageAsync(
            ContainerRegistryImagePushedEventData pushEvent,
            AppConfiguration configuration,
            ILogger log)
        {
            // Create the resourceId from the target ACR resourceId string
            var targetACRResourceId = ResourceId.FromString(configuration.TargetACRResourceId);

            // Create Azure credentials to talk to target Cloud using the Active directory application
            var credential = new AzureCredentials(
                new ServicePrincipalLoginInformation
            {
                ClientId     = configuration.TargetAzureServicePrincipalClientId,
                ClientSecret = configuration.TargetAzureServicePrincipalClientKey
            },
                configuration.TargetAzureServicePrincipalTenantId,
                AzureEnvironment.FromName(configuration.TargetAzureEnvironmentName))
                             .WithDefaultSubscription(targetACRResourceId.SubscriptionId);

            var builder = RestClient
                          .Configure()
                          .WithEnvironment(AzureEnvironment.FromName(configuration.TargetAzureEnvironmentName))
                          .WithCredentials(credential)
                          .Build();

            // Create ACR management client using the Azure credentials
            var _registryClient = new ContainerRegistryManagementClient(builder);

            _registryClient.SubscriptionId = targetACRResourceId.SubscriptionId;

            // Initiate import of the image that is part of the push event into target ACR
            // Configure the pull of image from source ACR using the token
            var imageTag     = $"{pushEvent.Target.Repository}:{pushEvent.Target.Tag}";
            var importSource = new ImportSource
            {
                SourceImage = imageTag,
                RegistryUri = pushEvent.Request.Host,
                Credentials = new ImportSourceCredentials
                {
                    Username = configuration.SourceACRPullTokenName,
                    Password = configuration.SourceACRPullTokenPassword,
                }
            };

            await _registryClient.Registries.ImportImageAsync(
                resourceGroupName : targetACRResourceId.ResourceGroupName,
                registryName : targetACRResourceId.Name,
                parameters : new ImportImageParametersInner
            {
                // Existing Tag will be overwritten with Force option,
                // If the desired behavior is to fail the operation instead of overwriting, use ImportMode.NoForce
                Mode       = ImportMode.Force,
                Source     = importSource,
                TargetTags = new List <string>()
                {
                    imageTag
                }
            });

            log.LogInformation($"Import of '{imageTag}' success to '{configuration.TargetACRResourceId}'");
        }
Пример #20
0
 public ImportBuilder Source(ImportSource source)
 {
     _source = source;
     return(this);
 }
        void PopulateSourceCombo(ImportSource source_to_activate)
        {
            int activate_index = 0;
            sources_combo.Changed -= OnSourceComboChanged;
            Sources.Clear ();
            Sources.AppendValues (null, Catalog.GetString ("Choose Import source..."), String.Empty, true);
            Sources.AppendValues (null, select_folder_label, "folder", true);
            Sources.AppendValues (null, String.Empty, String.Empty);
            bool mount_added = false;
            foreach (var source in Controller.Sources) {
                if (source == source_to_activate) {
                    activate_index = Sources.IterNChildren ();
                }
                Sources.AppendValues (source, source.Name, source.IconName, true);
                mount_added = true;
            }
            if (!mount_added) {
                Sources.AppendValues (null, Catalog.GetString ("(No Cameras Detected)"), String.Empty, false);
            }

            if (history_sources.Count > 0) {
                Sources.AppendValues (null, String.Empty, String.Empty);
                foreach (var source in history_sources.Values) {
                    if (source == source_to_activate) {
                        activate_index = Sources.IterNChildren ();
                    }
                    Sources.AppendValues (source, source.Name, source.IconName, true);
                }
            }
            sources_combo.Changed += OnSourceComboChanged;
            sources_combo.Active = activate_index;
        }