Example #1
0
        private static LoadBase CallLoadWithContent(LoadOptions opt)
        {
            var filename    = opt.FileName;
            var fileContent = opt.FileContent;

            string pathFileName = Path.GetFileName(filename);
            string tmpFile      = Path.GetTempPath() + pathFileName;

            opt.FileName             = tmpFile;
            opt.ImageWriteToFileName = null;

            try
            {
                File.WriteAllBytes(tmpFile, fileContent);

                LoadBase load = LoadBase.Create(opt);

                if (load == null)
                {
                    return(null);
                }

                load.Load();
                return(load);
            }
            finally
            {
                File.Delete(tmpFile);
            }
        }
Example #2
0
    IEnumerator request()
    {
        if (currentLoaderTask.type == LoadType.Get || currentLoaderTask.type == LoadType.LocalOther)
        {
            targetLoad = new HttpLoad(currentLoaderTask.url, false);
        }
        else if (currentLoaderTask.type == LoadType.LocalAB)
        {
            targetLoad = new BundleLoadAsync(currentLoaderTask.url);
        }
        else if (currentLoaderTask.type == LoadType.StreamAssets)
        {
            targetLoad = new HttpLoad(currentLoaderTask.url, "");
        }
        else if (currentLoaderTask.type == LoadType.Post)
        {
            targetLoad = new HttpLoad(currentLoaderTask.url, currentLoaderTask.wform);
        }
        else if (currentLoaderTask.type == LoadType.PostWithHeader)
        {
            targetLoad = new HttpLoad(currentLoaderTask.url, currentLoaderTask.postdata, currentLoaderTask.header);
        }
        //HgqTest.AddUrlDown(currentLoaderTask.url);
        yield return(targetLoad.Load().coroutine);

        //HgqTest.EndUrlDown(currentLoaderTask.url);

        reponseData = new ResponseData(targetLoad);
        currentLoaderTask.SetResponseData(reponseData);
        idleCallback(this);
        //targetLoad.Dispose();

        state = State.Idle;
    }
Example #3
0
        private void LoadLocal(LoadOptions loadInfo)
        {
            try
            {
                LoadBase load = LoadBase.Create(loadInfo);

                load.LoadOptions = loadInfo;
                load.Load();
                Commands.Clear();
                Commands.AddRange(load.Commands);
                if (!string.IsNullOrEmpty(loadInfo.GCodeWriteToFileName))
                {
                    string gcodeFileName = Environment.ExpandEnvironmentVariables(loadInfo.GCodeWriteToFileName);
                    using (var sw = File.CreateText(gcodeFileName))
                    {
                        load.WriteGCodeFile(sw);
                    }

                    using (var sw = File.CreateText(Path.GetDirectoryName(gcodeFileName) + @"\" + Path.GetFileNameWithoutExtension(gcodeFileName) + @".cb"))
                    {
                        load.WriteCamBamFile(sw);
                    }

                    using (var sw = File.CreateText(Path.GetDirectoryName(gcodeFileName) + @"\" + Path.GetFileNameWithoutExtension(gcodeFileName) + @".hpgl"))
                    {
                        load.WriteImportInfoFile(sw);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #4
0
    IEnumerator request()
    {
        if (currentLoaderTask.type == LoadType.Get ||
            currentLoaderTask.type == LoadType.LocalOther)
        {
            targetLoad = new HttpLoad(currentLoaderTask.url);
        }
        else if (currentLoaderTask.type == LoadType.LocalAB)
        {
            targetLoad = new BundleLoadAsync(currentLoaderTask.url);
        }
        else if (currentLoaderTask.type == LoadType.Post)
        {
            targetLoad = new HttpLoad(currentLoaderTask.url, currentLoaderTask.wform);
        }
        else if (currentLoaderTask.type == LoadType.PostWithHeader)
        {
            targetLoad = new HttpLoad(currentLoaderTask.url, currentLoaderTask.postdata, currentLoaderTask.header);
        }
        yield return(targetLoad.Load().coroutine);

        reponseData = new ResponseData(targetLoad);


        currentLoaderTask.SetResponseData(reponseData);
        idleCallback(this);

        state = State.Idle;
    }
Example #5
0
        public static LoadBase CallLoad(string filename, byte[] filecontent, LoadOptions opt)
        {
            string pathfilename = Path.GetFileName(filename);
            string tmpfile      = Path.GetTempPath() + pathfilename;

            opt.FileName             = tmpfile;
            opt.ImageWriteToFileName = null;

            try
            {
                File.WriteAllBytes(tmpfile, filecontent);

                LoadBase load = LoadBase.Create(opt);

                if (load == null)
                {
                    return(null);
                }

                load.Load();
                return(load);
            }
            finally
            {
                File.Delete(tmpfile);
            }
        }
Example #6
0
        private static LoadBase CallLoadWithFileName(LoadOptions opt)
        {
            LoadBase load = LoadBase.Create(opt);

            if (load == null)
            {
                return(null);
            }

            load.Load();
            return(load);
        }