- 1
- 2
- 3
- 4
public static string toFormat(string s, int u)
{
return " ".Substring(0, u * 4) + s +"\r\n";
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
Всего: 2
+10
public static string toFormat(string s, int u)
{
return " ".Substring(0, u * 4) + s +"\r\n";
}
Функция используется для форматирования файла класса, созданного автоматически.
+2
switch (button.Tag.ToString()) {
case "Ezp":
{
if (nowLayer.OpenedFiles.Count == 0)
{
nowLayer.OpenedFiles = new List<ExemplarFile> { new ExemplarFile("") };
}
if (nowLayer.OpenedFiles[0].EdinZemleps == null)
{
nowLayer.OpenedFiles[0].EdinZemleps = new List<EdinZemlep>();
}
var strName = ":ЕЗ" + (nowLayer.OpenedFiles[0].EdinZemleps.Count + 1);
nowLayer.OpenedFiles[0].EdinZemleps.Add(new EdinZemlep(strName) { Status = StatusEnum.Образуемый });
_ezpListTreeView.Add(new EzpTreeView { NameEzp = strName, ContourList = new List<ContourTreeView>(), ParcelList = new List<PartZuTreeView>(), IsEzpVisible = true, IsSelectedEzp = false } );
_dictionaryEzpTreeViewFile.Add(_ezpListTreeView[_ezpListTreeView.Count - 1], nowLayer.OpenedFiles[0]);
_dictionaryEzpTreeViewEdinZemlep.Add(_ezpListTreeView[_ezpListTreeView.Count - 1], nowLayer.OpenedFiles[0].EdinZemleps[nowLayer.OpenedFiles[0].EdinZemleps.Count - 1]);
break;
}
case "ContourEzp":
{
indexEz = TreeViewStackPanelMain.Children.IndexOf(((button.Parent as Grid).Parent as StackPanel).Parent as Grid) - _partZuListTreeView.Count;
var strName = (nowLayer.OpenedFiles[0].EdinZemleps[indexEz].CadNum != "" ? nowLayer.OpenedFiles[0].EdinZemleps[indexEz].CadNum : nowLayer.OpenedFiles[0].EdinZemleps[indexEz].LastName) + "(" + (nowLayer.OpenedFiles[0].EdinZemleps[indexEz].Contours.Count + 1) + ")";
nowLayer.OpenedFiles[0].EdinZemleps[indexEz].AddContour(new Contour(strName) { Status = StatusEnum.Образуемый });
if (_ezpListTreeView[indexEz].ContourList == null)
{
_ezpListTreeView[indexEz].ContourList = new List<ContourTreeView>();
}
strName = nowLayer.OpenedFiles[0].EdinZemleps[indexEz].Contours.Last().Name;
_ezpListTreeView[indexEz].ContourList.Add(new ContourTreeView { NameContour = strName, IsContourVisible = true, IsSelectedContour = false } );
for (var i = 0; i < _ezpListTreeView[indexEz].ContourList.Count; i++)
{
_ezpListTreeView[indexEz].ContourList[i].NameContour = nowLayer.OpenedFiles[0].EdinZemleps[indexEz].Contours[i].Name;
}
break;
}
case "ZuEzp":
{
indexEz = TreeViewStackPanelMain.Children.IndexOf(((button.Parent as Grid).Parent as StackPanel).Parent as Grid) - _partZuListTreeView.Count;
var strName = ":ЗУ" + (nowLayer.OpenedFiles[0].EdinZemleps[indexEz].Parcels.Count + 1);
if (_ezpListTreeView[indexEz].ParcelList == null)
{
_ezpListTreeView[indexEz].ParcelList = new List<PartZuTreeView>();
}
nowLayer.OpenedFiles[0].EdinZemleps[indexEz].Parcels.Add(new Parcel(strName) { Status = StatusEnum.Образуемый });
_ezpListTreeView[indexEz].ParcelList.Add(new PartZuTreeView { NamePartZu = strName, ContourList = new List<ContourTreeView>(), PartList = new List<PartTreeView>(), IsPartZuVisible = true, IsSelectedPartZu = false });
_dictionaryPartZuTreeViewFile.Add(_ezpListTreeView[indexEz].ParcelList[_ezpListTreeView[indexEz].ParcelList.Count - 1], nowLayer.OpenedFiles[0]);
_dictionaryPartZuTreeViewParcel.Add(_ezpListTreeView[indexEz].ParcelList[_ezpListTreeView[indexEz].ParcelList.Count - 1], nowLayer.OpenedFiles[0].EdinZemleps[indexEz].Parcels[nowLayer.OpenedFiles[0].EdinZemleps[indexEz].Parcels.Count - 1]);
break;
}
case "PartZuEzp":
{
indexEz = TreeViewStackPanelMain.Children.IndexOf(((((((button.Parent as Grid).Parent as StackPanel).Parent as Grid).Parent as StackPanel).Parent as Grid).Parent as StackPanel).Parent as Grid) - _partZuListTreeView.Count;
indexZu = ((((((button.Parent as Grid).Parent as StackPanel).Parent as Grid).Parent as StackPanel).Parent as Grid).Parent as StackPanel).Children.IndexOf((((((button.Parent as Grid).Parent as StackPanel).Parent as Grid).Parent as StackPanel).Parent as Grid));
var sbPrclName = nowLayer.OpenedFiles[0].EdinZemleps[indexEz].Parcels[indexZu].LastName + "/чзу" + (nowLayer.OpenedFiles[0].EdinZemleps[indexEz].Parcels[indexZu].Subparcels.Count + 1);
nowLayer.OpenedFiles[0].EdinZemleps[indexEz].Parcels[indexZu].Subparcels.Add(new Subparcel(sbPrclName) { Status = StatusEnum.Образуемый });
if (_ezpListTreeView[indexEz].ParcelList[indexZu].PartList == null)
{
_ezpListTreeView[indexEz].ParcelList[indexZu].PartList = new List<PartTreeView>();
}
_ezpListTreeView[indexEz].ParcelList[indexZu].PartList.Add(new PartTreeView { NamePart = sbPrclName, ContourList = new List<ContourTreeView>(), IsPartVisible = true, IsSelectedPart = _ezpListTreeView[indexEz].ParcelList[indexZu].IsSelectedPartZu });
_dictionaryPartTreeViewSubparcel.Add(_ezpListTreeView[indexEz].ParcelList[indexZu].PartList[_ezpListTreeView[indexEz].ParcelList[indexZu].PartList.Count - 1], nowLayer.OpenedFiles[0].EdinZemleps[indexEz].Parcels[indexZu].Subparcels[nowLayer.OpenedFiles[0].EdinZemleps[indexEz].Parcels[indexZu].Subparcels.Count - 1]);
break;
}
и это продолжается, продолжается и продолжается....