本文整理汇总了C#中EA.GetLastError方法的典型用法代码示例。如果您正苦于以下问题:C# EA.GetLastError方法的具体用法?C# EA.GetLastError怎么用?C# EA.GetLastError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EA
的用法示例。
在下文中一共展示了EA.GetLastError方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateAttribute
public static bool UpdateAttribute(EA.Repository rep, EA.Attribute a)
{
// no classifier defined
if (a.ClassifierID == 0)
{
// find type from type_name
int id = GetTypeId(rep, a.Type);
if (id > 0)
{
a.ClassifierID = id;
bool error = a.Update();
if (!error)
{
MessageBox.Show(@"Error write Attribute", a.GetLastError());
return false;
}
}
}
return true;
}
示例2: ResetVc
//------------------------------------------------------------------------------------------
// resetVC If package is controlled: Reset package flags field of package
//------------------------------------------------------------------------------------------
// package flags: Recurse=0;VCCFG=unchanged;
public static void ResetVc(EA.Repository rep, EA.Package pkg)
{
if (pkg.IsVersionControlled)
{
// find VC=...;
string flags = pkg.Flags;
var pattern = new Regex(@"VCCFG=[^;]+;");
Match regMatch = pattern.Match(flags);
if (regMatch.Success)
{
// delete old string
flags = @"Recurse=0;" + regMatch.Value;
}
else
{
return;
}
// write flags
try
{
SetVcFlags(rep, pkg, flags);
}
catch (Exception e)
{
string s = e.Message + " ;" + pkg.GetLastError();
s = s + "!";
MessageBox.Show(s, @"Error Reset VC");
}
}
// recursive package
//foreach (EA.Package pkg1 in pkg.Packages)
//{
// updateVC(rep, pkg1);
//}
}
示例3: GetLatest
public static bool GetLatest(EA.Repository rep, EA.Package pkg, bool recursive, ref int count, int level, ref int errorCount)
{
if (pkg.IsControlled)
{
level = level + 1;
// check if checked out
string path = GetVccFilePath(rep, pkg);
string fText;
//rep.WriteOutput("Debug", "Path:" + pkg.Name + path, 0);
var sLevel = new string(' ', level * 2);
rep.WriteOutput("Debug", sLevel + (count+1).ToString(",0") + " Work for:" + path, 0);
if (path != "")
{
count = count + 1;
rep.ShowInProjectView(pkg);
// delete a potential write protection
try
{
var fileInfo = new FileInfo(path);
var attributes = (FileAttributes)(fileInfo.Attributes - FileAttributes.ReadOnly);
System.IO.File.SetAttributes(fileInfo.FullName, attributes);
System.IO.File.Delete(path);
}
catch (FileNotFoundException e)
{
fText = path + " " + e.Message;
rep.WriteOutput("Debug", fText, 0);
errorCount = errorCount + 1;
}
catch (DirectoryNotFoundException e)
{
fText = path + " " + e.Message;
rep.WriteOutput("Debug", fText, 0);
errorCount = errorCount + 1;
}
// get latest
try
{
// to make sure pkg is the correct reference
// new load of pkg after GetLatest
string pkgGuid = pkg.PackageGUID;
pkg.VersionControlGetLatest(true);
pkg = rep.GetPackageByGuid(pkgGuid);
count = count + 1;
}
catch
{
fText = path + " " + pkg.GetLastError();
rep.WriteOutput("Debug", fText, 0);
errorCount = errorCount + 1;
}
}
else
{
fText = pkg.XMLPath + " invalid path";
rep.WriteOutput("Debug", fText, 0);
errorCount = errorCount + 1;
}
}
//rep.WriteOutput("Debug", "Recursive:" +recursive.ToString(), 0);
if (recursive)
{
//rep.WriteOutput("Debug","Recursive count:" + pkg.Packages.Count.ToString(), 0);
// over all contained packages
foreach (EA.Package pkgNested in pkg.Packages)
{
//rep.WriteOutput("Debug", "Recursive:"+ pkgNested.Name, 0);
GetLatest(rep, pkgNested, true, ref count, level, ref errorCount);
}
}
return true;
}
示例4: UpdateVc
/// <summary>
/// Update VC (Version Control state of a controlled package:
/// - Returns user name of user who have checked out the package
/// - Updates the package flags
/// </summary>
/// <param name="rep">Repository</param>
/// <param name="pkg">Package to check</param>
public static string UpdateVc(EA.Repository rep, EA.Package pkg)
{
string userNameLockedPackage = "";
if (pkg.IsVersionControlled)
{
// find VC=...;
// replace by: VC=currentState();
string flags = pkg.Flags;
// remove check out flags
flags = Regex.Replace(flags, @"VC=[^;]*;", "");
flags = Regex.Replace(flags, @"CheckedOutTo=[^;]*;", "");
var svnHandle = new Svn(rep, pkg);
userNameLockedPackage = svnHandle.GetLockingUser();
if (userNameLockedPackage != "") flags = flags + "CheckedOutTo=" + userNameLockedPackage + ";";
try
{
SetVcFlags(rep, pkg, flags);
rep.ShowInProjectView(pkg);
}
catch (Exception e)
{
string s = e.Message + " ;" + pkg.GetLastError();
s = s + "!";
MessageBox.Show(s, @"Error UpdateVC state");
}
}
return userNameLockedPackage;
}