예제 #1
0
        public static void DoWork()
        {
            ListOfManipulatedFiles lomf = ListOfManipulatedFiles.UniqueInstance;

            try
            {
                string[] temp = FileSaverWorker.ReadFile();


                if (temp != null)
                {
                    foreach (string s in temp)
                    {
                        lomf.AddFile(s);
                    }
                }

                // Step 1 Create a URI to serve as the base address.
                Uri baseAddress = new Uri("http://localhost:8899/CloudManager/CommunicationChannel1");

                // Step 2 Create a ServiceHost instance
                if (selfHost != null)
                {
                    selfHost.Close();
                }

                selfHost = new ServiceHost(typeof(FileProtocoll), baseAddress);

                selfHost.Open();
            }
            catch (CommunicationException)
            {
                selfHost.Abort();
            }
            catch (Exception e)
            {
                System.IO.File.AppendAllText(FileSaverWorker.logFilePath, "Error: " + e.Message + Environment.NewLine);
            }
        }
예제 #2
0
        void IFilesDuplex.Update()
        {
            ListOfManipulatedFiles lomf = ListOfManipulatedFiles.UniqueInstance;

            String[] array1 = lomf.GetFilesAsStringArr();
            String[] array2 = FileSaverWorker.ReadFile();
            String[] newArray;

            if (array2 != null || array2.Length > 0)
            {
                newArray = new String[array1.Length + array2.Length];
                Array.Copy(array1, newArray, array1.Length);
                Array.Copy(array2, 0, newArray, array1.Length, array2.Length);
            }

            else
            {
                newArray = array1;
            }


            Callback.Equals(newArray);
            lomf.ResetList();
        }