A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/signumsoftware/framework/commit/227a8e79aece9d3be5020f2a8dad840c4fba95ad below:

more on Upgrade_20201110_DotNet5 · signumsoftware/framework@227a8e7 · GitHub

@@ -122,18 +122,18 @@ public void RemoveAllLines(Expression<Predicate<string>> condition)

122 122

});

123 123

}

124 124 125 -

public void InsertAfterFirstLine(Expression<Predicate<string>> condition, string otherLines)

125 +

public void InsertAfterFirstLine(Expression<Predicate<string>> condition, string text)

126 126

{

127 127

ProcessLines(lines =>

128 128

{

129 129

var pos = lines.FindIndex(condition.Compile());

130 130

if(pos == -1)

131 131

{

132 -

Warning($"Unable to find line where {condition} the insert after {otherLines}");

132 +

Warning($"Unable to find line where {condition} the insert after {text}");

133 133

return false;

134 134

}

135 135

var indent = GetIndent(lines[pos]);

136 -

lines.InsertRange(pos + 1, otherLines.Lines().Select(a => indent + a.Replace("Southwind", this.Uctx.ApplicationName)));

136 +

lines.InsertRange(pos + 1, text.Lines().Select(a => indent + a.Replace("Southwind", this.Uctx.ApplicationName)));

137 137

return true;

138 138

});

139 139

}

@@ -145,91 +145,90 @@ string GetIndent(string v)

145 145 146 146

/// <param name="fromLine">Not included</param>

147 147

/// <param name="toLine">Not included</param>

148 -

public void ReplaceBetween(Expression<Predicate<string>> fromLine, Expression<Predicate<string>> toLine, string otherLines

149 -

)

148 +

public void ReplaceBetween(Expression<Predicate<string>> fromLine, Expression<Predicate<string>> toLine, string text)

150 149

{

151 150

ProcessLines(lines =>

152 151

{

153 152

var from = lines.FindIndex(fromLine.Compile());

154 153

if (from == -1)

155 154

{

156 -

Warning($"Unable to find a line where {fromLine} to insert after {otherLines}");

155 +

Warning($"Unable to find a line where {fromLine} to insert after {text}");

157 156

return false;

158 157

}

159 158

var to = lines.FindIndex(from + 1, toLine.Compile());

160 159

if(to == -1)

161 160

{

162 -

Warning($"Unable to find a line where {toLine} after line {to} to insert before {otherLines}");

161 +

Warning($"Unable to find a line where {toLine} after line {to} to insert before {text}");

163 162

return false;

164 163

}

165 164

var indent = GetIndent(lines[from]);

166 165

lines.RemoveRange(from + 1, to - from - 1);

167 -

lines.InsertRange(from + 1, otherLines.Lines().Select(a => indent + a.Replace("Southwind", this.Uctx.ApplicationName)));

166 +

lines.InsertRange(from + 1, text.Lines().Select(a => indent + a.Replace("Southwind", this.Uctx.ApplicationName)));

168 167

return true;

169 168

});

170 169

}

171 170 172 -

public void ReplaceLine(Expression<Predicate<string>> condition, string otherLines)

171 +

public void ReplaceLine(Expression<Predicate<string>> condition, string text)

173 172

{

174 173

ProcessLines(lines =>

175 174

{

176 175

var pos = lines.FindIndex(condition.Compile());

177 176

if (pos == -1)

178 177

{

179 -

Warning($"Unable to find a line where {condition} to replace it by {otherLines}");

178 +

Warning($"Unable to find a line where {condition} to replace it by {text}");

180 179

return false;

181 180

}

182 181

var indent = GetIndent(lines[pos]);

183 182

lines.RemoveRange(pos, 1);

184 -

lines.InsertRange(pos, otherLines.Lines().Select(a => indent + a.Replace("Southwind", this.Uctx.ApplicationName)));

183 +

lines.InsertRange(pos, text.Lines().Select(a => indent + a.Replace("Southwind", this.Uctx.ApplicationName)));

185 184

return true;

186 185

});

187 186

}

188 187 189 -

public void InsertBeforeFirstLine(Expression<Predicate<string>> condition, string otherLines)

188 +

public void InsertBeforeFirstLine(Expression<Predicate<string>> condition, string text)

190 189

{

191 190

ProcessLines(lines =>

192 191

{

193 192

var pos = lines.FindIndex(condition.Compile());

194 193

if (pos == -1)

195 194

{

196 -

Warning($"Unable to find a line where {condition} to insert before {otherLines}");

195 +

Warning($"Unable to find a line where {condition} to insert before {text}");

197 196

return false;

198 197

}

199 198

var indent = GetIndent(lines[pos]);

200 -

lines.InsertRange(pos, otherLines.Lines().Select(a => indent + a.Replace("Southwind", this.Uctx.ApplicationName)));

199 +

lines.InsertRange(pos, text.Lines().Select(a => indent + a.Replace("Southwind", this.Uctx.ApplicationName)));

201 200

return true;

202 201

});

203 202

}

204 203 205 -

public void InsertAfterLastLine(Expression<Predicate<string>> condition, string otherLines)

204 +

public void InsertAfterLastLine(Expression<Predicate<string>> condition, string text)

206 205

{

207 206

ProcessLines(lines =>

208 207

{

209 208

var pos = lines.FindLastIndex(condition.Compile());

210 209

if (pos == -1)

211 210

{

212 -

Warning($"Unable to find a line where {condition} to insert after {otherLines}");

211 +

Warning($"Unable to find a line where {condition} to insert after {text}");

213 212

return false;

214 213

}

215 214

var indent = GetIndent(lines[pos]);

216 -

lines.InsertRange(pos + 1, otherLines.Lines().Select(a => indent + a.Replace("Southwind", this.Uctx.ApplicationName)));

215 +

lines.InsertRange(pos + 1, text.Lines().Select(a => indent + a.Replace("Southwind", this.Uctx.ApplicationName)));

217 216

return true;

218 217

});

219 218

}

220 219 221 -

public void InsertBeforeLastLine(Expression<Predicate<string>> condition, string otherLines)

220 +

public void InsertBeforeLastLine(Expression<Predicate<string>> condition, string text)

222 221

{

223 222

ProcessLines(lines =>

224 223

{

225 224

var pos = lines.FindLastIndex(condition.Compile());

226 225

if (pos == -1)

227 226

{

228 -

Warning($"Unable to find a line where {condition} to insert before {otherLines}");

227 +

Warning($"Unable to find a line where {condition} to insert before {text}");

229 228

return false;

230 229

}

231 230

var indent = GetIndent(lines[pos]);

232 -

lines.InsertRange(pos, otherLines.Lines().Select(a => indent + a.Replace("Southwind", this.Uctx.ApplicationName)));

231 +

lines.InsertRange(pos, text.Lines().Select(a => indent + a.Replace("Southwind", this.Uctx.ApplicationName)));

233 232

return true;

234 233

});

235 234

}

@@ -253,7 +252,15 @@ private void AssertExtension(params string[] extension)

253 252

throw new InvalidOperationException("");

254 253

}

255 254 256 -

public bool UpdateNugetReference(string packageName, string version)

255 +

public void UpgradeNpmPackage(string packageName, string version)

256 +

{

257 +

AssertExtension(".json");

258 + 259 +

this.ReplaceLine(condition: a => a.Contains(@$"""{packageName}"""),

260 +

text: @$"""{packageName}"": ""{version}""");

261 +

}

262 + 263 +

public void UpdateNugetReference(string packageName, string version)

257 264

{

258 265

AssertExtension(".csproj");

259 266

@@ -265,17 +272,16 @@ public bool UpdateNugetReference(string packageName, string version)

265 272

if (elem == null)

266 273

{

267 274

Warning($"Unable to find reference to Nuget {packageName} to update it to {version}");

268 -

return false;

269 275

}

276 +

else

277 +

{

278 +

elem.Attribute("Version")!.Value = version;

270 279 271 -

elem.Attribute("Version")!.Value = version;

272 - 273 -

this.Content = doc.ToString(SaveOptions.DisableFormatting);

274 - 275 -

return true;

280 +

this.Content = doc.ToString(SaveOptions.DisableFormatting);

281 +

}

276 282

}

277 283 278 -

public bool RemoveNugetReference(string packageName)

284 +

public void RemoveNugetReference(string packageName)

279 285

{

280 286

AssertExtension(".csproj");

281 287

@@ -287,17 +293,16 @@ public bool RemoveNugetReference(string packageName)

287 293

if (eleme == null)

288 294

{

289 295

Warning($"Unable to remove reference to Nuget {packageName} because is not found");

290 -

return false;

291 296

}

297 +

else

298 +

{

299 +

eleme.Remove();

292 300 293 -

eleme.Remove();

294 - 295 -

this.Content = doc.ToString(SaveOptions.DisableFormatting);

296 - 297 -

return true;

301 +

this.Content = doc.ToString(SaveOptions.DisableFormatting);

302 +

}

298 303

}

299 304 300 -

public bool AddNugetReference(string packageName, string version)

305 +

public void AddNugetReference(string packageName, string version)

301 306

{

302 307

AssertExtension(".csproj");

303 308

@@ -312,7 +317,6 @@ public bool AddNugetReference(string packageName, string version)

312 317 313 318

this.Content = doc.ToString(SaveOptions.DisableFormatting);

314 319 315 -

return true;

316 320

}

317 321

}

318 322

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4