mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-30 05:15:59 +02:00
Added MD5 file hashes to Beef
This commit is contained in:
parent
32c09bf94b
commit
61468d818f
33 changed files with 598 additions and 143 deletions
|
@ -261,7 +261,7 @@ namespace IDE.ui
|
|||
{
|
||||
IdSpan liveCharIdData;
|
||||
String liveText = scope:: String();
|
||||
app.FindProjectSourceContent(projectSource, out liveCharIdData, true, liveText);
|
||||
app.FindProjectSourceContent(projectSource, out liveCharIdData, true, liveText, null);
|
||||
defer(stack) liveCharIdData.Dispose();
|
||||
|
||||
var compileInstance = IDEApp.sApp.mWorkspace.GetProjectSourceCompileInstance(projectSource, mHotIdx);
|
||||
|
|
|
@ -708,7 +708,7 @@ namespace IDE.ui
|
|||
if ((IDEApp.IsBeefFile(filePath)) && (gApp.mBfResolveCompiler != null))
|
||||
{
|
||||
for (var projectSource in editData.mProjectSources)
|
||||
gApp.mBfResolveCompiler.QueueProjectSource(projectSource);
|
||||
gApp.mBfResolveCompiler.QueueProjectSource(projectSource, false);
|
||||
gApp.mBfResolveCompiler.QueueDeferredResolveAll();
|
||||
}
|
||||
|
||||
|
|
|
@ -332,7 +332,7 @@ namespace IDE.ui
|
|||
var envBlock = scope List<char8>();
|
||||
Environment.EncodeEnvironmentVariables(envVars, envBlock);
|
||||
|
||||
if (!gApp.mDebugger.OpenFile(targetPath, targetPath, arguments, workingDir, envBlock, false))
|
||||
if (!gApp.mDebugger.OpenFile(targetPath, targetPath, arguments, workingDir, envBlock, false, false))
|
||||
{
|
||||
gApp.Fail(scope String()..AppendF("Unable to open executable for debugging: {0}", targetPath));
|
||||
return;
|
||||
|
|
|
@ -352,7 +352,7 @@ namespace IDE.ui
|
|||
var resolveCompiler = gApp.GetProjectCompilerForFile(projectSource.mName);
|
||||
if (resolveCompiler != null)
|
||||
{
|
||||
resolveCompiler.QueueProjectSource(projectSource);
|
||||
resolveCompiler.QueueProjectSource(projectSource, false);
|
||||
resolveCompiler.QueueDeferredResolveAll();
|
||||
}
|
||||
projectSource.mHasChangedSinceLastCompile = true;
|
||||
|
|
|
@ -740,7 +740,7 @@ namespace IDE.ui
|
|||
if ((mKind == Kind.Rename) && (IDEApp.IsBeefFile(editData.mFilePath)))
|
||||
{
|
||||
for (var projectSource in editData.mProjectSources)
|
||||
app.mBfResolveCompiler.QueueProjectSource(projectSource);
|
||||
app.mBfResolveCompiler.QueueProjectSource(projectSource, false);
|
||||
app.mBfResolveCompiler.QueueDeferredResolveAll();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -453,6 +453,7 @@ namespace IDE.ui
|
|||
}
|
||||
|
||||
Debug.Assert(endingText == text);
|
||||
Debug.Assert(!endingText.Contains('\r'));
|
||||
|
||||
//mClangSourceChanged = false;
|
||||
//mLastFileTextVersion = mEditWidget.Content.mData.mCurTextVersionId;
|
||||
|
|
|
@ -262,83 +262,6 @@ namespace IDE.ui
|
|||
}
|
||||
}
|
||||
|
||||
public enum SourceHash
|
||||
{
|
||||
public enum Kind
|
||||
{
|
||||
None,
|
||||
MD5,
|
||||
SHA256
|
||||
}
|
||||
|
||||
case None;
|
||||
case MD5(MD5Hash hash);
|
||||
case SHA256(SHA256Hash hash);
|
||||
|
||||
public Kind GetKind()
|
||||
{
|
||||
switch (this)
|
||||
{
|
||||
case .MD5:
|
||||
return .MD5;
|
||||
case .SHA256:
|
||||
return .SHA256;
|
||||
default:
|
||||
return .None;
|
||||
}
|
||||
}
|
||||
|
||||
public static SourceHash Create(StringView hashStr)
|
||||
{
|
||||
if (hashStr.Length == 32)
|
||||
{
|
||||
if (MD5Hash.Parse(hashStr) case .Ok(let parsedHash))
|
||||
{
|
||||
return .MD5(parsedHash);
|
||||
}
|
||||
}
|
||||
else if (hashStr.Length == 64)
|
||||
{
|
||||
if (SHA256Hash.Parse(hashStr) case .Ok(let parsedHash))
|
||||
{
|
||||
return .SHA256(parsedHash);
|
||||
}
|
||||
}
|
||||
|
||||
return .None;
|
||||
}
|
||||
|
||||
public static SourceHash Create(Kind kind, StringView str)
|
||||
{
|
||||
switch (kind)
|
||||
{
|
||||
case .MD5:
|
||||
return .MD5(Security.Cryptography.MD5.Hash(.((uint8*)str.Ptr, str.Length)));
|
||||
case .SHA256:
|
||||
return .SHA256(Security.Cryptography.SHA256.Hash(.((uint8*)str.Ptr, str.Length)));
|
||||
default:
|
||||
return .None;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool operator==(SourceHash lhs, SourceHash rhs)
|
||||
{
|
||||
switch (lhs)
|
||||
{
|
||||
case .None:
|
||||
return rhs case .None;
|
||||
case .MD5(let lhsMD5):
|
||||
if (rhs case .MD5(let rhsMD5))
|
||||
return lhsMD5 == rhsMD5;
|
||||
case .SHA256(let lhsSHA256):
|
||||
if (rhs case .SHA256(let rhsSHA256))
|
||||
return lhsSHA256 == rhsSHA256;
|
||||
default:
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class QueuedAutoComplete
|
||||
{
|
||||
public char32 mKeyChar;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue