Skip to content

Commit

Permalink
v1.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Stupar authored and Stupar committed Feb 14, 2022
1 parent 95ea6e5 commit ac8552d
Show file tree
Hide file tree
Showing 12 changed files with 132 additions and 131 deletions.
3 changes: 3 additions & 0 deletions source/shared/project/cppFiltersAutoShared.projitems
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,15 @@
<Compile Include="$(MSBuildThisFileDirectory)source\source\extension\filterToDir\filters.cs" />
<Compile Include="$(MSBuildThisFileDirectory)source\source\extension\filterToDir\projectData.cs" />
<Compile Include="$(MSBuildThisFileDirectory)source\source\extension\filterToDir\work.cs" />
<Compile Include="$(MSBuildThisFileDirectory)source\source\other\test\dte\document.cs" />
<Compile Include="$(MSBuildThisFileDirectory)source\source\other\test\dte\dte.cs" />
<Compile Include="$(MSBuildThisFileDirectory)source\source\other\test\dte\project.cs" />
<Compile Include="$(MSBuildThisFileDirectory)source\source\other\test\dte\projectItem.cs" />
<Compile Include="$(MSBuildThisFileDirectory)source\source\other\test\other.cs" />
<Compile Include="$(MSBuildThisFileDirectory)source\source\other\test\vc\file.cs" />
<Compile Include="$(MSBuildThisFileDirectory)source\source\other\test\vc\filter.cs" />
<Compile Include="$(MSBuildThisFileDirectory)source\source\other\test\vc\project.cs" />
<Compile Include="$(MSBuildThisFileDirectory)source\source\other\test\vc\projectEngine.cs" />
<Compile Include="$(MSBuildThisFileDirectory)source\source\other\test\vc\projectReference.cs" />
<Compile Include="$(MSBuildThisFileDirectory)source\source\other\unused\project.cs" />
<Compile Include="$(MSBuildThisFileDirectory)source\source\other\unused\xml.cs" />
Expand Down
24 changes: 12 additions & 12 deletions source/shared/project/source/gui/questionFtd.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ internal sealed partial class extension
//callback
void buttonBeforeQueryStatus(object sender, EventArgs e)
{
ThreadHelper.ThrowIfNotOnUIThread();
OleMenuCommand x = (OleMenuCommand)sender;
if (x == null) return;

Expand Down Expand Up @@ -74,8 +75,8 @@ void buttonBeforeQueryStatus(object sender, EventArgs e)
private void buttonClick(object sender, EventArgs e)
{
//projectData
dirToFilter.ProjectData p = new dirToFilter.ProjectData();
ThreadHelper.ThrowIfNotOnUIThread();
dirToFilter.ProjectData p = new dirToFilter.ProjectData();
p.p = projectUtility.GetActive();


Expand Down
15 changes: 13 additions & 2 deletions source/shared/project/source/source/extension/filterToDir/error.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace filterToDir

public class error
{
public enum Type { move, delete, dirName, sameFile, sameFilter };
public enum Type { move, delete, dirName, sameFile, sameFilter, existFile/*, fileSaved*/ };



Expand Down Expand Up @@ -66,11 +66,22 @@ public override string ToString()
s2 += "\r\nfilter contains multiple filters with the same name, please rename or move them:";
s2 += "\r\n" + x2.s[0];
break;

case Type.existFile:
s2 += "\r\nfile path, included in project, does not exist:";
s2 += "\r\n" + x2.s[0];
s2 += "\r\n" + x2.s[1];
break;
/*case Type.fileSaved:
s2 += "\r\nfiles that need to be moved are opened in editor, changed, but not saved. Please save or discard (close without save).";
foreach (string s3 in x2.s)
s2 += "\r\n" + s3;
break;*/
}

if (x2.e != null) s.Append("\r\n\r\nexception: [" + x2.e.Message + "]");

s.Append(s2);
if (x2.e != null) s.Append("\r\n\r\nexception: [" + x2.e.Message + "]");
if (i < x.Count - 1) s.Append("\r\n\r\n\r\n\r\n");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,82 +127,6 @@ public void init(VCProject p)
}







/*public void fCleanEmpty(Dictionary<string, VCFile> filesIn, bool fEmptyDelete)
{
//remove from filters2
foreach (var v in filesIn)
{
object o = v.Value.Parent;
if (!(o is VCFilter)) continue;
VCFilter f = (VCFilter)o;
fAll[f.CanonicalName].files.Remove(v.Value.FullPath);
v.Value.Move(p);
}
//filters2 clean
bool b;
do
{
b = false;
fAll = fAll.Where(x =>
{
filter2 x2 = x.Value;
if (x2.files.Count != 0) return true;
if (x2.filters2.Count != 0) return true;
if (!fEmptyDelete) if (x2.fEmpty) return true;
filter2 xp = x2.xp;
xp.filters2.Remove(x2.xn2);
x2.x.Remove();
b = true;
return false;
}
).ToDictionary(x => x.Key, x => x.Value);
} while (b);
}*/







/*public filter2 fAdd(filter2 f, string x)
{
path x2 = new path(x, path.Separator.sDefault);
filter2 x3 = f;
for (int i = 0; i < x2.x2.Length; i++)
{
if (!x3.filters2.TryGetValue(x2.x2[i], out filter2 x4))
{
VCFilter x5 = null;
if (x3.x == null)
x5 = (VCFilter)p.AddFilter(x2.x2[i]);
else
x5 = (VCFilter)x3.x.AddFilter(x2.x2[i]);
x4 = new filter2() { x = x5 };
x4.xp = x3;
x3.filters2.Add(x5.Name, x4);
fAll.Add(x5.CanonicalName, x4);
x4.xn = x5.CanonicalName;
x4.xn2 = x5.Name;
}
x3 = x4;
}
return x3;
}*/



}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,18 @@ public void filesGet(Project p)
private void check2(filter x, error e)
{
//chars
bool b = true;
foreach (char c in checkC)
if (x.xn2.Contains(c)) { b = false; break; }
if (!b) e.add(new error.data() { t = error.Type.dirName, s = new string[] { x.xn.x } });
if (x.xn2 != null)
{
bool b = true;
foreach (char c in checkC)
if (x.xn2.Contains(c)) { b = false; break; }
if (!b) e.add(new error.data() { t = error.Type.dirName, s = new string[] { x.xn.x } });
}


//exist file
foreach (var x3 in x.o.files.Where(x2 => !File.Exists(x2.Key)))
e.add(new error.data() { t = error.Type.existFile, s = new string[] { "path: " + x3.Key, "filter: " + dir.file2.fileRelative(x3.Value).x } });

//same file
foreach (var x3 in x.o.files.GroupBy(x2 => dir.file2.fileRelative(x2.Value).x.ToLower()).Where(x2 => x2.Count() > 1))
Expand All @@ -118,11 +126,8 @@ private void check2(filter x, error e)
check2(x2, e);
}

public void check(error e)
{
foreach (filter x in f2.f.o.filters2)
check2(x, e);
}
public void check(error e) => check2(f2.f, e);

}
public Files f = new Files();

Expand Down Expand Up @@ -264,37 +269,48 @@ public class file2

public class Configuration
{
public string itemType;
//public string contentType; //contentType can not be empty string or start with null char
public eFileType fileType;

public bool deploymentContent;
//public string customTool;
//public bool includedInProject;

public bool document = false;
public string dGuid;

public Configuration(VCFile x)
{
itemType = x.ItemType;
//contentType = x.ContentType;
fileType = x.FileType;

deploymentContent = x.DeploymentContent;
//customTool = x.CustomTool;
//includedInProject

ProjectItem x2 = (ProjectItem)x.Object;
//if (!x2.Saved) x2.Save(); notImplemented
Document x3 = x2.Document;
if (x3 != null)
Document x2 = ((ProjectItem)x.Object).Document;
if (x2 != null)
{
document = true;
dGuid = x3.Kind;
x2.Close(); //if (!x2.Saved) x2.Save(); notImplemented
}
}
public void set(VCFile x)
{
if (x == null) return;

x.ItemType = itemType;
//x.ContentType = contentType;
x.FileType = fileType;

x.DeploymentContent = deploymentContent;
//x.CustomTool = customTool; notImplemented

ProjectItem x2 = (ProjectItem)x.Object;
if (document) x2.Open();
//includedInProject

if (document)
try { ((ProjectItem)x.Object).DTE.Documents.Open(x.FullPath); } //((ProjectItem)x.Object).Open(Document.Kind {8E7B96A8-E33D-11D0-A6D5-00C04FB67F6A} );
catch (Exception) { }
}
}

Expand Down Expand Up @@ -333,16 +349,17 @@ public bool move(ProjectData p, error e)
{
if (File.Exists(p2.x)) return false;

object o = f.xp.x;
bool b = o != null;
VCFilter x = f.xp.x;
bool b = x != null;
path p3 = p2;

Configuration c = new Configuration(f.x);
{
if (b) ((VCFilter)o).RemoveFile(f.x); else p.p.p.RemoveFile(f.x);
if (b) x.RemoveFile(f.x); else p.p.p.RemoveFile(f.x);
{
if (!file2.move(p1, p2, e)) p2 = p1;
if (!file2.move(p1, p2, e)) p3 = p1;
}
f.x = (VCFile)(b ? ((VCFilter)o).AddFile(p2.x) : p.p.p.AddFile(p2.x));
f.x = (VCFile)(b ? x.AddFile(p3.x) : p.p.p.AddFile(p3.x));
}
c.set(f.x);
return true;
Expand Down Expand Up @@ -538,6 +555,15 @@ public void init(error e)
LinkedList<file2> x1 = new LinkedList<file2>();
file2.filesGet(root, p.f.f2.f, ref x1);
x = x1.ToArray();
//error
/*{
file2[] x4 = x.Where(x3 => !((ProjectItem)x3.f.x.Object).).ToArray();
if (x4.Length > 0)
{
e.add(new error.data() { t = error.Type.fileSaved, s = x4.Select(x3 => x3.p1.x).ToArray() });
return;
}
}*/
}

HashSet<dir2> x2 = new HashSet<dir2>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ internal sealed partial class extension
private void button2Click(object sender, EventArgs e)
{
//project
ThreadHelper.ThrowIfNotOnUIThread();
filterToDir.ProjectData p = new filterToDir.ProjectData();
{
ThreadHelper.ThrowIfNotOnUIThread();
Project x = projectUtility.GetActive();

//check 1 project
Expand Down Expand Up @@ -79,7 +79,13 @@ private void button2Click(object sender, EventArgs e)


//dir
if (!p.e.full) p.dirSet();
if (!p.e.full)
{
projectUtility.documentsRefresh();
string dn = projectUtility.dte.ActiveDocument?.Name;
p.dirSet();
projectUtility.documentActivate(dn);
}



Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions source/shared/project/source/source/other/test/dte/dte.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

2 changes: 0 additions & 2 deletions source/shared/project/source/source/other/test/other.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ public static void stringsInit(int i)





public static void pathSeparator()
{
//DirectorySeparatorChar \
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Loading

0 comments on commit ac8552d

Please sign in to comment.