Exemplo n.º 1
0
    private IEnumerator Upload2()
    {
        /*
         * urn = "urn:adsk.objects:os.object:" + bucketName + "/" + fileName;
         * byte[] bytesToEncode = Encoding.UTF8.GetBytes(urn);
         * string URN = Convert.ToBase64String(bytesToEncode);
         */
        Debug.Log(URN);



        Project1 writePlayer = new Project1()
        {
            input = new Meta()
            {
                urn = URN,
            },

            output = new Output()
            {
                formats = new List <Formats>
                {
                    new Formats()
                    {
                        type  = "arkit",
                        scene = "crgscene"
                    }
                }
            }
        };
        string jsonString = JsonUtility.ToJson(writePlayer);

        Debug.Log(jsonString);


        using (UnityWebRequest www = UnityWebRequest.Put("https://developer-api-beta.autodesk.io/modelderivative/v2/arkit/job", jsonString))
        {
            www.method = UnityWebRequest.kHttpVerbPOST;
            www.SetRequestHeader("Authorization", "Bearer " + acctoken);
            www.SetRequestHeader("Content-Type", "application/json");

            yield return(www.SendWebRequest());

            if (www.isNetworkError || www.isHttpError)
            {
                Debug.Log(www.error);
                Debug.Log(www.responseCode);
                Debug.Log(www.downloadHandler.text);
            }
            else
            {
                Debug.Log("complete 2");
                // Debug.Log(www.responseCode);
                //Debug.Log(www.downloadHandler.text);
                click3();
            }
        }
    }
Exemplo n.º 2
0
        public static object GetProjectInstance(string projectName)
        {
            switch (projectName)
            {
            case "Project 1": return(Project1.GetInstance());

            case "Project 2": return(Project2.GetInstance());

            default: throw new Exception();
            }
        }
Exemplo n.º 3
0
        private void EmitContentFiles(string outDir)
        {
            if (string.IsNullOrEmpty(_cSharpProject.FilePath))
            {
                return;
            }
            var p            = Project1.Load(_cSharpProject.FilePath);
            var contentFiles = (from i in p.Items
                                where i.BuildAction == BuildActions.Content
                                select PathUtil.MakeWinPath(i.Name, PathUtil.SeparatorProcessing.Append)).ToArray();

            if (!contentFiles.Any())
            {
                return;
            }
            var attr   = CompiledAssembly.GetCustomAttribute <ResourcesDirectoryAttribute>();
            var srcDir = PathUtil.MakeWinPath(attr == null ? null : attr.Source, PathUtil.SeparatorProcessing.Append,
                                              PathUtil.SeparatorProcessing.Append).ToLower();
            var dstDir = PathUtil.MakeWinPath(attr == null ? null : attr.Destination,
                                              PathUtil.SeparatorProcessing.Append, PathUtil.SeparatorProcessing.Append);
            // ReSharper disable once PossibleNullReferenceException
            var projectDir = new FileInfo(_cSharpProject.FilePath).Directory.FullName;

            foreach (var fileName in contentFiles)
            {
                if (!fileName.ToLower().StartsWith(srcDir))
                {
                    continue;
                }
                var relDestFilename = dstDir + fileName.Substring(srcDir.Length);
                var dstFile         = Path.Combine(outDir, relDestFilename.Substring(1));
                var srcFile         = Path.Combine(projectDir, fileName.Substring(1));
                Console.WriteLine("copy {0} to {1}", fileName, relDestFilename);
                // ReSharper disable once PossibleNullReferenceException
                new FileInfo(dstFile).Directory.Create();
                File.Copy(srcFile, dstFile, true);
            }
        }