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); } }
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; }
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; } }
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; }
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); } }
private static LoadBase CallLoadWithFileName(LoadOptions opt) { LoadBase load = LoadBase.Create(opt); if (load == null) { return(null); } load.Load(); return(load); }