@@ -100,10 +100,18 @@ public void filesGet(Project p)
100
100
private void check2 ( filter x , error e )
101
101
{
102
102
//chars
103
- bool b = true ;
104
- foreach ( char c in checkC )
105
- if ( x . xn2 . Contains ( c ) ) { b = false ; break ; }
106
- if ( ! b ) e . add ( new error . data ( ) { t = error . Type . dirName , s = new string [ ] { x . xn . x } } ) ;
103
+ if ( x . xn2 != null )
104
+ {
105
+ bool b = true ;
106
+ foreach ( char c in checkC )
107
+ if ( x . xn2 . Contains ( c ) ) { b = false ; break ; }
108
+ if ( ! b ) e . add ( new error . data ( ) { t = error . Type . dirName , s = new string [ ] { x . xn . x } } ) ;
109
+ }
110
+
111
+
112
+ //exist file
113
+ foreach ( var x3 in x . o . files . Where ( x2 => ! File . Exists ( x2 . Key ) ) )
114
+ e . add ( new error . data ( ) { t = error . Type . existFile , s = new string [ ] { "path: " + x3 . Key , "filter: " + dir . file2 . fileRelative ( x3 . Value ) . x } } ) ;
107
115
108
116
//same file
109
117
foreach ( var x3 in x . o . files . GroupBy ( x2 => dir . file2 . fileRelative ( x2 . Value ) . x . ToLower ( ) ) . Where ( x2 => x2 . Count ( ) > 1 ) )
@@ -118,11 +126,8 @@ private void check2(filter x, error e)
118
126
check2 ( x2 , e ) ;
119
127
}
120
128
121
- public void check ( error e )
122
- {
123
- foreach ( filter x in f2 . f . o . filters2 )
124
- check2 ( x , e ) ;
125
- }
129
+ public void check ( error e ) => check2 ( f2 . f , e ) ;
130
+
126
131
}
127
132
public Files f = new Files ( ) ;
128
133
@@ -264,37 +269,48 @@ public class file2
264
269
265
270
public class Configuration
266
271
{
272
+ public string itemType ;
273
+ //public string contentType; //contentType can not be empty string or start with null char
267
274
public eFileType fileType ;
275
+
268
276
public bool deploymentContent ;
269
277
//public string customTool;
270
278
//public bool includedInProject;
271
279
272
280
public bool document = false ;
273
- public string dGuid ;
281
+
274
282
public Configuration ( VCFile x )
275
283
{
284
+ itemType = x . ItemType ;
285
+ //contentType = x.ContentType;
276
286
fileType = x . FileType ;
287
+
277
288
deploymentContent = x . DeploymentContent ;
278
289
//customTool = x.CustomTool;
290
+ //includedInProject
279
291
280
- ProjectItem x2 = ( ProjectItem ) x . Object ;
281
- //if (!x2.Saved) x2.Save(); notImplemented
282
- Document x3 = x2 . Document ;
283
- if ( x3 != null )
292
+ Document x2 = ( ( ProjectItem ) x . Object ) . Document ;
293
+ if ( x2 != null )
284
294
{
285
295
document = true ;
286
- dGuid = x3 . Kind ;
296
+ x2 . Close ( ) ; //if (!x2.Saved) x2.Save(); notImplemented
287
297
}
288
298
}
289
299
public void set ( VCFile x )
290
300
{
291
301
if ( x == null ) return ;
302
+
303
+ x . ItemType = itemType ;
304
+ //x.ContentType = contentType;
292
305
x . FileType = fileType ;
306
+
293
307
x . DeploymentContent = deploymentContent ;
294
308
//x.CustomTool = customTool; notImplemented
295
-
296
- ProjectItem x2 = ( ProjectItem ) x . Object ;
297
- if ( document ) x2 . Open ( ) ;
309
+ //includedInProject
310
+
311
+ if ( document )
312
+ try { ( ( ProjectItem ) x . Object ) . DTE . Documents . Open ( x . FullPath ) ; } //((ProjectItem)x.Object).Open(Document.Kind {8E7B96A8-E33D-11D0-A6D5-00C04FB67F6A} );
313
+ catch ( Exception ) { }
298
314
}
299
315
}
300
316
@@ -333,16 +349,17 @@ public bool move(ProjectData p, error e)
333
349
{
334
350
if ( File . Exists ( p2 . x ) ) return false ;
335
351
336
- object o = f . xp . x ;
337
- bool b = o != null ;
352
+ VCFilter x = f . xp . x ;
353
+ bool b = x != null ;
354
+ path p3 = p2 ;
338
355
339
356
Configuration c = new Configuration ( f . x ) ;
340
357
{
341
- if ( b ) ( ( VCFilter ) o ) . RemoveFile ( f . x ) ; else p . p . p . RemoveFile ( f . x ) ;
358
+ if ( b ) x . RemoveFile ( f . x ) ; else p . p . p . RemoveFile ( f . x ) ;
342
359
{
343
- if ( ! file2 . move ( p1 , p2 , e ) ) p2 = p1 ;
360
+ if ( ! file2 . move ( p1 , p2 , e ) ) p3 = p1 ;
344
361
}
345
- f . x = ( VCFile ) ( b ? ( ( VCFilter ) o ) . AddFile ( p2 . x ) : p . p . p . AddFile ( p2 . x ) ) ;
362
+ f . x = ( VCFile ) ( b ? x . AddFile ( p3 . x ) : p . p . p . AddFile ( p3 . x ) ) ;
346
363
}
347
364
c . set ( f . x ) ;
348
365
return true ;
@@ -538,6 +555,15 @@ public void init(error e)
538
555
LinkedList < file2 > x1 = new LinkedList < file2 > ( ) ;
539
556
file2 . filesGet ( root , p . f . f2 . f , ref x1 ) ;
540
557
x = x1 . ToArray ( ) ;
558
+ //error
559
+ /*{
560
+ file2[] x4 = x.Where(x3 => !((ProjectItem)x3.f.x.Object).).ToArray();
561
+ if (x4.Length > 0)
562
+ {
563
+ e.add(new error.data() { t = error.Type.fileSaved, s = x4.Select(x3 => x3.p1.x).ToArray() });
564
+ return;
565
+ }
566
+ }*/
541
567
}
542
568
543
569
HashSet < dir2 > x2 = new HashSet < dir2 > ( ) ;
0 commit comments