public void WriteInPowerShell(ICodeConverter converter) { string currentDir = "\"" + FinalFile.BuildDirectory + "\""; this.directories.ForEach(new Action <string>(delegate(string dir) { converter.CurrentFunction.AddToSource("CreateDirectoryIfNotExists (" + currentDir + " + " + dir + ")" + Environment.NewLine); currentDir += " + " + dir + " + \"" + PowerShellConverter.Escape(Path.DirectorySeparatorChar.ToString()) + "\""; })); string completeFileName = ""; bool first = true; this.fileName.ForEach(new Action <string>(delegate(string s) { if (!first) { completeFileName += " + \".\" + "; } else { first = false; } completeFileName += s; })); converter.CurrentFunction.AddToSource("EraseFile (" + currentDir + " + " + completeFileName + ")" + Environment.NewLine); converter.CurrentFunction.AddToSource("S[left:" + PowerShellConverter.Escape(this.newWriter.Name) + "] = @((" + currentDir + " + " + completeFileName + ")" + ", 0, \"\", $true)" + Environment.NewLine); }
public void WriteInPowerShell(ICodeConverter converter) { if (this.isFromDict) { if (!this.defaultWriter.IsGlobal) { converter.CurrentFunction.AddToSource("WriteToFile S[byvalue:" + PowerShellConverter.Escape(this.defaultWriter.Name) + "] $theDict.GetString(\"" + PowerShellConverter.Escape(this.varName) + "\")" + Environment.NewLine); } else { converter.CurrentFunction.AddToSource("WriteToFile $" + PowerShellConverter.Escape(this.defaultWriter.Name) + " $theDict.GetString(\"" + PowerShellConverter.Escape(this.varName) + "\")" + Environment.NewLine); } } else { if (!this.defaultWriter.IsGlobal) { converter.CurrentFunction.AddToSource("WriteToFile S[byvalue:" + PowerShellConverter.Escape(this.defaultWriter.Name) + "] (S[byvalue:" + PowerShellConverter.Escape(this.varName) + "])" + Environment.NewLine); } else { converter.CurrentFunction.AddToSource("WriteToFile $" + PowerShellConverter.Escape(this.defaultWriter.Name) + " (S[byvalue:" + PowerShellConverter.Escape(this.varName) + "])" + Environment.NewLine); } } }
public void WriteInPowerShell(ICodeConverter converter) { if (!this.defaultWriter.IsGlobal) { converter.CurrentFunction.AddToSource("WriteToFile S[byvalue:" + PowerShellConverter.Escape(this.defaultWriter.Name) + "] $" + PowerShellConverter.Escape(this.crlf.Name) + Environment.NewLine); } else { converter.CurrentFunction.AddToSource("WriteToFile $" + PowerShellConverter.Escape(this.defaultWriter.Name) + " $" + PowerShellConverter.Escape(this.crlf.Name) + Environment.NewLine); } }
public void WriteInPowerShell(ICodeConverter converter) { if (!this.result.IsGlobal) { converter.CurrentFunction.AddToSource("S[left:" + PowerShellConverter.Escape(this.varName) + "] = " + this.result.ValueString + Environment.NewLine); } else { converter.CurrentFunction.AddToSource("$" + PowerShellConverter.Escape(this.varName) + " = " + this.result.ValueString + Environment.NewLine); } }
public void WriteInPowerShell(ICodeConverter converter) { if (!this.value.IsGlobal) { converter.CurrentFunction.AddToSource("S[left:" + PowerShellConverter.Escape(this.varName) + "] = $theDict.GetString(\"" + PowerShellConverter.Escape(this.stringName) + "\")" + Environment.NewLine); } else { converter.CurrentFunction.AddToSource("$" + PowerShellConverter.Escape(this.varName) + " = $theDict.GetString(\"" + PowerShellConverter.Escape(this.stringName) + "\")" + Environment.NewLine); } }
public void WriteInPowerShell(ICodeConverter converter) { if (!this.defaultWriter.IsGlobal) { converter.CurrentFunction.AddToSource("WriteToFile S[byvalue:" + PowerShellConverter.Escape(this.defaultWriter.Name) + "] $theDict.GetArray(\"" + PowerShellConverter.Escape(this.tabName) + "\").Item(" + this.index + ").GetString(\"" + PowerShellConverter.Escape(this.fieldName) + "\")" + Environment.NewLine); } else { converter.CurrentFunction.AddToSource("WriteToFile $" + PowerShellConverter.Escape(this.defaultWriter.Name) + " $theDict.GetArray(\"" + PowerShellConverter.Escape(this.tabName) + "\").Item(" + this.index + ").GetString(\"" + PowerShellConverter.Escape(this.fieldName) + "\")" + Environment.NewLine); } }
public void WriteInPowerShell(ICodeConverter converter) { string printed = this.text.Replace("\\", "\\\\").Replace("\"", "\"\"").Replace("S[", "\\S[").Replace("\r\n", "").Replace(" ", "").Replace("\t", "").Replace('·', ' ').Replace('¬', '\t').Replace("¶", "\" + $" + this.crlf.Name + " + \""); if (!this.defaultWriter.IsGlobal) { converter.CurrentFunction.AddToSource("WriteToFile S[byvalue:" + PowerShellConverter.Escape(this.defaultWriter.Name) + "] (\"" + printed + "\")" + Environment.NewLine); } else { converter.CurrentFunction.AddToSource("WriteToFile $" + PowerShellConverter.Escape(this.defaultWriter.Name) + " (\"" + printed + "\")" + Environment.NewLine); } }
public void WriteInPowerShell(ICodeConverter converter) { IFunction f = converter.ImplementedFunctions.Find(new Predicate <IFunction>(delegate(IFunction func) { return(func.Name == this.cachedProc.FunctionName); })); if (!converter.CallingFunctions.Exists(new Predicate <IFunction>(delegate(IFunction func) { return(func.StrictName == CallSkeleton.SpecialChars(this.Name) && func.InstanceNumber == f.InstanceNumber); }))) { converter.CallingFunctions.Add(f); } converter.CurrentFunction.AddToSource(PowerShellConverter.Escape((f.IsMacro ? "macro_" : f.IsJob ? "job_" : "func_") + f.Name + " ")); bool first = true; // ne pas ajouter des paramètres typés, utiliser des VariableName distinct List <string> distincts = new List <string>(); foreach (IParameter p in f.Parameters) { if (!distincts.Contains(p.VariableName)) { if (!first) { converter.CurrentFunction.AddToSource(" "); } else { first = false; } converter.CurrentFunction.AddToSource("-" + p.VariableName); if (p.IsMutableParameter) { converter.CurrentFunction.AddToSource(" S[byref:" + p.VariableName + "]"); } else { converter.CurrentFunction.AddToSource(" S[byvalue:" + p.VariableName + "]"); } distincts.Add(p.VariableName); } } converter.CurrentFunction.AddToSource(Environment.NewLine); }
public void WriteInPowerShell(ICodeConverter converter) { converter.CurrentFunction.AddToSource("Unindent $" + PowerShellConverter.Escape(this.defaultWriter) + Environment.NewLine); }
public void WriteInPowerShell(ICodeConverter converter) { converter.CurrentFunction.AddToSource("S[left:" + PowerShellConverter.Escape(this.value.Name) + "] = $theDict.GetArray(\"" + PowerShellConverter.Escape(this.tabName) + "\").Count" + Environment.NewLine); }