Esempio n. 1
0
        public void GivenValidBindOption_WhenBuild_ShouldSucceed()
        {
            var args = new string[]
            {
                "Bind",
                "modelName=model-temp",
                "VersionId=v1000",
                "VsProject=c:\\folder\\installPath\\testproject.csproj",
                "Store:ContainerName=containerName",
                "Store:AccountName=accountName",
                "Store:AccountKey=dummyKey",
            };

            IOption option = new OptionBuilder()
                             .SetArgs(args)
                             .Build();

            option.ModelName.Should().Be("model-temp");
            option.VersionId.Should().Be("v1000");

            option.Store.Should().NotBeNull();
            option.Store !.ContainerName.Should().Be("containerName");
            option.Store !.AccountName.Should().Be("accountName");
            option.Store !.AccountKey.Should().Be("dummyKey");
        }
        public string CreateMountDestination(string rootPath)
        {
            var destination = new StringBuilder();

            if (!rootPath.StartsWith('/'))
            {
                destination.Append('/');
            }

            destination.Append(rootPath);

            if (!rootPath.EndsWith('/') && !ContainerName.StartsWith('/'))
            {
                destination.Append('/');
            }

            destination.Append(ContainerName);

            if (!ContainerName.EndsWith('/') && !VolumeDisplayName.EndsWith('/'))
            {
                destination.Append('/');
            }

            destination.Append(VolumeDisplayName);

            return(destination.ToString());
        }
Esempio n. 3
0
        public void GivenValidDownloadOption_WhenBuild_ShouldSucceed()
        {
            var args = new string[]
            {
                "DOWNLOAD",
                "PackageFile=c:\\zipfile2.mlPackage",
                "modelName=mymodel99",
                "VersionId=x1000",
                "Store:ContainerName=containerName",
                "Store:AccountName=accountName",
                "Store:AccountKey=dummyKey",
            };

            IOption option = new OptionBuilder()
                             .SetArgs(args)
                             .Build();

            option.Download.Should().BeTrue();
            option.PackageFile.Should().Be("c:\\zipfile2.mlPackage");
            option.ModelName.Should().Be("mymodel99");
            option.VersionId.Should().Be("x1000");

            option.Store.Should().NotBeNull();
            option.Store !.ContainerName.Should().Be("containerName");
            option.Store !.AccountName.Should().Be("accountName");
            option.Store !.AccountKey.Should().Be("dummyKey");
        }
Esempio n. 4
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (BlobName != null)
         {
             hashCode = hashCode * 59 + BlobName.GetHashCode();
         }
         if (ContainerName != null)
         {
             hashCode = hashCode * 59 + ContainerName.GetHashCode();
         }
         if (CorrelationId != null)
         {
             hashCode = hashCode * 59 + CorrelationId.GetHashCode();
         }
         if (HostName != null)
         {
             hashCode = hashCode * 59 + HostName.GetHashCode();
         }
         if (SasToken != null)
         {
             hashCode = hashCode * 59 + SasToken.GetHashCode();
         }
         return(hashCode);
     }
 }
Esempio n. 5
0
        public void GivenValidDeleteOption_WhenBuild_ShouldSucceed()
        {
            var args = new string[]
            {
                "Delete",
                "modelName=mymodel-temp",
                "VersionId=v1000",
                "Store:ContainerName=containerName",
                "Store:AccountName=accountName",
                "Store:AccountKey=dummyKey",
            };

            IOption option = new OptionBuilder()
                             .SetArgs(args)
                             .Build();

            option.Delete.Should().BeTrue();
            option.ModelName.Should().Be("mymodel-temp");
            option.VersionId.Should().Be("v1000");

            option.Store.Should().NotBeNull();
            option.Store !.ContainerName.Should().Be("containerName");
            option.Store !.AccountName.Should().Be("accountName");
            option.Store !.AccountKey.Should().Be("dummyKey");
        }
Esempio n. 6
0
        /// <summary>
        /// Upload an image to blob storage
        /// OR
        /// Replace it if a file with the provided guid already exists
        /// </summary>
        /// <param name="container">The container to upload the blob to.
        /// Container is an enum.</param>
        /// <param name="formFile">The FormFile object which contains the byte data and meta-data
        /// for the file being uploaded.</param>
        /// <param name="blobName">The guid which will become the blob filename in azure storage.
        /// </param>
        /// <returns>A Image object which contains the guid filename given to the blob in blob storage.
        /// This object also contains the URL that you can use to access the blob file from online.</returns>
        public async Task <Image> UploadOrReplaceImage(ContainerName container, FormFile formFile, Guid blobName)
        {
            CloudBlockBlob blockBlob;

            if (container == ContainerName.Gallery)
            { // check which container to upload the blob to
                blockBlob = _GalleryContainer.GetBlockBlobReference(blobName.ToString());
            }
            else if (container == ContainerName.Log)
            {
                blockBlob = _LogContainer.GetBlockBlobReference(blobName.ToString());
            }
            else
            {
                throw new ArgumentException("Invalid enum ContainerName value", container.ToString());
            }


            blockBlob.Properties.ContentType = formFile.ContentType; // set the new blob's mime type
            // Create or overwrite the blob with the contents of formFile stream
            await blockBlob.UploadFromStreamAsync(formFile.OpenReadStream());

            Image image = new Image
            {
                Url           = blockBlob.StorageUri.PrimaryUri.ToString(),
                Guid          = blobName,
                Filename      = formFile.FileName,
                ContainerName = container
            };

            return(image);
        }
Esempio n. 7
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (AccountName != null)
         {
             hashCode = hashCode * 59 + AccountName.GetHashCode();
         }
         if (ContainerName != null)
         {
             hashCode = hashCode * 59 + ContainerName.GetHashCode();
         }
         if (AccessKey != null)
         {
             hashCode = hashCode * 59 + AccessKey.GetHashCode();
         }
         if (RootPath != null)
         {
             hashCode = hashCode * 59 + RootPath.GetHashCode();
         }
         if (ConnectionURL != null)
         {
             hashCode = hashCode * 59 + ConnectionURL.GetHashCode();
         }
         return(hashCode);
     }
 }
        public override void SetDefaults()
        {
            Main.tileSpelunker[Type]         = true;
            Main.tileContainer[Type]         = true;
            Main.tileShine2[Type]            = true;
            Main.tileShine[Type]             = 1200;
            Main.tileFrameImportant[Type]    = true;
            Main.tileNoAttach[Type]          = true;
            Main.tileOreFinderPriority[Type] = 500;
            TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2);
            TileObjectData.newTile.Origin                = new Point16(0, 1);
            TileObjectData.newTile.CoordinateHeights     = new int[] { 16, 18 };
            TileObjectData.newTile.HookCheckIfCanPlace   = new PlacementHook(new Func <int, int, int, int, int, int, int>(Chest.FindEmptyChest), -1, 0, true);
            TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(new Func <int, int, int, int, int, int, int>(Chest.AfterPlacement_Hook), -1, 0, false);
            TileObjectData.newTile.AnchorInvalidTiles    = new int[] { 127 };
            TileObjectData.newTile.StyleHorizontal       = true;
            TileObjectData.newTile.LavaDeath             = false;
            TileObjectData.newTile.AnchorBottom          = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0);
            TileObjectData.addTile(Type);
            ModTranslation name = CreateMapEntryName();

            name.SetDefault("CrystalWood Chest");
            AddMapEntry(new Color(250, 140, 250), name, MapChestName);
            DustType = DustType <CrystalDust>();
            TileID.Sets.DisableSmartCursor[Type] = true;
            AdjTiles = new int[] { TileID.Containers };
            // TODO: Check how to port chests
            // chest = "CrystalWood Chest";
            TileID.Sets.BasicChest[Type] = true;
            ContainerName.SetDefault("CrystalWood Chest");
            ChestDrop = ItemType <Items.Placeable.CrystalWoodChest>();
        }
Esempio n. 9
0
 public csgo_tts_settings()
 {
     InitializeComponent();
     containerOrder.Clear();
     foreach (char letter in csgo_tts_main.letters)
     {
         if (letter == 'N')
         {
             ContainerName.BringToFront();
             containerOrder.Add(ContainerName);
             ContainerName.Left = containerOffset.ElementAt(containerOrder.IndexOf(ContainerName));
         }
         if (letter == 'F')
         {
             ContainerFiller.BringToFront();
             containerOrder.Add(ContainerFiller);
             ContainerFiller.Left = containerOffset.ElementAt(containerOrder.IndexOf(ContainerFiller));
         }
         if (letter == 'S')
         {
             ContainerSpot.BringToFront();
             containerOrder.Add(ContainerSpot);
             ContainerSpot.Left = containerOffset.ElementAt(containerOrder.IndexOf(ContainerSpot));
         }
         if (letter == 'M')
         {
             ContainerMessage.BringToFront();
             containerOrder.Add(ContainerMessage);
             ContainerMessage.Left = containerOffset.ElementAt(containerOrder.IndexOf(ContainerMessage));
         }
     }
 }
Esempio n. 10
0
        public async Task <Stream> Load(string name, ContainerName containerName)
        {
            var container = await GetContainer(containerName.ToString().ToLower());

            var blob = container.GetBlobReference(name);

            return(await blob.OpenReadAsync());
        }
Esempio n. 11
0
 public bool Validate()
 {
     return(ContainerId >= 0 &&
            ContainerName.IsValidContainerName() &&
            !string.IsNullOrWhiteSpace(Name) &&
            !string.IsNullOrWhiteSpace(Type) &&
            !string.IsNullOrWhiteSpace(Data));
 }
Esempio n. 12
0
        /// <summary>
        /// Initialize the appender based on the options set
        /// </summary>
        /// <remarks>
        /// <para>
        /// This is part of the <see cref="T:log4net.Core.IOptionHandler"/> delayed object activation scheme.
        /// The <see cref="M:log4net.Appender.BufferingAppenderSkeleton.ActivateOptions"/> method must be called on this object after the configuration properties have been set.
        /// Until <see cref="M:log4net.Appender.BufferingAppenderSkeleton.ActivateOptions"/> is called this object is in an undefined state and must not be used.
        /// </para>
        /// <para>
        /// If any of the configuration properties are modified then <see cref="M:log4net.Appender.BufferingAppenderSkeleton.ActivateOptions"/> must be called again.
        /// </para>
        /// </remarks>
        public override void ActivateOptions()
        {
            base.ActivateOptions();

            _account            = new BlobServiceClient(ConnectionString);
            _cloudBlobContainer = _account.GetBlobContainerClient(ContainerName.ToLower());
            _cloudBlobContainer.CreateIfNotExists();
        }
Esempio n. 13
0
        public override void ActivateOptions()
        {
            base.ActivateOptions();

            _account            = CloudStorageAccount.Parse(ConnectionString);
            _client             = _account.CreateCloudBlobClient();
            _cloudBlobContainer = _client.GetContainerReference(ContainerName.ToLower());
            _cloudBlobContainer.CreateIfNotExists();
        }
Esempio n. 14
0
        public async Task <string> Save(Stream stream, ContainerName containerName, string fileName)
        {
            var container = await GetContainer(containerName.ToString().ToLower());

            var name = $"{Guid.NewGuid().ToString("D")}-{fileName}";
            var blob = container.GetBlockBlobReference(name);
            await blob.UploadFromStreamAsync(stream);

            return(name);
        }
Esempio n. 15
0
        public string Read(ContainerName containerName)
        {
            var assembly     = Assembly.GetExecutingAssembly();
            var resourceName = $"NLPEnvironment.Container.{GetContainerFileName(containerName)}";

            using (Stream stream = assembly.GetManifestResourceStream(resourceName))
                using (StreamReader reader = new StreamReader(stream))
                {
                    return(reader.ReadToEnd());
                }
        }
Esempio n. 16
0
        public override int GetHashCode()
        {
            int hashCode = Scope.GetHashCode();

            hashCode = (hashCode * 499) ^ (ContainerName != null ? ContainerName.ToLowerInvariant().GetHashCode() : 0);
            hashCode = (hashCode * 499) ^ (ModifiedSince != null ? ModifiedSince.GetHashCode() : 0);
            hashCode = (hashCode * 499) ^ (ModifiedAfterRevision != null ? ModifiedAfterRevision.GetHashCode() : 0);
            hashCode = (hashCode * 499) ^ (CoreAttributes != null ? CoreAttributes.GetHashCode() : 0);

            return(hashCode);
        }
Esempio n. 17
0
        public void GivenValidDownloadOptionWithConfigFile_WhenBuild_ShouldSucceed()
        {
            var tempConfigFile = Path.Combine(Path.GetTempPath(), "test-configfile.json");

            IJson json = new Json();

            dynamic config = new
            {
                Download    = true,
                PackageFile = "c:\\zipfile2.mlPackage",
                ModelName   = "ml-model-temp",
                VersionID   = "v10-0-0-1",
                Store       = new
                {
                    ContainerName = "containerName",
                    AccountName   = "accountName",
                    AccountKey    = "accountKey",
                },
            };

            string data = json.Serialize(config);

            File.WriteAllText(tempConfigFile, data);

            try
            {
                var args = new string[]
                {
                    $"configfile={tempConfigFile}",
                    "ModelName=ml-model-temp-next-version",
                };

                IOption option = new OptionBuilder()
                                 .SetArgs(args)
                                 .Build();

                option.Download.Should().BeTrue();
                option.PackageFile.Should().Be("c:\\zipfile2.mlPackage");
                option.ModelName.Should().Be("ml-model-temp-next-version");
                option.VersionId.Should().Be("v10-0-0-1");

                option.Store.Should().NotBeNull();
                option.Store !.ContainerName.Should().Be("containerName");
                option.Store !.AccountName.Should().Be("accountName");
                option.Store !.AccountKey.Should().Be("accountKey");
            }
            finally
            {
                File.Delete(tempConfigFile);
            }
        }
Esempio n. 18
0
        protected string GetContainerFileName(ContainerName containerName)
        {
            switch (containerName)
            {
            case ContainerName.SHORTLIST:
                return("ShortList.txt");

            case ContainerName.MORPHOLOGICAL:
                return("Morphological.txt");

            default:
                return(null);
            }
        }
Esempio n. 19
0
        /// <summary>
        /// Initialize the appender based on the options set
        /// </summary>
        /// <remarks>
        /// <para>
        /// This is part of the <see cref="T:log4net.Core.IOptionHandler"/> delayed object
        ///             activation scheme. The <see cref="M:log4net.Appender.BufferingAppenderSkeleton.ActivateOptions"/> method must
        ///             be called on this object after the configuration properties have
        ///             been set. Until <see cref="M:log4net.Appender.BufferingAppenderSkeleton.ActivateOptions"/> is called this
        ///             object is in an undefined state and must not be used.
        /// </para>
        /// <para>
        /// If any of the configuration properties are modified then
        ///             <see cref="M:log4net.Appender.BufferingAppenderSkeleton.ActivateOptions"/> must be called again.
        /// </para>
        /// </remarks>
        public override void ActivateOptions()
        {
            base.ActivateOptions();

            // Attempt to retrieve the connection string by name from the config file first.  If it doesn't exist,
            // assume the defined connection string is the actual connection string.
            var connectionStringObj = ConfigurationManager.ConnectionStrings[ConnectionString];
            var connectionString    = connectionStringObj != null ? connectionStringObj.ConnectionString : ConnectionString;

            _account            = CloudStorageAccount.Parse(connectionString);
            _client             = _account.CreateCloudBlobClient();
            _cloudBlobContainer = _client.GetContainerReference(ContainerName.ToLower());
            _cloudBlobContainer.CreateIfNotExists();
        }
        public override void ActivateOptions()
        {
            base.ActivateOptions();

            var connectionString = ConnectionString ?? GetConnectionString();

            if (!CloudStorageAccount.TryParse(connectionString, out account))
            {
                throw new ArgumentException("Missing or malformed connection string.", nameof(connectionString));
            }

            client    = account.CreateCloudBlobClient();
            container = client.GetContainerReference(ContainerName.ToLower());
            container.CreateIfNotExists();
        }
 public override int GetHashCode() =>
 BlobName.GetHashCode() ^
 CacheControl.GetHashCode() ^
 ContainerName.GetHashCode() ^
 ContentDisposition.GetHashCode() ^
 ContentEncoding.GetHashCode() ^
 ContentLanguage.GetHashCode() ^
 ContentType.GetHashCode() ^
 ExpiryTime.GetHashCode() ^
 Identifier.GetHashCode() ^
 IPRange.GetHashCode() ^
 Permissions.GetHashCode() ^
 Protocol.GetHashCode() ^
 StartTime.GetHashCode() ^
 Version.GetHashCode();
Esempio n. 22
0
        public async Task <string> UploadPhotoAsync(HttpPostedFileBase binaryFile, ContainerName containerName = ContainerName.General)
        {
            if (binaryFile == null)
            {
                return(string.Empty);
            }

            var photo = new Photo
            {
                ContainerName = containerName.GetDescription(),
                FileName      = binaryFile.FileName.GetRandomBlobName(),
                BinaryContent = binaryFile.InputStream,
                ContentType   = binaryFile.ContentType
            };

            return(await _fileService.CreateAsync(photo));
        }
Esempio n. 23
0
        public override void SetDefaults()
        {
            // Properties
            Main.tileSpelunker[Type]             = true;
            Main.tileContainer[Type]             = true;
            Main.tileShine2[Type]                = true;
            Main.tileShine[Type]                 = 1200;
            Main.tileFrameImportant[Type]        = true;
            Main.tileNoAttach[Type]              = true;
            Main.tileOreFinderPriority[Type]     = 500;
            TileID.Sets.HasOutlines[Type]        = true;
            TileID.Sets.BasicChest[Type]         = true;
            TileID.Sets.DisableSmartCursor[Type] = true;

            DustType  = ModContent.DustType <Sparkle>();
            AdjTiles  = new int[] { TileID.Containers };
            ChestDrop = ModContent.ItemType <Items.Placeable.Furniture.ExampleChest>();

            // Names
            ContainerName.SetDefault("Example Chest");

            ModTranslation name = CreateMapEntryName();

            name.SetDefault("Example Chest");
            AddMapEntry(new Color(200, 200, 200), name, MapChestName);

            name = CreateMapEntryName(Name + "_Locked");             // With multiple map entries, you need unique translation keys.
            name.SetDefault("Locked Example Chest");
            AddMapEntry(new Color(0, 141, 63), name, MapChestName);

            // Placement
            TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2);
            TileObjectData.newTile.Origin                = new Point16(0, 1);
            TileObjectData.newTile.CoordinateHeights     = new[] { 16, 18 };
            TileObjectData.newTile.HookCheckIfCanPlace   = new PlacementHook(Chest.FindEmptyChest, -1, 0, true);
            TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(Chest.AfterPlacement_Hook, -1, 0, false);
            TileObjectData.newTile.AnchorInvalidTiles    = new int[] { TileID.MagicalIceBlock };
            TileObjectData.newTile.StyleHorizontal       = true;
            TileObjectData.newTile.LavaDeath             = false;
            TileObjectData.newTile.AnchorBottom          = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0);
            TileObjectData.addTile(Type);
        }
Esempio n. 24
0
        private void Init()
        {
            if (IsFolder)
            {
                IsTracerXPath =
                    FullPath.EndsWith("\\TracerX\\ViewerLogs", StringComparison.OrdinalIgnoreCase) ||
                    FullPath.EndsWith("\\TracerX\\ServiceLogs", StringComparison.OrdinalIgnoreCase);
            }
            else
            {
                IsTracerXPath =
                    ContainerName.EndsWith("\\TracerX\\ViewerLogs", StringComparison.OrdinalIgnoreCase) ||
                    ContainerName.EndsWith("\\TracerX\\ServiceLogs", StringComparison.OrdinalIgnoreCase);

                // This is an archive file if the file name ends in "_num" where num is
                // one or more numeric chars and at least one of them is non-zero.
                // Start at the end of the name search backwards for '_' or the first non-number.

                bool foundNonZero = false;

                for (int i = ItemName.Length - 1; i > 0; --i)
                {
                    char c = ItemName[i];

                    if (c == '_')
                    {
                        IsArchive = foundNonZero;
                        break;
                    }
                    else if (c < '0' || c > '9')
                    {
                        // We found a non-numeric char before finding '_' so this
                        // can't be an archive file.  Leave IsArchive == false;
                        break;
                    }
                    else if (c != '0')
                    {
                        foundNonZero = true;
                    }
                }
            }
        }
Esempio n. 25
0
        public List <ElmahError> GetElmahError(DateTime start, DateTime end)
        {
            if (StorageAccount == null)
            {
                StorageAccount = CloudStorageAccount.Parse(ConnectionString);
            }
            List <string>        nonCriticalErrorDictionary = new JavaScriptSerializer().Deserialize <List <string> >(Load(StorageAccount, "Configuration.ElmahNonCriticalErrors.json", ContainerName));
            TableErrorLog        log      = new TableErrorLog(string.Format(ElmahAccountCredentials));
            List <ErrorLogEntry> entities = new List <ErrorLogEntry>();

            int lasthours = DateTime.Now.Subtract(start).Hours + 1;

            log.GetErrors(0, 500 * lasthours, entities); //retrieve n * LastNHours errors assuming a max of 500 errors per hour.
            List <ElmahError> listOfErrors = new List <ElmahError>();

            //Get the error from Last N hours.
            if (entities.Any(entity => entity.Error.Time.ToUniversalTime() > start.ToUniversalTime() && entity.Error.Time.ToUniversalTime() < end.ToUniversalTime()))
            {
                entities = entities.Where(entity => entity.Error.Time.ToUniversalTime() > start.ToUniversalTime() && entity.Error.Time.ToUniversalTime() < end.ToUniversalTime()).ToList();
                var elmahGroups = entities.GroupBy(item => item.Error.Message);

                //Group the error based on exception and send alerts if critical errors exceed the thresold values.
                foreach (IGrouping <string, ErrorLogEntry> errorGroups in elmahGroups)
                {
                    Console.WriteLine(errorGroups.Key.ToString() + "  " + errorGroups.Count());
                    int severity = 0;
                    if (nonCriticalErrorDictionary.Any(item => errorGroups.Key.ToString().Contains(item)))
                    {
                        severity = 1; //sev 1 is low pri and sev 0 is high pri.
                    }
                    string link = "https://www.nuget.org/Admin/Errors.axd/detail?id={0}";
                    if (ContainerName.Contains("qa"))
                    {
                        link = "https://int.nugettest.org/Admin/Errors.axd/detail?id={0}";
                    }
                    //for severity, assume all refresh error, severity = 0
                    listOfErrors.Add(new ElmahError(errorGroups.Key.ToString(), errorGroups.Count(), errorGroups.Min(item => item.Error.Time.ToLocalTime()), errorGroups.Max(item => item.Error.Time.ToLocalTime()), string.Format(link, errorGroups.First().Id), errorGroups.First().Error.Detail, severity));
                }
            }

            return(listOfErrors);
        }
Esempio n. 26
0
        public void GivenValidUploadOption_WhenBuild_ShouldSucceed()
        {
            var tempZipFile = Path.Combine(Path.GetTempPath(), "zipFile1.mlPackage");

            File.WriteAllText(tempZipFile, "hello");

            try
            {
                var args = new string[]
                {
                    "upload",
                    $"PackageFile={tempZipFile}",
                    "modelName=ml-model-temp",
                    "VersionId=v10-0-0-1",
                    "Store:ContainerName=containerName",
                    "Store:AccountName=accountName",
                    "Store:AccountKey=dummyKey",
                };

                IOption option = new OptionBuilder()
                                 .SetArgs(args)
                                 .Build();

                option.Upload.Should().BeTrue();
                option.PackageFile.Should().Be(tempZipFile);
                option.ModelName.Should().Be("ml-model-temp");
                option.VersionId.Should().Be("v10-0-0-1");

                option.Store.Should().NotBeNull();
                option.Store !.ContainerName.Should().Be("containerName");
                option.Store !.AccountName.Should().Be("accountName");
                option.Store !.AccountKey.Should().Be("dummyKey");
            }
            finally
            {
                File.Delete(tempZipFile);
            }
        }
Esempio n. 27
0
        /// <summary>
        /// Returns true if OrgApacheJackrabbitOakSegmentAzureAzureSegmentStoreServiceProperties instances are equal
        /// </summary>
        /// <param name="other">Instance of OrgApacheJackrabbitOakSegmentAzureAzureSegmentStoreServiceProperties to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(OrgApacheJackrabbitOakSegmentAzureAzureSegmentStoreServiceProperties other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     AccountName == other.AccountName ||
                     AccountName != null &&
                     AccountName.Equals(other.AccountName)
                     ) &&
                 (
                     ContainerName == other.ContainerName ||
                     ContainerName != null &&
                     ContainerName.Equals(other.ContainerName)
                 ) &&
                 (
                     AccessKey == other.AccessKey ||
                     AccessKey != null &&
                     AccessKey.Equals(other.AccessKey)
                 ) &&
                 (
                     RootPath == other.RootPath ||
                     RootPath != null &&
                     RootPath.Equals(other.RootPath)
                 ) &&
                 (
                     ConnectionURL == other.ConnectionURL ||
                     ConnectionURL != null &&
                     ConnectionURL.Equals(other.ConnectionURL)
                 ));
        }
Esempio n. 28
0
        /// <summary>
        /// Returns true if BlobStorageInfo instances are equal
        /// </summary>
        /// <param name="other">Instance of BlobStorageInfo to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(BlobStorageInfo other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     BlobName == other.BlobName ||
                     BlobName != null &&
                     BlobName.Equals(other.BlobName)
                     ) &&
                 (
                     ContainerName == other.ContainerName ||
                     ContainerName != null &&
                     ContainerName.Equals(other.ContainerName)
                 ) &&
                 (
                     CorrelationId == other.CorrelationId ||
                     CorrelationId != null &&
                     CorrelationId.Equals(other.CorrelationId)
                 ) &&
                 (
                     HostName == other.HostName ||
                     HostName != null &&
                     HostName.Equals(other.HostName)
                 ) &&
                 (
                     SasToken == other.SasToken ||
                     SasToken != null &&
                     SasToken.Equals(other.SasToken)
                 ));
        }
Esempio n. 29
0
        public override void SetDefaults()
        {
            TileIO.Tiles.unloadedTypes.Add(Type);

            //common
            Main.tileFrameImportant[Type]        = true;
            TileID.Sets.DisableSmartCursor[Type] = true;

            Main.tileSolid[Type]    = false;
            Main.tileNoAttach[Type] = true;

            TileID.Sets.BasicChest[Type] = true;

            TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2);             // Disables hammering
            TileObjectData.addTile(Type);

            Main.tileSpelunker[Type]         = true;
            Main.tileContainer[Type]         = true;
            Main.tileShine2[Type]            = true;
            Main.tileShine[Type]             = 1200;
            Main.tileOreFinderPriority[Type] = 500;

            //TileID.Sets.HasOutlines[Type] = isChest;

            AdjTiles = new int[] { TileID.Containers };

            ContainerName.SetDefault("UnloadedChest");

            ModTranslation name = CreateMapEntryName();

            name.SetDefault("Unloaded Chest");
            AddMapEntry(new Color(200, 200, 200), name, MapChestName);

            name = CreateMapEntryName(Name + "_Locked");
            name.SetDefault("Locked Unloaded Chest");
            AddMapEntry(new Color(0, 141, 63), name, MapChestName);
        }
        protected bool OnCheck()
        {
            var ifViewBoundStatement = Ctx._if("_view.IsBound");

            ifViewBoundStatement.FalseStatements._("return false");

            var ifViewModelIsEmpty = ifViewBoundStatement.TrueStatements._if("_viewModel == null");

            ifViewModelIsEmpty.TrueStatements._("_viewModel = _view.ViewModelObject as {0}", ContainerName.AsViewModel());

            Ctx._("return _viewModel.{0}", Ctx.Data.Name);
            return(true);
        }