예제 #1
0
        private void Current_Startup(object sender, StartupEventArgs e)
        {
            Rect        positionAndSize = PlotManager.UI.Properties.Settings.Default.MainWindowPosition;
            WindowState wState          = PlotManager.UI.Properties.Settings.Default.MainWindowState;

            wnd             = new wndMain();
            vmm             = new ViewModelMain();
            wnd.DataContext = vmm;

            wnd.Closing += Wnd_Closing;

            if ((positionAndSize.IsEmpty) ||
                (SystemParameters.VirtualScreenWidth < positionAndSize.Left) ||
                (SystemParameters.VirtualScreenHeight < positionAndSize.Top))
            {
                positionAndSize = new Rect(10, 10, 800, 600);
            }

            wnd.Left        = positionAndSize.Left;
            wnd.Top         = positionAndSize.Top;
            wnd.Width       = positionAndSize.Width;
            wnd.Height      = positionAndSize.Height;
            wnd.WindowState = wState;

            wnd.Show();
        }
예제 #2
0
        public MainWindow()
        {
            InitializeComponent();

            vm = new ViewModelMain(mosiacBoard);
            this.DataContext = vm;
        }
예제 #3
0
        public MainWindow()
        {
            InitializeComponent();
            ViewModelMain vm = new ViewModelMain();

            DataContext = vm;
        }
        public MainWindow()
        {
            InitializeComponent();
            ViewModelMaxLayout vmLayout = maxlayout.DataContext as ViewModelMaxLayout;

            DataContext = new ViewModelMain(vmLayout);
        }
 public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
 {
     // Read values, and set Command binding and content property of Button btSwitch.
     // 0 for selected item
     // 1 for viewmodelmain
     // 2 for button
     if (values.IsNotEmpty() && values.IsExpectedQuantity(3))
     {
         Service       selectedService = (Service)values[0];
         ViewModelMain viewModel       = (ViewModelMain)values[1];
         Button        btSwitch        = (Button)values[2];
         if (selectedService.Status == "Running")
         {
             btSwitch.IsEnabled        = true;
             btSwitch.Content          = "Stop Service";
             btSwitch.Command          = viewModel.StopService;
             btSwitch.CommandParameter = selectedService;
         }
         else if (selectedService.Status == "Stopped")
         {
             btSwitch.IsEnabled        = true;
             btSwitch.Content          = "Start Service";
             btSwitch.Command          = viewModel.StartService;
             btSwitch.CommandParameter = selectedService;
         }
     }
     return(null);
 }
예제 #6
0
        public MainWindow()
        {
            controller = new ControllerMain();
            viewModel  = new ViewModelMain();
            InitializeComponent();

            this.DataContext = viewModel;
        }
예제 #7
0
 public MainWindow()
 {
     InitializeComponent();
     StateChanged         += MainWindowStateChangeRaised;
     MaxHeight             = SystemParameters.MaximizedPrimaryScreenHeight;
     viewModel             = ((ViewModelMain)DataContext);
     viewModel.CloseAction = Close;
 }
예제 #8
0
        public MainWindow()
        {
            InitializeComponent();
            Application.Current.MainWindow = this;

            vm = new ViewModelMain();
            this.DataContext = vm;
        }
예제 #9
0
        public void TestThatDocumentIsNotNullReturnsTrue()
        {
            ViewModelMain viewModel = new ViewModelMain();

            viewModel.BitmapManager.ActiveDocument = new Document(1, 1);

            Assert.True(viewModel.DocumentIsNotNull(null));
        }
예제 #10
0
        public void TestThatNewDocumentCreatesNewDocumentWithBaseLayer()
        {
            ViewModelMain viewModel = new ViewModelMain();

            viewModel.NewDocument(5, 5);

            Assert.NotNull(viewModel.BitmapManager.ActiveDocument);
            Assert.Single(viewModel.BitmapManager.ActiveDocument.Layers);
        }
예제 #11
0
        public void TestInitializeDeveloper()
        {
            ViewModelMain givenViewModel = new ViewModelMain();

            PrivateObject obj    = new PrivateObject(givenViewModel);
            var           retVal = obj.Invoke("InitializeDevelopers");

            Assert.IsNotNull(givenViewModel.Developers);
        }
예제 #12
0
        public void TestThatZoomSetsViewModelsZoomPercentage()
        {
            ViewModelMain vm       = new ViewModelMain();
            ZoomTool      zoomTool = new ZoomTool();
            double        zoom     = 110;

            zoomTool.Zoom(zoom);
            Assert.Equal(zoom, vm.ZoomPercentage);
        }
예제 #13
0
        public void TestThatMouseUpCommandStopsRecordingMouseMovements()
        {
            ViewModelMain viewModel = ViewModelHelper.MockedViewModelMain();

            viewModel.BitmapManager.MouseController.StartRecordingMouseMovementChanges(true);

            Assert.True(viewModel.BitmapManager.MouseController.IsRecordingChanges);

            viewModel.IoSubViewModel.MouseHook_OnMouseUp(default, default, MouseButton.Left);
예제 #14
0
        public void TestThatSelectToolCommandSelectsNewTool()
        {
            ViewModelMain viewModel = new ViewModelMain();

            Assert.Equal(ToolType.Move, viewModel.BitmapManager.SelectedTool.ToolType);

            viewModel.SelectToolCommand.Execute(ToolType.Line);

            Assert.Equal(ToolType.Line, viewModel.BitmapManager.SelectedTool.ToolType);
        }
예제 #15
0
        public void TestThatConstructorSetsUpControllersCorrectly()
        {
            ViewModelMain viewModel = ViewModelHelper.MockedViewModelMain();

            Assert.NotNull(viewModel.ChangesController);
            Assert.NotNull(viewModel.ShortcutController);
            Assert.NotEmpty(viewModel.ShortcutController.ShortcutGroups);
            Assert.NotNull(viewModel.BitmapManager);
            Assert.Equal(viewModel, ViewModelMain.Current);
        }
예제 #16
0
        static void Main()
        {
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(ExceptionHandler);

            // start main thread here
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            VmMain = new ViewModelMain();
            Application.Run(VmMain);
        }
예제 #17
0
        public void TestThatSelectToolCommandSelectsNewTool()
        {
            ViewModelMain viewModel = ViewModelHelper.MockedViewModelMain();

            Assert.Equal(typeof(MoveViewportTool), viewModel.BitmapManager.SelectedTool.GetType());

            viewModel.ToolsSubViewModel.SelectToolCommand.Execute(new LineTool());

            Assert.Equal(typeof(LineTool), viewModel.BitmapManager.SelectedTool.GetType());
        }
예제 #18
0
        public void TestThatZoomSetsActiveDocumentZoomPercentage()
        {
            ViewModelMain vm = new ViewModelMain(new ServiceCollection().AddSingleton <IPreferences>(new Mocks.PreferenceSettingsMock()).BuildServiceProvider());

            vm.BitmapManager.ActiveDocument = new PixiEditor.Models.DataHolders.Document(10, 10);
            ZoomTool zoomTool = new ZoomTool();
            double   zoom     = 110;

            zoomTool.Zoom(zoom);
            Assert.Equal(zoom, vm.BitmapManager.ActiveDocument.ZoomPercentage);
        }
예제 #19
0
        public void TestThatZoomSetsActiveDocumentZoomPercentage()
        {
            ViewModelMain vm = new ViewModelMain();

            vm.BitmapManager.ActiveDocument = new PixiEditor.Models.DataHolders.Document(10, 10);
            ZoomTool zoomTool = new ZoomTool();
            double   zoom     = 110;

            zoomTool.Zoom(zoom);
            Assert.Equal(zoom, vm.BitmapManager.ActiveDocument.ZoomPercentage);
        }
예제 #20
0
        public void TestThatConstructorSetsUpControllersCorrectly()
        {
            ViewModelMain viewModel = new ViewModelMain();

            Assert.Equal(viewModel, UndoManager.MainRoot);
            Assert.NotNull(viewModel.ChangesController);
            Assert.NotNull(viewModel.ShortcutController);
            Assert.NotEmpty(viewModel.ShortcutController.Shortcuts);
            Assert.NotNull(viewModel.BitmapManager);
            Assert.Equal(viewModel, ViewModelMain.Current);
        }
예제 #21
0
        public void TestThatAddSwatchAddsNonDuplicateSwatch()
        {
            ViewModelMain viewModel = new ViewModelMain();

            viewModel.BitmapManager.ActiveDocument = new Document(1, 1);

            viewModel.AddSwatch(Colors.Green);
            viewModel.AddSwatch(Colors.Green);

            Assert.Single(viewModel.BitmapManager.ActiveDocument.Swatches);
            Assert.Equal(Colors.Green, viewModel.BitmapManager.ActiveDocument.Swatches[0]);
        }
예제 #22
0
        public void TestThatNewLayerCommandCreatesNewLayer()
        {
            ViewModelMain viewModel = new ViewModelMain();

            viewModel.BitmapManager.ActiveDocument = new Document(1, 1);

            Assert.Empty(viewModel.BitmapManager.ActiveDocument.Layers);

            viewModel.NewLayerCommand.Execute(null);

            Assert.Single(viewModel.BitmapManager.ActiveDocument.Layers);
        }
예제 #23
0
        public void TestThatMouseUpCommandStopsRecordingMouseMovements()
        {
            ViewModelMain viewModel = new ViewModelMain();

            viewModel.BitmapManager.MouseController.StartRecordingMouseMovementChanges(true);

            Assert.True(viewModel.BitmapManager.MouseController.IsRecordingChanges);

            viewModel.MouseUpCommand.Execute(null);

            Assert.False(viewModel.BitmapManager.MouseController.IsRecordingChanges);
        }
예제 #24
0
        public void TestThatSwapColorsCommandSwapsColors()
        {
            ViewModelMain viewModel = new ViewModelMain();

            viewModel.PrimaryColor   = Colors.Black;
            viewModel.SecondaryColor = Colors.White;

            viewModel.SwapColorsCommand.Execute(null);

            Assert.Equal(Colors.White, viewModel.PrimaryColor);
            Assert.Equal(Colors.Black, viewModel.SecondaryColor);
        }
예제 #25
0
        public void TestThatMouseMoveCommandUpdatesCurrentCoordinates()
        {
            ViewModelMain viewModel = new ViewModelMain();

            Assert.Equal(new Coordinates(0, 0), MousePositionConverter.CurrentCoordinates);

            viewModel.MouseXOnCanvas = 5;
            viewModel.MouseYOnCanvas = 5;

            viewModel.MouseMoveCommand.Execute(null);

            Assert.Equal(new Coordinates(5, 5), MousePositionConverter.CurrentCoordinates);
        }
예제 #26
0
        public void TestThatSelectAllCommandSelectsWholeDocument(int docWidth, int docHeight)
        {
            ViewModelMain viewModel = new ViewModelMain
            {
                BitmapManager = { ActiveDocument = new Document(docWidth, docHeight) }
            };

            viewModel.BitmapManager.AddNewLayer("layer");

            viewModel.SelectAllCommand.Execute(null);

            Assert.Equal(viewModel.BitmapManager.ActiveDocument.Width * viewModel.BitmapManager.ActiveDocument.Height,
                         viewModel.ActiveSelection.SelectedPoints.Count);
        }
예제 #27
0
        public MainWindow()
        {
            InitializeComponent();

            IServiceCollection services = new ServiceCollection()
                                          .AddSingleton <IPreferences>(new PreferencesSettings());

            DataContext = new ViewModelMain(services.BuildServiceProvider());

            StateChanged                    += MainWindowStateChangeRaised;
            MaxHeight                        = SystemParameters.MaximizedPrimaryScreenHeight;
            viewModel                        = (ViewModelMain)DataContext;
            viewModel.CloseAction            = Close;
            Application.Current.ShutdownMode = ShutdownMode.OnMainWindowClose;
        }
예제 #28
0
        public void TestThatDocumentGetsAddedToRecentlyOpenedList()
        {
            ViewModelMain viewModel = ViewModelHelper.MockedViewModelMain();

            Document document = new Document(1, 1)
            {
                XamlAccesibleViewModel = viewModel
            };

            string testFilePath = @"C:\idk\somewhere\homework";

            document.DocumentFilePath = testFilePath;

            Assert.Contains(viewModel.FileSubViewModel.RecentlyOpened, x => x.FilePath == testFilePath);
        }
예제 #29
0
        public void TestThatSaveDocumentCommandSavesFile()
        {
            ViewModelMain viewModel = new ViewModelMain();
            string        fileName  = "testFile.pixi";

            viewModel.BitmapManager.ActiveDocument = new Document(1, 1);

            Exporter.SaveDocumentPath = fileName;

            viewModel.SaveDocumentCommand.Execute(null);

            Assert.True(File.Exists(fileName));

            File.Delete(fileName);
        }
예제 #30
0
        public void TestThatMouseMoveCommandUpdatesCurrentCoordinates()
        {
            ViewModelMain viewModel = ViewModelHelper.MockedViewModelMain();

            viewModel.BitmapManager.ActiveDocument = new Document(10, 10);

            Assert.Equal(new Coordinates(0, 0), MousePositionConverter.CurrentCoordinates);

            viewModel.BitmapManager.ActiveDocument.MouseXOnCanvas = 5;
            viewModel.BitmapManager.ActiveDocument.MouseYOnCanvas = 5;

            viewModel.IoSubViewModel.MouseMoveCommand.Execute(null);

            Assert.Equal(new Coordinates(5, 5), MousePositionConverter.CurrentCoordinates);
        }
예제 #31
0
        public MainWindow()
        {
            InitializeComponent();
            /* Можно определить DataContext в MainWindow.xaml через указание
             *
             *    DataContext="{DynamicResource ViewModelMain}"
             *    ...
             *    <Window.Resources>
             *      <vm:ViewModelMain x:Key="ViewModelMain"/>
             *    </Window.Resources>
             */

            var vmm = new ViewModelMain();
            DataContext = vmm;

            //////////////////////////////////////////
            /*
            const string str = "()(((()))(()()()((((()(((())(()(()((((((()(()(((())))((()(((()))((())(()((()()()()(((())(((((((())))()()(()(()(())(((((()()()((())(((((()()))))()(())(((())(())((((((())())))(()())))()))))()())()())((()()((()()()()(()((((((((()()())((()()(((((()(((())((())(()))()((((()((((((((())()((()())(())((()))())((((()())(((((((((((()()(((((()(()))())(((()(()))())((()(()())())())(()(((())(())())()()(()(()((()))((()))))((((()(((()))))((((()(()(()())())()(((()((((())((((()(((()()(())()()()())((()((((((()((()()))()((()))()(()()((())))(((()(((()))((()((()(()))(((()()(()(()()()))))()()(((()(((())())))))((()(((())()(()(())((()())))((((())))(()(()(()())()((()())))(((()((()(())()()((()((())(()()((())(())()))()))((()(())()))())(((((((()(()()(()(())())))))))(()((((((())((((())((())())(()()))))()(())(()())()())((())(()))))(()))(()((()))()(()((((((()()()()((((((((()(()(())((()()(()()))(())()())()((())))()))()())(((()))(())()(())()))()((()((()(()()())(())()()()((())())))((()()(()()((()(())()()())(((()(()()))))(())))(()(()())()))()()))))))()))))((((((())))())))(()(())())(()())))))(()))()))))))()((()))))()))))(()(()((()())())(()()))))(((())()))())())())(((()(()()))(())()(())(())((((((()()))))((()(()))))))(()))())(((()()(()))()())()()()())))))))))))))(())(()))(()))((()(())(()())(())())(()())(())()()(()())))()()()))(())())()))())())(())((())))))))(())))(())))))()))))((())(()(((()))))(()))()((()(())))(()())(((((()))()())()()))))()))))()))())(()(()()()))()))))))((()))))))))))()((()))((()(())((())()()(()()))()(()))))()()(()))()))(((())))(())()((())(())(()())()())())))))))())))()((())))()))(()))()()))(((((((()))())(()()))(()()(()))()(()((()())()))))))(((()()()())))(())()))()())(()()))()()))))))))(())))()))()()))))))()))()())))()(())(())))))()(())()()(()()))))())((()))))()))))(()(((((()))))))))())))())()(())()()))))(())))())()()())()()())()(()))))()))()))))))))())))((()))()))()))())))()())()()())))())))(()((())()((()))())))))())()(())((())))))))))))())()())(())())())(()))(()))()))())(()(())())()())()()(()))))(()(())))))))(())))())(())))))))())()()(())())())))(())))))()))()(()())()(()))())())))))()()(()))()))))())))))))))()))))()))))))())()())()()))))()())))())))))))))))()()))))()()(((()))()()(())()))))((()))))(()))(())())))(())()))))))(()))()))))(())())))))()))(()())))))))))))))())))))))))()((()())(()())))))))((()))))(())(())))()(()())())))())())(()()()())))()))))))())))))())()()())))))))))))()()(()))))()())()))((()())(()))))()(()))))))))))()())())(((())(()))))())()))()))()))))))()))))))(()))))()))))()(())))(())))(()))())()()(()()))()))(()()))))))))()))(()))())(()()(()(()())()()))()))))))))(())))))((()()(()))())())))))()))())(()())()()))())))()(()()()()))((())())))())()(()()))()))))))))(()))(())))()))))(()(()())(()))))()())())()))()()))())))))))))))())()))))))()))))))))())))))()))))())(()())))(())()))())())))))()()(()()())(()())))()()))(((()))(()()()))))()))))()))))((())))()((((((()()))))))())))))))))))(((()))))))))))))(())())))))())(()))))))(()))((()))())))()(()((()))()))()))))))))))())()))()(()()))))())))())(())()(()))()))())(()))()))))(()()))()()(())))))()))(())(()(()()))(()()())))))(((()))))))()))))))))))))(())(()))))()())())()()((()()))())))))(()))))())))))))()()()))))))))())))()(((()()))(())))))(((())())))))((()))()(()))(()))))(()())))(()))())))))()))))(())(())))()((()))(())())))()()))()))))))))()))(()()()(()()()(()))())(())()())(((()))(())))))))))(((()())))()()))))))))()(())(()))()((((())(())(()())))()))(((())()()()))((()))(()))())())))())))(()))())()())())(()(())())()()()(())))())(())))(())))(())()))()))(()((()))))))))())(()))))))())(()()))()()))()(()(()())))()()(()((()((((((()))(())))()()()))())()))((()()(()))())((()(()(()))(()()))))()())))()))()())))))))()()((()())(())))()))(()))(())(()))())(()(())))()()))))))(((()(((()()))()(()(())())((()()))()))()))()))()(()()()(()))((()())()(())))()()))(((())()()())(())()((()()()()(()(())(()()))()(((((()())))((())))))(()()()))))(((()(())))()))((()((()(())()(()((())))((()())()(()))(((()())()()(()))(())(((()((()())()((())()())(((()()))((()((())(()))(()())(()()()))((()))(())(()((()()())((()))(())))(())(())(())))(()())))(((((()(()(((((()())((((()(()())(())(()()(((())((()(((()()(((()()((((((())))())(()((((((()(()))()))()()((()((()))))()(()()(()((()()))))))(((((()(((((())()()()(())())))))))()))((()()(())))(())(()()()())))))(()((((())))))))()()(((()(()(()(()(()())()()()(((((((((()()())()(()))((()()()()()(((((((()())()((())()))((((((()(()(()(()())(((()(((((((()(((())(((((((((())(())())()))((()(()))(((()()())(())(()(()()(((()(())()))())))(())((((((())(()()())()()(((()(((())(()(((())(((((((()(((((((((()))(())(()(()(()))))((()))()(())())())((()(()((()()))((()()((()(())(())(()((())(((())(((()()()((((((()()(())((((())()))))(())((()(()((())))(((((()(()()())())((())())))((())((()((()()((((((())(((()()(()())())(()(()))(()(()))())())()(((((((()(((()(())()()((())((()(()()((()(()()(((((((((((())((())((((((())((()((((()(()((((()(((((((())()((()))))())()((()((((()(()(((()((()())))(())())(((()(((())((((((()(((((((((()()(())))(()(((((()((((()())))((()((()((()(()()(((())((((((((((((()(((())(()(((((()))(()()(()()()()()()((())(((((((())(((((())))))())()(()()(()(()(((()()(((((())(()((()((()(((()()((()((((())()))()((((())(())))()())(((())(())(()()((()(((()()((((((((((()()(()())())(((((((((())((((()))()()((((())(()((((()(((())())(((((((((((()((((())))(())(()(((()(((()((())(((((()((()()(()(()()((((((()((((()((()(()((()(()((((((()))))()()(((((()((()(()(())()))(())(((((((()((((()())(()((()((()(()))())))(())((()))))(((((((()()()())(()))(()()((()())()((()((()()()(()(()()))(()())(())(((((()(((((((((((()((()(((()(((((((()()((((((()(((((()(()((()(((((())((((((()))((((())((()()((())(((())()(((((()()(((((()((()(()(((((((()(((((()((()((()((())(())((())(()))()()))(()()(()(()()(((((((()(((()(((())()(((((()((((((()())((((())()((()((()(()()())(()))((((()()((((((()((()(()(()((((()((()((())((((((()(()(())((((((()((((((((((()((())()))()(()(()(((((()()()))((())))()(()((((((((((((((()(((()((((()((())((()((()(((()()(()(((()((())(()()())))()(()(()(((((()()(()(()((((()(((((())()(()(()))(((((()()(((()()(())((((((((((((((())((())(((((((((((())()()()(())()(()(()(((((((((())(((()))(()()())(()((((()(())(((((()())(())((((((((())()((((()((((((())(()((()(())(((()((((()))(((((((((()()))((((()(())()()()(())(()((())((()()))()(((())(((((())((((((()()))(((((((((()((((((())))(((((((()((()(()(())))())(()(()))()(((((()())(()))()(()(())(((()))))())()())))(((((()))())()((()(()))))((()()()((((((()))()()((((((((())((()(()(((()(()((())((()())(()((((())(()(((()()()(()(()()))())())((((((((((())())((()))()((())(())(())))())()(()()(())))())(()))(((()(()()(((()(((())))()(((()(())()((((((())()))()))()((((((()(()(((((()())))()))))())()()(((()(((((())((()()(()((()((()(()(()(())))(()()()()((()(())(((()((()))((((()))())(())))())(()))()()()())()))(((()()())()((())))(())(()()()()(()())((()(()()((((())))((()((()(())((()(()((())()(()()(((()())()()())((()))((())(((()()(())))()()))(((()((())()(((((()())(())((())()())())((((((()(()(((((()))(()(";
            int idx = 0;
            int basement = 0;
            foreach (var character in str)
            {
                idx++;
                if (character.Equals('('))
                {
                    basement++;
                }
                else
                {
                    basement--;
                }
                if (basement == -1)
                {
                    break;
                }
            }
            */
            // http://adventofcode.com
            ////////////////////////////////////////// Day2 part1
            //string line = null;
            //var rows = new List<string>();

            //System.IO.StreamReader file = new System.IO.StreamReader("d:\\Test\\numbers.txt");
            //while ((line = file.ReadLine()) != null)
            //{
            //    rows.Add(line);
            //}

            //file.Close();

            //const string rule = @"\d+";
            //var itemRegex = new Regex(rule, RegexOptions.Compiled);
            //var nums = new List<List<int>>();

            //foreach (var oneLine in rows)
            //{
            //    var elmnts = new List<int>();
            //    foreach (var itemMatch in itemRegex.Matches(oneLine))
            //    {
            //        int val;
            //        int.TryParse(itemMatch.ToString(), out val);
            //        elmnts.Add(val);
            //    }
            //    nums.Add(elmnts);
            //}

            //var sequence = new List<int>();

            //foreach (var dims in nums)
            //{
            //    var tmpList = new List<int>();
            //    tmpList.Add(dims[0] * dims[1]);
            //    tmpList.Add(dims[1] * dims[2]);
            //    tmpList.Add(dims[2] * dims[0]);
            //    var boxDim = 2*tmpList[0] + 2*tmpList[1] + 2*tmpList[2];
            //    var min = tmpList.Min();
            //    boxDim = boxDim + min;
            //    sequence.Add(boxDim);
            //}

            //long summ = 0;
            //foreach (var value in sequence)
            //{
            //    summ = summ + value;
            //}

            //summ = summ + summ;

            ////////////////////////////////////////// Day2 part2
            string line = null;
            var rows = new List<string>();

            //System.IO.StreamReader file = new System.IO.StreamReader("d:\\Test\\feet_of_ribbon.txt");
            System.IO.StreamReader file = new System.IO.StreamReader("c:\\Users\\Igor\\Documents\\ribbon_lenght.txt");
            while ((line = file.ReadLine()) != null)
            {
                rows.Add(line);
            }

            file.Close();

            const string rule = @"\d+";
            //var itemRegex = new Regex(rule, RegexOptions.Compiled);
            var nums = new List<object>();

            foreach (var oneLine in rows)
            {
                var elmnts = new List<int>();
                int value;
                var itemMatch = Regex.Match(oneLine, rule);
                int.TryParse(itemMatch.ToString(), out value);
                elmnts.Add(value);
                itemMatch = itemMatch.NextMatch();
                int.TryParse(itemMatch.ToString(), out value);
                elmnts.Add(value);
                itemMatch = itemMatch.NextMatch();
                int.TryParse(itemMatch.ToString(), out value);
                elmnts.Add(value);

                nums.Add(new { L = elmnts[0], W = elmnts[1], H = elmnts[2] });
            }

            var sequence = new List<int>();

            foreach (var dims in nums)
            {
                var t = dims.GetType();
                var propL = t.GetProperty("L");
                var propW = t.GetProperty("W");
                var propH = t.GetProperty("H");

                var valueL = (int)propL.GetValue(dims, null);
                var valueW = (int)propW.GetValue(dims, null);
                var valueH = (int)propH.GetValue(dims, null);

                var dim2 = valueL*valueW*valueH;

                var tmpList = (new[] {valueL, valueW, valueH}).ToList();
                var query = tmpList.GroupBy(x => x).Where(y => y.Count() > 1).Select(g => g.Key).ToList();

                if (query.Count > 0 && tmpList.Max() == query[0])
                {
                    //var itemToRemove = tmpList.Single(r => r == query[0]);
                    var itemToRemove = tmpList.First(r => r == query[0]);
                    tmpList.Remove(itemToRemove);
                }
                else if (query.Count > 0 && tmpList.Min() == query[0])
                {
                    var itemToRemove = tmpList.Single(r => r == tmpList.Max());
                    tmpList.Remove(itemToRemove);
                }

                int[] values = null;
                IEnumerable<int> newList;

                if (tmpList.Count == 3)
                {
                    newList = from node in tmpList
                              where node < tmpList.Max()
                              select node;
                    values = newList.ToArray();
                }
                else
                {
                    values = tmpList.ToArray();
                }

                var dim1 = 2*values[0] + 2*values[1];

                sequence.Add(dim1 + dim2);
            }

            long summ = sequence.Sum(x => x);
        }