System.IO.Path.GetTempPath()

Here are the examples of the csharp api System.IO.Path.GetTempPath() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1972 Examples 7

19 Source : UpdateWindow.axaml.cs
with GNU Affero General Public License v3.0
from arklumpus

private void InitializeComponent()
        {
            AvaloniaXamlLoader.Load(this);
            this.FindControl<Grid>("HeaderGrid").Children.Add(new DPIAwareBox(Icons.GetIcon32("TreeViewer.replacedets.Updates")) { Width = 32, Height = 32 });
            this.FindControl<Button>("CancelButton").Click += (s, e) =>
            {
                this.Close();
            };

            this.FindControl<Button>("DownloadButton").Click += (s, e) =>
            {
                System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo()
                {
                    FileName = DownloadUrl,
                    UseShellExecute = true
                });
                this.Close();
            };

            this.FindControl<Button>("UpdateButton").Click += async (s, e) =>
            {
                string remoteDownloadFile = null;
                string localDownloadFile = null;

                if (Modules.IsWindows)
                {
                    remoteDownloadFile = "https://github.com/arklumpus/TreeViewer/releases/latest/download/TreeViewer-Win-x64.msi";
                    localDownloadFile = Path.Combine(Path.GetTempPath(), "TreeViewer-Win-x64.msi");
                }
                else if (Modules.IsMac)
                {
                    remoteDownloadFile = "https://github.com/arklumpus/TreeViewer/releases/latest/download/TreeViewer-Mac-x64.pkg";
                    localDownloadFile = Path.Combine(Path.GetTempPath(), "TreeViewer-Mac-x64.pkg");
                }

                ProgressWindow win = new ProgressWindow() { IsIndeterminate = false, Progress = 0, ProgressText = "Downloading update...", LabelText = Path.GetFileName(remoteDownloadFile) };
                _ = win.ShowDialog2(this);

                SemapreplacedSlim semapreplaced = new SemapreplacedSlim(0, 1);
                WebClient client = new WebClient();

                double lastProgress = 0;

                client.DownloadProgressChanged += async (s, e) =>
                {
                    await Avalonia.Threading.Dispatcher.UIThread.InvokeAsync(() =>
                    {
                        double progress = (double)e.BytesReceived / e.TotalBytesToReceive;

                        if (progress > lastProgress + 0.005)
                        {
                            win.Progress = progress;
                            lastProgress = progress;
                        }
                    });
                };

                client.DownloadFileCompleted += (s, e) =>
                {
                    semapreplaced.Release();
                };


                client.DownloadFileAsync(new System.Uri(remoteDownloadFile), localDownloadFile);

                await semapreplaced.WaitAsync();
                semapreplaced.Release();
                semapreplaced.Dispose();
                client.Dispose();

                win.Close();

                System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo()
                {
                    FileName = localDownloadFile,
                    UseShellExecute = true
                });

                System.Diagnostics.Process.GetCurrentProcess().Kill();
            };
        }

19 Source : ModuleRepositoryWindow.axaml.cs
with GNU Affero General Public License v3.0
from arklumpus

private async Task SelectModule(string moduleId, string moduleVersion)
        {
            Uri moduleFile = new Uri(ModuleRepositoryBaseUri, moduleId + "/" + moduleId + ".v" + moduleVersion + ".json.zip");

            ModuleMetadata module;

            using (WebClient client = new WebClient())
            {
                string tempFile = Path.GetTempFileName();
                await client.DownloadFileTaskAsync(moduleFile, tempFile);

                string tempDir = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());

                ZipFile.ExtractToDirectory(tempFile, tempDir);

                File.Delete(tempFile);

                using (FileStream fs = new FileStream(Path.Combine(tempDir, "Module.json"), FileMode.Open))
                {
                    module = await System.Text.Json.JsonSerializer.DeserializeAsync<ModuleMetadata>(fs, Modules.DefaultSerializationOptions);
                }

                File.Delete(tempFile);
                Directory.Delete(tempDir, true);
            }

            await Dispatcher.UIThread.InvokeAsync(() =>
            {
                int tabInd = (int)module.ModuleType;
                selectedModules[tabInd] = moduleId;
                nameContainers[tabInd].Text = module.Name;
                idContainers[tabInd].Text = module.Id;
                authorContainers[tabInd].Text = module.Author;
                versionContainers[tabInd].Text = "Version " + module.Version.ToString();
                bool isVerified = module.VerifySignature();
                verifiedIcons[tabInd].Children.Clear();

                if (isVerified)
                {
                    verifiedIcons[tabInd].Children.Add(new Avalonia.Controls.Shapes.Path() { Data = Icons.TickGeometry, Stroke = new SolidColorBrush(Color.FromRgb(0, 158, 115)), Margin = new Thickness(3), StrokeThickness = 2 });
                    AvaloniaBugFixes.SetToolTip(verifiedIcons[tabInd], "Code signature verified!");
                }
                else
                {
                    verifiedIcons[tabInd].Children.Add(new Avalonia.Controls.Shapes.Path() { Data = Icons.CrossGeometry, Stroke = new SolidColorBrush(Color.FromRgb(213, 94, 0)), Margin = new Thickness(3), StrokeThickness = 2 });
                    AvaloniaBugFixes.SetToolTip(verifiedIcons[tabInd], "Code signature not verified!");
                }
                helpContainers[tabInd].Text = module.HelpText;
                sourceContainers[tabInd].Text = module.SourceCode;

                noModuleGrids[tabInd].IsVisible = false;

                foreach (KeyValuePair<string, (ModuleTypes, Button)> kvp in ModuleButtons)
                {
                    if (kvp.Value.Item1 == module.ModuleType)
                    {
                        if (kvp.Key == module.Id)
                        {
                            kvp.Value.Item2.Background = new SolidColorBrush(Color.FromRgb(255, 255, 255));
                            ((Border)kvp.Value.Item2.Content).BorderBrush = new SolidColorBrush(Color.FromRgb(114, 114, 114));
                        }
                        else
                        {
                            kvp.Value.Item2.Background = Brushes.Transparent;
                            ((Border)kvp.Value.Item2.Content).BorderBrush = Brushes.Transparent;
                        }
                    }
                }
            });
        }

19 Source : ModuleRepositoryWindow.axaml.cs
with GNU Affero General Public License v3.0
from arklumpus

private async void LoadClicked()
        {
            int tabInd = bar.SelectedIndex;
            if (string.IsNullOrEmpty(selectedModules[tabInd]))
            {
                await new MessageBox("Attention!", "No module has been selected!").ShowDialog2(this);
                return;
            }

            string moduleId = selectedModules[tabInd];


            Uri moduleFile = new Uri(ModuleRepositoryBaseUri, moduleId + "/" + moduleId + ".v" + repositoryModuleHeaders[moduleId].Version.ToString() + ".json.zip");

            string tempFile = Path.GetTempFileName();

            ProgressWindow progressWindow = new ProgressWindow() { ProgressText = "Downloading module file..." };
            _ = progressWindow.ShowDialog2(this);

            try
            {
                using (WebClient client = new WebClient())
                {
                    await client.DownloadFileTaskAsync(moduleFile, tempFile);
                }
                progressWindow.Close();
            }
            catch (Exception ex)
            {
                progressWindow.Close();
                await new MessageBox("Attention!", "An error occurred while downloading the module file!\n" + ex.Message).ShowDialog2(this);
                return;
            }

            string tempDir = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
            try
            {
                ZipFile.ExtractToDirectory(tempFile, tempDir);

                ModuleMetadata metaData;

                using (FileStream fs = new FileStream(Path.Combine(tempDir, "Module.json"), FileMode.Open))
                {
                    metaData = await System.Text.Json.JsonSerializer.DeserializeAsync<ModuleMetadata>(fs, Modules.DefaultSerializationOptions);
                }

                if (Modules.LoadedModulesMetadata.ContainsKey(metaData.Id))
                {
                    await new MessageBox("Attention", "A module with the same Id has already been loaded! If you wish to update the module, please Install the new version instead.").ShowDialog2(this);
                    return;
                }

                if (!metaData.VerifySignature())
                {
                    MessageBox box = new MessageBox("Attention", "The source code of the module could not be verified. Proceed only if you trust the source from which you obtained the module. Do you wish to proceed?", MessageBox.MessageBoxButtonTypes.YesNo);
                    await box.ShowDialog2(this);
                    if (box.Result != MessageBox.Results.Yes)
                    {
                        return;
                    }
                }

                Modules.LoadModule(metaData);

                managerWindowParent.BuildModuleButton(new KeyValuePair<string, ModuleMetadata>(metaData.Id, metaData));
                repositoryModuleHeaders.Remove(moduleId);
                ((IPanel)ModuleButtons[moduleId].Item2.Parent).Children.Remove(ModuleButtons[moduleId].Item2);
                ModuleButtons.Remove(moduleId);
                noModuleGrids[tabInd].IsVisible = true;

                foreach (KeyValuePair<string, ModuleHeader> module in repositoryModuleHeaders)
                {
                    if ((int)module.Value.ModuleType == tabInd)
                    {
                        progressWindow = new ProgressWindow() { ProgressText = "Downloading module file..." };
                        _ = progressWindow.ShowDialog2(this);

                        await SelectModule(module.Key, module.Value.Version.ToString());

                        progressWindow.Close();
                        break;
                    }
                }

                notifications = new NotificationType[headers.Length];

                foreach (ModuleHeader header in repositoryModuleHeaders.Values)
                {
                    bool newModule = !Modules.LoadedModulesMetadata.TryGetValue(header.Id, out ModuleMetadata loadedModuleMetadata);

                    if (newModule || loadedModuleMetadata.Version < header.Version)
                    {
                        if (newModule)
                        {
                            notifications[(int)header.ModuleType] |= NotificationType.NewModules;
                        }
                        else
                        {
                            notifications[(int)header.ModuleType] |= NotificationType.Updates;
                        }
                    }
                }

                for (int i = 0; i < headers.Length; i++)
                {
                    switch (notifications[i])
                    {
                        case NotificationType.None:
                            notificationEllipses[i].Clreplacedes.Remove("Updates");
                            notificationEllipses[i].Clreplacedes.Remove("NewModules");
                            break;
                        case NotificationType.Updates:
                            notificationEllipses[i].Clreplacedes.Add("Updates");
                            notificationEllipses[i].Clreplacedes.Remove("NewModules");
                            break;
                        case NotificationType.NewModules:
                            notificationEllipses[i].Clreplacedes.Remove("Updates");
                            notificationEllipses[i].Clreplacedes.Add("NewModules");
                            break;
                        case NotificationType.Both:
                            notificationEllipses[i].Clreplacedes.Add("Updates");
                            notificationEllipses[i].Clreplacedes.Add("NewModules");
                            break;
                    }
                }

                await new MessageBox("Success!", "Module loaded succesfully!", MessageBox.MessageBoxButtonTypes.OK, MessageBox.MessageBoxIconTypes.Tick).ShowDialog2(this);
            }
            catch (Exception ex)
            {
                await new MessageBox("Attention!", "An error occurred while loading the module!\n" + ex.Message).ShowDialog2(this);
            }
            finally
            {
                try
                {
                    File.Delete(tempFile);
                }
                catch { }

                try
                {
                    Directory.Delete(tempDir, true);
                }
                catch { }
            }
        }

19 Source : Program.cs
with GNU General Public License v3.0
from Artentus

private static void SetDirectories(OptionsBase options)
        {
            // Application directory
            var replacedembly = replacedembly.GetEntryreplacedembly();
            ApplicationDirectory = new DirectoryInfo(Path.GetDirectoryName(replacedembly!.Location)!);

            // Data directory
            if (string.IsNullOrWhiteSpace(options.AppDataPath))
            {
                ApplicationDataDirectory = GetApplicationDataDirectory();
                if (!ApplicationDataDirectory.Exists) ApplicationDataDirectory.Create();
            }
            else
            {
                try
                {
                    ApplicationDataDirectory = new DirectoryInfo(options.AppDataPath);
                    if (!ApplicationDataDirectory.Exists) ApplicationDataDirectory.Create();
                }
                catch
                {
                    // We play it safe here and fall back to the default since at this point
                    // in the app lifetime we cannot properly handle this error except crashing
                    ApplicationDataDirectory = GetApplicationDataDirectory();
                    if (!ApplicationDataDirectory.Exists) ApplicationDataDirectory.Create();
                }
            }

            // Temporary directory
            TemporaryDirectory = new DirectoryInfo(Path.Combine(Path.GetTempPath(), "ModMyFactoryGUI"));
            if (!TemporaryDirectory.Exists) TemporaryDirectory.Create();
        }

19 Source : SqlAnalysis.cs
with MIT License
from ashleyglee

public void RunreplacedysisAgainstDatabase(string Server, string Database, string OutFile)
        {
            string extractedPackagePath = System.IO.Path.GetTempPath() + System.IO.Path.GetRandomFileName() + ".dacpac";

            DacServices services = new DacServices("Server=" + Server + ";Integrated Security=true;");
            services.Extract(extractedPackagePath, Database, "AppName", new Version(1, 0));

            RunDacpacreplacedysis(extractedPackagePath, OutFile);
        }

19 Source : UnixFilePal.cs
with MIT License
from asmichi

private static string MakeSocketPathPrefix()
        {
            var candidate = NamedPipeUtil.MakePipePathPrefix(Path.GetTempPath(), (uint)LibChildProcess.GetPid());
            const int maxBodyLength = 11;
            if ((nuint)candidate.Length + maxBodyLength > LibChildProcess.GetMaxSocketPathLength())
            {
                throw new PathTooLongException("Path to the temporary directory is too long to accomodate a socket file.");
            }

            return candidate;
        }

19 Source : TempDirectory.cs
with Apache License 2.0
from aspnet

private static TempDirectory Create()
        {
            var directoryPath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString("n"));
            Directory.CreateDirectory(directoryPath);
            return new TempDirectory(directoryPath);
        }

19 Source : AMLUtils.cs
with MIT License
from AstroTechies

public static bool IsCurrentFileSystemProbablyCaseSensitive()
        {
            var tmp = Path.GetTempPath();
            return Directory.Exists(tmp) && (!Directory.Exists(tmp.ToUpper()) || !Directory.Exists(tmp.ToLower()));
        }

19 Source : Form1.cs
with MIT License
from AstroTechies

public bool DownloadVersionSync(Mod thisMod, Version newVersion)
        {
            try
            {
                if (!ModManager.GlobalIndexFile.ContainsKey(thisMod.CurrentModData.ModID)) throw new IndexFileException("Can't find index file entry for mod: " + thisMod.CurrentModData.ModID);
                Dictionary<Version, IndexVersionData> allVerData = ModManager.GlobalIndexFile[thisMod.CurrentModData.ModID].AllVersions;
                if (!allVerData.ContainsKey(newVersion)) throw new IndexFileException("Failed to find the requested version in the mod's index file: " + thisMod.CurrentModData.ModID + " v" + newVersion);

                using (var wb = new WebClient())
                {
                    wb.Headers[HttpRequestHeader.UserAgent] = AMLUtils.UserAgent;

                    string kosherFileName = AMLUtils.SanitizeFilename(allVerData[newVersion].Filename);

                    string tempDownloadFolder = Path.Combine(Path.GetTempPath(), "AstroModLoader", "Downloads");
                    Directory.CreateDirectory(tempDownloadFolder);
                    wb.DownloadFile(allVerData[newVersion].URL, Path.Combine(tempDownloadFolder, kosherFileName));
                    InstallModFromPath(Path.Combine(tempDownloadFolder, kosherFileName), out _, out int numMalformatted, out _);
                    if (numMalformatted > 0) throw new FormatException(numMalformatted + " mods were malformatted");
                    ModManager.SortVersions();
                    ModManager.SortMods();
                    Directory.Delete(tempDownloadFolder, true);
                }
            }
            catch (Exception ex)
            {
                if (ex is WebException || ex is IOException || ex is IndexFileException)
                {
                    Debug.WriteLine(ex.ToString());
                    return false;
                }
                throw;
            }
            return true;
        }

19 Source : Form1.cs
with MIT License
from AstroTechies

private List<Mod> InstallModFromPath(string newInstallingMod, out int numClientOnly, out int numMalformatted, out int numNewProfiles)
        {
            numClientOnly = 0;
            numMalformatted = 0;
            numNewProfiles = 0;
            string ext = Path.GetExtension(newInstallingMod);
            if (!AllowedModExtensions.Contains(ext)) return null;

            List<string> newPaths = new List<string>();

            if (ext == ".zip") // If the mod we are trying to install is a zip, we go through and copy each pak file inside that zip
            {
                string targetFolderPath = Path.Combine(Path.GetTempPath(), "AstroModLoader", Path.GetFileNameWithoutExtension(newInstallingMod)); // Extract the zip file to the temporary data folder
                ZipFile.ExtractToDirectory(newInstallingMod, targetFolderPath);

                string[] allAccessiblePaks = Directory.GetFiles(targetFolderPath, "*.pak", SearchOption.AllDirectories); // Get all pak files that exist in the zip file
                foreach (string zippedPakPath in allAccessiblePaks)
                {
                    string newPath = AddModFromPakPath(zippedPakPath, out bool wasMalformatted);
                    if (wasMalformatted) numMalformatted++;
                    if (newPath != null) newPaths.Add(newPath);
                }

                // Any .json files included will be treated as mod profiles to add to our current list
                string[] allAccessibleJsonFiles = Directory.GetFiles(targetFolderPath, "*.json", SearchOption.AllDirectories);
                foreach (string jsonFilePath in allAccessibleJsonFiles)
                {
                    ModProfile parsingProfile = null;
                    try
                    {
                        parsingProfile = JsonConvert.DeserializeObject<ModProfile>(File.ReadAllText(jsonFilePath));
                    }
                    catch
                    {
                        continue;
                    }

                    parsingProfile.Name = string.IsNullOrWhiteSpace(parsingProfile.Name) ? "Unknown" : parsingProfile.Name;
                    while (ModManager.ProfileList.ContainsKey(parsingProfile.Name)) parsingProfile.Name = parsingProfile.Name + "*";

                    List<KeyValuePair<string, Mod>> plannedOrdering = new List<KeyValuePair<string, Mod>>();
                    foreach (KeyValuePair<string, Mod> entry in parsingProfile.ProfileData)
                    {
                        plannedOrdering.Add(entry);
                    }
                    plannedOrdering = new List<KeyValuePair<string, Mod>>(plannedOrdering.OrderBy(o => o.Value.Priority).ToList());

                    ModProfile currentProf = ModManager.GenerateProfile();
                    List<KeyValuePair<string, Mod>> plannedOrderingCurrent = new List<KeyValuePair<string, Mod>>();
                    string[] parsingProfileAllIDs = parsingProfile.ProfileData.Keys.ToArray();
                    foreach (KeyValuePair<string, Mod> entry in currentProf.ProfileData)
                    {
                        if (parsingProfileAllIDs.Contains(entry.Key)) continue;
                        entry.Value.Enabled = false;
                        plannedOrderingCurrent.Add(entry);
                    }

                    plannedOrdering.AddRange(plannedOrderingCurrent.OrderBy(o => o.Value.Priority));

                    ModProfile creatingProfile = new ModProfile();
                    creatingProfile.ProfileData = new Dictionary<string, Mod>();
                    for (int i = 0; i < plannedOrdering.Count; i++)
                    {
                        plannedOrdering[i].Value.Priority = i + 1;
                        creatingProfile.ProfileData[plannedOrdering[i].Key] = plannedOrdering[i].Value;
                    }

                    if (ModManager.ProfileList == null) ModManager.ProfileList = new Dictionary<string, ModProfile>();
                    ModManager.ProfileList[parsingProfile.Name] = creatingProfile;
                    numNewProfiles++;
                }

                Directory.Delete(targetFolderPath, true); // Clean up the temporary data folder
            }
            else // Otherwise just copy the file itself
            {
                string newPath = AddModFromPakPath(newInstallingMod, out bool wasMalformatted);
                if (wasMalformatted) numMalformatted++;
                if (newPath != null) newPaths.Add(newPath);
            }

            List<Mod> outputs = new List<Mod>();

            foreach (string newPath in newPaths)
            {
                try
                {
                    if (!string.IsNullOrEmpty(newPath))
                    {
                        Mod nextMod = ModManager.SyncSingleModFromDisk(newPath, out bool wasClientOnly, false);
                        if (nextMod != null) outputs.Add(nextMod);
                        if (wasClientOnly)
                        {
                            numClientOnly++;
                            File.Delete(newPath);
                        }
                    }
                }
                catch (IOException) { }
            }
            
            return outputs;
        }

19 Source : ProfileSelector.cs
with MIT License
from AstroTechies

private void ForceExportProfile()
        {
            if (listBox1.SelectedValue == null || SelectedProfile == null)
            {
                this.ShowBasicButton("Please select a profile to export it as a .zip file.", "OK", null, null);
                return;
            }

            var dialog = new SaveFileDialog();
            dialog.Filter = "ZIP files (*.zip)|*.zip|All files (*.*)|*.*";
            dialog.replacedle = "Export a profile";
            dialog.RestoreDirectory = true;
            if (dialog.ShowDialog() == DialogResult.OK)
            {
                string targetFolderPath = Path.Combine(Path.GetTempPath(), "AstroModLoader", "export");
                Directory.CreateDirectory(targetFolderPath);

                ModProfile creatingProfile = new ModProfile();
                creatingProfile.ProfileData = new Dictionary<string, Mod>();
                creatingProfile.Name = listBox1.SelectedValue as string;
                creatingProfile.Info = "Exported by " + AMLUtils.UserAgent + " at " + DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.fffK");

                List<KeyValuePair<string, Mod>> plannedOrdering = new List<KeyValuePair<string, Mod>>();
                foreach (KeyValuePair<string, Mod> entry in SelectedProfile.ProfileData)
                {
                    if (entry.Value.Enabled) plannedOrdering.Add(entry);
                }
                plannedOrdering = new List<KeyValuePair<string, Mod>>(plannedOrdering.OrderBy(o => o.Value.Priority).ToList());

                for (int i = 0; i < plannedOrdering.Count; i++)
                {
                    plannedOrdering[i].Value.Priority = i + 1;
                    creatingProfile.ProfileData[plannedOrdering[i].Key] = plannedOrdering[i].Value;

                    // Copy mod pak to the zip as well
                    string onePathOnDisk = OurParentForm.ModManager.GetPathOnDisk(plannedOrdering[i].Value, plannedOrdering[i].Key);
                    if (!string.IsNullOrEmpty(onePathOnDisk)) File.Copy(onePathOnDisk, Path.Combine(targetFolderPath, Path.GetFileName(onePathOnDisk)));
                }

                File.WriteAllBytes(Path.Combine(targetFolderPath, "profile1.json"), Encoding.UTF8.GetBytes(AMLUtils.SerializeObject(creatingProfile)));

                ZipFile.CreateFromDirectory(targetFolderPath, dialog.FileName);
                Directory.Delete(targetFolderPath, true);

                RefreshBox();
                statusLabel.Text = "Successfully exported profile.";
            }
        }

19 Source : AutoTask.cs
with GNU General Public License v3.0
from AtomCrafty

protected override void Execute() {
			if(arguments.Length == 0) {
				Task task = new HelpTask();
				task.arguments = new string[0];
				task.flags = flags;
				task.Run();
			}
			else if(arguments[0].EndsWith(".patch.ykc")) {
				// patch mode
				Task task = null;
				for(int i = 1; i <= 5; i++) {
					if(Path.GetFileName(arguments[0]).Contains(".data0" + i + '.')) {
						if(File.Exists(Path.Combine(Path.GetDirectoryName(arguments[0]), "data0" + i + ".ykc"))) {
							flags.Set('v');
							task = new PatchTask(new[] { arguments[0], Path.Combine(Path.GetDirectoryName(arguments[0]), "data0" + i + ".ykc") }, flags);
						}
						else if(File.Exists(Helpers.AbsolutePath("data0" + i + ".ykc"))) {
							flags.Set('v');
							task = new PatchTask(new[] { arguments[0], Path.Combine(Directory.GetCurrentDirectory(), "data0" + i + ".ykc") }, flags);
						}
						break;
					}
				}
				if(task == null) {
					Fail("Unable to determine patch target");
				}
				else {
					task.Run();
				}
				Console.ReadLine();
			}
			else if(Path.GetExtension(arguments[0]) == '.' + Constants.ykg) {
				string path = Path.Combine(Path.GetTempPath(), Path.ChangeExtension(Path.GetFileName(arguments[0]), Constants.png));
				using(FileStream fs = new FileStream(Helpers.AbsolutePath(arguments[0]), FileMode.Open)) {
					YukaGraphics g = GraphicsFactory.Instance.FromBinary(fs);
					g.bitmap.Save(path);
					System.Diagnostics.Process.Start(path);
				}
			}
			else if(Directory.Exists(arguments[0])) {
				string patchLogPath = Path.Combine(Helpers.AbsolutePath(arguments[0]), "patch.ypl");
				if(File.Exists(patchLogPath)) {
					// TODO
				}
			}
			else if(Path.GetExtension(arguments[0]) == '.' + Constants.ypl) {
				flags.Set('v');
				flags.Set('w');
				new PatchTask(arguments, flags).Run();
			}
			else if(Path.GetExtension(arguments[0]) == '.' + Constants.ydr) {
				flags.Set('v');
				flags.Set('w');
				new DeployTask(arguments, flags).Run();
			}
			else {
				Fail("Unable to auto determine processing method");
			}
		}

19 Source : OutputWriterFactory.cs
with Microsoft Public License
from atrenton

internal OutputWriter CreateInstance()
        {
            OutputWriter writer = null;
            var ts = new TraceSwitch(DisplayName, Description)
            {
                Level = (TraceLevel)
                    Enum.Parse(typeof(TraceLevel), TraceSwitchLevel, true)
            };

            if (ts.Level != TraceLevel.Off)
            {
                switch (OutputWriterTypeName)
                {
                    case "LogOutputWriter":
                    case "logoutputwriter":
                        var logFileName = DisplayName + ".log";
                        var logFilePath =
                            Path.Combine(Path.GetTempPath(), logFileName);

                        var logFileStream =
                            new FileStream(logFilePath, FileMode.Append);

                        writer = new LogOutputWriter(logFileStream, ts);
                        break;

                    case "TraceOutputWriter":
                    case "traceoutputwriter":
                        writer = new TraceOutputWriter(ts);
                        break;

                    default:
                        writer = new DefaultOutputWriter();
                        break;
                }
            }
            return writer;
        }

19 Source : DMTModelWriterTest.cs
with MIT License
from Autodesk

[Test]
        public void WhenWritingDMTFile_ThenCheckOutput()
        {
            DMTModel importedModel = DMTModelReader.ReadFile(new File(TestFiles.NormalDmt));
            var outputFile = new File(string.Format("{0}\\output.dmt", Path.GetTempPath()));
            DMTModelWriter.WriteFile(importedModel, outputFile);
            DMTModel writtenModel = DMTModelReader.ReadFile(outputFile);

            // Ensure that model is written correctly
            replacedert.AreEqual(importedModel.BoundingBox.MaxX, writtenModel.BoundingBox.MaxX);
            replacedert.AreEqual(importedModel.BoundingBox.MaxY, writtenModel.BoundingBox.MaxY);
            replacedert.AreEqual(importedModel.BoundingBox.MaxZ, writtenModel.BoundingBox.MaxZ);
            replacedert.AreEqual(importedModel.BoundingBox.MinX, writtenModel.BoundingBox.MinX);
            replacedert.AreEqual(importedModel.BoundingBox.MinY, writtenModel.BoundingBox.MinY);
            replacedert.AreEqual(importedModel.BoundingBox.MinZ, writtenModel.BoundingBox.MinZ);

            outputFile.Delete();
        }

19 Source : MSRFile.Test.cs
with MIT License
from Autodesk

[Test]
        public void WriteFile()
        {
            Geometry.MSRFile msrFile =
                new Geometry.MSRFile(AppDomain.CurrentDomain.BaseDirectory +
                                     "\\..\\..\\TestFiles\\MSRTestFiles\\G330 Untransformed.msr",
                                     true);
            replacedert.AreEqual(81, msrFile.Points.Count);

            var fileToSave = new File(string.Format("{0}\\\\test.msr", System.IO.Path.GetTempPath()));
            msrFile.WriteFile(fileToSave.Path);

            Geometry.MSRFile fileSaved = new Geometry.MSRFile(fileToSave.Path, true);
            replacedert.AreEqual(81, fileSaved.Points.Count);

            fileToSave.Delete();
        }

19 Source : DMTModelWriterTest.cs
with MIT License
from Autodesk

[Test]
        public void WhenWritingSTLFileFromDMTFile_ThenCheckOutput()
        {
            DMTModel importedModel = DMTModelReader.ReadFile(new File(TestFiles.NormalDmt));
            var outputFile = new File(string.Format("{0}\\output.stl", Path.GetTempPath()));
            DMTModelWriter.WriteFile(importedModel, outputFile);
            DMTModel writtenModel = DMTModelReader.ReadFile(outputFile);

            // Ensure that model is written correctly
            replacedert.AreEqual(importedModel.BoundingBox.MaxX, writtenModel.BoundingBox.MaxX);
            replacedert.AreEqual(importedModel.BoundingBox.MaxY, writtenModel.BoundingBox.MaxY);
            replacedert.AreEqual(importedModel.BoundingBox.MaxZ, writtenModel.BoundingBox.MaxZ);
            replacedert.AreEqual(importedModel.BoundingBox.MinX, writtenModel.BoundingBox.MinX);
            replacedert.AreEqual(importedModel.BoundingBox.MinY, writtenModel.BoundingBox.MinY);
            replacedert.AreEqual(importedModel.BoundingBox.MinZ, writtenModel.BoundingBox.MinZ);

            outputFile.Delete();
        }

19 Source : DMTModelWriterTest.cs
with MIT License
from Autodesk

[Test]
        public void WhenWritingSTLFile_ThenCheckOutput()
        {
            DMTModel importedModel = DMTModelReader.ReadFile(new File(TestFiles.NormalStl));
            var outputFile = new File(string.Format("{0}\\output.stl", Path.GetTempPath()));
            DMTModelWriter.WriteFile(importedModel, outputFile);
            DMTModel writtenModel = DMTModelReader.ReadFile(outputFile);

            // Ensure that model is written correctly
            replacedert.AreEqual(importedModel.BoundingBox.MaxX, writtenModel.BoundingBox.MaxX);
            replacedert.AreEqual(importedModel.BoundingBox.MaxY, writtenModel.BoundingBox.MaxY);
            replacedert.AreEqual(importedModel.BoundingBox.MaxZ, writtenModel.BoundingBox.MaxZ);
            replacedert.AreEqual(importedModel.BoundingBox.MinX, writtenModel.BoundingBox.MinX);
            replacedert.AreEqual(importedModel.BoundingBox.MinY, writtenModel.BoundingBox.MinY);
            replacedert.AreEqual(importedModel.BoundingBox.MinZ, writtenModel.BoundingBox.MinZ);

            outputFile.Delete();
        }

19 Source : DatabaseEntitiesCollectionTest.cs
with MIT License
from Autodesk

[TearDown]
        public void MyTestCleanup()
        {
            try
            {
                if (TestContext.CurrentContext.Result.Outcome.Equals(ResultState.Failure))
                {
                    FileInfo[] files = new DirectoryInfo(Path.GetTempPath()).GetFiles("w_*.log");

                    //this section is what's really important for your application.
                    foreach (FileInfo file in files)
                    {
                        file.CopyTo(@"c:\temp\testfail\" + file.Name, true);
                    }
                }

                // Check that no dialogs need to be closed
                _powerSHAPE.Execute("CANCEL");

                // Switch FormUpdate and Dialogs back on
                _powerSHAPE.FormUpdateOn();
                _powerSHAPE.DialogsOn();

                // Close model
                _powerSHAPE.Models.Clear();
            }
            catch (Exception)
            {
            }
        }

19 Source : FileTest.cs
with MIT License
from Autodesk

[Test]
        public void CreateTemporaryFileTest()
        {
            string extension = ".tmp";
            File actual;
            actual = File.CreateTemporaryFile(extension);

            replacedert.IsFalse(System.IO.File.Exists(actual.Path), "File should not exist");
            actual.Create();

            replacedert.IsTrue(System.IO.File.Exists(actual.Path), "File should exist");
            string dir = Path.GetDirectoryName(actual.Path) + "\\";
            replacedert.AreEqual(Path.GetTempPath(), dir, "Temp Directory different");

            actual.Delete();
            replacedert.IsFalse(System.IO.File.Exists(actual.Path), "Temp File should not exist");
        }

19 Source : ApiClient.cs
with Apache License 2.0
from Autodesk-Forge

public /*object*/dynamic Deserialize (IRestResponse response, Type type, bool asType = false) {
#pragma warning disable CS0618 // Type or member is obsolete
			IList<Parameter> headers = response.Headers;
#pragma warning restore CS0618 // Type or member is obsolete
			if ( type == typeof (byte []) ) // return byte array
				return response.RawBytes;

			if ( type == typeof (Stream) ) {
				if ( headers != null ) {
					var filePath = String.IsNullOrEmpty (Configuration.TempFolderPath)
						? Path.GetTempPath ()
						: Configuration.TempFolderPath;
					var regex = new Regex (@"Content-Disposition=.*filename=['""]?([^'""\s]+)['""]?$");
					foreach ( var header in headers ) {
						var match = regex.Match (header.ToString ());
						if ( match.Success ) {
							string fileName = filePath + SanitizeFilename (match.Groups [1].Value.Replace ("\"", "").Replace ("'", ""));
							File.WriteAllBytes (fileName, response.RawBytes);
							return new FileStream (fileName, FileMode.Open);
						}
					}
				}
				var stream = new MemoryStream (response.RawBytes);
				return stream;
			}

			if ( type.Name.StartsWith ("System.Nullable`1[[System.DateTime") ) // return a datetime object
			{
				return DateTime.Parse (response.Content, null, System.Globalization.DateTimeStyles.RoundtripKind);
			}

			if ( type == typeof (String) || type.Name.StartsWith ("System.Nullable") ) // return primitive type
			{
				return ConvertType (response.Content, type);
			}

			// at this point, it must be a model (json)
			try {
				if ( asType )
					return JsonConvert.DeserializeObject (response.Content, type, serializerSettings);
				return new DynamicJsonResponse (JObject.Parse (response.Content));
			} catch ( Exception /*e*/) {
				//throw new ApiException(500, e.Message);
				return (new DynamicJsonResponse ());
			}
		}

19 Source : DatabaseEntityTest.cs
with MIT License
from Autodesk

[TearDown]
        public void MyTestCleanup()
        {
            try
            {
                if (TestContext.CurrentContext.Result.Outcome.Equals(ResultState.Failure))
                {
                    FileInfo[] files = new DirectoryInfo(Path.GetTempPath()).GetFiles("w_*.log");

                    //this section is what's really important for your application.
                    foreach (FileInfo file in files)
                    {
                        file.CopyTo(@"c:\temp\testfail\" + file.Name, true);
                    }
                }

                // Check that no dialogs need to be closed
                _powerSHAPE.Execute("CANCEL");

                // Switch FormUpdate and Dialogs back on
                _powerSHAPE.FormUpdateOn();
                _powerSHAPE.DialogsOn();

                // Close all models
                _powerSHAPE.Models.Clear();
            }
            catch (Exception)
            {
            }
        }

19 Source : Directory.cs
with MIT License
from Autodesk

public static Directory CreateTemporaryDirectory(bool createFolder = false)
        {
            Random rnd = new Random();
            Directory tempDirectory = new Directory(System.IO.Path.GetTempPath());
            Directory newDirectory = null;
            int attempts = 0;
            do
            {
                newDirectory = new Directory(tempDirectory, string.Format("TMP{0:00000}", rnd.Next(0, 99999)));
                if (!newDirectory.Exists)
                {
                    break;
                }

                attempts++;
            } while (attempts < 1000000);

            if (newDirectory.Exists)
            {
                throw new Exception("Ran out of temporary directory names.Try cleaning temp folder!");
            }

            if (createFolder)
            {
                newDirectory.Create();
            }

            return newDirectory;
        }

19 Source : File.cs
with MIT License
from Autodesk

public static File CreateTemporaryFile(string extension, bool createFile = false)
        {
            // Remove any period at the start
            if (extension.StartsWith("."))
            {
                extension = extension.Substring(1);
            }

            File tempFile;

            do
            {
                // Get a unique file name, without creating it
                var fileName = System.IO.Path.GetRandomFileName();

                tempFile = new File(System.IO.Path.Combine(System.IO.Path.GetTempPath(), fileName + "." + extension));

                // Keep looping until the file is unique
            } while (tempFile.Exists);

            if (createFile)
            {
                // Create a zero-byte file
                tempFile.Create();
            }

            return tempFile;
        }

19 Source : MainWindow.xaml.cs
with GNU General Public License v3.0
from autodotua

private async void Window_Loaded(object sender, RoutedEventArgs e)
        {
            if (!Configs.HasOpened)
            {
                Configs.HasOpened = true;
                ContentRendered += async (p1, p2) =>
                 {
                     if (await new ConfirmDialog().ShowAsync("第一次使用,需要生成示例数据吗?", "首次使用"))
                     {
                         Project project = null;
                         await DoProcessAsync(Task.Run(() =>
                         {
                             string db = "UEsDBBQAAAgIAEleCFEu73xcLDIAAAAwAQAJABIA55S15b2xLmRidXAOAAHWiDf655S15b2xLmRi7X0JeBzVlW5rsdTqrsWsBgymMVsbuE7tC6s3yZZXYcsLTBKo1WqQ1ULdsi2SEIvV2GAa4mCpvQYDtsMmwmZsY5hMJs+Tl0mYvEyGyeTN4+WpW1JCCGEIcRw7eedW3RK2wXFpMgnv5avzQZ/z16265+73/LdKsOD62Zm8k3KzHreplacedfEqMjY5VVsYmpVKxWKwK/j0t9pHQ8G/1UbgidnKpik2UUvhBpmpUjJ3NHGIm0MsS79c11i4dde+ocdX/UL24arBqNSRGEsmnJd0xpnbM5Msrui/ItNnOysYlN80x8lbL1Gybnclnsm25m6a2Grlc47TjLrNT59dPbq5PNc6dVr8kNf7Ez41PzZubGn9c4vhUenyQPuHzdO0YfkxFd0VQgoZMq5O7qakje4tj5RuneZD5mL/j7vL9eBdx7h9dn7CMqh2jXljRTR+dv+cdnse274JcoT/R0bG3f+SLXMceSdKE9mTtGB3cnfJJ7kilj7pE/VF/xzTicQ6HG3BBombMhLEVtwUOoZ3dzNLcTbOcLmImP+bkqHv8zMkFnDG+NsGtqx0jj63orhvOlRRpuGXJhcTH8z7+TuLho6If1Tt3fT5eO+bCCyvuq8obZqtzVB2PMuuIj+bJU2bXH98QdCIFMh67aZzbXD+9fn5q7rzm1NyFs2enps6bu6B5/mS4nhrfNOumYx5smt84Z/L8G1Kz6m9ITV7YPK9xLniZUz+3+QqS43DjH59tcEMwGk6UviBv5DtzJ0w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imlbGlB2IPPAojndlrHj2aEdh/1a2FYc3XZUpOoyfgMhw2ZiiDyyFNFWedUVFJ5LtxSKs/xpd5xjoOtDqx4K+z20DnWTbIFDvI5P4ERHx59/2tDYhi3hv7gUTQufhMwMTkKO8TW09+Hyi1sGe5+C39BfYNuiqkuQbNmCgD/WFZAmQQFEXeFUUVYVW3ZwszYON2uwkJVX7S2t2Vl6uActNlpbUb13BBP+naUOVXIME1ZtaFxYgHQHaTb+SwBFF/F3ATLMx/T/BVBLAQIUABQAAAgIAEleCFEu73xcLDIAAAAwAQAJADYAAAAAAAAAIAAAAAAAAADnlLXlvbEuZGIKACAAAAAAAAEAGAB/HPEGN23WAX8c8QY3bdYBqb3aBjdt1gF1cA4AAdaIN/rnlLXlvbEuZGJQSwUGAAAAAAEAAQBtAAAAZTIAAAAA";
                             string zipTemp = Path.GetTempFileName() + ".zip";
                             System.IO.File.WriteAllBytes(zipTemp, Convert.FromBase64String(db));
                             string dbTemp = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
                             ZipFile.ExtractToDirectory(zipTemp, dbTemp);
                             project = Import(Path.Combine(dbTemp, "电影.db"))[0];
                         }));
                         Projects.Add(project);
                         SelectedProject = project;
                     }
                     else
                     {
                         await LoadPanelAsync();
                     }
                 };
            }
            else
            {
                await LoadPanelAsync();
            }
        }

19 Source : FileIconUtility.cs
with GNU General Public License v3.0
from autodotua

public static void UpdateSettings()
        {
            if (Configs.CacheInTempDir)
            {
                ThumbnailFolderPath = P.Combine(P.GetTempPath(), nameof(ClreplacedifyFiles));
            }
            else
            {
                if (!FileUtility.CanWriteInCurrentDirectory() || F.Exists(DbUtility.DbInAppDataFolderMarkerFileName))
                {
                    string path = P.Combine(
                       Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), nameof(ClreplacedifyFiles), "thumb");
                    ThumbnailFolderPath = path;
                }
                else
                {
                    ThumbnailFolderPath = "thumb";
                }
            }
            D.CreateDirectory(P.Combine(ThumbnailFolderPath, "exp"));
            D.CreateDirectory(P.Combine(ThumbnailFolderPath, "win10"));
            D.CreateDirectory(P.Combine(ThumbnailFolderPath, "media"));
        }

19 Source : CsvExporter.cs
with MIT License
from Autodesk-Forge

private static void WriteFileAndExplore(string csv, string name)
        {
            Random rnd = new Random();
            string rand = string.Empty;
            for (var i = 0; i < 10; i++)
            {
                rand += ((char)(rnd.Next(1, 26) + 64)).ToString();
            }
            string path = $"{Path.GetTempPath()}{Path.DirectorySeparatorChar}{name}_{rand}.csv";
            System.IO.File.WriteAllText(path, csv);
            ExploreFile(path);
        }

19 Source : EmbeddedResourcesService.cs
with Apache License 2.0
from AutomateThePlanet

public string FromFile(string name)
        {
            _currentExecutingreplacedembly = _currentExecutingreplacedembly ?? _replacedemblyFacade.GetreplacedembliesCallChain()[2];
            string currentFileTempPath;
            using (var resourceStream = _currentExecutingreplacedembly.GetManifestResourceStream(name))
            {
                var tempFolder = Path.GetTempPath();
                currentFileTempPath = Path.Combine(tempFolder, name).Replace("\\", "/");

                using Stream file = File.Create(currentFileTempPath);
                CopyStream(resourceStream, file);
            }

            if (!File.Exists(currentFileTempPath))
            {
                throw new ArgumentException($"Image {name} was not found. Please add the base line image as embedded resource.");
            }

            return currentFileTempPath;
        }

19 Source : PathFacade.cs
with Apache License 2.0
from AutomateThePlanet

public string GetTempFolderPath() => Path.GetTempPath();

19 Source : EmailService.cs
with Apache License 2.0
from AutomateThePlanet

public static Email ReadEmail(string name = "", string cookieName = "set_emails")
        {
            if (string.IsNullOrEmpty(name))
            {
                name = ServicesCollection.Current.Resolve<CookiesService>().GetCookie(cookieName);
            }

            string tempFilePath = Path.Combine(Path.GetTempPath(), $"{Guid.NewGuid()}.json");
            _blobStorageService.DownloadFile(name, tempFilePath, "emails");
            string fileContent = new FileFacade().ReadAllText(tempFilePath);
            var email = new JsonSerializer().Deserialize<Email>(fileContent);
            return email;
        }

19 Source : EmailService.cs
with Apache License 2.0
from AutomateThePlanet

public static string LoadEmailBody(string htmlBody)
        {
            htmlBody = htmlBody.Replace("\n", string.Empty).Replace("\\/", "/").Replace("\\\"", "\"");
            string tempFilePath = Path.Combine(Path.GetTempPath(), $"{Guid.NewGuid()}.html");
            File.WriteAllText(tempFilePath, htmlBody);
            var navigationService = ServicesCollection.Current.Resolve<NavigationService>();
            navigationService.NavigateToLocalPage(tempFilePath);
            return htmlBody;
        }

19 Source : FileSystemServiceTests.cs
with Apache License 2.0
from AutomateThePlanet

[Test]
        [Category(Categories.KnownIssue)]
        public void FileSavedToDevice_When_CallPushFileFromFileInfo()
        {
            string filePath = Path.GetTempPath();
            var fileName = Guid.NewGuid().ToString();
            string fullPath = Path.Combine(filePath, fileName);

            File.WriteAllText(fullPath,
                "The eventual code is no more than the deposit of your understanding. ~E. W. Dijkstra");

            try
            {
                var file = new FileInfo(fullPath);

                // Creates a new file on the device from the specified file info.
                App.Files.PushFile("/data/local/tmp/remote.txt", file);

                byte[] returnDataBytes = App.Files.PullFile("/data/local/tmp/remote.txt");
                string returnedData = Encoding.UTF8.GetString(returnDataBytes);
                replacedert.AreEqual(
                    "The eventual code is no more than the deposit of your understanding. ~E. W. Dijkstra",
                    returnedData);
            }
            finally
            {
                File.Delete(fullPath);
            }
        }

19 Source : FileSystemServiceTests.cs
with Apache License 2.0
from AutomateThePlanet

[TestMethod]
        [TestCategory(Categories.CI)]
        public void FileSavedToDevice_When_CallPushFileFromFileInfo()
        {
            string filePath = Path.GetTempPath();
            var fileName = Guid.NewGuid().ToString();
            string fullPath = Path.Combine(filePath, fileName);

            File.WriteAllText(fullPath,
                "The eventual code is no more than the deposit of your understanding. ~E. W. Dijkstra");

            try
            {
                var file = new FileInfo(fullPath);
                App.Files.PushFile("/data/local/tmp/remote.txt", file);

                byte[] returnDataBytes = App.Files.PullFile("/data/local/tmp/remote.txt");
                string returnedData = Encoding.UTF8.GetString(returnDataBytes);
                replacedert.AreEqual(
                    "The eventual code is no more than the deposit of your understanding. ~E. W. Dijkstra",
                    returnedData);
            }
            finally
            {
                File.Delete(fullPath);
            }
        }

19 Source : CreateDirectory_Should.cs
with Apache License 2.0
from AutomateThePlanet

[Test]
        public void DirectoryCreatedSuccessfully()
        {
            // Arrange
            var directoryProvider = new DirectoryProvider();
            string newFolder = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());

            // Act
            directoryProvider.CreateDirectory(newFolder);

            // replacedert
            replacedert.That(Directory.Exists(newFolder), Is.True);

            // Clean-up
            Directory.Delete(newFolder);
        }

19 Source : DoesDirectoryExists_Should.cs
with Apache License 2.0
from AutomateThePlanet

[Test]
        public void ReturnFalse_When_FolderExists()
        {
            // Arrange
            var fixture = new Fixture();
            string newFolder = Path.Combine(Path.GetTempPath(), fixture.Create<string>());
            var directoryProvider = new DirectoryProvider();

            // Act
            bool doesFolderExists = directoryProvider.DoesDirectoryExists(newFolder);

            // replacedert
            replacedert.That(doesFolderExists, Is.False);
        }

19 Source : NativeTestsRunnerPluginService.cs
with Apache License 2.0
from AutomateThePlanet

public string BuildNativeRunnerArguments(string libraryName, string libraryPath, List<TestCase> testCasesToBeExecuted, string testResultsFilePath, string outputFilesDir, string nativeArguments)
        {
            // 1. copy all js files to temp folder
            // 2. edit conf.js and add results logger
            // 3. edit js files and set to focus all present here in the testCases names
            var allJsFiles = Directory.GetFiles(new FileInfo(libraryPath).Directory.FullName, "*.js", SearchOption.AllDirectories);

            // Ignore all files in node_modules folder
            var specFiles = allJsFiles.Where(x => !x.Contains("node_modules"));
            var tempFolderPath = Path.GetTempPath();
            var newTempFolder = Path.Combine(tempFolderPath, Guid.NewGuid().ToString());

            // Write the path of the file that we will later delete.
            File.AppendAllText(_deleteItemsFilePath, newTempFolder + Environment.NewLine);

            Directory.CreateDirectory(newTempFolder);

            // Copy all spec files to a temporary folder so that we can update them.
            foreach (var currentFile in specFiles)
            {
                var fileInfo = new FileInfo(currentFile);
                string newFilePath = Path.Combine(newTempFolder, fileInfo.Name);

                File.Copy(currentFile, newFilePath);
            }

            // Gather the paths to all copied spec files.
            var copiedSpecFiles = Directory.GetFiles(newTempFolder, "*.js", SearchOption.AllDirectories);

            // locate the conf.js file
            var confFile = copiedSpecFiles.FirstOrDefault(x => x.Contains(libraryName));

            // If the mentioned conf file doesn't exist we throw an exception since we cannot proceed.
            if (confFile == null)
            {
                throw new ArgumentException("The specified configuration file doesn't exist.");
            }

            // Read the content of the copied conf file and add the NUnit Jasmine reporter with specified results file path.
            string confFileContent = File.ReadAllText(confFile);

            // if for some reason a temp file exists we delete it, because the jasmine NUnit report cannot create a file but creates a folder.
            if (File.Exists(testResultsFilePath))
            {
                File.Delete(testResultsFilePath);
            }

            testResultsFilePath = testResultsFilePath.Replace("\\", "//");

            confFileContent = confFileContent.Replace("framework: 'jasmine',", JasminNUnitReporter.Replace("#", testResultsFilePath));
            File.WriteAllText(confFile, confFileContent);

            // To execute only the mentioned test cases we edit all spec files and set the 'f' infront of all it functions so that they are filtered.
            foreach (var newSpecFile in copiedSpecFiles)
            {
                string newSpecFileContent = File.ReadAllText(newSpecFile);

                var regex = new Regex(ItNamePattern);
                string focusedContent = ReplaceItNamesWithFocused(newSpecFileContent, regex, "itBegin", "f", testCasesToBeExecuted.Select(x => x.FullName).ToList());

                File.WriteAllText(newSpecFile, focusedContent);
            }

            // Copy jasmin_reporters node_modules folder to temp folder, otherwise the run cannot happen.
            string jasminReportersPluginsFolder = Path.Combine(GetRunningreplacedemblyPath(), "Plugins\\node_modules_jasmin_reporters");
            string jasminReportersModuleFolder = Path.Combine(newTempFolder, "node_modules");
            Copy(jasminReportersPluginsFolder, jasminReportersModuleFolder);

            var arguments = $" /c {Path.Combine(GetRunningreplacedemblyPath(), "Plugins\\node_modules\\.bin\\protractor")} {confFile} {nativeArguments}";

            return arguments;
        }

19 Source : DirectoryFactory.cs
with Apache License 2.0
from AutomateThePlanet

public static string GetUniqueTestDirectory()
        {
            var destinationFolder = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());

            return destinationFolder;
        }

19 Source : DefaultRepositoryMonitorTests.cs
with MIT License
from awaescher

[OneTimeSetUp]
		public void OneTimeSetUp()
		{
			_rootPath = Path.Combine(Path.GetTempPath(), "RepoZ_Test_Repositories");

			TryCreateRootPath(_rootPath);

			string repoPath = Path.Combine(_rootPath, Guid.NewGuid().ToString());
			Directory.CreateDirectory(repoPath);

			_monitor = new DefaultRepositoryMonitor(
				new GivenPathProvider(new string[] { repoPath }),
				new DefaultRepositoryReader(),
				new DefaultRepositoryDetectorFactory(new DefaultRepositoryReader()),
				new DefaultRepositoryObserverFactory(),
				new DefaultPathCrawlerFactory(new NeverSkippingPathSkipper()),
				new UselessRepositoryStore(),
				new DefaultRepositoryInformationAggregator(
					new StatusCompressor(new StatusCharacterMap()),
					new DirectThreadDispatcher()),
				new Mock<IAutoFetchHandler>().Object,
				new Mock<IRepositoryIgnoreStore>().Object
				);

			_monitor.DelayGitRepositoryStatusAfterCreationMilliseconds = 100;
			_monitor.DelayGitStatusAfterFileOperationMilliseconds = 100;

			_origin = new RepositoryWriter(Path.Combine(repoPath, "BareOrigin"));
			_cloneA = new RepositoryWriter(Path.Combine(repoPath, "CloneA"));
			_cloneB = new RepositoryWriter(Path.Combine(repoPath, "CloneB"));
		}

19 Source : BaseDemo.cs
with BSD 3-Clause "New" or "Revised" License
from aweber

protected async Task<string> GetAccessTokenAsync()
        {
            var credentialsFilePath = Path.Combine(Path.GetTempPath(), "AWeber", "credentials.json");
            return await _authHelper.RetrieveAccessTokenAsync(credentialsFilePath);
        }

19 Source : FileWrapper.cs
with Apache License 2.0
from aws

public string GetUniqueTempFilePath() => Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());

19 Source : Program.cs
with BSD 3-Clause "New" or "Revised" License
from aweber

private static async Task ExecuteAsync(HttpClient httpClient, IConsole console, IConfiguration config)
        {
            var authenticationHelper = new AuthenticationHelper(httpClient, OAuthUri, RedirectUri);
            var clientId = config["AWeberClientId"];
            if (string.IsNullOrWhiteSpace(clientId))
            {
                clientId = Prompt.GetString("Enter your client id:", promptColor: ConsoleColor.Yellow,
                    promptBgColor: ConsoleColor.Black);
            }
            else
            {
                console.WriteResponse(ConsoleColor.Green, "Client id retrieved from config.");
            }

            var clientSecret = config["AWeberClientSecret"];
            if (string.IsNullOrWhiteSpace(clientSecret))
            {
                clientSecret = Prompt.GetPreplacedword("Enter your client secret:", promptColor: ConsoleColor.Yellow,
                    promptBgColor: ConsoleColor.Black);
            }
            else
            {
                console.WriteResponse(ConsoleColor.Green, "Client secret retrieved from config.");
            }

            // Use your client id and secret to get an access token.
            //
            // See the Getting Started guide to redirect to a callback URL:
            // https://api.aweber.com/#tag/Getting-Started

            var scopes = new List<string>
            {
                Scopes.AccountRead,
                Scopes.ListRead,
                Scopes.ListWrite,
                Scopes.SubscriberRead,
                Scopes.SubscriberWrite,
                Scopes.EmailRead,
                Scopes.EmailWrite,
                Scopes.SubscriberReadExtended,
                Scopes.LandingPageRead
            };

            // Log in to receive a redirect url
            var authorizationUrl = authenticationHelper.CreateAuthorizationUrl(scopes, clientId);
            console.WriteResponse(ConsoleColor.White, "Go to this URL:");
            console.WriteResponse(ConsoleColor.Blue, authorizationUrl.Url);
            var authorizationResponse = Prompt.GetString("Log in and paste the returned URL here: ",
                promptColor: ConsoleColor.Yellow,
                promptBgColor: ConsoleColor.Black);

            // Use authorization response to get a token
            var authorizationCode = authenticationHelper.ParseAuthorizationCode(authorizationResponse, authorizationUrl.State);
            var accessTokenResponse = await authenticationHelper.MakeAccessTokenRequestAsync(authorizationCode, clientId, clientSecret);

            // The path to store the credentials
            var credentialsFilePath = Path.Combine(Path.GetTempPath(), "AWeber", "credentials.json");
            authenticationHelper.SaveAccessToken(new Credentials(accessTokenResponse, clientId, clientSecret), credentialsFilePath);
            console.WriteResponse(ConsoleColor.Green, "Updated credentials.json with your new credentials");
        }

19 Source : PublishLayerCommand.cs
with Apache License 2.0
from aws

private async Task<CreateLayerZipFileResult> CreateRuntimePackageStoreLayerZipFile(string layerName, string s3Prefix)
        {
            var targetFramework = this.GetStringValueOrDefault(this.TargetFramework, CommonDefinedCommandOptions.ARGUMENT_FRAMEWORK, true);
            var projectLocation = this.GetStringValueOrDefault(this.ProjectLocation, CommonDefinedCommandOptions.ARGUMENT_PROJECT_LOCATION, false);
            var enableOptimization = this.GetBoolValueOrDefault(this.EnablePackageOptimization, LambdaDefinedCommandOptions.ARGUMENT_ENABLE_PACKAGE_OPTIMIZATION, false).GetValueOrDefault();

            if(string.Equals(targetFramework, "netcoreapp3.1"))
            {
                var version = DotNetCLIWrapper.GetSdkVersion();
                
                // .NET SDK 3.1 versions less then 3.1.400 have an issue throwing NullReferenceExceptions when pruning packages out with the manifest.
                // https://github.com/dotnet/sdk/issues/10973
                if (version < Version.Parse("3.1.400"))
                {
                    var message = $"Publishing runtime package store layers targeting .NET Core 3.1 requires at least version 3.1.400 of the .NET SDK. Current version installed is {version}.";
                    throw new LambdaToolsException(message, LambdaToolsException.LambdaErrorCode.DisabledSupportForNET31Layers);
                }
            }

#if NETCORE
            if (enableOptimization)
            {
                if(!RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
                {
                    throw new LambdaToolsException($"Package optimization is only possible on Amazon Linux. To use this feature execute the command in an Amazon Linux environment.", LambdaToolsException.LambdaErrorCode.UnsupportedOptimizationPlatform);
                }
                else
                {
                    this.Logger.WriteLine("Warning: Package optimization has been enabled. Be sure to run this on an Amazon Linux environment or the optimization might not be compatbile with the Lambda runtime.");
                }
            }
#else
            // This is the case the code is run in the AWS Toolkit for Visual Studio which will never run on Amazon Linux.
            enableOptimization = false;
#endif

            // This is the manifest that list the NuGet packages via <PackageReference> elements in the msbuild project file.
            var packageManifest = this.GetStringValueOrDefault(this.PackageManifest, LambdaDefinedCommandOptions.ARGUMENT_PACKAGE_MANIFEST, false);
            // If this is null attempt to use the current directory. This is likely if the intent is to make a
            // layer from the current Lambda project.
            if (string.IsNullOrEmpty(packageManifest))
            {
                packageManifest = Utilities.DetermineProjectLocation(this.WorkingDirectory, projectLocation);
            }

            // If this is a directory look to see if there is a single csproj of fsproj in the directory in use that.
            // This is to make it easy to make a layer in the current directory of a Lambda function.
            if (Directory.Exists(packageManifest))
            {
                var files = Directory.GetFiles(packageManifest, "*.csproj");
                if(files.Length == 1)
                {
                    packageManifest = Path.Combine(packageManifest, files[0]);
                }
                else if(files.Length == 0)
                {
                    files = Directory.GetFiles(packageManifest, "*.fsproj");
                    if (files.Length == 1)
                    {
                        packageManifest = Path.Combine(packageManifest, files[0]);
                    }
                }
            }

            if(!File.Exists(packageManifest))
            {
                throw new LambdaToolsException($"Can not find package manifest {packageManifest}. Make sure to point to a file not a directory.", LambdaToolsException.LambdaErrorCode.LayerPackageManifestNotFound);
            }

            // Create second subdirectory so that when the directory is zipped the sub directory is retained in the zip file.
            // The sub directory will be created in the /opt directory in the Lambda environment.
            var tempDirectoryName = $"{layerName}-{DateTime.UtcNow.Ticks}".ToLower();
            var optDirectory = this.GetStringValueOrDefault(this.OptDirectory, LambdaDefinedCommandOptions.ARGUMENT_OPT_DIRECTORY, false);
            if (string.IsNullOrEmpty(optDirectory))
            {
                optDirectory = LambdaConstants.DEFAULT_LAYER_OPT_DIRECTORY;
            }
            var tempRootPath = Path.Combine(Path.GetTempPath(), tempDirectoryName);
            var storeOutputDirectory = Path.Combine(tempRootPath, optDirectory);

            {
                var convertResult = LambdaUtilities.ConvertManifestToSdkManifest(targetFramework, packageManifest);
                if (convertResult.ShouldDelete)
                {
                    this.Logger?.WriteLine("Converted ASP.NET Core project file to temporary package manifest file.");
                }
                var architecture = this.GetStringValueOrDefault(this.Architecture, LambdaDefinedCommandOptions.ARGUMENT_FUNCTION_ARCHITECTURE, false);
                var cliWrapper = new LambdaDotNetCLIWrapper(this.Logger, this.WorkingDirectory);
                if(cliWrapper.Store(defaults: this.DefaultConfig, 
                                        projectLocation: projectLocation,
                                        outputLocation: storeOutputDirectory, 
                                        targetFramework: targetFramework,
                                        packageManifest: convertResult.PackageManifest,
                                        architecture: architecture,
                                        enableOptimization: enableOptimization) != 0)
                {
                    throw new LambdaToolsException($"Error executing the 'dotnet store' command", LambdaToolsException.LambdaErrorCode.StoreCommandError);
                }

                if (convertResult.ShouldDelete)
                {
                    File.Delete(convertResult.PackageManifest);
                }
            }

            // The artifact.xml file is generated by the "dotnet store" command that lists the packages that were added to the store.
            // It is required during a "dotnet publish" so the NuGet packages in the store will be filtered out.
            var artifactXmlPath = Path.Combine(storeOutputDirectory, "x64", targetFramework, "artifact.xml");
            if(!File.Exists(artifactXmlPath))
            {
                throw new LambdaToolsException($"Failed to find artifact.xml file in created local store.", LambdaToolsException.LambdaErrorCode.FailedToFindArtifactZip);
            }
            this.Logger.WriteLine($"Uploading runtime package store manifest to S3");
            var s3Key = await UploadFile(artifactXmlPath, $"{s3Prefix}artifact.xml");

            this.Logger.WriteLine($"Create zip file of runtime package store directory");
            var zipPath = Path.Combine(Path.GetTempPath(), $"{layerName}-{DateTime.UtcNow.Ticks}.zip");
            if(File.Exists(zipPath))
            {
                File.Delete(zipPath);
            }
            LambdaPackager.BundleDirectory(zipPath, tempRootPath, false, this.Logger);

            var result = new CreateLayerZipFileResult
            {
                ZipFile = zipPath,
                LayerDirectory = optDirectory
            };

            var s3Bucket = this.GetStringValueOrDefault(this.S3Bucket, LambdaDefinedCommandOptions.ARGUMENT_S3_BUCKET, true);

            // Set the description field to the our JSON layer manifest file so when the tooling is used
            // to create a package of a Lambda function in the future the artifact.xml file can be used during "dotnet publish".
            result.Description = GeneratorRuntimePackageManifestLayerDescription(optDirectory, s3Bucket, s3Key, enableOptimization);

            var compatibleRuntime = LambdaUtilities.DetermineLambdaRuntimeFromTargetFramework(targetFramework);
            if(!string.IsNullOrEmpty(compatibleRuntime))
            {
                result.CompatibleRuntimes = new List<string>() { compatibleRuntime };
            }

            return result;
        }

19 Source : LambdaUtilities.cs
with Apache License 2.0
from aws

public static async Task<LayerPackageInfo> LoadLayerPackageInfos(IToolLogger logger, IAmazonLambda lambdaClient, IAmazonS3 s3Client, IEnumerable<string> layerVersionArns)
        {
            var info = new LayerPackageInfo();
            if (layerVersionArns == null || !layerVersionArns.Any())
                return info;

            logger.WriteLine("Inspecting Lambda layers for runtime package store manifests");
            foreach(var arn in layerVersionArns)
            {
                try
                {
                    var p = ParseLayerVersionArn(arn);
                    var getLayerResponse = await lambdaClient.GetLayerVersionAsync(new GetLayerVersionRequest { LayerName = p.Name, VersionNumber = p.VersionNumber });

                    LayerDescriptionManifest manifest;
                    if (!LambdaUtilities.AttemptToParseLayerDescriptionManifest(getLayerResponse.Description, out manifest))
                    {
                        logger.WriteLine($"... {arn}: Skipped, does not contain a layer description manifest");
                        continue;
                    }
                    if (manifest.Nlt != LayerDescriptionManifest.ManifestType.RuntimePackageStore)
                    {
                        logger.WriteLine($"... {arn}: Skipped, layer is of type {manifest.Nlt.ToString()}, not {LayerDescriptionManifest.ManifestType.RuntimePackageStore}");
                        continue;
                    }

                    string GetLastArnComponent(string input)
                    {
                        return input.Substring(input.LastIndexOf(':') + 1);
                    }

                    var layerName = GetLastArnComponent(getLayerResponse.LayerArn);
                    var layerVers = GetLastArnComponent(getLayerResponse.LayerVersionArn);

                    var tempPath = Directory.CreateDirectory(Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()));
                    var filePath = Path.Combine(tempPath.FullName, $"{layerName}-v{layerVers}.xml");

                    using (var getResponse = await s3Client.GetObjectAsync(manifest.Buc, manifest.Key))
                    using (var reader = new StreamReader(getResponse.ResponseStream))
                    {
                        await getResponse.WriteResponseStreamToFileAsync(filePath, false, default(System.Threading.CancellationToken));
                    }

                    logger.WriteLine($"... {arn}: Downloaded package manifest for runtime package store layer");
                    info.Items.Add(new LayerPackageInfo.LayerPackageInfoItem
                    {
                        Directory = manifest.Dir,
                        ManifestPath = filePath
                    });
                }
                catch(Exception e)
                {
                    logger.WriteLine($"... {arn}: Skipped, error inspecting layer. {e.Message}");
                }
            }

            return info;
        }

19 Source : DeployTest.cs
with Apache License 2.0
from aws

[Fact]
        public async Task DeployWithPackage()
        {
            var replacedembly = this.GetType().GetTypeInfo().replacedembly;

            string packageZip = Path.GetTempFileName() + ".zip";
            var fullPath = Path.GetFullPath(Path.GetDirectoryName(replacedembly.Location) + "../../../../../../testapps/TestFunction");

            var packageCommand = new PackageCommand(new TestToolLogger(_testOutputHelper), fullPath, new string[0]);
            packageCommand.OutputPackageFileName = packageZip;
            packageCommand.Configuration = "Release";

            await packageCommand.ExecuteAsync();

            var deployCommand = new DeployFunctionCommand(new TestToolLogger(_testOutputHelper), Path.GetTempPath(), new string[0]);
            deployCommand.FunctionName = "test-function-" + DateTime.Now.Ticks;
            deployCommand.Handler = "TestFunction::TestFunction.Function::ToUpper";
            deployCommand.Timeout = 10;
            deployCommand.MemorySize = 512;
            deployCommand.Role = await TestHelper.GetTestRoleArnAsync();
            deployCommand.Package = packageZip;
            deployCommand.Runtime = "dotnetcore2.1";
            deployCommand.Region = "us-east-1";
            deployCommand.DisableInteractive = true;

            var created = await deployCommand.ExecuteAsync();
            try
            {
                replacedert.True(created);

                var invokeRequest = new InvokeRequest
                {
                    FunctionName = deployCommand.FunctionName,
                    LogType = LogType.Tail,
                    Payload = "\"hello world\""
                };
                var response = await deployCommand.LambdaClient.InvokeAsync(invokeRequest);

                var payload = new StreamReader(response.Payload).ReadToEnd();
                replacedert.Equal("\"HELLO WORLD\"", payload);
            }
            finally
            {
                if(File.Exists(packageZip))
                {
                    File.Delete(packageZip);
                }

                if (created)
                {
                    await deployCommand.LambdaClient.DeleteFunctionAsync(deployCommand.FunctionName);
                }
            }

        }

19 Source : DeployTests.cs
with Apache License 2.0
from aws

[Fact(Skip = "Trouble running in CodeBuild.  Need to debug.")]
        public async Task CreateEnvironmentWithPackageTest()
        {
            var application = "TestApp";
            var environment = "TestEnv";
            var solutionStack = "TestWindowsStack";
            var iamProfile = "arn:aws:fake-profile";

            var mockS3Client = new Mock<IAmazonS3>();

            var calls = new Dictionary<string, int>();
            Action<string> addCall = x =>
            {
                if (calls.ContainsKey(x))
                    calls[x] = calls[x] + 1;
                else
                    calls[x] = 1;

            };
            var mockEbClient = new Mock<IAmazonElasticBeanstalk>();
            mockEbClient.Setup(client => client.DescribeApplicationsAsync(It.IsAny<DescribeApplicationsRequest>(), It.IsAny<CancellationToken>()))
                .Callback<DescribeApplicationsRequest, CancellationToken>((request, token) =>
                {
                    replacedert.Equal(application, request.ApplicationNames[0]);
                })
                .Returns((DescribeApplicationsRequest r, CancellationToken token) =>
                {
                    addCall("DescribeApplicationsAsync");
                    return Task.FromResult(new DescribeApplicationsResponse());
                });
            mockEbClient.Setup(client => client.CreateStorageLocationAsync(It.IsAny<CancellationToken>()))
                .Returns((CancellationToken token) =>
                {
                    addCall("CreateStorageLocationAsync");
                    return Task.FromResult(new CreateStorageLocationResponse { S3Bucket = "TestBucket" });
                });
            mockEbClient.Setup(client => client.DescribeEventsAsync(It.IsAny<DescribeEventsRequest>(), It.IsAny<CancellationToken>()))
                .Callback<DescribeEventsRequest, CancellationToken>((request, token) =>
                {
                    replacedert.Equal(application, request.ApplicationName);
                    replacedert.Equal(environment, request.EnvironmentName);
                })
                .Returns((DescribeEventsRequest r, CancellationToken token) =>
                {
                    addCall("DescribeEventsAsync");
                    var response = new DescribeEventsResponse
                    {
                        Events = new List<EventDescription>
                        {
                            new EventDescription
                            {
                                ApplicationName = application,
                                EnvironmentName = environment,
                                Message = "Dummy Message",
                                EventDate = DateTime.Now
                            }
                        }
                    };
                    return Task.FromResult(response);
                });
            mockEbClient.Setup(client => client.CreateApplicationAsync(It.IsAny<CreateApplicationRequest>(), It.IsAny<CancellationToken>()))
                .Callback<CreateApplicationRequest, CancellationToken>((request, token) =>
                {
                    replacedert.Equal(application, request.ApplicationName);
                })
                .Returns((CreateApplicationRequest r, CancellationToken token) =>
                {
                    addCall("CreateApplicationAsync");
                    return Task.FromResult(new CreateApplicationResponse());
                });
            mockEbClient.Setup(client => client.CreateEnvironmentAsync(It.IsAny<CreateEnvironmentRequest>(), It.IsAny<CancellationToken>()))
                .Callback<CreateEnvironmentRequest, CancellationToken>((request, token) =>
                {
                    replacedert.Equal(application, request.ApplicationName);
                    replacedert.Equal(environment, request.EnvironmentName);
                    replacedert.Equal(solutionStack, request.SolutionStackName);

                    var iamSetting = request.OptionSettings.FirstOrDefault(x => string.Equals(x.OptionName, "IamInstanceProfile") && string.Equals(x.Namespace, "aws:autoscaling:launchconfiguration"));
                    replacedert.Equal(iamSetting.Value, iamProfile);

                    var xraySetting = request.OptionSettings.FirstOrDefault(x => string.Equals(x.OptionName, "XRayEnabled") && string.Equals(x.Namespace, "aws:elasticbeanstalk:xray"));
                    replacedert.Equal(xraySetting.Value.ToLower(), "true");
                })
                .Returns((CreateEnvironmentRequest r, CancellationToken token) =>
                {
                    addCall("CreateEnvironmentAsync");
                    return Task.FromResult(new CreateEnvironmentResponse());
                });
            mockEbClient.Setup(client => client.DescribeEnvironmentsAsync(It.IsAny<DescribeEnvironmentsRequest>(), It.IsAny<CancellationToken>()))
                .Returns((DescribeEnvironmentsRequest r, CancellationToken token) =>
                {
                    addCall("DescribeEnvironmentsAsync");

                    return Task.FromResult(new DescribeEnvironmentsResponse
                    {
                        Environments = new List<EnvironmentDescription>
                        {
                            new EnvironmentDescription
                            {
                                ApplicationName = application,
                                EnvironmentName = environment,
                                DateCreated = DateTime.Now.AddMinutes(-1),
                                DateUpdated = DateTime.Now,
                                Status = EnvironmentStatus.Ready
                            }
                        }
                    });
                });

            var outputPackage = Path.GetTempFileName().Replace(".tmp", ".zip");
            var packageCommand = new PackageCommand(new ConsoleToolLogger(), TestUtilities.TestBeanstalkWebAppPath,
                new string[] { "--output-package", outputPackage, "--iis-website", "The WebSite", "--app-path", "/child" });
            packageCommand.DisableInteractive = true;
            await packageCommand.ExecuteAsync();


            var deployCommand = new DeployEnvironmentCommand(new ConsoleToolLogger(), Path.GetTempPath(),
                new string[] { "-app", application, "-env", environment, "--solution-stack", solutionStack,
                    "--instance-profile", iamProfile, "--region", "us-moq-1", "--enable-xray", "true",
                    "--package", outputPackage});
            deployCommand.DisableInteractive = true;
            deployCommand.EBClient = mockEbClient.Object;
            deployCommand.S3Client = mockS3Client.Object;

            await deployCommand.ExecuteAsync();
            replacedert.Null(deployCommand.LastToolsException);

            replacedert.True(calls.ContainsKey("CreateApplicationAsync"));
            replacedert.True(calls.ContainsKey("CreateEnvironmentAsync"));
        }

19 Source : DeployTest.cs
with Apache License 2.0
from aws

[Fact]
        public async Task TestServerlessPackage()
        {
            var logger = new TestToolLogger();
            var replacedembly = this.GetType().GetTypeInfo().replacedembly;

            var fullPath = Path.GetFullPath(Path.GetDirectoryName(replacedembly.Location) + "../../../../../../testapps/TestServerlessWebApp");
            var command = new PackageCICommand(logger, fullPath, new string[0]);
            command.Region = "us-west-2";
            command.Configuration = "Release";
            command.TargetFramework = "netcoreapp2.1";
            command.CloudFormationTemplate = "serverless.template";
            command.CloudFormationOutputTemplate = Path.Combine(Path.GetTempPath(),  "output-serverless.template");
            command.S3Bucket = "serverless-package-test-" + DateTime.Now.Ticks;
            command.DisableInteractive = true;

            if (File.Exists(command.CloudFormationOutputTemplate))
                File.Delete(command.CloudFormationOutputTemplate);


            await command.S3Client.PutBucketAsync(command.S3Bucket);
            try
            {
                replacedert.True(await command.ExecuteAsync());
                replacedert.True(File.Exists(command.CloudFormationOutputTemplate));
            }
            finally
            {
                await AmazonS3Util.DeleteS3BucketWithObjectsAsync(command.S3Client, command.S3Bucket);
            }

        }

19 Source : TemplateProcessorManager.cs
with Apache License 2.0
from aws

private static string GenerateOutputZipFilename(IUpdateResourceField field)
        {
            var outputPackage = Path.Combine(Path.GetTempPath(), $"{field.Resource.Name}-{field.Name}-{DateTime.Now.Ticks}.zip");
            return outputPackage;
        }

19 Source : ArmTests.cs
with Apache License 2.0
from aws

[Fact]
        public async Task TestServerlessPackage()
        {
            var logger = new TestToolLogger();
            var replacedembly = this.GetType().GetTypeInfo().replacedembly;

            var fullPath = Path.GetFullPath(Path.GetDirectoryName(replacedembly.Location) + "../../../../../../testapps/TestServerlessWebApp");
            var command = new PackageCICommand(logger, fullPath, new string[0]);
            command.Region = "us-west-2";
            command.Configuration = "Release";
            command.CloudFormationTemplate = "serverless-arm.template";
            command.CloudFormationOutputTemplate = Path.Combine(Path.GetTempPath(), "output-serverless-arm.template");
            command.S3Bucket = "serverless-package-test-" + DateTime.Now.Ticks;
            command.DisableInteractive = true;

            if (File.Exists(command.CloudFormationOutputTemplate))
                File.Delete(command.CloudFormationOutputTemplate);


            await command.S3Client.PutBucketAsync(command.S3Bucket);
            try
            {
                replacedert.True(await command.ExecuteAsync());
                replacedert.True(File.Exists(command.CloudFormationOutputTemplate));

                var templateJson = File.ReadAllText(command.CloudFormationOutputTemplate);
                var templateRoot = JsonConvert.DeserializeObject(templateJson) as JObject;
                var codeUri = templateRoot["Resources"]["DefaultFunction"]["Properties"]["CodeUri"].ToString();
                replacedert.False(string.IsNullOrEmpty(codeUri));

                var s3Key = codeUri.Split('/').Last();

                var transfer = new TransferUtility(command.S3Client);
                var functionZipPath = Path.GetTempFileName();
                await transfer.DownloadAsync(functionZipPath, command.S3Bucket, s3Key);
                replacedert.Equal("linux-arm64", GetRuntimeFromBundle(functionZipPath));

                File.Delete(functionZipPath);
            }
            finally
            {
                await AmazonS3Util.DeleteS3BucketWithObjectsAsync(command.S3Client, command.S3Bucket);
            }

        }

19 Source : ArmTests.cs
with Apache License 2.0
from aws

[Fact]
        public async Task TestServerlessPackageWithGlobalArchitectures()
        {
            var logger = new TestToolLogger();
            var replacedembly = this.GetType().GetTypeInfo().replacedembly;

            var fullPath = Path.GetFullPath(Path.GetDirectoryName(replacedembly.Location) + "../../../../../../testapps/TestServerlessWebApp");
            var command = new PackageCICommand(logger, fullPath, new string[0]);
            command.Region = "us-west-2";
            command.Configuration = "Release";
            command.CloudFormationTemplate = "serverless-global-arm.template";
            command.CloudFormationOutputTemplate = Path.Combine(Path.GetTempPath(), "output-serverless-global--arm.template");
            command.S3Bucket = "serverless-package-test-" + DateTime.Now.Ticks;
            command.DisableInteractive = true;

            if (File.Exists(command.CloudFormationOutputTemplate))
                File.Delete(command.CloudFormationOutputTemplate);


            await command.S3Client.PutBucketAsync(command.S3Bucket);
            try
            {
                replacedert.True(await command.ExecuteAsync());
                replacedert.True(File.Exists(command.CloudFormationOutputTemplate));

                var templateJson = File.ReadAllText(command.CloudFormationOutputTemplate);
                var templateRoot = JsonConvert.DeserializeObject(templateJson) as JObject;
                var codeUri = templateRoot["Resources"]["DefaultFunction"]["Properties"]["CodeUri"].ToString();
                replacedert.False(string.IsNullOrEmpty(codeUri));

                var s3Key = codeUri.Split('/').Last();

                var transfer = new TransferUtility(command.S3Client);
                var functionZipPath = Path.GetTempFileName();
                await transfer.DownloadAsync(functionZipPath, command.S3Bucket, s3Key);
                replacedert.Equal("linux-arm64", GetRuntimeFromBundle(functionZipPath));

                File.Delete(functionZipPath);
            }
            finally
            {
                await AmazonS3Util.DeleteS3BucketWithObjectsAsync(command.S3Client, command.S3Bucket);
            }

        }

19 Source : ProjectBuildHandlerTests.cs
with Apache License 2.0
from aws

[OneTimeSetUp]
        public virtual void OneTimeSetUp()
        {
            projectFileContent = @"<Project Sdk=""Microsoft.NET.Sdk"">
  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
  </PropertyGroup>
  <ItemGroup>
    <FrameworkReference Include=""Microsoft.AspNetCore.App"" />
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include=""MyFirstPackage"" Version=""1.0.0"" />
    <PackageReference Include=""MySecondPackage"" Version=""2.0.0"" />
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include=""TheMainProject"" />
    <ProjectReference Include=""TheDependency"" />
  </ItemGroup>
  <ItemGroup Label=""PortingInfo"">
    <!-- DO NOT REMOVE WHILE PORTING
        C:\\RandomFile.dll
        C:\\this\\is\\some\\path\\to\\Some.dll
    -->
  </ItemGroup>
</Project>";
            tmpTestFixturePath = Path.GetFullPath(Path.Combine(
                Path.GetTempPath(),
                Path.GetRandomFileName()));
            Directory.CreateDirectory(tmpTestFixturePath);
        }

19 Source : CorrectnessTestBase.cs
with Apache License 2.0
from aws

[OneTimeSetUp]
        public virtual void OneTimeSetUp()
        {
            testDirectoryRoot = TestContext.CurrentContext.TestDirectory;

            tmpTestFixturePath = Path.GetFullPath(Path.Combine(
                Path.GetTempPath(),
                Path.GetRandomFileName()));
            Directory.CreateDirectory(tmpTestFixturePath);

            testProjectZipPath = Path.Combine(
                testDirectoryRoot,
                "TestProjects",
                "NetFrameworkExample.zip");
        }

See More Examples