コード例 #1
0
        /// <summary>
        /// Synchronizes the specified system's details with the configured <c>Snipe.It</c>
        /// system.
        /// </summary>
        private void SyncHostNameDetails(string hostName)
        {
            // Single Device.
            SnipeItApi snipe =
                SnipeApiExtensions.CreateClient(
                    snipeApiUrl,
                    snipeApiToken);

            if (!String.IsNullOrWhiteSpace(hostName))
            {
                Log.Information($"Retrieving asset details for {hostName}");
                try
                {
                    var asset      = AssetDescriptor.Create(hostName);
                    var components = ComponentDescriptor.Create(hostName);
                    try
                    {
                        Log.Information($"Synchronizing asset details for {hostName}");
                        // The current version of the SnipeSharp API has mapping issues causing the response not de serializing.
                        snipe.SyncAssetWithCompoments(asset, components);
                    }
                    catch (Exception ex)
                    {
                        Log.Error($"Failed to sync asset details for {hostName}");
                        Log.Error(ex.ToString());
                    }
                }
                catch (Exception ex)
                {
                    Log.Error($"Failed to retrieve asset details for {hostName}");
                    Log.Error(ex.ToString());
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Synchronizes the specified system's details with the configured <c>Snipe.It</c>
        /// system.
        /// </summary>
        private void SyncHostNameDetails(string hostName)
        {
            // Single Device.
            SnipeItApi snipe =
                SnipeApiExtensions.CreateClient(
                    ConfigurationManager.AppSettings["Snipe:ApiAddress"],
                    ConfigurationManager.AppSettings["Snipe:ApiToken"]);

            if (!String.IsNullOrWhiteSpace(hostName))
            {
                Console.WriteLine($"Retrieving asset details for {hostName}");
                try
                {
                    var asset      = AssetDescriptor.Create(hostName);
                    var components = ComponentDescriptor.Create(hostName);
                    try
                    {
                        Console.WriteLine($"Synchronizing asset details for {hostName}");
                        // The current version of the SnipeSharp API has mapping issues causing the response not de serializing.
                        snipe.SyncAssetWithCompoments(asset, components);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine($"Failed to sync asset details for {hostName}");
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine($"Failed to retrieve asset details for {hostName}");
                }
            }
        }
コード例 #3
0
ファイル: SpriteLoader.cs プロジェクト: plavip/UnityAM
        public override List <AssetDescriptor> GetDependencies(AssetManager manager, string path, FileInfo fileHandle, SpriteParameters param)
        {
            meshType      = DefaultMeshType;
            borders       = DefaultBorders;
            extrude       = DefaultExtrude;
            pixelsPerUnit = DefaultPixelsPerUnit;
            pivot         = DefaultPivot;

            textureParams = null;

            if (param != null)
            {
                textureParams            = new Texture2DParameters();
                textureParams.filterMode = param.filterMode;
                textureParams.wrapMode   = param.wrapMode;

                meshType = param.meshType;
                borders  = param.borders;
                extrude  = param.extrude;
                pivot    = param.pivot;

                if (param.pixelsPerUnit > 0)
                {
                    pixelsPerUnit = param.pixelsPerUnit;
                }
            }

            return(new List <AssetDescriptor>()
            {
                AssetDescriptor.Create <Texture2D>(path, textureParams)
            });
        }